Kicking it Olde Sküül! Burgerlib on Github Follow Olde Sküül on Twitter Burgerbecky on LinkedIn Burgerbecky on LinkedIn
Loading...
Searching...
No Matches
Burger::LinkedListObjects::Object Class Reference

Instance of a linked list object that contains a pointer to arbitrary data. More...

Inheritance diagram for Burger::LinkedListObjects::Object:
Collaboration diagram for Burger::LinkedListObjects::Object:

Public Types

typedef void(*) ProcDataDelete(Object *pObject)
 Data deletion callback pointer.
 

Public Member Functions

 Object () noexcept
 Default constructor.
 
 Object (void *pData, ProcDataDelete pDataDelete=proc_free_data) noexcept
 Default constructor.
 
 ~Object ()
 Destructor.
 
Objectget_next (void) const noexcept
 Get the next pointer in the list.
 
Objectget_previous (void) const noexcept
 Get the previous pointer in the list.
 
void * get_data (void) const noexcept
 Get the data pointer contained in the Object.
 
void set_data (void *pInput) noexcept
 Set the data pointer that will be contained in the Object.
 
ProcDataDelete get_data_delete_proc (void) const noexcept
 Get the disposal function pointer associated with the Object.
 
void set_data_delete_proc (ProcDataDelete pProc) noexcept
 Set the disposal function pointer that will be contained in the Object.
 

Static Public Member Functions

static void proc_null (Object *pObject) noexcept
 Memory release proc for doing nothing.
 
static void proc_free_object_and_data (Object *pObject) noexcept
 Memory release proc for releasing the data and object.
 
static void proc_free_data (Object *pObject) noexcept
 Memory release proc for releasing the data only.
 
static void proc_free_object (Object *pObject) noexcept
 Memory release proc for releasing the object only.
 
static ObjectNew (void *pData, ProcDataDelete pProc=proc_free_object_and_data) noexcept
 Create a new Object instance.
 

Private Member Functions

 Object (const Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&)=delete
 
Objectoperator= (Object &&)=delete
 
void shutdown (void) noexcept
 Dispose of a single object.
 
void insert_before (Object *pObject) noexcept
 Attach the input object before this one in the list.
 
void insert_after (Object *pObject) noexcept
 Attach the input object after this one in the list.
 
- Private Member Functions inherited from Burger::DoubleLinkedList
 DoubleLinkedList () noexcept
 Initializer for a DoubleLinkedList.
 
 ~DoubleLinkedList ()
 Destructor for a DoubleLinkedList.
 
void detach (void) noexcept
 Detach this object from any attached linked list.
 
void insert_after (DoubleLinkedList *pInput) noexcept
 Attach the input object after this one in the list.
 
void insert_before (DoubleLinkedList *pInput) noexcept
 Attach the input object before this one in the list.
 
DoubleLinkedListget_next (void) const noexcept
 Get the next pointer in the list.
 
DoubleLinkedListget_previous (void) const noexcept
 Get the previous pointer in the list.
 

Private Attributes

void * m_pData
 Pointer to the data.
 
ProcDataDelete m_ProcDataDelete
 Data destructor callback.
 

Friends

class LinkedListObjects
 

Additional Inherited Members

- Static Private Member Functions inherited from Burger::DoubleLinkedList
static DoubleLinkedListNew (void) noexcept
 Create a new DoubleLinkedList instance.
 

Detailed Description

Instance of a linked list object that contains a pointer to arbitrary data.


Each LinkedListObjects::Object has a pointer to the generic data that is contained and also a pointer to a function to discard the data once the entry itself is deleted. The function pointer could be nullptr meaning that the data can be deleted with a simple call to Burger::Free(). The data could also be pointing to the end of the base LinkedListObjects::Object structure if the LinkedListObjects::Object structure is part of a larger structure.

Note
This class is used by LinkedListObjects
See also
LinkedListObjects

Member Typedef Documentation

◆ ProcDataDelete

void( *) Burger::LinkedListObjects::Object::ProcDataDelete(Object *pObject)

