Last active
December 20, 2015 18:29
-
-
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 file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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 file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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