itom
Loading...
Searching...
No Matches
ito::FctCallParamContainer Class Reference

each instance of this class contains the parameters (including return parameter) for any function call, which is parsed by the Qt-signal-slot system. This class is especially used for wrapping function calls between C++ and any python method. The convention for the main member variables corresponds to the usual Qt-way to wrap such function calls. More...

#include <pythonItomMetaObject.h>

Public Member Functions

 FctCallParamContainer (int nrOfParams)
 constructor
 
 ~FctCallParamContainer ()
 destructor
 
void ** args ()
 
int * argTypes ()
 
int getRetType () const
 
void initRetArg (int type)
 initializes the return value
 
void setParamArg (unsigned int index, void *ptr, int type)
 stores a pair of variable-type and corresponding void-pointer as parameter with given index number
 

Private Member Functions

 FctCallParamContainer (const FctCallParamContainer &)=delete
 copy constructor is not accessible
 

Private Attributes

int m_nrOfParams
 
int m_sizeArgs
 
void ** m_args
 
int * m_argTypes
 

Detailed Description

each instance of this class contains the parameters (including return parameter) for any function call, which is parsed by the Qt-signal-slot system. This class is especially used for wrapping function calls between C++ and any python method. The convention for the main member variables corresponds to the usual Qt-way to wrap such function calls.

Each parameter is stored in this container using the construct and destroy method of QMetaType. The result of deeply copying a variable by QMetaType::construct is a void* containing the deep-copy and the corresponding type-id (integer). Both are then saved in a void* and int-array in the corresponding order. The first value of these arrays is always reserved for the return value. If the return value is of type void, the type-id of the first element is equal to zero.

Constructor & Destructor Documentation

◆ FctCallParamContainer()

ito::FctCallParamContainer::FctCallParamContainer ( int nrOfParams)
inline

constructor

initializes the FctCallParamContainer with a given number of arguments. Each argument is not allocated, hence each value in m_argTypes is set to -1 and each value in m_args is set to NULL.

Parameters
nrOfParamsis the number of arguments (without return value) for the corresponding method / function

◆ ~FctCallParamContainer()

ito::FctCallParamContainer::~FctCallParamContainer ( )
inline

destructor

Each value in m_args is destroyed using QMetaType::destroy, since this FctCallParamContainer always holds a deep copy of each parameter.

Member Function Documentation

◆ argTypes()

int * ito::FctCallParamContainer::argTypes ( )
inline

returns m_args

◆ getRetType()

int ito::FctCallParamContainer::getRetType ( ) const
inline

returns m_argTypes

◆ initRetArg()

void ito::FctCallParamContainer::initRetArg ( int type)
inline

initializes the return value

returns type of return value

At first, an existing return value is deleted and then the new return value given by type is created. The value is always the default type of this argument.

Parameters
typeis the desired type-id of the default value which is assumed as return type

◆ setParamArg()

void ito::FctCallParamContainer::setParamArg ( unsigned int index,
void * ptr,
int type )
inline

stores a pair of variable-type and corresponding void-pointer as parameter with given index number

At first any existing parameter at the given index position is deleted. Then the new value is saved. Consider, that no further deep copy of the new variable is created, hence, the reference to the void-pointer is stolen and will be deleted by this FctCallParamContainer. You can create an appropriate pair of void-pointer and type-id using QMetaType::construct.

Parameters
indexis the parameter index (zero-based)
ptris the void-pointer with the internal data of the parameter
typeis the corresponding type-id with respect to QMetaType

Member Data Documentation

◆ m_args

void** ito::FctCallParamContainer::m_args
private

void*-array containing the data of each parameter, NULL if the parameter is not available / filled (yet)

◆ m_argTypes

int* ito::FctCallParamContainer::m_argTypes
private

int-array with the corresponding type-id's for each parameter in m_args

◆ m_nrOfParams

int ito::FctCallParamContainer::m_nrOfParams
private

number of arguments (hence m_sizeArgs - 1)

◆ m_sizeArgs

int ito::FctCallParamContainer::m_sizeArgs
private

number of arguments + 1 (for return value), hence length of m_args and m_argTypes


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