The base class for all objects. More...
#include <object.hpp>
Inherits oos::object_atomizable.
Inherited by oos::value_item< T >.
Public Member Functions | |
object () | |
Create a new object. More... | |
virtual | ~object () |
virtual void | deserialize (object_reader &deserializer) |
virtual void | serialize (object_writer &serializer) const |
const char * | classname () const |
Returns the classname of the object. More... | |
long | id () const |
Returns the unique identifier of the object. More... | |
void | id (long oid) |
Sets the id of the object. More... | |
object_store * | ostore () const |
Returns the object store. More... | |
template<class T > | |
bool | set (const std::string &name, const T &val) |
template<class T > | |
bool | get (const std::string &name, T &val) |
template<class T > | |
bool | get (const std::string &name, T &val, int precision) |
template<class T > | |
void | modify (T &attr, const T &val) |
void | modify (char *attr, int max_size, const char *val, int size) |
template<class T > | |
void | modify (oos::object_ref< T > &attr, const oos::object_ptr< T > &val) |
void | modify (varchar_base &attr, const std::string &val) |
void | modify (varchar_base &attr, const varchar_base &val) |
Protected Member Functions | |
object_proxy * | proxy () const |
Returns the object_proxy of the object. More... | |
void | mark_modified () |
Marks this object as modified in its object_store. More... | |
Friends | |
class | object_store |
class | object_deleter |
class | object_base_ptr |
class | object_serializer |
class | object_container |
class | object_value_base |
class | table |
class | relation_filler |
class | query |
class | database |
OOS_API std::ostream & | operator<< (std::ostream &os, const object &o) |
Detailed Description
The base class for all objects.
The object class must be the base class of all classes inserted into the object_store. At least the object_store handles with objects of base type object. When iterating over a view these objects are casted to the concrete type.
The object is identified by a unique id, which is set by the object_store.
Constructor & Destructor Documentation
oos::object::object | ( | ) |
Create a new object.
Creates a new object, which is not member of the object_store.
|
virtual |
Destroys the object.
Member Function Documentation
const char* oos::object::classname | ( | ) | const |
Returns the classname of the object.
Returns the classname of the object if the object isn't stored in the object store 'nullptr' is returned
- Returns
- Name of the object type or nullptr
|
inlinevirtual |
Deserializes an object from the given object_atomizer object.
- Parameters
-
deserializer The object_atomizer to deserialize from.
Implements oos::object_atomizable.
Reimplemented in oos::container_item< T, C >, and oos::value_item< T >.
|
inline |
Gets the value of a member identified by the given name. If the operation succeeds true is returned.
- Template Parameters
-
T The type of the value to retrieve.
- Parameters
-
name The name of the member variable. val The reference where the value is assigned to.
- Returns
- True if the operation succeeds.
|
inline |
Gets the value of a member identified by the given name. If the operation succeeds true is returned.
- Template Parameters
-
T The type of the value to retrieve.
- Parameters
-
name The name of the member variable. val The reference where the value is assigned to. precision The precision of the value to get.
- Returns
- True if the operation succeeds.
long oos::object::id | ( | ) | const |
Returns the unique identifier of the object.
This method returns the unique id of the object. These id is first set when the object is inserted into the object_store. On creation the value of the id is zero.
- Returns
- The unique id of the object.
void oos::object::id | ( | long | oid | ) |
Sets the id of the object.
Sets the id of the object.
- Parameters
-
oid The new id of the object.
|
protected |
Marks this object as modified in its object_store.
Marks this object as modified in its object_store. This method must be called before modifing a derived object. Otherwise the object can't be restored on an error or rollback.
|
inline |
Modify the attribute assigning the new given value to attributes reference.
- Template Parameters
-
T Type of attribute to change.
- Parameters
-
attr Refernce to attribute to change. val New value for attribute.
|
inline |
Modify the char attribute assigning the new given char value to attributes reference.
- Parameters
-
attr Pointer to character string to change. max_size The maximum capacity of the destinition array. val New stringto set. size The length of the new string.
- Exceptions
-
std::logic_error.
|
inline |
Modify an object_ptr attribute assigning the new given value to attributes reference.
- Template Parameters
-
T Type of object_ptr to change.
- Parameters
-
attr Refernce to object_ptr to change. val New value for object_ptr.
|
inline |
Modify a varchar_base attribute assigning the new given value to attributes reference.
- Parameters
-
attr Refernce to varchar_base to change. val New value for varchar_base.
|
inline |
Modify a varchar_base attribute assigning the new given value to attributes reference.
- Parameters
-
attr Refernce to varchar_base to change. val New value for varchar_base.
object_store* oos::object::ostore | ( | ) | const |
Returns the object store.
Returns the object_store into which this object was inserted. If this object wasn't inserted NULL is returned.
- Returns
- The object_store to which the object belongs.
|
inlineprotected |
Returns the object_proxy of the object.
Returns the object_proxy of the object. If the object isn't inserted into a object_store NULL is returned.
- Returns
- The object_proxy of the object.
|
inlinevirtual |
Serializes an object to the given object_atomizer object.
- Parameters
-
serializer The object_atomizer to serialize to.
Implements oos::object_atomizable.
Reimplemented in oos::container_item< T, C >, and oos::value_item< T >.
|
inline |
Sets a value of a member identified by the given name. If the operation succeeds true is returned.
- Template Parameters
-
T The type of the value to set.
- Parameters
-
name The name of the member variable. val The new value for the member.
- Returns
- True if the operation succeeds.
Friends And Related Function Documentation
|
friend |
Print the object to a given stream
- Parameters
-
os The stream to write the object on. o The object to write
- Returns
- The modified stream.
The documentation for this class was generated from the following file:
- object/object.hpp