ug4
|
A stack that can hold values together with their type-id. More...
#include <parameter_stack.h>
Public Member Functions | |
const Variant & | get (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 > | |
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 ClassNameNode * | class_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 > | |
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... | |
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.
|
inlineprotected |
pushes a native type or a ptr/smartptr to a registered type to the stack. The value is stored in a Variant (thus, ptr are stored as void*, const void*, SmartPtr<void>, ConstSmartPtr<void>)
val | the parameter to push |
References ug::bridge::ParameterInfo::m_numEntries, and m_vEntry.
Referenced by ug::bridge::ParameterStack::PushType< bool >::push(), ug::bridge::ParameterStack::PushType< const char * >::push(), ug::bridge::ParameterStack::PushType< const std::string & >::push(), ug::bridge::ParameterStack::PushType< double >::push(), ug::bridge::ParameterStack::PushType< float >::push(), ug::bridge::ParameterStack::PushType< int >::push(), ug::bridge::ParameterStack::PushType< size_t >::push(), and ug::bridge::ParameterStack::PushType< std::string >::push().
|
inlineprotected |
References ug::bridge::ParameterInfo::m_numEntries, and m_vEntry.
Referenced by ug::bridge::ParameterStack::PushType< const T * >::push(), ug::bridge::ParameterStack::PushType< ConstSmartPtr< T > >::push(), ug::bridge::ParameterStack::PushType< SmartPtr< T > >::push(), and ug::bridge::ParameterStack::PushType< T * >::push().
|
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.
spVec | a smart-ptr to the std::vector |
References _push_void_pointer_vector().
Referenced by ug::bridge::ParameterStack::PushType< std::vector< const T * > >::push(), ug::bridge::ParameterStack::PushType< const std::vector< const T * > & >::push(), ug::bridge::ParameterStack::PushType< std::vector< ConstSmartPtr< T > > >::push(), ug::bridge::ParameterStack::PushType< const std::vector< ConstSmartPtr< T > > & >::push(), ug::bridge::ParameterStack::PushType< std::vector< SmartPtr< T > > >::push(), ug::bridge::ParameterStack::PushType< const std::vector< SmartPtr< T > > & >::push(), ug::bridge::ParameterStack::PushType< std::vector< T * > >::push(), and ug::bridge::ParameterStack::PushType< const std::vector< T * > & >::push().
|
inlineprotected |
pushes an std::vector to the stack, holding native type entries.
spVec | a smart-ptr to the std::vector |
References ug::bridge::ParameterInfo::m_numEntries, and m_vEntry.
|
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
val | the value to push |
classNameNode | the values classNameNode |
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.
|
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.
spVec | a smart-ptr to the std::vector |
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().
|
inlineprotected |
return element in param stack casted to native type
References ug::bridge::ParameterInfo::ARRAY_INDEX_TO_STACK_INDEX(), ug::bridge::ParameterInfo::m_numEntries, m_vEntry, and ug::Variant::to().
Referenced by ug::bridge::ParameterStack::ToType< bool >::to(), ug::bridge::ParameterStack::ToType< int >::to(), ug::bridge::ParameterStack::ToType< size_t >::to(), ug::bridge::ParameterStack::ToType< float >::to(), ug::bridge::ParameterStack::ToType< double >::to(), ug::bridge::ParameterStack::ToType< const char * >::to(), ug::bridge::ParameterStack::ToType< std::string >::to(), ug::bridge::ParameterStack::ToType< const std::string & >::to(), ug::bridge::ParameterStack::ToType< void * >::to(), ug::bridge::ParameterStack::ToType< const void * >::to(), ug::bridge::ParameterStack::ToType< SmartPtr< void > >::to(), and ug::bridge::ParameterStack::ToType< ConstSmartPtr< void > >::to().
|
inlineprotected |
return element in param stack casted to native type vector
References ug::bridge::ParameterInfo::ARRAY_INDEX_TO_STACK_INDEX(), SmartPtr< void >::cast_reinterpret(), SmartPtr< T, FreePolicy >::invalid(), ug::bridge::ParameterInfo::m_numEntries, m_vEntry, ug::Variant::to(), and UG_THROW.
Referenced by ug::bridge::ParameterStack::ToType< std::vector< bool > >::to(), ug::bridge::ParameterStack::ToType< std::vector< int > >::to(), ug::bridge::ParameterStack::ToType< std::vector< size_t > >::to(), ug::bridge::ParameterStack::ToType< std::vector< float > >::to(), ug::bridge::ParameterStack::ToType< std::vector< double > >::to(), ug::bridge::ParameterStack::ToType< std::vector< const char * > >::to(), ug::bridge::ParameterStack::ToType< std::vector< std::string > >::to(), ug::bridge::ParameterStack::ToType< const std::vector< bool > & >::to(), ug::bridge::ParameterStack::ToType< const std::vector< int > & >::to(), ug::bridge::ParameterStack::ToType< const std::vector< size_t > & >::to(), ug::bridge::ParameterStack::ToType< const std::vector< float > & >::to(), ug::bridge::ParameterStack::ToType< const std::vector< double > & >::to(), ug::bridge::ParameterStack::ToType< const std::vector< const char * > & >::to(), and ug::bridge::ParameterStack::ToType< const std::vector< std::string > & >::to().
|
inlineprotected |
returns element in param stack casted to pointer type
returns the element at index in the stack casted to a pointer type
index | the stack index |
TPtr | concrete pointer type |
TVoid | ptr-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().
|
inlineprotected |
return element in param stack casted to native type vector
References ug::bridge::ParameterInfo::ARRAY_INDEX_TO_STACK_INDEX(), SmartPtr< void >::cast_reinterpret(), SmartPtr< T, FreePolicy >::invalid(), ug::bridge::ParameterInfo::m_numEntries, m_vEntry, m_vStoredSmartPtr, ug::Variant::to(), and UG_THROW.
Referenced by ug::bridge::ParameterStack::ToType< std::vector< T * > >::to(), ug::bridge::ParameterStack::ToType< const std::vector< T * > & >::to(), ug::bridge::ParameterStack::ToType< std::vector< const T * > >::to(), ug::bridge::ParameterStack::ToType< const std::vector< const T * > & >::to(), ug::bridge::ParameterStack::ToType< std::vector< SmartPtr< T > > >::to(), ug::bridge::ParameterStack::ToType< const std::vector< SmartPtr< T > > & >::to(), ug::bridge::ParameterStack::ToType< std::vector< ConstSmartPtr< T > > >::to(), and ug::bridge::ParameterStack::ToType< const std::vector< ConstSmartPtr< T > > & >::to().
|
inlineprotected |
return element in param stack casted to native type vector
References ug::bridge::ParameterInfo::ARRAY_INDEX_TO_STACK_INDEX(), SmartPtr< void >::cast_reinterpret(), SmartPtr< T, FreePolicy >::invalid(), ug::bridge::ParameterInfo::m_numEntries, m_vEntry, ug::Variant::to(), and UG_THROW.
Referenced by ug::bridge::ParameterStack::ToType< SmartPtr< std::vector< std::pair< void *, const ClassNameNode * > > > >::to(), ug::bridge::ParameterStack::ToType< SmartPtr< std::vector< std::pair< const void *, const ClassNameNode * > > > >::to(), ug::bridge::ParameterStack::ToType< SmartPtr< std::vector< std::pair< SmartPtr< void >, const ClassNameNode * > > > >::to(), and ug::bridge::ParameterStack::ToType< SmartPtr< std::vector< std::pair< ConstSmartPtr< void >, const ClassNameNode * > > > >::to().
|
inline |
return element in param stack as plain variant
References m_vEntry.
|
inline |
push user defined classes casted to void
|
inline |
push user defined classes casted to void
|
inline |
push native array type
|
inline |
push native array type
|
inline |
push native array type
|
inline |
push native array type
|
inline |
push native array type
|
inline |
push native array type
|
inline |
push array type
|
inline |
push array type
|
inline |
push array type
|
inline |
push array type
|
inline |
push native array type
|
inline |
push user defined classes casted to void
|
inline |
return element in param stack casted to type
References ug::bridge::ParameterStack::PushType< T >::push().
|
inline |
push user defined classes casted to void
Referenced by ug::bridge::MethodProxy< TClass, TMethod, TRet >::apply(), ug::bridge::FunctionProxy< TFunc, TRet >::apply(), ug::vrl::jobjectArray2ParamStack(), ug::bridge::lua::LuaToStringDefault(), ug::bridge::ParameterStack::PushType< std::vector< bool > >::push(), ug::bridge::ParameterStack::PushType< const std::vector< bool > & >::push(), ug::bridge::ParameterStack::PushType< std::vector< const char * > >::push(), ug::bridge::ParameterStack::PushType< const std::vector< const char * > & >::push(), ug::bridge::ParameterStack::PushType< std::vector< double > >::push(), ug::bridge::ParameterStack::PushType< const std::vector< double > & >::push(), ug::bridge::ParameterStack::PushType< std::vector< float > >::push(), ug::bridge::ParameterStack::PushType< const std::vector< float > & >::push(), ug::bridge::ParameterStack::PushType< std::vector< int > >::push(), ug::bridge::ParameterStack::PushType< const std::vector< int > & >::push(), ug::bridge::ParameterStack::PushType< std::vector< size_t > >::push(), ug::bridge::ParameterStack::PushType< const std::vector< size_t > & >::push(), ug::bridge::ParameterStack::PushType< std::vector< std::string > >::push(), ug::bridge::ParameterStack::PushType< const std::vector< std::string > & >::push(), ug::bridge::PushLuaStackEntryToParamStack(), ug::bridge::PushLuaStackPointerEntryToParamStack(), and ug::bridge::WriteLUAObject2().
|
inline |
return element in param stack casted to type
References ug::bridge::ParameterStack::ToType< T >::to().
Referenced by ug::vrl::param2JObject(), ug::bridge::ParamStackEntryToLuaStack(), and ug::bridge::ParamStackPointerEntryToLuaStack().
|
private |
fixed size array storing the data for a stack entry
Referenced by _push_native(), _push_pointer(), _push_vector(), _push_void_pointer(), _push_void_pointer_vector(), _to_native(), _to_native_vector(), _to_pointer(), _to_pointer_vector(), _to_void_pointer_vector(), and get().
|
protected |
Referenced by _to_pointer_vector().