GeData Class Reference

#include <c4d_gedata.h>

Detailed Description

The GeData class can hold values of many different types, including custom data types.
It is used by many parts of the API, and can be stored in BaseContainer objects.

Private Attributes

Int32 Type
 
Int32 dummy
 
union {
   Int32   DInteger
 
   Float   DReal
 
   void *   Ddata
 
   Int64   DLLong
 
}; 
 

Constructor/Destructor

 GeData ()
 
 GeData (double n)
 
 GeData (const GeData &n)
 
 GeData (Int32 n)
 
 GeData (Float32 n)
 
 GeData (void *v, VOIDVALUETYPE xdummy)
 
 GeData (Int64 v, LLONGVALUETYPE xdummy)
 
 GeData (const Vector &n)
 
 GeData (const C4DUuid &n)
 
 GeData (const Matrix &n)
 
 GeData (const Char *n)
 
 GeData (const maxon::String &n)
 
 GeData (void *mem, Int count)
 
 GeData (const Filename &n)
 
 GeData (const BaseTime &n)
 
 GeData (const BaseContainer &n)
 
 GeData (const BaseLink *n)
 
 GeData (BaseList2D *bl)
 
 GeData (const maxon::Data &n)
 
 GeData (Int32 type, const CustomDataType &data)
 
 GeData (Int32 type, DEFAULTVALUETYPE v)
 
void Free ()
 
 ~GeData ()
 

Operator

const GeDataoperator= (const GeData &n)
 
Bool operator== (const GeData &d) const
 
Bool operator!= (const GeData &d) const
 

Type

Bool SetDefault (Int32 type)
 
Int32 GetType () const
 

Get Data

Bool GetBool () const
 
Int32 GetInt32 () const
 
Int64 GetInt64 () const
 
Float GetFloat () const
 
void * GetVoid () const
 
const VectorGetVector () const
 
const MatrixGetMatrix () const
 
const StringGetString () const
 
const C4DUuidGetUuid () const
 
const FilenameGetFilename () const
 
const BaseTimeGetTime () const
 
BaseContainerGetContainer () const
 
BaseLinkGetBaseLink () const
 
const maxon::DataGetData () const
 
CustomDataTypeGetCustomDataType (Int32 datatype) const
 
BaseList2DGetLink (const BaseDocument *doc, Int32 instanceof=0) const
 
C4DAtomGoalGetLinkAtom (const BaseDocument *doc, Int32 instanceof=0) const
 
void * GetMemoryAndRelease (Int &count)
 
void * GetMemory (Int &count)
 

Set Data

void CopyData (GeData *dest, AliasTrans *aliastrans) const
 
void SetFloat (Float v)
 
void SetInt32 (Int32 v)
 
void SetInt64 (const Int64 &v)
 
void SetVoid (void *v)
 
void SetMemory (void *data, Int count)
 
void SetVector (const Vector &v)
 
void SetMatrix (const Matrix &v)
 
void SetString (const maxon::String &v)
 
void SetUuid (const C4DUuid &v)
 
void SetTristate ()
 
void SetData (const maxon::Data &v)
 
void SetFilename (const Filename &v)
 
void SetBaseTime (const BaseTime &v)
 
void SetContainer (const BaseContainer &v)
 
void SetBaseLink (const BaseLink &v)
 
void SetBaseList2D (BaseList2D *bl)
 
void SetCustomDataType (Int32 datatype, const CustomDataType &v)
 

Constructor & Destructor Documentation

◆ GeData() [1/21]

GeData ( )

Creates a DA_NIL data with no value.

◆ GeData() [2/21]

GeData ( double  n)

Creates a float data.

Parameters
[in]nThe initial value.

◆ GeData() [3/21]

GeData ( const GeData n)

Copy constructor.

Parameters
[in]nThe data to copy.

◆ GeData() [4/21]

GeData ( Int32  n)

Creates an Int32 data.

Parameters
[in]nThe initial value.

◆ GeData() [5/21]

GeData ( Float32  n)

Creates a Float32 data.

Parameters
[in]nThe initial value.

◆ GeData() [6/21]

GeData ( void *  v,
VOIDVALUETYPE  xdummy 
)

