ug4
ug::bridge::ParameterStack Class Reference

A stack that can hold values together with their type-id. More...

#include <parameter_stack.h>

+ Inheritance diagram for ug::bridge::ParameterStack:

Classes

struct  PushType
 
struct  PushType< bool >
 
struct  PushType< const char * >
 
struct  PushType< const std::string & >
 
struct  PushType< const std::vector< bool > & >
 
struct  PushType< const std::vector< const char * > & >
 
struct  PushType< const std::vector< const T * > & >
 
struct  PushType< const std::vector< ConstSmartPtr< T > > & >
 
struct  PushType< const std::vector< double > & >
 
struct  PushType< const std::vector< float > & >
 
struct  PushType< const std::vector< int > & >
 
struct  PushType< const std::vector< size_t > & >
 
struct  PushType< const std::vector< SmartPtr< T > > & >
 
struct  PushType< const std::vector< std::string > & >
 
struct  PushType< const std::vector< T * > & >
 
struct  PushType< const T & >
 
struct  PushType< const T * >
 
struct  PushType< ConstSmartPtr< T > >
 
struct  PushType< double >
 
struct  PushType< float >
 
struct  PushType< int >
 
struct  PushType< size_t >
 
struct  PushType< SmartPtr< T > >
 
struct  PushType< std::string >
 
struct  PushType< std::vector< bool > >
 
struct  PushType< std::vector< const char * > >
 
struct  PushType< std::vector< const T * > >
 
struct  PushType< std::vector< ConstSmartPtr< T > > >
 
struct  PushType< std::vector< double > >
 
struct  PushType< std::vector< float > >
 
struct  PushType< std::vector< int > >
 
struct  PushType< std::vector< size_t > >
 
struct  PushType< std::vector< SmartPtr< T > > >
 
struct  PushType< std::vector< std::string > >
 
struct  PushType< std::vector< T * > >
 
struct  PushType< T & >
 
struct  PushType< T * >
 
struct  ToType
 
struct  ToType< bool >
 
struct  ToType< const char * >
 
struct  ToType< const std::string & >
 
struct  ToType< const std::vector< bool > & >
 
struct  ToType< const std::vector< const char * > & >
 
struct  ToType< const std::vector< const T * > & >
 
struct  ToType< const std::vector< ConstSmartPtr< T > > & >
 
struct  ToType< const std::vector< double > & >
 
struct  ToType< const std::vector< float > & >
 
struct  ToType< const std::vector< int > & >
 
struct  ToType< const std::vector< size_t > & >
 
struct  ToType< const std::vector< SmartPtr< T > > & >
 
struct  ToType< const std::vector< std::string > & >
 
struct  ToType< const std::vector< T * > & >
 
struct  ToType< const T & >
 
struct  ToType< const T * >
 
struct  ToType< const void * >
 
struct  ToType< ConstSmartPtr< T > >
 
struct  ToType< ConstSmartPtr< void > >
 
struct  ToType< double >
 
struct  ToType< float >
 
struct  ToType< int >
 
struct  ToType< size_t >
 
struct  ToType< SmartPtr< std::vector< std::pair< const void *, const ClassNameNode * > > > >
 
struct  ToType< SmartPtr< std::vector< std::pair< ConstSmartPtr< void >, const ClassNameNode * > > > >
 
struct  ToType< SmartPtr< std::vector< std::pair< SmartPtr< void >, const ClassNameNode * > > > >
 
struct  ToType< SmartPtr< std::vector< std::pair< void *, const ClassNameNode * > > > >
 
struct  ToType< SmartPtr< T > >
 
struct  ToType< SmartPtr< void > >
 
struct  ToType< std::string >
 
struct  ToType< std::vector< bool > >
 
struct  ToType< std::vector< const char * > >
 
struct  ToType< std::vector< const T * > >
 
struct  ToType< std::vector< ConstSmartPtr< T > > >
 
struct  ToType< std::vector< double > >
 
struct  ToType< std::vector< float > >
 
struct  ToType< std::vector< int > >
 
struct  ToType< std::vector< size_t > >
 
