12 #ifndef __SGOBJECT_H__
13 #define __SGOBJECT_H__
42 class CSerializableFile;
44 template <
class T,
class K>
class CMap;
47 template <
class T>
class DynArray;
51 #ifdef USE_REFERENCE_COUNTING
52 #define SG_REF(x) { if (x) (x)->ref(); }
53 #define SG_UNREF(x) { if (x) { if ((x)->unref()==0) (x)=NULL; } }
54 #define SG_UNREF_NO_NULL(x) { if (x) { (x)->unref(); } }
58 #define SG_UNREF_NO_NULL(x)
64 #define SG_ADD(param, name, description, ms_available) {\
65 m_parameters->add(param, name, description);\
67 m_model_selection_parameters->add(param, name, description);\
100 #ifdef USE_REFERENCE_COUNTING
119 #endif //USE_REFERENCE_COUNTING
144 virtual const char*
get_name()
const = 0;
154 virtual bool is_generic(EPrimitiveType*
generic)
const;
213 const char* prefix=
"");
228 int32_t current_version,
246 int32_t& base_version,
317 #ifdef TRACE_MEMORY_ALLOCS
318 static void list_memory_allocs()
320 shogun::list_memory_allocs();
344 virtual TParameter*
migrate(DynArray<TParameter*>* param_base,
345 const SGParamInfo* target);
370 const SGParamInfo* target, TParameter*& replacement,
371 TParameter*& to_migrate,
char* old_name=NULL);
422 void set_global_objects();
423 void unset_global_objects();
431 bool is_param_new(const SGParamInfo param_info) const;
441 bool save_parameter_version(CSerializableFile* file, const
char* prefix="",
447 int32_t load_parameter_version(CSerializableFile* file,
448 const
char* prefix="");
460 void get_parameter_incremental_hash(Parameter* param,
461 uint32_t& hash, uint32_t& carry, uint32_t& total_length);
487 EPrimitiveType m_generic;
488 bool m_load_pre_called;
489 bool m_load_post_called;
490 bool m_save_pre_called;
491 bool m_save_post_called;
496 PTHREAD_LOCK_T m_ref_lock;
497 #endif //HAVE_PTHREAD
500 #endif // __SGOBJECT_H__