BaseLink Class Reference

#include <c4d_baselist.h>

Detailed Description

A dynamic link to a BaseList2D object.
These links can easily be stored in containers and saved to disk, and are even preserved when duplicating hierarchies.

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

 BaseLink ()
 
 ~BaseLink ()
 

Alloc/Free

static BaseLinkAlloc ()
 
static void Free (BaseLink *&link)
 

Get Link

BaseList2DGetLink (const BaseDocument *doc, Int32 instanceof=0) const
 
C4DAtomGoalGetLinkAtom (const BaseDocument *doc, Int32 instanceof=0) const
 
BaseList2DForceGetLink () const
 
C4DAtomGoalForceGetLinkAtom () const
 

Set Link

void SetLink (C4DAtomGoal *list)
 

Read/Write

Bool Read (HyperFile *hf)
 
Bool Write (HyperFile *hf) const
 

Copy

BaseLinkGetClone (COPYFLAGS flags, AliasTrans *trn) const
 
Bool CopyTo (BaseLink *dst, COPYFLAGS flags, AliasTrans *trn) const
 

Miscellaneous

Bool IsCacheLink () const
 
void SetUpPointer (C4DAtom *t_up_pointer)
 

Constructor & Destructor Documentation

◆ BaseLink()

BaseLink ( )
private

◆ ~BaseLink()

~BaseLink ( )
private

Member Function Documentation

◆ Alloc()

static BaseLink* Alloc ( )
static

Allocates a base link. Destroy the allocated base link with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.

Returns
The allocated base link, or nullptr if the allocation failed.

◆ Free()

static void Free ( BaseLink *&  link)
static

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

Parameters
[in,out]linkThe base link to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆ GetLink()

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

Evaluates the link in the specified document.
If instanceof is specified, nullptr is returned if the object is not of this type.

Parameters
[in]docThe document to evaluate the link in. The caller owns the pointed document.
[in]instanceofSet this to a node type ID to only return the link if it is of this type.
Returns
The linked object, or nullptr if the link is broken or of the wrong type. The document owns the pointed object.

◆ GetLinkAtom()

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

Evaluates the atom link in the specified document.
If instanceof is specified, nullptr is returned if the atom object is not of this type.

Parameters
[in]docThe document to evaluate the link in. The caller owns the pointed document.
[in]instanceofSet this to a type ID to only return the link if it is of this type.
Returns
The linked atom object, or nullptr if the link is broken or of the wrong type. The document owns the pointed atom object.

◆ ForceGetLink()

BaseList2D* ForceGetLink ( ) const

Retrieves the stored link independent of a document.
Can return nullptr if there is no object linked. For example:

  • Object A is inserted into document B.
  • SetLink(A) is called.
  • GetLink(B) is called : returns A.
  • Object A is removed from document B.
  • GetLink(B) is called : returns nullptr.
  • ForceGetLink() is called : returns A.
  • Object A is deleted.
  • ForceGetLink() is called : returns nullptr.
    Returns
    The linked object, or nullptr if the link is broken. The document owns the pointed object.

◆ ForceGetLinkAtom()

C4DAtomGoal* ForceGetLinkAtom ( ) const

Retrieves the stored atom link independent of a document.
Can return nullptr if there is no object linked. For example:

  • Object A is inserted into document B.
  • SetLink(A) is called.
  • GetLink(B) is called : returns A.
  • Object A is removed from document B.
  • GetLink(B) is called : returns nullptr.
  • ForceGetLink() is called : returns A.
  • Object A is deleted.
  • ForceGetLink() is called : returns nullptr.
    Returns
    The linked atom object, or nullptr if the link is broken. The document owns the pointed atom object.

◆ SetLink()

void SetLink ( C4DAtomGoal list)

Sets the link to point to list.

Parameters
[in]listThe new atom goal. The caller owns the pointed atom goal.

◆ Read()

Bool Read ( HyperFile hf)

Reads the link from a hyper file.

Parameters
[in]hfThe hyper file to read from. The caller owns the pointed hyper file.
Returns
true if the link was read, otherwise false.

◆ Write()

Bool Write ( HyperFile hf) const

Writes the link to a hyper file.

Parameters
[in]hfThe hyper file to write to. The caller owns the pointed hyper file.
Returns
true if the link was written, otherwise false.

◆ GetClone()

BaseLink* GetClone ( COPYFLAGS  flags,
AliasTrans trn 
) const

Gets a copy of the link.

Parameters
[in]flagsFlags for the clone: COPYFLAGS
[in]trnAn alias translator for the operation. Can be nullptr. The caller owns the pointed alias translator.
Returns
The cloned link. The caller owns the pointed link.

◆ CopyTo()

Bool CopyTo ( BaseLink dst,
COPYFLAGS  flags,
AliasTrans trn 
) const

Copies the link to dst.

Parameters
[in]dstThe destination link. The caller owns the pointed link.
[in]flagsFlags for the copy: COPYFLAGS
[in]trnAn alias translator for the operation. Can be nullptr. The caller owns the pointed alias translator.
Returns
true if the link was copied, otherwise false.

◆ IsCacheLink()

Bool IsCacheLink ( ) const

Checks if the link points to an object within the cache of another object.

Returns
true if this link points to an object's cache, otherwise false.

◆ SetUpPointer()

void SetUpPointer ( C4DAtom t_up_pointer)

@markPrivate