Creates a void* data.

Parameters
[in]vThe initial void* value.
[in]xdummyThe dummy parameter. Should always be VOIDVALUE.

◆ GeData() [7/21]

GeData ( Int64  v,
LLONGVALUETYPE  xdummy 
)

Creates a long long (64-bit integer) data.

Parameters
[in]vThe initial value.
[in]xdummyThe dummy parameter. Should always be LLONGVALUE.

◆ GeData() [8/21]

GeData ( const Vector n)

Creates a Vector data.

Parameters
[in]nThe initial value.

◆ GeData() [9/21]

GeData ( const C4DUuid n)

Creates a C4DUuid data.

Parameters
[in]nThe initial value.

◆ GeData() [10/21]

GeData ( const Matrix n)

Creates a Matrix data.

Parameters
[in]nThe initial value.

◆ GeData() [11/21]

GeData ( const Char n)

Creates a String data from a character buffer.

Parameters
[in]nThe initial value.

◆ GeData() [12/21]

GeData ( const maxon::String n)

Creates a String data.

Parameters
[in]nThe initial value.

◆ GeData() [13/21]

GeData ( void *  mem,
Int  count 
)

Creates a memory buffer data.

Parameters
[in]memThe initial memory buffer value.
[in]countThe number of bytes in the initial buffer.

◆ GeData() [14/21]

GeData ( const Filename n)

Creates a Filename data.

Parameters
[in]nThe initial value.

◆ GeData() [15/21]

GeData ( const BaseTime n)

Creates a BaseTime data.

Parameters
[in]nThe initial value.

◆ GeData() [16/21]

GeData ( const BaseContainer n)

Creates a BaseContainer data.

Parameters
[in]nThe initial value.

◆ GeData() [17/21]

GeData ( const BaseLink n)

Creates a BaseLink data.

Parameters
[in]nThe initial value.

◆ GeData() [18/21]

GeData ( BaseList2D bl)

Creates a BaseList2D data.

Parameters
[in]blThe initial value.

◆ GeData() [19/21]

GeData ( const maxon::Data n)

Creates a maxon::Data data.

Parameters
[in]nThe initial value.

◆ GeData() [20/21]

GeData ( Int32  type,
const CustomDataType data 
)

Creates a data with a custom data type.

Parameters
[in]typeThe custom data type ID.
[in]dataThe custom data.

◆ GeData() [21/21]

GeData ( Int32  type,
DEFAULTVALUETYPE  v 
)

Creates a custom data type with the default value for the type.
The second parameter is simply a typing trick so that the compiler chooses this constructor:

@ DEFAULTVALUE
Dummy value for the default value GeData constructor.
Definition: c4d_gedata.h:65
Definition: c4d_gedata.h:83
#define DATETIME_DATA
DateTime custom data ID.
Definition: customgui_datetime.h:23
Parameters
[in]typeThe custom data type ID.
[in]vThe dummy parameter. Should always be DEFAULTVALUE.

◆ ~GeData()

~GeData ( )

Destructor.

Member Function Documentation

◆ Free()

void Free ( )

Deletes the internal data and sets the type to DA_NIL.

◆ operator=()

const GeData& operator= ( const GeData n)

Assignment operator.

Parameters
[in]nThe data to assign.
Returns
The assigned data.

◆ operator==()

Bool operator== ( const GeData d) const

Equality operator.

Parameters
[in]dThe data to compare with.
Returns
true if the data are equal, otherwise false.

◆ operator!=()

Bool operator!= ( const GeData d) const

Inequality operator.

Parameters
[in]dThe data to compare with.
Returns
true if the data are different, otherwise false.

◆ SetDefault()

Bool SetDefault ( Int32  type)

Sets the default value for the data type.

Parameters
[in]typeThe type ID: DA
Returns
true if successful, otherwise false.

◆ GetType()

Int32 GetType ( ) const

Retrieves the type of the data.

Returns
The data type: DA

◆ GetBool()

Bool GetBool ( ) const

Retrieves the value of Bool data objects. Forbidden for other data.

Returns
The value. Only valid as long as the GeData value exists.

◆ GetInt32()