Data deletion callback pointer.


Function pointer to delete data that's associated with this LinkedListObjects::Object

Parameters
pObjectPointer to the object to act upon.
See also
Object, proc_null(Object*), proc_free_object_and_data(Object*), proc_free_data(Object*) or proc_free_object(Object*)

Constructor & Destructor Documentation

◆ Object() [1/4]

Burger::LinkedListObjects::Object::Object ( const Object & )
privatedelete

◆ Object() [2/4]

Burger::LinkedListObjects::Object::Object ( Object && )
privatedelete

◆ Object() [3/4]

Burger::LinkedListObjects::Object::Object ( )
inlinenoexcept

Default constructor.


Initialize the structure and set up a deallocation pointer that will only dispose of the data. This constructor is the one used for derived classes or static instances where the disposal of this class is handled by the compiler.

See also
Object(void*, ProcDataDelete) or proc_free_data(Object*)

◆ Object() [4/4]

Burger::LinkedListObjects::Object::Object ( void * pData,
ProcDataDelete pDataDelete = proc_free_data )
inlinenoexcept

Default constructor.


Initialize the structure and set up a deallocation pointer that will only dispose of the data. This constructor is the one used for derived classes or static instances where the disposal of this class requires finer control.

Parameters
pDataPointer to data to store in this object
pDataDeletePointer to function to dispose of this object
See also
Object() or proc_free_data()

◆ ~Object()

Burger::LinkedListObjects::Object::~Object ( )
inline

Destructor.


Unlink this object from the parent linked list and then dispose of the contents. All of this is performed in a call to shutdown()

Note
Under normal circumstances, the disposal function will not dispose of the object itself since calling a destructor implies that destruction is occuring by the caller. If an Object is assumed to be disposed of by the use of a destructor, only use the functions proc_free_data() or proc_null().
See also
shutdown(), Object() or Object(void *,ProcDataDelete)

Member Function Documentation

◆ get_data()

void * Burger::LinkedListObjects::Object::get_data ( void ) const
inlinenoexcept

Get the data pointer contained in the Object.


Return the application supplied data pointer. It can be nullptr

Returns
Data pointer contained within
See also
set_data(void*)

◆ get_data_delete_proc()

ProcDataDelete Burger::LinkedListObjects::Object::get_data_delete_proc ( void ) const
inlinenoexcept

Get the disposal function pointer associated with the Object.


Return the application supplied data disposal pointer.

Returns
Disposal function pointer contained within
See also
set_data_delete_proc(ProcDataDelete)

◆ get_next()

Object * Burger::LinkedListObjects::Object::get_next ( void ) const
inlinenoexcept

Get the next pointer in the list.


Return the pointer to the next object in the list. Since the list is circular, it's the caller's responsibility to ensure that the start and end are detected properly

Returns
Pointer to the next Object in the chain
See also
get_previous(void) const

◆ get_previous()

Object * Burger::LinkedListObjects::Object::get_previous ( void ) const
inlinenoexcept

Get the previous pointer in the list.


Return the pointer to the previous object in the list. Since the list is circular, it's the caller's responsibility to ensure that the start and end are detected properly

Returns
Pointer to the previous Object in the chain
See also
get_next(void) const

◆ insert_after()

void Burger::LinkedListObjects::Object::insert_after ( Object * pObject)
inlineprivatenoexcept

Attach the input object after this one in the list.


Detach the input object from any linked list and then attach the input object after this one in the current list.

Parameters
pObjectPointer to a Object object to link after this one
See also
insert_before(Object *)

◆ insert_before()

void Burger::LinkedListObjects::Object::insert_before ( Object * pObject)
inlineprivatenoexcept

Attach the input object before this one in the list.


Detach the input object from any linked list and then attach the input object before this one in the current list.

Parameters
pObjectPointer to a Object object to link before this one
See also
insert_after(Object *)

◆ New()

Burger::LinkedListObjects::Object *BURGER_API Burger::LinkedListObjects::Object::New ( void * pData,
ProcDataDelete pProc = proc_free_object_and_data )
staticnoexcept

