Objects
Prev | Next | |||
Overview | Object Store |
Objects
As mentioned above there are three rules you have to follow while intergrating your object classes into OOS.
Derive from class object
All your entity classes or extity base classes must be derived from oos::object and must have a default constructor.
Provide access methods
Write correct access (get/set) methods for all your member attributes. It is important when modifying an attribute to use the oos::object::modify() method. It tells the oos::object_store and the oos::object_observer objects that an object is modified.
void person::name(const std::string &n)
{
modify(name_, n);
}
std::string name() const
{
return name_;
}
Make it serializable
To make the class serializable you have to implement the methods oos::object::serialize() and oos::object::deserialize(). And don't forget to call these methods for your super class.
{
object::serialize(serializer);
serializer.read("name", name_);
}
void person::deserialize(oos::object_reader &deserializer)
{
object::deserialize(deserializer);
deserializer->write("name", name_);
}
Prev | Next | |||
Overview | Object Store |
Table of content