Int32 GetInt32 ( ) const

Retrieves the value of Int32 data objects. Forbidden for other data.

Returns
The value. Only valid as long as the GeData value exists.

◆ GetInt64()

Int64 GetInt64 ( ) const

Retrieves the value of Int64 data objects. Forbidden for other data.

Returns
The value. Only valid as long as the GeData value exists.

◆ GetFloat()

Float GetFloat ( ) const

Retrieves the value of Float data objects. Forbidden for other data.

Returns
The value. Only valid as long as the GeData value exists.

◆ GetVoid()

void* GetVoid ( ) const

Retrieves the value of void* data objects. Forbidden for other data.

Returns
The value. Only valid as long as the GeData value exists.

◆ GetVector()

const Vector& GetVector ( ) const

Retrieves the value of Vector data objects. Forbidden for other data.

Returns
The value. Only valid as long as the GeData value exists.

◆ GetMatrix()

const Matrix& GetMatrix ( ) const

Retrieves the value of Matrix data objects. Forbidden for other data.

Returns
The value. Only valid as long as the GeData value exists.

◆ GetString()

const String& GetString ( ) const

Retrieves the value of String data objects. Forbidden for other data.

Returns
The value. Only valid as long as the GeData value exists.

◆ GetUuid()

const C4DUuid& GetUuid ( ) const

Retrieves the value of C4DUuid data objects. Forbidden for other data.

Returns
The value. Only valid as long as the GeData value exists.

◆ GetFilename()

const Filename& GetFilename ( ) const

Retrieves the value of Filename data objects. Forbidden for other data.

Returns
The value. Only valid as long as the GeData value exists.

◆ GetTime()

const BaseTime& GetTime ( ) const

Retrieves the value of BaseTime data objects. Forbidden for other data.

Returns
The value. Only valid as long as the GeData value exists.

◆ GetContainer()

BaseContainer* GetContainer ( ) const

Retrieves the value of BaseContainer data objects. Forbidden for other data.

Returns
The value. Only valid as long as the GeData value exists.

◆ GetBaseLink()

BaseLink* GetBaseLink ( ) const

Retrieves the value of BaseLink data objects. Forbidden for other data.

Returns
The value. Only valid as long as the GeData value exists.

◆ GetData()

const maxon::Data& GetData ( ) const

Retrieves the value of maxon::Data data objects. Forbidden for other data.

Returns
The value. Only valid as long as the GeData value exists.

◆ GetCustomDataType()

CustomDataType* GetCustomDataType ( Int32  datatype) const

Retrieves the value of a CustomDataType, or nullptr if the wrong data type was specified. Forbidden for other data types.

Parameters
[in]datatypeThe data type ID.
Returns
The custom data type value, or nullptr if the types do not match. The data owns the pointed value.
Only valid as long as the GeData value exists.

◆ GetLink()

BaseList2D* GetLink ( const BaseDocument doc,
Int32  instanceof = 0 
) const

Evaluates the link of DA_ALIASLINK data objects. Equivalent to GetBaseLink()->GetLink().
If instanceof is specified, nullptr is returned if the object is not of this type. Forbidden for other data.

Parameters
[in]docThe document to evaluate the link in. The caller owns the pointed document.
[in]instanceofSet this to a node type to only return the link if it is of this type.
Returns
The evaluated link. Cinema 4D owns the pointed link.
Only valid as long as the GeData value exists.

◆ GetLinkAtom()

C4DAtomGoal* GetLinkAtom ( const BaseDocument doc,
Int32  instanceof = 0 
) const

Evaluates the atom link of DA_ALIASLINK data objects. Equivalent to GetBaseLink()->GetLinkAtom().
If instanceof is specified, nullptr is returned if the object is not of this type. Forbidden for other data.

Parameters
[in]docThe document to evaluate the atom link in. The caller owns the pointed document.
[in]instanceofSet this to a node type to only return the atom link if it is of this type.
Returns
The evaluated atom link. Cinema 4D owns the pointed atom link.
Only valid as long as the GeData value exists.

◆ GetMemoryAndRelease()

void* GetMemoryAndRelease ( Int count)

Retrieves the value of memory buffer data objects. Forbidden for other data.