Create a new Object instance.


Allocate memory using Burger::Alloc() and initialize an Object with it.

Note
Since this object was allocated with the Burger::Alloc() function, use the disposal functions proc_free_object(Object*) or proc_free_object_and_data(Object*) to release it
Parameters
pDataPointer to the data this object will control, nullptr is acceptable
pProcPointer to the disposal function
Returns
nullptr if out of memory
See also
shutdown(), proc_free_object(Object*), or proc_free_object_and_data(Object*)

◆ operator=() [1/2]

Object & Burger::LinkedListObjects::Object::operator= ( const Object & )
privatedelete

◆ operator=() [2/2]

Object & Burger::LinkedListObjects::Object::operator= ( Object && )
privatedelete

◆ proc_free_data()

void BURGER_API Burger::LinkedListObjects::Object::proc_free_data ( Object * pObject)
staticnoexcept

Memory release proc for releasing the data only.


Call Burger::Free() on the data pointer only. The Object is assumed to be either static or allocated elsewhere

The data pointer is set to nullptr

Parameters
pObjectPointer to the Object with data to delete (The object's pointer is not disposed of)
See also
ProcDataDelete, proc_null(Object*), proc_free_object_and_data(Object*), or proc_free_object(Object*)

◆ proc_free_object()

void BURGER_API Burger::LinkedListObjects::Object::proc_free_object ( Object * pObject)
staticnoexcept

Memory release proc for releasing the object only.


Call Burger::Free() on the Object pointer only. The data is assumed to be either static or allocated elsewhere

Parameters
pObjectPointer to the Object to delete
See also
ProcDataDelete, proc_null(Object*), proc_free_object_and_data(Object*), or proc_free_data(Object*)

◆ proc_free_object_and_data()

void BURGER_API Burger::LinkedListObjects::Object::proc_free_object_and_data ( Object * pObject)
staticnoexcept

Memory release proc for releasing the data and object.


Call Burger::Free() on both the Object and data pointers. This is the default behavior if no function was supplied

Parameters
pObjectPointer to the Object and data to delete
See also
ProcDataDelete, proc_null(Object*), proc_free_data(Object*) or proc_free_object(Object*)

◆ proc_null()

void BURGER_API Burger::LinkedListObjects::Object::proc_null ( Object * pObject)
staticnoexcept

Memory release proc for doing nothing.


For data that is allocated and released by other means, use this function to perform no action when an item is deleted from the linked list.

Parameters
pObjectPointer to the Object to delete (Not used)
See also
ProcDataDelete, proc_free_object_and_data(Object*), proc_free_data(Object*), or proc_free_object(Object*)

◆ set_data()

void Burger::LinkedListObjects::Object::set_data ( void * pInput)
inlinenoexcept

Set the data pointer that will be contained in the Object.


Sets the a new data pointer. It can be nullptr

Parameters
pInputThe new data pointer for the Object
See also
get_data(void) const

◆ set_data_delete_proc()

void Burger::LinkedListObjects::Object::set_data_delete_proc ( ProcDataDelete pProc)
inlinenoexcept

Set the disposal function pointer that will be contained in the Object.


Sets the a new disposal function pointer.

Parameters
pProcThe new disposal function pointer for the Object
See also
get_data_delete_proc(void) const

◆ shutdown()

void Burger::LinkedListObjects::Object::shutdown ( void )
privatenoexcept

Dispose of a single object.


Unlink this object from the parent linked list and then dispose of the contents.

Note
The behavior of the memory deallocation function is dependent on the active memory disposal function.
See also
ProcDataDelete, ~Object() or DoubleLinkedList::detach()

Friends And Related Symbol Documentation

◆ LinkedListObjects

friend class LinkedListObjects
friend

Member Data Documentation

◆ m_pData

void* Burger::LinkedListObjects::Object::m_pData
private

Pointer to the data.

◆ m_ProcDataDelete

ProcDataDelete Burger::LinkedListObjects::Object::m_ProcDataDelete
private

Data destructor callback.