struct  ToType< std::vector< SmartPtr< T > > >
 
struct  ToType< std::vector< std::string > >
 
struct  ToType< std::vector< T * > >
 
struct  ToType< T & >
 
struct  ToType< T * >
 
struct  ToType< void * >
 

Public Member Functions

const Variantget (int index) const
 return element in param stack as plain variant More...
 
template<typename T >
void push (T data)
 return element in param stack casted to type More...
 
template<typename T >
to (int index) const
 return element in param stack casted to type More...
 
void push (void *ptr, const ClassNameNode *classNameNode)
 
void push (const void *ptr, const ClassNameNode *classNameNode)
 
void push (SmartPtr< void > ptr, const ClassNameNode *classNameNode)
 
void push (ConstSmartPtr< void > ptr, const ClassNameNode *classNameNode)
 
void push (SmartPtr< std::vector< std::pair< void *, const ClassNameNode * > > > spVec)
 
void push (SmartPtr< std::vector< std::pair< const void *, const ClassNameNode * > > > spVec)
 
void push (SmartPtr< std::vector< std::pair< SmartPtr< void >, const ClassNameNode * > > > spVec)
 
void push (SmartPtr< std::vector< std::pair< ConstSmartPtr< void >, const ClassNameNode * > > > spVec)
 
void push (SmartPtr< std::vector< bool > > spVec)
 
void push (SmartPtr< std::vector< size_t > > spVec)
 
void push (SmartPtr< std::vector< int > > spVec)
 
void push (SmartPtr< std::vector< float > > spVec)
 
void push (SmartPtr< std::vector< double > > spVec)
 
void push (SmartPtr< std::vector< const char * > > spVec)
 
void push (SmartPtr< std::vector< std::string > > spVec)
 
- Public Member Functions inherited from ug::bridge::ParameterInfo
const char * class_name (int index) const
 returns the class name for an element in the param stack More...
 
const ClassNameNodeclass_name_node (int index) const
 returns the class name node for an element in the param stack More...
 
bool is_vector (int index) const
 returns if index is a std::vector More...
 
bool parameter_named (int index) const
 returns true if a parameter of the stack has been named by user More...
 
 ParameterInfo ()
 default constructor More...
 
template<typename T >
void push_type ()
 pushes a type to the parameter stack More...
 
int size () const
 returns number of parameters in the param stack More...
 
Variant::Type type (int index) const
 returns ParameterType enum of data type for a stack entry More...
 

Protected Member Functions

template<typename T >
void _push_native (const T &val)
 
template<typename TPtr , typename TType >
void _push_pointer (TPtr val)
 
template<typename TVoid , typename TPtr , typename TNode >
void _push_pointer_vector (const std::vector< TPtr > &vec)
 
template<class T >
void _push_vector (SmartPtr< std::vector< T > > spVec)
 
template<typename T >
void _push_void_pointer (T val, const ClassNameNode *classNameNode)
 
template<typename TVoid >
void _push_void_pointer_vector (SmartPtr< std::vector< std::pair< TVoid, const ClassNameNode * > > > spVec, const ClassNameNode *baseNameNode=NULL)
 
template<typename T >
_to_native (int index) const
 return element in param stack casted to native type More...
 
template<typename T >
std::vector< T > & _to_native_vector (int index) const
 return element in param stack casted to native type vector More...
 
template<typename T , typename TPtr , typename TVoid >
TPtr _to_pointer (int index) const
 returns element in param stack casted to pointer type More...
 
template<typename T , typename TPtr , typename TVoid >
std::vector< TPtr > & _to_pointer_vector (int index) const
 return element in param stack casted to native type vector More...
 
template<typename TPtr >
SmartPtr< std::vector< std::pair< TPtr, const ClassNameNode * > > > _to_void_pointer_vector (int index) const
 return element in param stack casted to native type vector More...
 
- Protected Member Functions inherited from ug::bridge::ParameterInfo
template<typename TType , typename TNode >
void _push_type ()
 
template<typename TNative >
void _push_type ()
 
template<typename TType , typename TNode >
void _push_vector_type ()
 
