#include <c4d_basecontainer.h>
A container is a collection of individual values. Each value has its own ID and type. Container can also carry any number of child containers.
90% of Cinema 4D's internal values are stored in containers and all messages are working with container, so this class is an essential part of the SDK.
Containers can store any GeData type, including custom data types. Use GetCustomDataType() to access these values in a safe manner.
It is recommended to use the available containers to store your own values as well. That way they will be automatically saved.
However, to store values in the top level of for example an object container, use a sub-container with a unique id from http://www.plugincafe.com. Inside this sub-container use whatever ids.
Private Attributes | |
void * | dummy1 |
Int | dummy2 |
Int32 | dummy3 |
Int32 | dummy4 |
Int32 | dummy5 |
Constructor/Destructor | |
BaseContainer () | |
BaseContainer (Int32 id) | |
BaseContainer (const BaseContainer &n) | |
~BaseContainer () | |
Assign/Clone/Copy | |
const BaseContainer & | operator= (const BaseContainer &n) |
BaseContainer * | GetClone (COPYFLAGS flags, AliasTrans *trans) const |
Bool | CopyTo (BaseContainer *dst, COPYFLAGS flags, AliasTrans *trans) const |
Flush All | |
void | FlushAll () |
Id | |
Int32 | GetId () const |
void | SetId (Int32 c_id) |
Dirty | |
UInt32 | GetDirty () const |
Remove Data/Index | |
Bool | RemoveData (Int32 id) |
Bool | RemoveIndex (Int32 i) |
Find Index / Get Index Id | |
Int32 | FindIndex (Int32 id, GeData **ppData=nullptr) const |
Int32 | GetIndexId (Int32 index) const |
Get Data Pointer(s) | |
const GeData * | GetDataPointer (Int32 id) const |
void | GetDataPointers (const Int32 *ids, Int32 cnt, const GeData **data) const |
Data | |
GeData * | GetIndexData (Int32 index) const |
GeData * | InsData (Int32 id, const GeData &n) |
GeData * | InsDataAfter (Int32 id, const GeData &n, GeData *last) |
GeData * | SetData (Int32 id, const GeData &n) |
const GeData & | GetData (Int32 id) const |
Equal/Not Equal Operators | |
Bool | operator== (const BaseContainer &d) const |
Bool | operator!= (const BaseContainer &d) const |
Get Type | |
Int32 | GetType (Int32 id) const |
Set Data | |
void | SetBool (Int32 id, Bool b) |
void | SetInt32 (Int32 id, Int32 l) |
void | SetUInt32 (Int32 id, UInt32 l) |
void | SetInt64 (Int32 id, Int64 l) |
void | SetUInt64 (Int32 id, UInt64 l) |
void | SetFloat (Int32 id, Float r) |
void | SetVoid (Int32 id, void *v) |
void | SetMemory (Int32 id, void *mem, Int count) |
void | SetVector (Int32 id, const Vector &v) |
void | SetMatrix (Int32 id, const Matrix &m) |
void | SetString (Int32 id, const maxon::String &s) |
void | SetUuid (Int32 id, const C4DUuid &u) |
void | SetFilename (Int32 id, const Filename &f) |
void | SetTime (Int32 id, const BaseTime &b) |
void | SetContainer (Int32 id, const BaseContainer &s) |
void | SetLink (Int32 id, C4DAtomGoal *link) |
Merge Container | |
void | MergeContainer (const BaseContainer &src) |
Get/Set Parameter | |
Bool | GetParameter (const DescID &id, GeData &t_data) const |
Bool | SetParameter (const DescID &id, const GeData &t_data) |
Sort | |
void | Sort () |
BaseContainer | ( | ) |
Default constructor. Creates an empty container with ID 0.
|
explicit |
Creates a container with a specific id.
[in] | id | The container ID. |
BaseContainer | ( | const BaseContainer & | n | ) |
Copy constructor. Creates a new container with all the IDs and values from the source one.
[in] | n | The source container. |
~BaseContainer | ( | ) |
Destructor.
const BaseContainer& operator= | ( | const BaseContainer & | n | ) |
Assignment operator. Copies all values from the source container.
[in] | n | The source container. |
BaseContainer* GetClone | ( | COPYFLAGS | flags, |
AliasTrans * | trans | ||
) | const |
Retrieves a copy of the container including all values.
[in] | flags | The flags for the clone: COPYFLAGS |
[in] | trans | An alias translator for the operation. Can be nullptr. The caller owns the pointed alias translator. |
Bool CopyTo | ( | BaseContainer * | dst, |
COPYFLAGS | flags, | ||
AliasTrans * | trans | ||
) | const |
Copies the container values into the destination container dst.
[out] | dst | The destination container. The caller owns the pointed container. |
[in] | flags | The flags for the clone: COPYFLAGS |
[in] | trans | An alias translator for the operation. Can be nullptr. The caller owns the pointed alias translator. |
void FlushAll | ( | ) |
Clears all values in the container. The container ID is not changed.
Int32 GetId | ( | ) | const |
Gets the ID of the container.
void SetId | ( | Int32 | c_id | ) |
Sets the ID of the container.
[in] | c_id | The container ID. |
UInt32 GetDirty | ( | ) | const |
Gets the dirty count. It is incremented when the container changes so it can be used to check if the container has changed.
Removes the first data item with the specified id.
[in] | id | The ID of the value to be removed. |
Removes the data item at the specified index i.
[in] | i | The index of the value to be removed. |
Gets the index for the value with the specified id. ppData is optionally assigned the data of the specified id.
[in] | id | The ID of the value. |
[out] | ppData | Assigned the data of the specified id, if not nullptr. |
Gets the ID of the element at the specified index.
Can be used to browse through the container:
[in] | index | The index of the value. |
Retrieves a pointer to directly access the data (Read-only).
[in] | id | The ID of the data. |
Retrieves an array of pointers to directly access the data (Read-only).
[out] | ids | Assigned a pointer to the array of data IDs. The container owns the pointed array. |
[in] | cnt | The number of array elements. |
[out] | data | Assigned a pointer to the data pointer array. The container owns the pointed array. |
Retrieves the data for the element at index.
[in] | index | The index of the element. |
Inserts an arbitrary data at the specified id.
[in] | id | The ID to insert at. |
[in] | n | The data to insert. |
Inserts an arbitrary data at the specified id after last.
[in] | id | The ID to insert at. |
[in] | n | The data to insert. |
[in] | last | The data to insert after. The container owns the pointed data. |
Sets an arbitrary data at the specified id. If a value exists under the same ID, its content will be changed.
[in] | id | The ID of the element to set. |
[in] | n | The data to set. |
Retrieves the data for an element at the specified id.
[in] | id | The ID of the element. |
Bool operator== | ( | const BaseContainer & | d | ) | const |
Equality operator. Checks if the containers have the same IDs, the same values and all values are equal.
[in] | d | The container to compare against. |
Bool operator!= | ( | const BaseContainer & | d | ) | const |
Not equal operator. Checks if the containers have different IDs, different values or values are different.
[in] | d | The container to compare against. |
Gets the Bool value at the specified id.
[in] | id | The ID of the requested value. |
[in] | preset | Returned if the value is not available. |
Gets the Int32 value at the specified id.
[in] | id | The ID of the requested value. |
[in] | preset | Returned if the value is not available. |
Gets the UInt32 value at the specified id.
[in] | id | The ID of the requested value. |
[in] | preset | Returned if the value is not available. |
Gets the Int64 value at the specified id.
[in] | id | The ID of the requested value. |
[in] | preset | Returned if the value is not available. |
Gets the UInt64 value at the specified id.
[in] | id | The ID of the requested value. |
[in] | preset | Returned if the value is not available. |
Gets the Float value at the specified id.
[in] | id | The ID of the requested value. |
[in] | preset | Returned if the value is not available. |
void* GetVoid | ( | Int32 | id, |
void * | preset = nullptr |
||
) | const |
Gets the void*
value at the specified id.
[in] | id | The ID of the requested value. |
[in] | preset | Returned if the value is not available. |
Gets the memory buffer at the specified id.
[in] | id | The ID of the requested value. |
[out] | count | Assigned the number of bytes in the memory buffer returned. |
[in] | preset | Returned if the value is not available. |
Gets the memory buffer at the specified id.
[in] | id | The ID of the requested value. |
[out] | count | Assigned the number of bytes in the memory buffer returned. |
[in] | preset | Returned if the value is not available. |
Gets the Vector value at the specified id.
[in] | id | The ID of the requested value. |
[in] | preset | Returned if the value is not available. |
Gets the Matrix value at the specified id.
[in] | id | The ID of the requested value. |
[in] | preset | Returned if the value is not available. |
String GetString | ( | Int32 | id, |
const maxon::String & | preset = maxon::String() |
||
) | const |
Gets the String value at the specified id.
[in] | id | The ID of the requested value. |
[in] | preset | Returned if the value is not available. |
Gets the C4DUuid value at the specified id.
[in] | id | The ID of the requested value. |
[in] | preset | Returned if the value is not available. |
Gets the Filename value at the specified id.
[in] | id | The ID of the requested value. |
[in] | preset | Returned if the value is not available. |
Gets the BaseTime value at the specified id.
[in] | id | The ID of the requested value. |
[in] | preset | Returned if the value is not available. |
BaseContainer GetContainer | ( | Int32 | id | ) | const |
Gets a copy of the sub-container at the specified id.
[in] | id | The ID of the requested sub-container. |
BaseContainer* GetContainerInstance | ( | Int32 | id | ) |
Gets a pointer to the sub-container at the specified id. Changes to the pointed container are reflected in the stored sub-container.
[in] | id | The ID of the requested sub-container ID. |
const BaseContainer* GetContainerInstance | ( | Int32 | id | ) | const |
Gets a read-only pointer to the sub-container with the specified id.
[in] | id | The ID of the requested sub-container ID. |
BaseList2D* GetLink | ( | Int32 | id, |
const BaseDocument * | doc, | ||
Int32 | instanceof = 0 |
||
) | const |
Gets a linked baselist node at the specified id. Equivalent to BaseLink::GetLink().
If instanceof is specified, nullptr is returned if the node is not of this type.
[in] | id | The ID of the requested value. |
[in] | doc | The document to evaluate the link in. The caller owns the pointed document. |
[in] | instanceof | Set this to a node type to only return the link if it is of this type. |
BaseObject* GetObjectLink | ( | Int32 | id, |
const BaseDocument * | doc | ||
) | const |
Gets a linked object at the specified id.
[in] | id | The ID of the requested object link. |
[in] | doc | The document to evaluate the object link in. The caller owns the pointed document. |
BaseMaterial* GetMaterialLink | ( | Int32 | id, |
const BaseDocument * | doc | ||
) | const |
Gets a linked material at the specified id.
[in] | id | The ID of the requested link. |
[in] | doc | The document to evaluate the link in. The caller owns the pointed document. |
Gets the BaseLink at the specified id.
[in] | id | The ID of the requested link. |
const CustomDataType* GetCustomDataType | ( | Int32 | id, |
Int32 | datatype | ||
) | const |
Gets the CustomDataType value at the specified id.
[in] | id | The ID of the requested custom datatype. |
[in] | datatype | The datatype type ID. |
Gets the type of the element at the specified id.
[in] | id | The ID of the element. |
Sets the Bool value at the specified id, or inserts it if it does not exist.
[in] | id | The ID of the value to set. |
[in] | b | The new or inserted value. |
Sets the Int32 value at the specified id, or inserts it if it does not exist.
[in] | id | The ID of the value to set. |
[in] | l | The new or inserted value. |
Sets the UInt32 value at the specified id, or inserts it if it does not exist.
[in] | id | The ID of the value to set. |
[in] | l | The new or inserted value. |
Sets the Int64 value at the specified id, or inserts it if it does not exist.
[in] | id | The ID of the value to set. |
[in] | l | The new or inserted value. |
Sets the UInt64 value at the specified id, or inserts it if it does not exist.
[in] | id | The ID of the value to set. |
[in] | l | The new or inserted value. |
Sets the Float value at the specified id, or inserts it if it does not exist.
[in] | id | The ID of the value to set. |
[in] | r | The new or inserted value. |
void SetVoid | ( | Int32 | id, |
void * | v | ||
) |
Sets the void*
value at the specified id, or inserts it if it does not exist.
[in] | id | The ID of the value to set. |
[in] | v | The new or inserted value. |
Sets the memory block at the specified id to mem, or inserts it if it did not exist.
[in] | id | The ID of the value to set. |
[in] | mem | The memory buffer. The container takes the ownership over the memory buffer. |
[in] | count | The number of bytes in mem. |
Sets the Vector value at the specified id, or inserts it if it does not exist.
[in] | id | The ID of the value to set. |
[in] | v | The new or inserted value. |
Sets the Matrix value at the specified id, or inserts it if it does not exist.
[in] | id | The ID of the value to set. |
[in] | m | The new or inserted value. |
void SetString | ( | Int32 | id, |
const maxon::String & | s | ||
) |
Sets the String value at the specified id, or inserts it if it does not exist.
[in] | id | The ID of the value to set. |
[in] | s | The new or inserted value. |
Sets the C4DUuid value at the specified id, or inserts it if it does not exist.
[in] | id | The ID of the value to set. |
[in] | u | The new or inserted value. |
Sets the Filename value at the specified id, or inserts it if it does not exist.
[in] | id | The ID of the value to set. |
[in] | f | The new or inserted value. |
Sets the BaseTime value at the specified id, or inserts it if it does not exist.
[in] | id | The ID of the value to set. |
[in] | b | The new or inserted value. |
void SetContainer | ( | Int32 | id, |
const BaseContainer & | s | ||
) |
Sets the sub-container value at the specified id, or inserts it if it does not exist.
[in] | id | The ID of the value to set. |
[in] | s | The new or inserted value. |
void SetLink | ( | Int32 | id, |
C4DAtomGoal * | link | ||
) |
Sets the link value at the specified id, or inserts it if it does not exist.
[in] | id | The ID of the value to set. |
[in] | link | The new or inserted value. |
void MergeContainer | ( | const BaseContainer & | src | ) |
Stores the values from src in the container, overwriting any elements with the same IDs and keeping the rest.
[in] | src | The source container to merge. |
Retrieves the GeData for the specified parameter description id.
[in] | id | The ID of the requested data. |
[out] | t_data | Assigned the retrieved data. |
Sets the GeData for the specified parameter description id.
[in] | id | The ID of the parameter to set. |
[in] | t_data | The data to set or insert. |
void Sort | ( | ) |
Sorts the container entries by ID except ID 1. Remove all value except string and subcontainer.
|
private |
|
private |
|
private |
|
private |
|
private |