Note
In this version of GetMemory() the caller takes over the ownership of the memory block.
The memory block must be allocated with NewMem() and deallocated with DeleteMem().
Parameters
[in]countAssigned the number of bytes in the returned memory buffer.
Returns
The memory buffer. The caller takes over the ownership of the memory block.
Only valid as long as the GeData value exists.

◆ GetMemory()

void* GetMemory ( Int count)

Retrieves the value of memory buffer data objects. Forbidden for other data.

Note
The memory block must be allocated with NewMem() and deallocated with DeleteMem().
Parameters
[in]countAssigned the number of bytes in the returned memory buffer.
Returns
The memory buffer. The data owns the pointed memory block.
Only valid as long as the GeData value exists.

◆ CopyData()

void CopyData ( GeData dest,
AliasTrans aliastrans 
) const

Copies the data to another with an alias translator for the links.

Parameters
[in]destThe destination data. The caller owns the pointed data.
[in]aliastransAn alias translator for the operation. Can be nullptr. The caller owns the pointed alias translator.

◆ SetFloat()

void SetFloat ( Float  v)

Sets the Float value and changes the data type accordingly.

Parameters
[in]vThe new value.

◆ SetInt32()

void SetInt32 ( Int32  v)

Sets the Int32 value and changes the data type accordingly.

Parameters
[in]vThe new value.

◆ SetInt64()

void SetInt64 ( const Int64 v)

Sets the Int64 value and changes the data type accordingly.

Parameters
[in]vThe new value.

◆ SetVoid()

void SetVoid ( void *  v)

Sets the void* value and changes the data type accordingly.

Parameters
[in]vThe new value.

◆ SetMemory()

void SetMemory ( void *  data,
Int  count 
)

Sets the memory buffer value and changes the data type accordingly.

Parameters
[in]dataThe new memory buffer value.
[in]countThe number of bytes in the memory buffer.

◆ SetVector()

void SetVector ( const Vector v)

Sets the Vector value and changes the data type accordingly.

Parameters
[in]vThe new value.

◆ SetMatrix()

void SetMatrix ( const Matrix v)

Sets the Matrix value and changes the data type accordingly.

Parameters
[in]vThe new value.

◆ SetString()

void SetString ( const maxon::String v)

Sets the String value and changes the data type accordingly.

Parameters
[in]vThe new value.

◆ SetUuid()

void SetUuid ( const C4DUuid v)

Sets the C4DUuid value and changes the data type accordingly.

Parameters
[in]vThe new value.

◆ SetTristate()

void SetTristate ( )

Sets data type accordingly (and clears the internal value)

◆ SetData()

void SetData ( const maxon::Data v)

Sets the maxon::Data value and changes the data type accordingly.

Parameters
[in]vThe new value.

◆ SetFilename()

void SetFilename ( const Filename v)

Sets the Filename value and changes the data type accordingly.

Parameters
[in]vThe new value.

◆ SetBaseTime()

void SetBaseTime ( const BaseTime v)

Sets the BaseTime value and changes the data type accordingly.

Parameters
[in]vThe new value.

◆ SetContainer()

void SetContainer ( const BaseContainer v)

Sets the BaseContainer value and changes the data type accordingly.

Parameters
[in]vThe new value.

◆ SetBaseLink()

void SetBaseLink ( const BaseLink v)

Sets the BaseLink value and changes the data type accordingly.

Parameters
[in]vThe new value.

◆ SetBaseList2D()

void SetBaseList2D ( BaseList2D bl)

Sets the BaseList2D value and changes the data type accordingly.

Parameters
[in]blThe new value.

◆ SetCustomDataType()

void SetCustomDataType ( Int32  datatype,
const CustomDataType v 
)

Sets the value for custom data type and changes the data type accordingly.

Parameters
[in]datatypeThe custom data type ID.
[in]vThe new custom data type value.

Member Data Documentation

◆ Type

Int32 Type
private

◆ dummy

Int32 dummy
private

◆ DInteger

Int32 DInteger

◆ DReal

Float DReal

◆ Ddata

void* Ddata

◆ DLLong

Int64 DLLong

◆ 

union { ... }