ConversionSequence Class Reference

#include <corenodes_conversion.h>

Detailed Description

A ConversionSequence is a sequence of conversions (implemented by ConversionNode and registered by MAXON_CORENODE_REGISTER_CONVERSION) which are needed to convert from a source type to a destination type. It is created by CoreNodesLib::GetConversion().

Public Types

using PartiallyOrdered = std::true_type
 

Public Member Functions

Result< DataConvert (const ConstDataPtr &source) const
 
const CoreNode & operator[] (Int index) const
 
CoreNode & operator[] (Int index)
 
Int GetCount () const
 
Block< const CoreNode > ToBlock () const
 
 operator Block< const CoreNode > () const
 
CONVERSION_FLAGS GetFlags () const
 
Bool operator== (const ConversionSequence &other) const
 
Bool operator!= (const ConversionSequence &other) const
 
Bool operator> (const ConversionSequence &other) const
 
Bool operator>= (const ConversionSequence &other) const
 
Bool operator< (const ConversionSequence &other) const
 
Bool operator<= (const ConversionSequence &other) const
 
String ToString (const FormatStatement *fs=nullptr) const
 
 ~ConversionSequence ()
 

Private Member Functions

 ConversionSequence (CONVERSION_FLAGS flags, Int count)
 

Private Attributes

const CONVERSION_FLAGS _flags
 
const Int _count
 
const CoreNodeInterface_sequence []
 

Friends

class CoreNodesLibImpl
 

Member Typedef Documentation

◆ PartiallyOrdered

using PartiallyOrdered = std::true_type

Constructor & Destructor Documentation

◆ ~ConversionSequence()

◆ ConversionSequence()

ConversionSequence ( CONVERSION_FLAGS  flags,
Int  count 
)
private

Member Function Documentation

◆ Convert()

Result<Data> Convert ( const ConstDataPtr source) const

◆ operator[]() [1/2]

const CoreNode& operator[] ( Int  index) const

Returns the conversion node at index. The conversion sequence applies conversion nodes in ascending order.

Parameters
[in]indexIndex within this sequence.
Returns
Conversion node at index.

◆ operator[]() [2/2]

CoreNode& operator[] ( Int  index)

◆ GetCount()

Int GetCount ( void  ) const

Returns the number of conversions of this sequence.

Returns
Number of conversions.

◆ ToBlock()

Block<const CoreNode> ToBlock ( ) const

Returns this conversion sequence as a block. The conversion sequence applies conversion nodes in ascending order.

Returns
Conversion sequence as a block.

◆ operator Block< const CoreNode >()

operator Block< const CoreNode > ( ) const

Returns this conversion sequence as a block. The conversion sequence applies conversion nodes in ascending order.

Returns
Conversion sequence as a block.

◆ GetFlags()

CONVERSION_FLAGS GetFlags ( void  ) const

Returns the conversion flags of this sequence. They are the combination of the flags of the individual conversion nodes.

Returns
Conversion flags of this sequence.

◆ operator==()

Bool operator== ( const ConversionSequence other) const

Checks if this @CLASS equals other.

Parameters
[in]otherAnother @CLASS.
Returns
True if this equals other, false otherwise.

◆ operator!=()

Bool operator!= ( const ConversionSequence other) const

Checks if this @CLASS is not equal to other.

Parameters
[in]otherAnother @CLASS.
Returns
True if this is not equal to other, false otherwise.

◆ operator>()

Bool operator> ( const ConversionSequence other) const

Checks if this conversion sequence is better than other. For example a shorter sequence is better than a longer one, or the sequence Vec3<Float> → Float → Int is better than Vec3<Float> → Vec3<Int> → Int. This implements a partial ordering, i.e., there are pairs of sequences where one sequence is neither better nor worse than the other one.

Parameters
[in]otherAnother conversion sequence.
Returns
True if this sequence is better than other, false otherwise.

◆ operator>=()

Bool operator>= ( const ConversionSequence other) const

Checks if this conversion sequence is better than other or the same. This implements a partial ordering. See operator> for more details.

Parameters
[in]otherAnother conversion sequence.
Returns
True if this sequence is better than other or the same, false otherwise.

◆ operator<()

Bool operator< ( const ConversionSequence other) const

Checks if this conversion sequence is worse than other. This implements a partial ordering. See operator> for more details.

Parameters
[in]otherAnother conversion sequence.
Returns
True if this sequence is worse than other, false otherwise.

◆ operator<=()

Bool operator<= ( const ConversionSequence other) const

Checks if this conversion sequence is worse than other or the same. This implements a partial ordering. See operator> for more details.

Parameters
[in]otherAnother conversion sequence.
Returns
True if this sequence is worse than other or the same, false otherwise.

◆ ToString()

String ToString ( const FormatStatement fs = nullptr) const

Returns a String representation of this @CLASS.

Parameters
[in]formatStatementNullptr or additional formatting instruction.
Returns
String representation of this @CLASS.

Friends And Related Function Documentation

◆ CoreNodesLibImpl

friend class CoreNodesLibImpl
friend

Member Data Documentation

◆ _flags

const CONVERSION_FLAGS _flags
private

◆ _count

const Int _count
private

◆ _sequence

const CoreNodeInterface* _sequence[]
private