FieldCallerStack Class Reference

#include <c4d_fielddata.h>

Detailed Description

A list of all of the "callers" i.e. objects that invoked the sampling function. Additionally contains an identifier one way hash created to generate a unique ID based on the objects invoking the sampling, you can append additional addresses/objects using the operator + and += functions in order to continue the chain and ensure that the caller ID remains unique within the FieldInfo for each call chain.

Public Member Functions

 FieldCallerStack ()=default
 
 FieldCallerStack (UInt value)
 
 FieldCallerStack (FieldCallerStack &&src)
 
 ~FieldCallerStack ()=default
 
 MAXON_OPERATOR_MOVE_ASSIGNMENT (FieldCallerStack)
 
maxon::Result< void > CopyFrom (const FieldCallerStack &src)
 
const BaseList2Doperator[] (Int index) const
 
 operator const UInt & () const
 
UInt RecalcValue () const
 
void UpdateValue ()
 
void UpdateValue (const BaseList2D *caller)
 
maxon::Result< void > Add (const BaseList2D *caller)
 
Int GetCount () const
 
UInt GetValue () const
 
Bool IsValid () const
 
void Add (UInt levelValue)
 
maxon::Result< void > AddOrAddCacheParentObject (BaseObject *caller)
 

Static Public Member Functions

static FieldCallerStack Create ()
 
static maxon::Result< FieldCallerStackCreate (const BaseList2D *caller)
 
static maxon::Result< FieldCallerStackCreate (const std::initializer_list< const BaseList2D * > &callers)
 
static FieldCallerStack Add (const FieldCallerStack &src, const BaseList2D *newCaller)
 

Public Attributes

UInt _value
 
maxon::BaseArray< const BaseList2D * > _callers
 

Private Member Functions

 MAXON_DISALLOW_COPY_AND_ASSIGN (FieldCallerStack)
 

Constructor & Destructor Documentation

◆ FieldCallerStack() [1/3]

FieldCallerStack ( )
default

◆ FieldCallerStack() [2/3]

FieldCallerStack ( UInt  value)
explicit

◆ FieldCallerStack() [3/3]

◆ ~FieldCallerStack()

~FieldCallerStack ( )
default

Member Function Documentation

◆ MAXON_DISALLOW_COPY_AND_ASSIGN()

MAXON_DISALLOW_COPY_AND_ASSIGN ( FieldCallerStack  )
private

◆ MAXON_OPERATOR_MOVE_ASSIGNMENT()

MAXON_OPERATOR_MOVE_ASSIGNMENT ( FieldCallerStack  )

◆ Create() [1/3]

static FieldCallerStack Create ( )
static

Creates an empty FieldCallerStack. Cannot fail. Same as using default constructor.

Returns
A maxon::Result<FieldCallerStack>.

◆ Create() [2/3]

static maxon::Result<FieldCallerStack> Create ( const BaseList2D caller)
static

Creates a FieldCallerStack while relaying potential allocation errors. On error, the result will contain a default FieldCallerStack structure.

Parameters
[in]callerThe first caller for the stack.
Returns
A maxon::Result<FieldCallerStack>.

◆ Create() [3/3]

static maxon::Result<FieldCallerStack> Create ( const std::initializer_list< const BaseList2D * > &  callers)
static

Creates a FieldCallerStack while relaying potential allocation errors. On error, the result will contain a default FieldCallerStack structure.

Parameters
[in]callersAn initializer list to build the stack, first item is base of stack.
Returns
A maxon::Result<FieldCallerStack>.

◆ CopyFrom()

maxon::Result<void> CopyFrom ( const FieldCallerStack src)

Copies from the supplied FieldCallerStack.

Parameters
[in]srcThe source.
Returns
A maxon::Result.

◆ operator[]()

const BaseList2D* operator[] ( Int  index) const

Returns an element of the stack.

Parameters
[in]indexThe caller index.
Returns
The element.

◆ operator const UInt &()

operator const UInt & ( ) const

Cast to UInt, return the value of the stack.

Returns
The stack value.

◆ RecalcValue()

UInt RecalcValue ( ) const

Calculates the id of the caller stack from scratch. Does not update stored id value.

Returns
The new id.

◆ UpdateValue() [1/2]

void UpdateValue ( )

Recalculates the id of the caller stack from scratch. Will update the internal stack id value.

◆ UpdateValue() [2/2]

void UpdateValue ( const BaseList2D caller)

Calculates a new stack id from the current id and the added caller. Can be used to calculate a stack id without carrying the actual BaseList2d stack.

Parameters
[in]callerThe new caller, assuming already added to stack.

◆ Add() [1/3]

maxon::Result<void> Add ( const BaseList2D caller)

Adds a caller to the caller stack and updates the stack id.

Parameters
[in]callerThe caller object to add to the stack.
Returns
OK on success.

◆ Add() [2/3]

static FieldCallerStack Add ( const FieldCallerStack src,
const BaseList2D newCaller 
)
static

Adds a caller to the caller stack and returns a modified stack. This function hides the memory management iferr statement by returning an empty FieldCallerStack if an error occurs. It can be used within a field sampling call directly. But it is recommended to use the non static version and avoid any field sampling call if a prior memory error occurred.

Parameters
[in]srcThe original stack.
[in]newCallerThe caller object to add to the stack.
Returns
A new stack passed by move constructor. Stack will be empty if internal error occurred.

◆ GetCount()

Int GetCount ( ) const

Returns the number of callers involved in this chain.

Returns
The number of callers.

◆ GetValue()

UInt GetValue ( ) const

Returns the caller stack id.

Returns
The id.

◆ IsValid()

Bool IsValid ( ) const

Check for valid stack content. Empty stack is valid. Stack with null pointers is not valid. Non empty stack with no stack id value is not valid.

Returns
True if valid.

◆ Add() [3/3]

void Add ( UInt  levelValue)

Adds a non caller value to the stack ID.

Parameters
[in]levelValueThe value to add to the stack ID..

◆ AddOrAddCacheParentObject()

maxon::Result<void> AddOrAddCacheParentObject ( BaseObject caller)

Adds a the object or it's cache parent parent to the stack if the object has a cache along with all object uniqueIP's to maintain a better path to the object.

Parameters
[in]callerThe caller object or caller cache source to add to the stack ID.
Returns
OK on success.

Member Data Documentation

◆ _value

UInt _value

Caller stack id.

◆ _callers

maxon::BaseArray<const BaseList2D*> _callers

Detailed stack for id _value.