Skip to content

Commit

Permalink
Add helper function to retrieve available objects (shogun-toolbox#4112)
Browse files Browse the repository at this point in the history
  • Loading branch information
lisitsyn authored and karlnapf committed Feb 4, 2018
1 parent a6d1f45 commit 8af43ee
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/shogun/base/class_list.cpp.templ
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,14 @@ void shogun::delete_object(CSGObject* object)
{
delete object;
}

std::set<std::string> available_objects()
{
std::set<std::string> result;
for (class_list_entry_t* i=class_list; i->m_class_name != NULL;
i++)
{
result.insert(i->m_class_name);
}
return result;
}
9 changes: 9 additions & 0 deletions src/shogun/base/class_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

#include <shogun/io/SGIO.h>

#include <set>
#include <string>

namespace shogun {
class CSGObject;

Expand Down Expand Up @@ -50,6 +53,12 @@ namespace shogun {
cast->ref();
return cast;
}

/** Returns all available object names
*
*/
std::set<std::string> available_objects();

}

#endif /* __SG_CLASS_LIST_H__ */

0 comments on commit 8af43ee

Please sign in to comment.