AtomArray Class Reference

#include <c4d_baselist.h>

Detailed Description

An array of C4DAtom objects.

Note
Has to be created with Alloc() and destroyed with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.

Private Member Functions

 AtomArray ()
 
 ~AtomArray ()
 

Alloc/Free

static AtomArrayAlloc ()
 
static void Free (AtomArray *&obj)
 

Miscellaneous

Int32 GetCount () const
 
Int32 GetCount (Int32 type, Int32 instance) const
 
C4DAtomGetIndex (Int32 idx) const
 
Bool Append (C4DAtom *obj)
 
void Flush ()
 
Bool Remove (C4DAtom *obj)
 
C4DAtomGetPreferred () const
 
void SetPreferred (C4DAtom *t_preferred)
 
void FilterObject (Int32 type, Int32 instance, Bool generators=false)
 
void FilterObjectChildren ()
 
Bool Append (AtomArray *src)
 
Int32 Find (C4DAtom *obj)
 
Bool Compare (AtomArray *cmp)
 

Copy

Bool CopyTo (AtomArray *dest) const
 
Bool CopyToFilter (AtomArray *dest, Int32 type, Int32 instance, Int32 generators=1) const
 

User ID and Data

Int32 GetUserID () const
 
void SetUserID (Int32 t_userid)
 
void * GetUserData () const
 
void SetUserData (void *t_userdata)
 

Constructor & Destructor Documentation

AtomArray ( )
private
~AtomArray ( )
private

Member Function Documentation

static AtomArray* Alloc ( void  )
static

Allocates an atom array. Destroy the allocated atom array with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.

Returns
The allocated atom array, or nullptr if the allocation failed.
static void Free ( AtomArray *&  obj)
static

Destructs atom arrays allocated with Alloc(). Use AutoAlloc to automate the allocation and destruction based on scope.

Parameters
[in,out]objThe atom array to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.
Int32 GetCount ( void  ) const

Gets the number of atoms in the array.

Returns
The atom count.
Int32 GetCount ( Int32  type,
Int32  instance 
) const

Checks how many elements in the array match type and/or instance.

Parameters
[in]typeChecked against C4DAtom::GetType(). Pass NOTOK to ignore this test.
[in]instanceChecked against C4DAtom::IsInstanceOf(). Pass NOTOK to ignore this test.
Returns
The number of matches.
C4DAtom* GetIndex ( Int32  idx) const

Gets the atom at the position idx in the array.

Parameters
[in]idxThe index. Must be between 0 and GetCount().
Returns
The idx-th atom in the array. The atom array owns the pointed object.
Bool Append ( C4DAtom obj)

Appends obj to the array.

Parameters
[in]objThe atom to append to the array. Only the pointer is stored; the actual ownership remains with the caller.
Returns
true if the atom was appended, otherwise false.
void Flush ( void  )

Clears the atom array.

Bool Remove ( C4DAtom obj)

Removes obj from the array.

Parameters
[in]objThe atom to remove from the array. Only the pointer is removed; the object is not freed.
Returns
true if successful, otherwise false.
Bool CopyTo ( AtomArray dest) const

Copies all atoms in *this to *dest.

Parameters
[out]destThe destination array. The caller owns the pointed object.
Returns
true if the atom array was copied, otherwise false.
Bool CopyToFilter ( AtomArray dest,
Int32  type,
Int32  instance,
Int32  generators = 1 
) const

Copies all atoms in *this to *dest filtered by type and/or instance.

Parameters
[out]destThe destination array. The caller owns the pointed object.
[in]typeChecked against C4DAtom::GetType(). Pass NOTOK to ignore this test.
[in]instanceChecked against C4DAtom::IsInstanceOf(). Pass NOTOK to ignore this test.
[in]generatorsUsed to filter generators.
Returns
true if the atom array was copied, otherwise false.
Int32 GetUserID ( void  ) const

Gets the user ID of the array.

Returns
This array's user ID.
void SetUserID ( Int32  t_userid)

Sets the user ID of the array to t_userid.

Parameters
[in]t_useridThe new user ID.
void* GetUserData ( ) const

Gets the user data pointer stored with the array.

Returns
The user data pointer. Not managed by the atom array.
void SetUserData ( void *  t_userdata)

Store a user data pointer with the array.

Parameters
[in]t_userdataThe new user data pointer. Not manager by the atom array.
C4DAtom* GetPreferred ( ) const

The preferred object is the one to use for operations that require a single object.
For example, if the user drags many objects to a link field this is used.

Note
This is not always set. In that case for example use the first object.
Returns
The preferred object to use for single object actions. The array owns the pointed object..
void SetPreferred ( C4DAtom t_preferred)

Sets the preferred object.

See Also
GetPreferred()
Parameters
[in]t_preferredThe new preferred object. Must already be in the array.
void FilterObject ( Int32  type,
Int32  instance,
Bool  generators = false 
)

Removes objects that do not match the filter given by type and instance.

Parameters
[in]typeChecked against C4DAtom::GetType(). Pass NOTOK to ignore this test.
[in]instanceChecked against C4DAtom::IsInstanceOf(). Pass NOTOK to ignore this test.
[in]generatorsUsed to filter generators.
void FilterObjectChildren ( )

Removes all objects that has a parent (or ancestor) in the array.

Bool Append ( AtomArray src)

Appends all objects in src to the array.

Parameters
[in]srcThe source array to append. The caller owns the pointed object.
Returns
true if successful, otherwise false.
Int32 Find ( C4DAtom obj)

Finds the index of obj in the array.

Parameters
[in]objThe atom to search for.
Returns
The index, or NOTOK if not found.
Bool Compare ( AtomArray cmp)

Compares the array with cmp.

Parameters
[in]cmpThe atom array to compare with. The caller owns the pointed object.
Returns
true if both arrays are identical, otherwise false.