Hedgehog  3.1.0
A library to generate hybrid pipeline workflow systems
Loading...
Searching...
No Matches
hh::AbstractState< Separator, AllTypes > Class Template Reference

Hedgehog AbstractState. More...

#include "abstract_state.h"

Inheritance diagram for hh::AbstractState< Separator, AllTypes >:
Inheritance graph
Collaboration diagram for hh::AbstractState< Separator, AllTypes >:
Collaboration graph

Public Member Functions

 AbstractState ()
 Default state constructor.
 
 ~AbstractState () override=default
 Default state destructor.
 
std::shared_ptr< ManagedMemorygetManagedMemory ()
 Accessor to the managed memory if a memory manager has been attached to a StateManager.
 
void lock ()
 Lock the state.
 
void unlock ()
 Unlock the state.
 
- Public Member Functions inherited from hh::behavior::Cleanable
 Cleanable ()=default
 Default constructor.
 
 ~Cleanable ()=default
 Default destructor.
 
virtual void clean ()
 Clean a node.
 

Private Member Functions

void stateManager (StateManager< Separator, AllTypes... > *stateManager)
 AbstractState manager setter.
 

Private Attributes

std::unique_ptr< std::shared_mutex > mutex_ = nullptr
 Mutex to protect the state.
 
StateManager< Separator, AllTypes... > * stateManager_ = nullptr
 AbstractState manager currently using the state.
 

Detailed Description

template<size_t Separator, class ... AllTypes>
class hh::AbstractState< Separator, AllTypes >

Hedgehog AbstractState.

The state holds the data structures that are used to manage the flow of data and organize rendez-vous points or other synchronization mechanisms. It is managed and used through a StateManager, and is thread safe.

Template Parameters
SeparatorSeparator position between input types and output types
AllTypesList of input and output types

Definition at line 41 of file abstract_state.h.

Constructor & Destructor Documentation

◆ AbstractState()

template<size_t Separator, class ... AllTypes>
hh::AbstractState< Separator, AllTypes >::AbstractState ( )
inline

Default state constructor.

Definition at line 54 of file abstract_state.h.

◆ ~AbstractState()

template<size_t Separator, class ... AllTypes>
hh::AbstractState< Separator, AllTypes >::~AbstractState ( )
overridedefault

Default state destructor.

Member Function Documentation

◆ getManagedMemory()

template<size_t Separator, class ... AllTypes>
std::shared_ptr< ManagedMemory > hh::AbstractState< Separator, AllTypes >::getManagedMemory ( )
inline

Accessor to the managed memory if a memory manager has been attached to a StateManager.

Returns
Return a managed memory from the memory manager attached to the state manager

Definition at line 60 of file abstract_state.h.

Here is the call graph for this function:

◆ lock()

template<size_t Separator, class ... AllTypes>
void hh::AbstractState< Separator, AllTypes >::lock ( )
inline

Lock the state.

Definition at line 63 of file abstract_state.h.

◆ stateManager()

template<size_t Separator, class ... AllTypes>
void hh::AbstractState< Separator, AllTypes >::stateManager ( StateManager< Separator, AllTypes... > *  stateManager)
inlineprivate

AbstractState manager setter.

Setter used by Hedgehog to indicate which state manager is currently using a specific state.

Parameters
stateManagerAbstractState manager managing the state

Definition at line 72 of file abstract_state.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ unlock()

template<size_t Separator, class ... AllTypes>
void hh::AbstractState< Separator, AllTypes >::unlock ( )
inline

Unlock the state.

Definition at line 66 of file abstract_state.h.

Member Data Documentation

◆ mutex_

template<size_t Separator, class ... AllTypes>
std::unique_ptr<std::shared_mutex> hh::AbstractState< Separator, AllTypes >::mutex_ = nullptr
mutableprivate

Mutex to protect the state.

Definition at line 50 of file abstract_state.h.

◆ stateManager_

template<size_t Separator, class ... AllTypes>
StateManager<Separator, AllTypes...>* hh::AbstractState< Separator, AllTypes >::stateManager_ = nullptr
private

AbstractState manager currently using the state.

Definition at line 51 of file abstract_state.h.