oos::object_base_ptr Class Referenceabstract

Base class for the object pointer and reference class. More...

#include <object_ptr.hpp>

Inherited by oos::object_ptr< item_type >, oos::object_ref< C >, oos::object_ptr< T >, and oos::object_ref< T >.

Public Member Functions

bool operator== (const object_base_ptr &x) const
 
bool operator!= (const object_base_ptr &x) const
 
virtual const char * type () const =0
 
void reset (const object *o=0)
 
bool is_loaded () const
 
long id () const
 
void id (long i)
 
objectptr () const
 
objectlookup_object () const
 
virtual bool is_reference () const
 
bool is_internal () const
 
unsigned long ref_count () const
 
unsigned long ptr_count () const
 

Protected Member Functions

 object_base_ptr (bool is_ref)
 Creates and empty base pointer. More...
 
 object_base_ptr (const object_base_ptr &x)
 
object_base_ptroperator= (const object_base_ptr &x)
 
 object_base_ptr (object *o, bool is_ref)
 Creates an object_base_ptr with a given object. More...
 
 object_base_ptr (object_proxy *op, bool is_ref)
 Creates an object_base_ptr with a given object_proxy. More...
 

Friends

class object_reader
 
class object_writer
 
class object_creator
 
class object_serializer
 
struct object_proxy
 
template<class T >
class object_ref
 
template<class T >
class object_ptr
 
OOS_API std::ostream & operator<< (std::ostream &out, const object_base_ptr &x)
 

Detailed Description

Base class for the object pointer and reference class.

This is the base class for the object pointer and reference class. The class holds the proxy of the object and the id of the object.

Constructor & Destructor Documentation

oos::object_base_ptr::object_base_ptr ( bool  is_ref)
explicitprotected

Creates and empty base pointer.

Creates and empty base pointer. The boolean tells the class if the object is handled as a reference or an pointer. The difference is that the reference couldn't be deleted from the object_store and the pointer can.

Parameters
is_refIf true the object is handled as a reference.
oos::object_base_ptr::object_base_ptr ( const object_base_ptr x)
protected

Copies from another object_base_ptr

Parameters
xthe object_base_ptr to copy from.
oos::object_base_ptr::object_base_ptr ( object o,
bool  is_ref 
)
protected

Creates an object_base_ptr with a given object.

Creates an object_base_ptr with a given object. The boolean tells the object_base_ptr if it should be handled as a reference or a pointer.

Parameters
oThe object of the object_base_ptr
is_refIf true the object is handled as a reference.
oos::object_base_ptr::object_base_ptr ( object_proxy *  op,
bool  is_ref 
)
protected

Creates an object_base_ptr with a given object_proxy.

Creates an object_base_ptr with a given object_proxy. The boolean tells the object_base_ptr if it should be handled as a reference or a pointer.

Parameters
opThe object_proxy of the object_base_ptr
is_refIf true the object is handled as a reference.

Member Function Documentation

long oos::object_base_ptr::id ( ) const

Returns the object id.

Returns
The id of the object.
void oos::object_base_ptr::id ( long  i)

Sets the object id. If a proxy is set an exception is thrown.

Parameters
iThe new object id
bool oos::object_base_ptr::is_internal ( ) const

Returns if this object_base_ptr is inside of the object_store. This is important to calculate the reference and pointer counter.

Returns
True if the object_base_ptr internal
bool oos::object_base_ptr::is_loaded ( ) const

Returns if the object is loaded.

Returns
True if the object is loaded.
virtual bool oos::object_base_ptr::is_reference ( ) const
virtual

Returns if the object is treated as a reference.

Returns
True if the object is treated like a reference.
object* oos::object_base_ptr::lookup_object ( ) const

Returns the object

Returns
The object.
bool oos::object_base_ptr::operator!= ( const object_base_ptr x) const

Not equal to operator for the object_base_ptr

Parameters
xThe object_base_ptr to check unequality with.
object_base_ptr& oos::object_base_ptr::operator= ( const object_base_ptr x)
protected

Assign operator.

Parameters
xThe object_base_ptr to assign from.
bool oos::object_base_ptr::operator== ( const object_base_ptr x) const

Equal to operator for the object_base_ptr

Parameters
xThe object_base_ptr to check equality with.
object* oos::object_base_ptr::ptr ( ) const

Returns the object

Returns
The object.
unsigned long oos::object_base_ptr::ptr_count ( ) const

Returns the pointer count.

Returns
The pointer count.
unsigned long oos::object_base_ptr::ref_count ( ) const

Returns the reference count.

Returns
The reference count.
void oos::object_base_ptr::reset ( const object o = 0)

Resets the object_base_ptr with the given object.

Parameters
oThe new object for the object_base_ptr.
virtual const char* oos::object_base_ptr::type ( ) const
pure virtual

Returns the type string of the object

Returns
The type string of the object.

Implemented in oos::object_ref< T >, oos::object_ref< C >, oos::object_ptr< T >, and oos::object_ptr< item_type >.

Friends And Related Function Documentation

OOS_API std::ostream& operator<< ( std::ostream &  out,
const object_base_ptr x 
)
friend

Prints the underlaying object

Parameters
outThe output stream to write on.
xThe object pointer to print.
Returns
The output stream.

The documentation for this class was generated from the following file:
  • object/object_ptr.hpp