Skip to content

Instantly share code, notes, and snippets.

@karlnapf
Last active December 20, 2015 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karlnapf/6176277 to your computer and use it in GitHub Desktop.
Save karlnapf/6176277 to your computer and use it in GitHub Desktop.
If we can autogenerate the obtain_from_generic.h from class_list.cpp, everything is fine
/*
* THIS IS A GENERATED FILE! DO NOT CHANGE THIS FILE!
-e */
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* Written (W) 2013 Heiko Strathmann
*/
#ifndef OBTAIN_FROM_GENERIC_H
#define OBTAIN_FROM_GENERIC_H
#include <shogun/kernel/GaussianARDKernel.h>
#include <shogun/features/DenseFeatures.h>
namespace shogun
{
CGaussianARDKernel* obtain_GaussianARDKernel(CSGObject* generic)
{
if (!generic)
return NULL;
CGaussianARDKernel* casted = dynamic_cast<CGaussianARDKernel*>(generic);
REQUIRE(generic, "Object \"%s\" could not be casted to "
"GaussianARDKernel\n", generic->get_name());
SG_REF(casted);
return casted;
}
CDenseFeatures<float64_t>* obtain_DenseFeatures_FLOAT64(CSGObject* generic)
{
if (!generic)
return NULL;
CDenseFeatures<float64_t>* casted = dynamic_cast<CDenseFeatures<float64_t>*>(generic);
REQUIRE(generic, "Object \"%s\" could not be casted to "
"CDenseFeatures<float64_t>\n", generic->get_name());
SG_REF(casted);
return casted;
}
}
#endif // OBTAIN_FROM_GENERIC_H
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* Written (W) 2013 Heiko Strathmann
*/
#include <shogun/base/init.h>
#include <shogun/kernel/GaussianARDKernel.h>
#include <shogun/base/obtain_from_generic.h>
using namespace shogun;
void test_obtain_GaussianARDKernel()
{
CSGObject* generic=new CGaussianARDKernel();
SG_REF(generic);
CGaussianARDKernel* obtained=obtain_GaussianARDKernel(generic);
SG_SPRINT("%s\n", obtained->get_name());
SG_UNREF(obtained);
SG_UNREF(generic);
}
void test_obtain_DenseFeatures_FLOAT64()
{
CSGObject* generic=new CDenseFeatures<float64_t>();
SG_REF(generic);
CDenseFeatures<float64_t>* obtained=obtain_DenseFeatures_FLOAT64(generic);
SG_SPRINT("%s\n", obtained->get_name());
SG_UNREF(obtained);
SG_UNREF(generic);
}
int main(int argc, char **argv)
{
init_shogun_with_defaults();
sg_io->set_loglevel(MSG_DEBUG);
test_obtain_GaussianARDKernel();
test_obtain_DenseFeatures_FLOAT64();
exit_shogun();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment