13 #ifndef __SGOBJECT_H__
14 #define __SGOBJECT_H__
34 class CSerializableFile;
36 template <
class T,
class K>
class CMap;
46 #ifdef USE_REFERENCE_COUNTING
47 #define SG_REF(x) { if (x) (x)->ref(); }
48 #define SG_UNREF(x) { if (x) { if ((x)->unref()==0) (x)=NULL; } }
49 #define SG_UNREF_NO_NULL(x) { if (x) { (x)->unref(); } }
53 #define SG_UNREF_NO_NULL(x)
60 #define VA_NARGS_IMPL(_1, _2, _3, _4, _5, N, ...) N
61 #define VA_NARGS(...) VA_NARGS_IMPL(__VA_ARGS__, 5, 4, 3, 2, 1)
63 #define VARARG_IMPL2(base, count, ...) base##count(__VA_ARGS__)
64 #define VARARG_IMPL(base, count, ...) VARARG_IMPL2(base, count, __VA_ARGS__)
65 #define VARARG(base, ...) VARARG_IMPL(base, VA_NARGS(__VA_ARGS__), __VA_ARGS__)
67 #define SG_ADD4(param, name, description, ms_available) {\
68 m_parameters->add(param, name, description);\
70 m_model_selection_parameters->add(param, name, description);\
73 #define SG_ADD5(param, name, description, ms_available, gradient_available) {\
74 m_parameters->add(param, name, description);\
76 m_model_selection_parameters->add(param, name, description);\
77 if (gradient_available)\
78 m_gradient_parameters->add(param, name, description);\
81 #define SG_ADD(...) VARARG(SG_ADD, __VA_ARGS__)
124 #ifdef USE_REFERENCE_COUNTING
143 #endif //USE_REFERENCE_COUNTING
145 #ifdef TRACE_MEMORY_ALLOCS
146 static void list_memory_allocs();
164 virtual const char*
get_name()
const = 0;
174 virtual bool is_generic(EPrimitiveType*
generic)
const;
200 const char* prefix=
"");
212 const char* prefix=
"");
352 void set_global_objects();
353 void unset_global_objects();
364 void get_parameter_incremental_hash(uint32_t& hash, uint32_t& carry,
365 uint32_t& total_length);
391 EPrimitiveType m_generic;
392 bool m_load_pre_called;
393 bool m_load_post_called;
394 bool m_save_pre_called;
395 bool m_save_post_called;
400 #endif // __SGOBJECT_H__
virtual const char * get_name() const =0
SGStringList< char > get_modelsel_names()
template class SGStringList
Parallel * get_global_parallel()
virtual void update_parameter_hash()
virtual CSGObject * clone()
Class ShogunException defines an exception which is thrown whenever an error inside of shogun occurs...
virtual CSGObject * shallow_copy() const
Version * get_global_version()
virtual void save_serializable_pre()
virtual bool is_generic(EPrimitiveType *generic) const
EModelSelectionAvailability
virtual bool load_serializable(CSerializableFile *file, const char *prefix="")
char * get_modsel_param_descr(const char *param_name)
Class SGObject is the base class of all shogun objects.
void build_gradient_parameter_dictionary(CMap< TParameter *, CSGObject * > *dict)
Template Dynamic array class that creates an array that can be used like a list or an array...
virtual void save_serializable_post()
void print_modsel_params()
Class Version provides version information.
Parameter * m_model_selection_parameters
virtual bool equals(CSGObject *other, float64_t accuracy=0.0, bool tolerant=false)
virtual CSGObject * deep_copy() const
void set_global_parallel(Parallel *parallel)
virtual void load_serializable_pre()
virtual void load_serializable_post()
Class Parallel provides helper functions for multithreading.
virtual bool save_serializable(CSerializableFile *file, const char *prefix="")
all of classes and functions are contained in the shogun namespace
index_t get_modsel_param_index(const char *param_name)
void set_global_io(SGIO *io)
Class SGIO, used to do input output operations throughout shogun.
Parameter * m_gradient_parameters
virtual void print_serializable(const char *prefix="")
virtual bool parameter_hash_changed()
void set_global_version(Version *version)
the class CMap, a map based on the hash-table. w: http://en.wikipedia.org/wiki/Hash_table ...