template<typename TNative >
void _push_vector_type ()
 

Protected Attributes

std::vector< SmartPtr< void > > m_vStoredSmartPtr
 
- Protected Attributes inherited from ug::bridge::ParameterInfo
int m_numEntries
 number of currently stored entries More...
 
EntryType m_vEntryType [PARAMETER_STACK_MAX_SIZE]
 

Private Attributes

Variant m_vEntry [PARAMETER_STACK_MAX_SIZE]
 fixed size array storing the data for a stack entry More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from ug::bridge::ParameterInfo
static int ARRAY_INDEX_TO_STACK_INDEX (int index, int stackSize)
 help function to compute correct parameter index More...
 
- Static Protected Attributes inherited from ug::bridge::ParameterInfo
static const int PARAMETER_STACK_MAX_SIZE = UG_REGISTRY_MAX_NUM_ARGS
 maximal number of parameter in a parameter list More...
 

Detailed Description

A stack that can hold values together with their type-id.

This class is mainly used as an intermediate parameter storage during calls to ugbridge methods. Its focus is on being lightweight and fast.

Use push() to add new parameters to the stack. Use to() to retrieve a value. Use set() to set a value in an existing entry.

Indices start with 0. Negative indices can be used to start indexing from the top of the stack.

Member Function Documentation

◆ _push_native()

◆ _push_pointer()

◆ _push_pointer_vector()

template<typename TVoid , typename TPtr , typename TNode >
void ug::bridge::ParameterStack::_push_pointer_vector ( const std::vector< TPtr > &  vec)
inlineprotected

◆ _push_vector()

template<class T >
void ug::bridge::ParameterStack::_push_vector ( SmartPtr< std::vector< T > >  spVec)
inlineprotected

pushes an std::vector to the stack, holding native type entries.

Parameters
spVeca smart-ptr to the std::vector

References ug::bridge::ParameterInfo::m_numEntries, and m_vEntry.

◆ _push_void_pointer()

template<typename T >
void ug::bridge::ParameterStack::_push_void_pointer ( val,
const ClassNameNode classNameNode 
)
inlineprotected

pushes a native type to a ptr/smartptr. In order to keep track of the concrete type of the object, the classNameNode is stored as well

Parameters
valthe value to push
classNameNodethe values classNameNode
Template Parameters
void-ptr-type(one of void*, const void*, SmartPtr<void>, ConstSmartPtr<void>)

References ug::bridge::ParameterInfo::EntryType::bVector, ug::bridge::ParameterInfo::m_numEntries, m_vEntry, ug::bridge::ParameterInfo::m_vEntryType, ug::bridge::ParameterInfo::EntryType::pClassNameNode, and ug::bridge::ParameterInfo::EntryType::type.

◆ _push_void_pointer_vector()

template<typename TVoid >
void ug::bridge::ParameterStack::_push_void_pointer_vector ( SmartPtr< std::vector< std::pair< TVoid, const ClassNameNode * > > >  spVec,
const ClassNameNode baseNameNode = NULL 
)
inlineprotected

pushes an std::vector to the stack, holding ptr/smartptr to user-defined (registered) type. Ptrs are casted to void, and in order to get the concrete type (for casting back), the ClassNameNode is stored.

Parameters
spVeca smart-ptr to the std::vector
Template Parameters
void-ptr-type(one of void*, const void*, SmartPtr<void>, ConstSmartPtr<void>)

References ug::bridge::ParameterInfo::EntryType::bVector, ug::bridge::ParameterInfo::m_numEntries, m_vEntry, ug::bridge::ParameterInfo::m_vEntryType, ug::bridge::ParameterInfo::EntryType::pClassNameNode, and ug::bridge::ParameterInfo::EntryType::type.

Referenced by _push_pointer_vector().

◆ _to_native()

◆ _to_native_vector()

◆ _to_pointer()

template<typename T , typename TPtr , typename TVoid >
TPtr ug::bridge::ParameterStack::_to_pointer ( int  index) const
inlineprotected

returns element in param stack casted to pointer type

returns the element at index in the stack casted to a pointer type

