Graphite  Version 3
An experimental 3D geometry processing program
OGF::LifeCycle Class Referenceabstract

Manages the life cycle of an object. More...

#include <OGF/gom/services/life_cycle.h>

Inheritance diagram for OGF::LifeCycle:
GEO::Counted OGF::GenericLifeCycle< T >

Public Member Functions

 LifeCycle (size_t object_size, bool is_pod=false)
 LifeCycle constructor. More...
 
virtual ~LifeCycle ()
 LifeCycle destructor.
 
size_t object_size () const
 Gets the size of an object. More...
 
bool is_pod () const
 Tests whether object is pod (plain ordinary datatype). More...
 
virtual void construct (Memory::pointer address)=0
 Calls the constructor of an object. More...
 
virtual void copy_construct (Memory::pointer lhs, Memory::pointer rhs)=0
 Copy-Constructs an object at a given address. More...
 
virtual void destroy (Memory::pointer address)=0
 Calls the destructor of an object. More...
 
virtual void assign (Memory::pointer lhs, Memory::pointer rhs)=0
 Calls the assignment operator. More...
 
virtual void construct_array (Memory::pointer address, index_t nb)=0
 Calls the constructor of objects in an array. More...
 
virtual void copy_construct_array (Memory::pointer lhs, Memory::pointer rhs, index_t nb)=0
 Copy-Constructs an array of object at a given address. More...
 
virtual void destroy_array (Memory::pointer address, index_t nb)=0
 Destroys an array of object at a given address. More...
 
virtual void assign_array (Memory::pointer lhs, Memory::pointer rhs, index_t nb)=0
 Copies an array of object at a given address. More...
 
virtual Memory::pointer new_object ()=0
 Dynamically allocates a new object. More...
 
virtual Memory::pointer new_object (Memory::pointer rhs)=0
 Dynamically allocates a new object with copy constructor. More...
 
virtual void delete_object (Memory::pointer address)=0
 Deletes an object. More...
 
virtual Memory::pointer new_array (index_t nb)=0
 Dynamically allocates an array of objects. More...
 
virtual void delete_array (Memory::pointer address)=0
 Deletes an array of objects. More...
 
- Public Member Functions inherited from GEO::Counted
void ref () const
 Increments the reference count. More...
 
void unref () const
 Decrements the reference count. More...
 
bool is_shared () const
 Check if the object is shared. More...
 
int nb_refs () const
 Gets the number of references that point to this object. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from GEO::Counted
static void ref (const Counted *counted)
 Increments the reference count. More...
 
static void unref (const Counted *counted)
 Decrements the reference count. More...
 
- Protected Member Functions inherited from GEO::Counted
 Counted ()
 Creates a reference counted object. More...
 
virtual ~Counted ()
 Destroys a reference counted object. More...
 

Detailed Description

Manages the life cycle of an object.

Definition at line 59 of file life_cycle.h.

Constructor & Destructor Documentation

◆ LifeCycle()

OGF::LifeCycle::LifeCycle ( size_t  object_size,
bool  is_pod = false 
)
inline

LifeCycle constructor.

Parameters
[in]object_sizethe size of an object in bytes.

Definition at line 66 of file life_cycle.h.

Member Function Documentation

◆ assign()

virtual void OGF::LifeCycle::assign ( Memory::pointer  lhs,
Memory::pointer  rhs 
)
pure virtual

Calls the assignment operator.

Parameters
[in]lhsthe address of the left hand side.
[in]rhsthe address of the right hand side.

Implemented in OGF::GenericLifeCycle< T >.

◆ assign_array()

virtual void OGF::LifeCycle::assign_array ( Memory::pointer  lhs,
Memory::pointer  rhs,
index_t  nb 
)
pure virtual

Copies an array of object at a given address.

Parameters
[in]lhsthe address of the left-hand-side objects
[in]rhsthe address of the right-hand-side objects to be copied.
[in]nbnumber of objects

No memory allocation is done.

Implemented in OGF::GenericLifeCycle< T >.

◆ construct()

