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 Member Functions

 GeData (DEFAULTVALUETYPE)=delete
 

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 (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 (maxon::Data &&n)
 
template<typename DATATYPE , size_t = sizeof(DATATYPE::DATATYPEID)>
 GeData (const DATATYPE &data)
 
 GeData (const CustomDataType &data, Int32 type)
 
 GeData (Int32 type, DEFAULTVALUETYPE v)
 
void Free ()
 
 ~GeData ()
 

Operator

const GeData & operator= (const GeData &n)
 
const GeData & operator= (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
 
const void * GetVoid () const
 
void * GetVoid ()
 
const Vector & GetVector () const
 
const Matrix & GetMatrix () const
 
const String & GetString () const
 
const C4DUuid & GetUuid () const
 
const Filename & GetFilename () const
 
const BaseTime & GetTime () const
 
const BaseContainer * GetContainer () const
 
BaseContainer * GetContainerWritable ()
 
const BaseLink * GetBaseLink () const
 
const maxon::Data & GetData () const
 
template<typename DATATYPE >
const DATATYPE * GetCustomDataType () const
 
template<typename DATATYPE >
DATATYPE * GetCustomDataTypeWritable ()
 
const CustomDataType * GetCustomDataTypeI (Int32 datatype) const
 
CustomDataType * GetCustomDataTypeWritableI (Int32 datatype)
 
const BaseList2D * GetLink (const BaseDocument *doc, Int32 instanceof=0) const
 
BaseList2D * GetLink (BaseDocument *doc, Int32 instanceof=0) const
 
BaseList2D * GetLink (std::nullptr_t doc, Int32 instanceof=0) const
 
const C4DAtomGoal * GetLinkAtom (const BaseDocument *doc, Int32 instanceof=0) const
 
C4DAtomGoal * GetLinkAtom (BaseDocument *doc, Int32 instanceof=0) const
 
C4DAtomGoal * GetLinkAtom (std::nullptr_t 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 SetData (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 SetCustomDataTypeI (Int32 datatype, const CustomDataType &v)
 
template<typename DATATYPE , size_t = sizeof(DATATYPE::DATATYPEID)>
void SetCustomDataType (const DATATYPE &v)
 

Constructor & Destructor Documentation

◆ GeData() [1/25]

GeData ( DEFAULTVALUETYPE  )
privatedelete

◆ GeData() [2/25]

GeData ( )

Creates a DA_NIL data with no value.

◆ GeData() [3/25]

GeData ( double  n)

Creates a float data.

Parameters
[in]nThe initial value.

◆ GeData() [4/25]

GeData ( const GeData &  n)

Copy constructor.

Parameters
[in]nThe data to copy.

◆ GeData() [5/25]

GeData ( GeData &&  n)

◆ GeData() [6/25]

GeData ( Int32  n)

Creates an Int32 data.

Parameters
[in]nThe initial value.

◆ GeData() [7/25]

GeData ( Float32  n)

Creates a Float32 data.

Parameters
[in]nThe initial value.

◆ GeData() [8/25]

GeData ( void *  v,
VOIDVALUETYPE  xdummy 
)

Creates a void* data.

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

◆ GeData() [9/25]

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() [10/25]

GeData ( const Vector &  n)

Creates a Vector data.

Parameters
[in]nThe initial value.

◆ GeData() [11/25]

GeData ( const C4DUuid &  n)

Creates a C4DUuid data.

Parameters
[in]nThe initial value.

◆ GeData() [12/25]

GeData ( const Matrix &  n)

Creates a Matrix data.

Parameters
[in]nThe initial value.

◆ GeData() [13/25]

GeData ( const Char *  n)

Creates a String data from a character buffer.

Parameters
[in]nThe initial value.

◆ GeData() [14/25]

GeData ( const maxon::String &  n)

Creates a String data.

Parameters
[in]nThe initial value.

◆ GeData() [15/25]

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() [16/25]

GeData ( const Filename &  n)

Creates a Filename data.

Parameters
[in]nThe initial value.

◆ GeData() [17/25]

GeData ( const BaseTime &  n)

Creates a BaseTime data.

Parameters
[in]nThe initial value.

◆ GeData() [18/25]

GeData ( const BaseContainer &  n)

Creates a BaseContainer data.

Parameters
[in]nThe initial value.

◆ GeData() [19/25]

GeData ( const BaseLink *  n)

Creates a BaseLink data.

Parameters
[in]nThe initial value.

◆ GeData() [20/25]

GeData ( BaseList2D *  bl)

Creates a BaseList2D data.

Parameters
[in]blThe initial value.

◆ GeData() [21/25]

GeData ( const maxon::Data &  n)

Creates a maxon::Data data.

Parameters
[in]nThe initial value.

◆ GeData() [22/25]

GeData ( maxon::Data &&  n)

◆ GeData() [23/25]

GeData ( const DATATYPE &  data)
explicit

Creates a data with a custom data type.

Parameters
[in]dataThe custom data.

◆ GeData() [24/25]

GeData ( const CustomDataType &  data,
Int32  type 
)

◆ GeData() [25/25]

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:

GeData()
Creates a DA_NIL data with no value.
Definition: c4d_gedata.h:104
#define DATETIME_DATA
DateTime custom data ID.
Definition: customgui_datetime.h:22
@ DEFAULTVALUE
Dummy value for the default value GeData constructor.
Definition: c4d_gedata.h:64
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=() [1/2]

const GeData& operator= ( const GeData &  n)

Assignment operator.

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

◆ operator=() [2/2]

const GeData& operator= ( GeData &&  n)

◆ 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() [1/2]

const 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.

◆ GetVoid() [2/2]

void* GetVoid ( )

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()

const 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.

◆ GetContainerWritable()

BaseContainer* GetContainerWritable ( )

◆ GetBaseLink()

const 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()

const DATATYPE* GetCustomDataType ( ) const

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

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.

◆ GetCustomDataTypeWritable()

DATATYPE* GetCustomDataTypeWritable ( )

◆ GetCustomDataTypeI()

const CustomDataType* GetCustomDataTypeI ( 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.

◆ GetCustomDataTypeWritableI()

CustomDataType* GetCustomDataTypeWritableI ( Int32  datatype)

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() [1/3]

const 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.

◆ GetLink() [2/3]

BaseList2D* GetLink ( 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.

◆ GetLink() [3/3]

BaseList2D* GetLink ( std::nullptr_t  doc,
Int32  instanceof = 0 
) const

◆ GetLinkAtom() [1/3]

const 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.

◆ GetLinkAtom() [2/3]

C4DAtomGoal* GetLinkAtom ( 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.

◆ GetLinkAtom() [3/3]

C4DAtomGoal* GetLinkAtom ( std::nullptr_t  doc,
Int32  instanceof = 0 
) const

◆ 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() [1/2]

void SetData ( const maxon::Data &  v)

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

Parameters
[in]vThe new value.

◆ SetData() [2/2]

void SetData ( maxon::Data &&  v)

◆ 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.

◆ SetCustomDataTypeI()

void SetCustomDataTypeI ( 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.

◆ SetCustomDataType()

void SetCustomDataType ( const DATATYPE &  v)

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

Parameters
[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 { ... }