Parameters
indexthe stack index
Returns
the casted pointer
Template Parameters
TPtrconcrete pointer type
TVoidptr-type (one of void*, const void*, SmartPtr<void>, ConstSmartPtr<void>)

References ug::bridge::ParameterInfo::ARRAY_INDEX_TO_STACK_INDEX(), ug::bridge::ParameterInfo::m_numEntries, m_vEntry, ug::bridge::ParameterInfo::m_vEntryType, and ug::bridge::ParameterInfo::EntryType::pClassNameNode.

Referenced by ug::bridge::ParameterStack::ToType< T * >::to(), ug::bridge::ParameterStack::ToType< const T * >::to(), ug::bridge::ParameterStack::ToType< SmartPtr< T > >::to(), and ug::bridge::ParameterStack::ToType< ConstSmartPtr< T > >::to().

◆ _to_pointer_vector()

◆ _to_void_pointer_vector()

◆ get()

const Variant& ug::bridge::ParameterStack::get ( int  index) const
inline

return element in param stack as plain variant

References m_vEntry.

◆ push() [1/16]

void ug::bridge::ParameterStack::push ( const void *  ptr,
const ClassNameNode classNameNode 
)
inline

push user defined classes casted to void

◆ push() [2/16]

void ug::bridge::ParameterStack::push ( ConstSmartPtr< void >  ptr,
const ClassNameNode classNameNode 
)
inline

push user defined classes casted to void

◆ push() [3/16]

void ug::bridge::ParameterStack::push ( SmartPtr< std::vector< bool > >  spVec)
inline

push native array type

◆ push() [4/16]

void ug::bridge::ParameterStack::push ( SmartPtr< std::vector< const char * > >  spVec)
inline

push native array type

◆ push() [5/16]

void ug::bridge::ParameterStack::push ( SmartPtr< std::vector< double > >  spVec)
inline

push native array type

◆ push() [6/16]

void ug::bridge::ParameterStack::push ( SmartPtr< std::vector< float > >  spVec)
inline

push native array type

◆ push() [7/16]

void ug::bridge::ParameterStack::push ( SmartPtr< std::vector< int > >  spVec)
inline

push native array type

◆ push() [8/16]

void ug::bridge::ParameterStack::push ( SmartPtr< std::vector< size_t > >  spVec)
inline

push native array type

◆ push() [9/16]

void ug::bridge::ParameterStack::push ( SmartPtr< std::vector< std::pair< const void *, const ClassNameNode * > > >  spVec)
inline

push array type

◆ push() [10/16]

void ug::bridge::ParameterStack::push ( SmartPtr< std::vector< std::pair< ConstSmartPtr< void >, const ClassNameNode * > > >  spVec)
inline

push array type

◆ push() [11/16]

void ug::bridge::ParameterStack::push ( SmartPtr< std::vector< std::pair< SmartPtr< void >, const ClassNameNode * > > >  spVec)
inline

push array type

◆ push() [12/16]

void ug::bridge::ParameterStack::push ( SmartPtr< std::vector< std::pair< void *, const ClassNameNode * > > >  spVec)
inline

push array type

◆ push() [13/16]

void ug::bridge::ParameterStack::push ( SmartPtr< std::vector< std::string > >  spVec)
inline

push native array type

◆ push() [14/16]

void ug::bridge::ParameterStack::push ( SmartPtr< void >  ptr,
const ClassNameNode classNameNode 
)
inline

push user defined classes casted to void

◆ push() [15/16]

template<typename T >
void ug::bridge::ParameterStack::push ( data)
inline

return element in param stack casted to type

References ug::bridge::ParameterStack::PushType< T >::push().

◆ push() [16/16]

void ug::bridge::ParameterStack::push ( void *  ptr,
const ClassNameNode classNameNode 
)
inline

◆ to()

template<typename T >
T ug::bridge::ParameterStack::to ( int  index) const
inline

Member Data Documentation

◆ m_vEntry

◆ m_vStoredSmartPtr

std::vector<SmartPtr<void> > ug::bridge::ParameterStack::m_vStoredSmartPtr
protected

Referenced by _to_pointer_vector().


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