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

< More...

#include <param.h>

Inheritance diagram for ito::ParamBase:
ito::Param

Classes

struct  Data
 < struct used as shared memory of ParamBase shared data container More...
 

Public Types

enum  Flag {
  NoAutosave = 0x010000 , Readonly = 0x020000 , In = 0x040000 , Out = 0x080000 ,
  NotAvailable = 0x100000
}
 < Flag section, new for itom > 4.1. Before it was part of the Type enumeration.
 
enum  Type {
  Pointer = 0x0001 , Char = 0x0002 , Int = 0x0004 , Double = 0x0008 ,
  Complex = 0x0400 , DObjPtr = 0x0010 | Pointer , String = 0x0020 | Pointer , HWRef = 0x0040 | Pointer ,
  CharArray = Char | Pointer , IntArray = Int | Pointer , DoubleArray = Double | Pointer , ComplexArray = Complex | Pointer ,
  PointCloudPtr = 0x0080 | Pointer , PointPtr = 0x0100 | Pointer , PolygonMeshPtr = 0x0200 | Pointer , StringList = 0x0800 | Pointer
}
 

Public Member Functions

 ParamBase ()
 default constructor, creates "empty" ParamBase
 
 ParamBase (const ByteArray &name)
 
 ParamBase (const ByteArray &name, const uint32 typeAndFlags)
 
 ParamBase (const ByteArray &name, const uint32 typeAndFlags, const char *val)
 
 ParamBase (const ByteArray &name, const uint32 typeAndFlags, const float64 val)
 
 ParamBase (const ByteArray &name, const uint32 typeAndFlags, const int32 val)
 
 ParamBase (const ByteArray &name, const uint32 typeAndFlags, const complex128 val)
 
 ParamBase (const ByteArray &name, const uint32 typeAndFlags, const uint32 size, const char *values)
 
 ParamBase (const ByteArray &name, const uint32 typeAndFlags, const uint32 size, const int32 *values)
 
 ParamBase (const ByteArray &name, const uint32 typeAndFlags, const uint32 size, const float64 *values)
 
 ParamBase (const ByteArray &name, const uint32 typeAndFlags, const uint32 size, const complex128 *values)
 
 ParamBase (const ByteArray &name, const uint32 typeAndFlags, const uint32 size, const ByteArray *values)
 Destructor.
 
virtual ~ParamBase ()
 copy constructor
 
 ParamBase (const ParamBase &other)
 copy constructor for rvalues
 
 ParamBase (ParamBase &&other) noexcept
 
const ParamBase operator[] (const int index) const
 < braces operator for element-wise access in arrays
 
ParamBaseoperator= (const ParamBase &rhs)
 rvalue assignment operator
 
ParamBaseoperator= (ParamBase &&other) noexcept
 just copies the value from the right-hand-side tParam (rhs) to this tParam.
 
ito::RetVal copyValueFrom (const ito::ParamBase *rhs)
 
bool operator== (const ParamBase &rhs) const
 
bool operator!= (const ParamBase &rhs) const
 
bool isNumeric (void) const
 returns true if Param is of type char, int, double or complex
 
bool isNumericArray (void) const
 returns true if Param is of type char array, int array, double array or complex array
 
bool isValid (void) const
 
uint16 getType () const
 returns parameter type
 
uint32 getFlags () const
 returns parameter flags
 
void setFlags (const uint32 flags)
 sets parameter flags for possible flags see tParamType
 
const char * getName (void) const
 returns parameter name (returned string is no copy, do not delete it)
 
ito::ByteArray getNameWithIndexSuffix (int index) const
 
bool getAutosave () const
 
void setAutosave (const bool autosave)
 
int getLen () const
 returns length of array parameters.
 
template<typename _Tp >
ito::RetVal setVal (_Tp val)
 
template<typename _Tp >
ito::RetVal setVal (_Tp val, int len)
 
template<typename _Tp >
_Tp getVal () const
 
template<typename _Tp >
_Tp getVal (int &len) const
 

Private Member Functions

