12 #ifndef __SGOBJECT_H__
13 #define __SGOBJECT_H__
40 class CSerializableFile;
42 template <
class T,
class K>
class CMap;
45 template <
class T>
class DynArray;
49 #ifdef USE_REFERENCE_COUNTING
50 #define SG_REF(x) { if (x) (x)->ref(); }
51 #define SG_UNREF(x) { if (x) { if ((x)->unref()==0) (x)=NULL; } }
52 #define SG_UNREF_NO_NULL(x) { if (x) { (x)->unref(); } }
56 #define SG_UNREF_NO_NULL(x)
62 #define SG_ADD(param, name, description, ms_available) {\
63 m_parameters->add(param, name, description);\
65 m_model_selection_parameters->add(param, name, description);\
98 #ifdef USE_REFERENCE_COUNTING
117 #endif //USE_REFERENCE_COUNTING
142 virtual const char*
get_name()
const = 0;
152 virtual bool is_generic(EPrimitiveType*
generic)
const;
211 const char* prefix=
"");
226 int32_t current_version,
244 int32_t& base_version,
315 #ifdef TRACE_MEMORY_ALLOCS
316 static void list_memory_allocs()
318 ::list_memory_allocs();
342 virtual TParameter*
migrate(DynArray<TParameter*>* param_base,
343 const SGParamInfo* target);
368 const SGParamInfo* target, TParameter*& replacement,
369 TParameter*& to_migrate,
char* old_name=NULL);
419 void set_global_objects();
420 void unset_global_objects();
428 bool is_param_new(const SGParamInfo param_info) const;
438 bool save_parameter_version(CSerializableFile* file, const
char* prefix="",
444 int32_t load_parameter_version(CSerializableFile* file,
445 const
char* prefix="");
457 void get_parameter_incremental_hash(Parameter* param,
458 uint32_t& hash, uint32_t& carry, uint32_t& total_length);
484 EPrimitiveType m_generic;
485 bool m_load_pre_called;
486 bool m_load_post_called;
487 bool m_save_pre_called;
488 bool m_save_post_called;
493 PTHREAD_LOCK_T m_ref_lock;
494 #endif //HAVE_PTHREAD
497 #endif // __SGOBJECT_H__