iv::Heap Class Reference

#include <Heap.hpp>

Public Member Functions

 Heap (Instance *inst=nullptr, ClientMarker *cm=nullptr)
 
 ~Heap ()
 
template<class T >
void destroy (T *)
 
void clear ()
 
template<class T , class ... CArgs>
T * create (CArgs const &...)
 
template<class T , class ... CArgs>
T * createInstance (std::string const &name, CArgs const &...)
 
template<class T , class ... CArgs>
T * createClient (CArgs const &...)
 
template<class T , class ... CArgs>
T * create (CArgs const &... cargs)
 
template<class T , class ... CArgs>
T * createInstance (std::string const &name, CArgs const &... cargs)
 
template<class T , class ... CArgs>
T * createClient (CArgs const &... cargs)
 

Detailed Description

All instances created by Heap will be deleted in Heap destructor.

Definition at line 13 of file Heap.hpp.

Constructor & Destructor Documentation

◆ Heap()

iv::Heap::Heap ( Instance inst = nullptr,
ClientMarker cm = nullptr 
)

inst Default instance that will be used as parent when creating new instances using Heap::createInst. If this is nullptr, then createInst should not be used. cm Client that will be parent of new clients created with Heap::createClient. This client should be client in Instance given as first parameter.

Definition at line 6 of file Heap.cpp.

◆ ~Heap()

iv::Heap::~Heap ( )

Definition at line 13 of file Heap.cpp.

Member Function Documentation

◆ destroy()

template<class T >
void iv::Heap::destroy ( T *  ptr)

Deletes any object created by this Heap, otherwise emmits warning. Works as operator delete, so for example polymorphic objects can be destroyed using typed pointer to its parent.

Definition at line 45 of file Heap.inl.

◆ clear()

void iv::Heap::clear ( )

Deletes everything in reverse order than in which it was created.

Definition at line 19 of file Heap.cpp.

◆ create() [1/2]

template<class T , class ... CArgs>
T* iv::Heap::create ( CArgs const &  ...)

Creates instance of T using operator new and constructor T::T( CArgs const & );

◆ createInstance() [1/2]

template<class T , class ... CArgs>
T* iv::Heap::createInstance ( std::string const &  name,
CArgs const &  ... 
)

Asserts that Instance passed to constructor is not nullptr. Creates child instance with given name and creates root client for it.

Type T must comply with Client concept: T::T( Instance *, Cargs ... ); Instance * T::instance() const; ClientMarker T::cm;

◆ createClient() [1/2]

template<class T , class ... CArgs>
T* iv::Heap::createClient ( CArgs const &  ...)

Asserts that both Instance and ClientMarker passed to constructor are not nullptr. Creates client in the Instance and adds it as child to given ClientMarker.

Type T must comply with Client concept: T::T( Instance *, Cargs ... ); Instance * T::instance() const; ClientMarker T::cm;

◆ create() [2/2]

template<class T , class ... CArgs>
T* iv::Heap::create ( CArgs const &...  cargs)

Definition at line 11 of file Heap.inl.

◆ createInstance() [2/2]

template<class T , class ... CArgs>
T* iv::Heap::createInstance ( std::string const &  name,
CArgs const &...  cargs 
)

Definition at line 31 of file Heap.inl.

◆ createClient() [2/2]

template<class T , class ... CArgs>
T* iv::Heap::createClient ( CArgs const &...  cargs)

Definition at line 37 of file Heap.inl.


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