virtual void OGF::LifeCycle::construct ( Memory::pointer  address)
pure virtual

Calls the constructor of an object.

Parameters
[in]addressthe address of the object to be constructed.

No memory allocation is done.

Implemented in OGF::GenericLifeCycle< T >.

◆ construct_array()

virtual void OGF::LifeCycle::construct_array ( Memory::pointer  address,
index_t  nb 
)
pure virtual

Calls the constructor of objects in an array.

Parameters
[in]addressthe address of the object array to be constructed.
[in]nbnumber of objects.

No memory allocation is done.

Implemented in OGF::GenericLifeCycle< T >.

◆ copy_construct()

virtual void OGF::LifeCycle::copy_construct ( Memory::pointer  lhs,
Memory::pointer  rhs 
)
pure virtual

Copy-Constructs an object at a given address.

Parameters
[in]lhsthe address where the object should be constructed.
[in]rhsthe address of the right-hand-side object to be copied.

No memory allocation is done.

Implemented in OGF::GenericLifeCycle< T >.

◆ copy_construct_array()

virtual void OGF::LifeCycle::copy_construct_array ( Memory::pointer  lhs,
Memory::pointer  rhs,
index_t  nb 
)
pure virtual

Copy-Constructs an array of object at a given address.

Parameters
[in]lhsthe address of the objects to be constructed.
[in]rhsthe address of the right-hand-side objects to be copied.
[in]nbnumber of objects

No memory allocation is done.

Implemented in OGF::GenericLifeCycle< T >.

◆ delete_array()

virtual void OGF::LifeCycle::delete_array ( Memory::pointer  address)
pure virtual

Deletes an array of objects.

Parameters
[in]addressthe address of the object array to be deleted.

Implemented in OGF::GenericLifeCycle< T >.

◆ delete_object()

virtual void OGF::LifeCycle::delete_object ( Memory::pointer  address)
pure virtual

Deletes an object.

Parameters
[in]addressthe address of the object.

Implemented in OGF::GenericLifeCycle< T >.

◆ destroy()

virtual void OGF::LifeCycle::destroy ( Memory::pointer  address)
pure virtual

Calls the destructor of an object.

Parameters
[in]addressthe address of the object to be destructed.

No memory deallocation is done.

Implemented in OGF::GenericLifeCycle< T >.

◆ destroy_array()

virtual void OGF::LifeCycle::destroy_array ( Memory::pointer  address,
index_t  nb 
)
pure virtual

Destroys an array of object at a given address.

Parameters
[in]addressthe address of the objects to be destroyed.
[in]nbnumber of objects

No memory deallocation is done.

Implemented in OGF::GenericLifeCycle< T >.

◆ is_pod()

bool OGF::LifeCycle::is_pod ( ) const
inline

Tests whether object is pod (plain ordinary datatype).

Plain ordinary datatypes can be copied with memcpy().

Return values
trueif object is pod.
falseotherwise.

Definition at line 91 of file life_cycle.h.

◆ new_array()

virtual Memory::pointer OGF::LifeCycle::new_array ( index_t  nb)
pure virtual

Dynamically allocates an array of objects.

Parameters
[in]nbnumber of objects.

Implemented in OGF::GenericLifeCycle< T >.

◆ new_object() [1/2]

virtual Memory::pointer OGF::LifeCycle::new_object ( )
pure virtual

Dynamically allocates a new object.

Returns
the address of the new object.

Implemented in OGF::GenericLifeCycle< T >.

◆ new_object() [2/2]

virtual Memory::pointer OGF::LifeCycle::new_object ( Memory::pointer  rhs)
pure virtual

Dynamically allocates a new object with copy constructor.

Parameters
[in]rhsthe address of the right-hand-side objects to be copied.
Returns
the address of the new object.

Implemented in OGF::GenericLifeCycle< T >.

◆ object_size()

size_t OGF::LifeCycle::object_size ( ) const
inline

Gets the size of an object.

Returns
the size of an object in bytes.

Definition at line 79 of file life_cycle.h.


The documentation for this class was generated from the following file: