Data Model Description
Defines
-
MAKE_CLASS_SORT(class_name, att_list)
Create an operator< based on a list of attributes.
expands toMAKE_CLASS_SORT(AbstractClosing, (from, to) )
public: bool operator<(AbstractClosing const&other) const { if( safecomp::neq( get_from(), other.get_from() ) ) { if( safecomp::lt( get_from(), other.get_from() ) ) { return true; } else { return false; } } if( safecomp::neq( get_to(), other.get_to() ) ) { if( safecomp::lt( get_to() , other.get_to() ) ) { return true; } else { return false; } } return false; }
- Parameters:
class_name – the name of the class
att_list – the list of attributes to sort on
-
MAKE_DTO_STRUCT(struct_name, att_seq)
allow the declaration of a structure
expands toMAKE_DTO_STRUCT( PressDto, ( (std::string)(id) ) ( (unsigned)(pos) ) )
struct PressDto { std::string id; unsigned pos; };
Remark
these structures are serializable and streamable
See also
See also
details::streamable
- Parameters:
struct_name – the name of the struct
att_seq – the sequence of sequences describing the attribute
-
MAKE_DTO_ENUM
allow the declaration of an enum
MAKE_DTO_ENUM( //Name EnumDto, //Values VAL_1, VAL_2, VAL_3 )
Remark
it is just an alias for BOOST_DEFINE_ENUM
Remark
these structures are serializable and streamable
See also
-
MAKE_ATT(att_desc)
Generate the declaration and every set / get for basic attribute.
expands toMAKE_ATT( (std::string)(id)("default") ) MAKE_ATT( (float)(contribution) )
private: std::string _id={"default"}; public: std::string const &get_id() const { return _id; } std::string &get_id() { return _id; } void set_id(std::string const &val) { _id = val; } private: float _contribution; public: float &get_contribution() { return _contribution; } float const &get_contribution() const { return _contribution; } void set_contribution(float const &val) { _contribution = val; }
- Parameters:
att_desc – sequence describing the attribute : (type)(name)[(default_value)]
-
MAKE_NON_COPYABLE_ATT(att_desc)
Generate the declaration and every set / get for basic attribute.
expands toMAKE_NON_COPYABLE_ATT( (MyClass)(my_class) )
private: MyClass _my_class; public: MyClass const &get_my_class() const { return _my_class; } MyClass &get_my_class() { return _my_class; }
- Parameters:
att_desc – sequence describing the attribute : (type)(name)[(default_value)]
-
MAKE_CONST_ATT(att_desc)
Generate the declaration and every get for basic non modifiable attribute.
expands toMAKE_CONST_ATT( (std::vector<std::string>)(ids) )
private: std::vector<std::string> _ids; public: std::vector<std::string> const &get_ids() const { return _ids; }
- Parameters:
att_desc – sequence describing the attribute : (type)(name)
-
MAKE_MAP(key, value, name)
Generate an editable attribute std::map<key, value> _name along with its getters.
expands toMAKE_MAP(std::string, int, values)
private: std::map<std::string, int> _values; public: std::map<std::string, int> &get_values() { return _values; } std::map<std::string, int> const &get_values() const { return _values; }
- Parameters:
key – the type of keys
value – the type of values
name – the name of the attribute
-
MAKE_SET(value, name)
Generate an editable attribute std::set<value> _name along with its getters.
expands toMAKE_SET(int, values)
private: std::set<int> _values; public: std::set<int> &get_values() { return _values; } std::set<int> const &get_values() const { return _values; }
- Parameters:
value – the type of values
name – the name of the attribute
-
MAKE_STRHASH_MAP(value, name)
Generate an editable attribute std::unordered_map<std::string, value> _name along with its getters.
expands toMAKE_STRHASH_MAP(int, values)
private: std::unordered_map<std::string, int, string_hash, std::equal_to<>>; public: std::unordered_map<std::string, int, string_hash, std::equal_to<>> &get_values() { return _values; } std::unordered_map<std::string, int, string_hash, std::equal_to<>> const &get_values() const { return _values; }
See also
- Parameters:
value – the type of values
name – the name of the attribute
-
MAKE_CLASS_REF_ATT(type, name)
Generate an editable attribute type & _name along with its getters.
expands toMAKE_CLASS_REF_ATT(type, obj)
private: type &_obj; public: type &get_obj() { return _obj; } type const &get_obj() const { return _obj; }
- Parameters:
type – the class name
name – the name of the attribute
-
MAKE_CLASS_CONSTREF_ATT(type, name)
Generate a read only attribute type const & _name along with its getters.
expands toMAKE_CLASS_CONSTREF_ATT(type, obj)
private: type const &_obj; public: type const &get_obj() const { return _obj; }
- Parameters:
type – the class name
name – the name of the attribute
-
MAKE_CLASS_ATT(const_att_seq, editable_att_seq)
Generate every set / get for basic attributes.
expands toMAKE_CLASS_ATT( //non editable attributes ( (std::string)(id) ), //editable attributes ( (unsigned)(x) ) ( (unsigned)(pos) ) )
private: std::string _id; public: std::string const &get_id() const { return _id; } private: unsigned _x; public: void set_x(unsigned p) { _x = p; } unsigned &get_x() { return _x; } unsigned get_x() const { return _x; } private: unsigned _pos; public: void set_pos(unsigned p) { _pos = p; } unsigned &get_pos() { return _pos; } unsigned get_pos() const { return _pos; }
- Parameters:
const_att_seq – sequence of non editable attributes
editable_att_seq – sequence of editable attributes