void clearData (Data *data)
 
void detach (bool allocNewArray=true)
 
void decRefAndFree (Data *x)
 increments the reference counter of data
 
void incRef (Data *x)
 depending on the type, set the default value for the autosave flag.
 
void setDefaultAutosaveFlag ()
 < depending on the type, set the default value for the autosave flag.
 
void checkAndCorrectInOutFlag ()
 < Verifies and possibly corrects the proper set of the direction flags depending on the type.
 

Private Attributes

Datad
 

Friends

template<typename _Tp >
struct ItomParamHelper
 

Detailed Description

<

Member Enumeration Documentation

◆ Type

Enumerator
Pointer 

character (int8) parameter

Char 

integer (int32) parameter

Int 

double (float64) parameter

Double 

complex (complex128) parameter

Complex 

dataObject parameter (pointer, no auto-save possible)

DObjPtr 

string parameter

String 

reference to another plugin instance (pointer, no auto-save possible)

HWRef 

array of characters

CharArray 

array of integers

IntArray 

array of doubles

DoubleArray 

array of complex numbers

ComplexArray 

point cloud parameter (pointer, no auto-safe possible)

PointCloudPtr 

point parameter (pointer, no auto-safe possible)

PointPtr 

polygon mesh parameter (pointer, no auto-safe possible)

PolygonMeshPtr 

list of strings, given as ito::ByteArray

Constructor & Destructor Documentation

◆ ParamBase() [1/8]

ito::ParamBase::ParamBase ( const ByteArray & name)

constructor with name only

Parameters
[in]namename of new ParamBase
Returns
new ParamBase name "name"

creates a new ParamBase with name "name", string is copied

◆ ParamBase() [2/8]

ito::ParamBase::ParamBase ( const ByteArray & name,
const uint32 typeAndFlags )

constructor with name and type

Parameters
[in]namename of new ParamBase
[in]typetype of new ParamBase for possible types see Type
Returns
new Param with name and type

creates a new Param with name and type, string is copied

◆ ParamBase() [3/8]

ito::ParamBase::ParamBase ( const ByteArray & name,
const uint32 typeAndFlags,
const char * val )

constructor with name and type, char val and optional info

Parameters
[in]namename of new ParamBase
[in]typetype of new ParamBase for possible types see Type
[in]valcharacter pointer to string pointer
[in]infocharacter pointer to string pointer holding information about this ParamBase
Returns
new ParamBase with name, type, string value

creates a new ParamBase with name, type, string value. Strings are copied

◆ ParamBase() [4/8]

ito::ParamBase::ParamBase ( const ByteArray & name,
const uint32 typeAndFlags,
const float64 val )

constructor with name and type, float64 val

Parameters
[in]namename of new ParamBase
[in]typetype of new ParamBase for possible types see Type
[in]valactual value
Returns
new ParamBase with name, type and val

creates a new ParamBase with name, type and val. Strings are copied.

◆ ParamBase() [5/8]

ito::ParamBase::ParamBase ( const ByteArray & name,
const uint32 typeAndFlags,
const int32 val )

constructor with name and type and int val

Parameters
[in]namename of new ParamBase
[in]typetype of new ParamBase for possible types see Type
[in]valactual value
Returns
new ParamBase with name, type andval.

creates a new ParamBase with name, type and val

◆ ParamBase() [6/8]

ito::ParamBase::ParamBase ( const ByteArray & name,
const uint32 typeAndFlags,
const complex128 val )

constructor with name and type, complex128 val

Parameters
[in]namename of new ParamBase
[in]typetype of new ParamBase for possible types see Type
[in]valactual value
Returns
new ParamBase with name, type and val

creates a new ParamBase with name, type and val. Strings are copied.

◆ ParamBase() [7/8]

ito::ParamBase::ParamBase ( const ByteArray & name,
const uint32 typeAndFlags,
const uint32 size,
const ByteArray * values )

Destructor.

constructor with name and type, and a list of strings

Parameters
[in]namename of new ParamBase
[in]typetype of new ParamBase for possible types see Type
[in]valactual value
Returns
new ParamBase with name, type and val

creates a new ParamBase with name, type and val. Strings are copied.

◆ ~ParamBase()

ito::ParamBase::~ParamBase ( )
virtual

copy constructor

destructor

clear (frees) the name and in case a string value.

◆ ParamBase() [8/8]

ito::ParamBase::ParamBase ( const ParamBase & other)

copy constructor for rvalues

copy constructor

Parameters
[in]copyConstrParamBase to copy from
Returns
new ParamBase with copied values

creates ParamBase according to passed Param, strings are copied

Member Function Documentation

◆ clearData()

void ito::ParamBase::clearData ( Data * data)
private

if data is currently shared with another object, detach this data d from the shared ones by making a copy. If this data is not shared, this method is a noop.

◆ detach()

void ito::ParamBase::detach ( bool allocNewArray = true)
private

decrements the reference counter of data. If it drops below zero the allocated memory is cleared.

◆ getAutosave()

bool ito::ParamBase::getAutosave ( void ) const

returns content of autosave flag - this flag determines whether the parameter value gets automagically saved to xml file when an instance of a plugin class is deleted (closed)

◆ getNameWithIndexSuffix()

ito::ByteArray ito::ParamBase::getNameWithIndexSuffix ( int index) const

return the name, where an integer index is appended with bracket squares, e.g. myArray becomes myArray[2].

◆ getVal() [1/2]

template<typename _Tp >
_Tp ito::ParamBase::getVal ( ) const
inline

getVal read parameter value - templated version

Returns
parameter value (numeric, casted)

returns the actual parameter value casted to the template parameter type. If the tParam has a non numeric type the largest value for the template type is passed.

◆ getVal() [2/2]

template<typename _Tp >
_Tp ito::ParamBase::getVal ( int & len) const
inline

getVal read parameter value - templated version for arrays

Parameters
[out]lenlength of array

returns the actual parameter value casted to the template parameter type. In 'len' is returned what is supposed to be the length of the array. As only array references are used within tParam the actual size may differ.

◆ isValid()

bool ito::ParamBase::isValid ( void ) const

returns whether Param contains a valid type (true) or is an empty parameter (false, type == 0). The default tParam-constructor is always an invalid tParam.

◆ operator=()

ParamBase & ito::ParamBase::operator= ( const ParamBase & rhs)

rvalue assignment operator

assignment operator

Parameters
[in]rhsParamBase to copy from
Returns
new ParamBase with copied values

sets values of lhs to values of rhs ParamBase, strings are copied

◆ operator[]()

const ParamBase ito::ParamBase::operator[] ( const int index) const

< braces operator for element-wise access in arrays

assignment operator (sets values of lhs to values of rhs Param, strings are copied)

braces operator

Parameters
[in]numarray index for which the value should be returned
Returns
new tParam with values of ParamBase[num] in the array

returns the value of the index num from the array

◆ setAutosave()

void ito::ParamBase::setAutosave ( const bool autosave)

sets content of autosave flag - this flag determines whether the parameter value gets automagically saved to xml file when an instance of a plugin class is deleted (closed)

◆ setVal() [1/2]

template<typename _Tp >
ito::RetVal ito::ParamBase::setVal ( _Tp val)
inline

setVal set parameter value - templated version

Parameters
[in]valvalue to set to
Returns
RetVal with operation status sets the parameter value to the passed value, if the parameter type is inadequate it is set to the maximum value of template type

◆ setVal() [2/2]

template<typename _Tp >
ito::RetVal ito::ParamBase::setVal ( _Tp val,
int len )
inline

setVal set parameter value - templated version for arrays

Parameters
[in]valvalue to set to
[in]lenlength of array
Returns
RetVal with operation status sets the parameter value to the passed value, if the length is below 1 or a Null pointer is passed an error is returned

Member Data Documentation

◆ d

Data* ito::ParamBase::d
mutableprivate

clears and frees memory that has been allocated by data. Does not delete data itself. Usually this method is internally called by decRefAndFree.


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