Graphite Version 3
An experimental 3D geometry processing program
Loading...
Searching...
No Matches
GEO::GenericLifeCycle< T > Class Template Reference

Concrete implementation of LifeCycle. More...

#include <geogram/basic/life_cycle.h>

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

Public Member Functions

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

Additional Inherited Members

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

Detailed Description

template<class T>
class GEO::GenericLifeCycle< T >

Concrete implementation of LifeCycle.

Definition at line 252 of file life_cycle.h.

Constructor & Destructor Documentation

◆ GenericLifeCycle()

template<class T >
GEO::GenericLifeCycle< T >::GenericLifeCycle ( )
inline

GenericLifeCycle constructor.

Definition at line 258 of file life_cycle.h.

Member Function Documentation

◆ assign()

template<class T >
void GEO::GenericLifeCycle< T >::assign ( Memory::pointer  lhs,
Memory::const_pointer  rhs 
)
inlineoverridevirtual

Calls the assignment operator.

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

Implements GEO::LifeCycle.

Definition at line 292 of file life_cycle.h.

◆ assign_array()

template<class T >
void GEO::GenericLifeCycle< T >::assign_array ( Memory::pointer  lhs,
Memory::const_pointer  rhs,
index_t  nb 
)
inlineoverridevirtual

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.

Implements GEO::LifeCycle.

Definition at line 346 of file life_cycle.h.

◆ construct()

template<class T >
void GEO::GenericLifeCycle< T >::construct ( Memory::pointer  address)
inlineoverridevirtual

Calls the constructor of an object.

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

No memory allocation is done.

Implements GEO::LifeCycle.

Definition at line 268 of file life_cycle.h.

◆ construct_array()

template<class T >
void GEO::GenericLifeCycle< T >::construct_array ( Memory::pointer  address,
index_t  nb 
)
inlineoverridevirtual

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.

Implements GEO::LifeCycle.

Definition at line 312 of file life_cycle.h.

◆ copy_construct()

template<class T >
void GEO::GenericLifeCycle< T >::copy_construct ( Memory::pointer  lhs,
Memory::const_pointer  rhs 
)
inlineoverridevirtual

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.

Implements GEO::LifeCycle.

Definition at line 275 of file life_cycle.h.

◆ copy_construct_array()

template<class T >
void GEO::GenericLifeCycle< T >::copy_construct_array ( Memory::pointer  lhs,
Memory::const_pointer  rhs,
index_t  nb 
)
inlineoverridevirtual

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.

Implements GEO::LifeCycle.

Definition at line 322 of file life_cycle.h.

◆ delete_array()

template<class T >
void GEO::GenericLifeCycle< T >::delete_array ( Memory::pointer  address)
inlineoverridevirtual

Deletes an array of objects.

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

Implements GEO::LifeCycle.

Definition at line 398 of file life_cycle.h.

◆ delete_object()

template<class T >
void GEO::GenericLifeCycle< T >::delete_object ( Memory::pointer  address)
inlineoverridevirtual

Deletes an object.

Parameters
[in]addressthe address of the object.

Implements GEO::LifeCycle.

Definition at line 384 of file life_cycle.h.

◆ destroy()

template<class T >
void GEO::GenericLifeCycle< T >::destroy ( Memory::pointer  address)
inlineoverridevirtual

Calls the destructor of an object.

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

No memory deallocation is done.

Implements GEO::LifeCycle.

Definition at line 284 of file life_cycle.h.

◆ destroy_array()

template<class T >
void GEO::GenericLifeCycle< T >::destroy_array ( Memory::pointer  address,
index_t  nb 
)
inlineoverridevirtual

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.

Implements GEO::LifeCycle.

Definition at line 335 of file life_cycle.h.

◆ new_array()

template<class T >
Memory::pointer GEO::GenericLifeCycle< T >::new_array ( index_t  nb)
inlineoverridevirtual

Dynamically allocates an array of objects.

Parameters
[in]nbnumber of objects.

Implements GEO::LifeCycle.

Definition at line 391 of file life_cycle.h.

◆ new_object() [1/2]

template<class T >
Memory::pointer GEO::GenericLifeCycle< T >::new_object ( )
inlineoverridevirtual

Dynamically allocates a new object.

Returns
the address of the new object.

Implements GEO::LifeCycle.

Definition at line 370 of file life_cycle.h.

◆ new_object() [2/2]

template<class T >
Memory::pointer GEO::GenericLifeCycle< T >::new_object ( Memory::const_pointer  rhs)
inlineoverridevirtual

Dynamically allocates a new object.

Returns
the address of the new object.

Implements GEO::LifeCycle.

Definition at line 377 of file life_cycle.h.

◆ reset()

template<class T >
void GEO::GenericLifeCycle< T >::reset ( Memory::pointer  address)
inlineoverridevirtual

Resets an object to its default value.

Creates a new object with the default constructor and assigns it to the object at address.

Parameters
[in]addressthe address of an already initialized object.

Implements GEO::LifeCycle.

Definition at line 299 of file life_cycle.h.

◆ reset_array()

template<class T >
void GEO::GenericLifeCycle< T >::reset_array ( Memory::pointer  address,
index_t  nb 
)
inlineoverridevirtual

Resets all objects in an array to their default value.

creates an object with the default value and assigns it to the element for each element in the array.

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

Implements GEO::LifeCycle.

Definition at line 359 of file life_cycle.h.

◆ swap()

template<class T >
void GEO::GenericLifeCycle< T >::swap ( Memory::pointer  a,
Memory::pointer  b 
)
inlineoverridevirtual

Swaps the objects at two addresses.

Parameters
[in]a,bpointers to the two objects to be swapped

Implements GEO::LifeCycle.

Definition at line 305 of file life_cycle.h.


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