vrmlproc & togeom
 
Loading...
Searching...
No Matches
vrml_proc::action::ConversionContextActionMap< ConversionContext > Class Template Reference

Represents class which is responsible for storing and mapping Action functor value to a string key. More...

#include <ConversionContextActionMap.hpp>

Public Types

using Argument = vrml_proc::traversor::handler::HandlerToActionBundle<ConversionContext>
 Argument represented by a HandlerToActionBundle object.
 
using ActionFunctor = std::function<std::shared_ptr<ConversionContextAction<ConversionContext>>(Argument)>
 The basic data type stored in the ActionMap. It is a function pointer which takes a arguments (represented by VRML node data) and returns a shared pointer of ConversionContextAction.
 

Public Member Functions

void AddAction (const std::string &key, ActionFunctor action)
 Adds new action to the ActionMap mapped to a string key. Duplicated key will be rewritten.
 
bool VerifyKey (const std::string &key) const
 Verifies if the given key exists in the ActionMap.
 
std::shared_ptr< ConversionContextAction< ConversionContext > > GetAction (const std::string &key, Argument arg) const
 Gets a shared pointer owning a ConversionContextAction object. The function creates new object using functor stored in the ActionMap and passed arg which is passed in to the Action constructor.
 

Detailed Description

template<vrml_proc::core::contract::ConversionContextable ConversionContext>
class vrml_proc::action::ConversionContextActionMap< ConversionContext >

Represents class which is responsible for storing and mapping Action functor value to a string key.

Member Function Documentation

◆ AddAction()

void vrml_proc::action::ConversionContextActionMap< ConversionContext >::AddAction ( const std::string & key,
ActionFunctor action )
inline

Adds new action to the ActionMap mapped to a string key. Duplicated key will be rewritten.

Parameters
keykey which will be mapped to the Action
actionActionFunctor representing the given Action

◆ GetAction()

std::shared_ptr< ConversionContextAction< ConversionContext > > vrml_proc::action::ConversionContextActionMap< ConversionContext >::GetAction ( const std::string & key,
Argument arg ) const
inline

Gets a shared pointer owning a ConversionContextAction object. The function creates new object using functor stored in the ActionMap and passed arg which is passed in to the Action constructor.

Parameters
keykey identifying the given Action
argargument passed into the function responsible for creating the given Action
Returns
nullptr if the key does not exists, otherwise shared pointer owning the given ConversionContextAction object

◆ VerifyKey()

bool vrml_proc::action::ConversionContextActionMap< ConversionContext >::VerifyKey ( const std::string & key) const
inline

Verifies if the given key exists in the ActionMap.

Parameters
keykey identifying the given Action
Returns
true if the key is present, false if the key is not present.

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