SHOGUN
v2.0.0
|
parameter struct
Definition at line 24 of file Parameter.h.
Public Member Functions | |
TParameter (const TSGDataType *datatype, void *parameter, const char *name, const char *description) | |
~TParameter () | |
void | print (const char *prefix) |
bool | save (CSerializableFile *file, const char *prefix="") |
bool | load (CSerializableFile *file, const char *prefix="") |
void | allocate_data_from_scratch (index_t len_y, index_t len_x, bool new_cont_call=true) |
void | copy_data (const TParameter *source) |
bool | operator== (const TParameter &other) const |
bool | operator< (const TParameter &other) const |
bool | operator> (const TParameter &other) const |
void | get_incremental_hash (uint32_t &hash, uint32_t &carry, uint32_t &total_length) |
Public Attributes | |
TSGDataType | m_datatype |
void * | m_parameter |
char * | m_name |
char * | m_description |
bool | m_delete_data |
bool | m_was_allocated_from_scratch |
|
explicit |
explicit constructor
datatype | datatype |
parameter | pointer to parameter |
name | name of parameter |
description | description of parameter |
Definition at line 1571 of file Parameter.cpp.
~TParameter | ( | ) |
destructor
Definition at line 1582 of file Parameter.cpp.
Allocates data for this instance from scratch. This is one of the core methods in parameter migration. It is used if parameters have to be loaded from file without having a class instance to put the data into. Namely, the data length variables are allocated, for numeric scalars, the memory is allocated, for SG_OBJECT scalars, a pointer to an CSGObject is allocated, for non-scalars, the pointer to the data is allocated for non-scalars, the actual data is also allocated via cont_new()
len_y | desired y length of the data |
len_x | desired x length of the data |
new_cont_call | whether new_cont should be called, if false, only scalar non-sgobject data will be allocated (needed for migration) |
Definition at line 2676 of file Parameter.cpp.
void copy_data | ( | const TParameter * | source | ) |
Given another TParameter instance (with same type, except for lengths) all its data is copied to the current one. This means in case of numeric scalars that the value is copied and in SG_OBJECT scalars and any arrays that the pointer to the data is copied. The old data is overwritten. Old SG_OBJECTS are SG_UNREF'ed and the new ones are SG_REF'ed.
source | source TParameter instance to copy from |
Definition at line 2761 of file Parameter.cpp.
void get_incremental_hash | ( | uint32_t & | hash, |
uint32_t & | carry, | ||
uint32_t & | total_length | ||
) |
Incrementally get a hash from parameter value*
hash | current hash value |
carry | value for incremental murmur hashing |
total_length | byte length of parameters. Function will add byte length to received value |
Definition at line 2192 of file Parameter.cpp.
bool load | ( | CSerializableFile * | file, |
const char * | prefix = "" |
||
) |
load from serializable file
file | source file |
prefix | prefix |
Definition at line 2357 of file Parameter.cpp.
bool operator< | ( | const TParameter & | other | ) | const |
operator for comparison (by string m_name)
Definition at line 2666 of file Parameter.cpp.
bool operator== | ( | const TParameter & | other | ) | const |
operator for comparison, (by string m_name)
Definition at line 2659 of file Parameter.cpp.
bool operator> | ( | const TParameter & | other | ) | const |
operator for comparison (by string m_name)
Definition at line 2671 of file Parameter.cpp.
void print | ( | const char * | prefix | ) |
bool save | ( | CSerializableFile * | file, |
const char * | prefix = "" |
||
) |
save to serializable file
file | destination file |
prefix | prefix |
Definition at line 2267 of file Parameter.cpp.
TSGDataType m_datatype |
type of parameter
Definition at line 90 of file Parameter.h.
bool m_delete_data |
if this is set true, the data, m_parameter points to, m_parameter itself, and possible lengths of the type will be deleted in destructor. This is needed because in data migration, TParameter instances are created from scratch without having a class instance and allocated data has to ne deleted in this case. The only way to set this is via an alternate constructor, false by default
Definition at line 105 of file Parameter.h.
char* m_description |
description of parameter
Definition at line 96 of file Parameter.h.
char* m_name |
name of parameter
Definition at line 94 of file Parameter.h.
void* m_parameter |
pointer to parameter
Definition at line 92 of file Parameter.h.
bool m_was_allocated_from_scratch |
Definition at line 109 of file Parameter.h.