ConversionSequence Class Reference

#include <corenodes_conversion.h>

Detailed Description

A ConversionSequence is a sequence of zero to two 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

 ConversionSequence ()=default
 
 ConversionSequence (const CoreNode &c1, CONVERSION_FLAGS flags)
 
 ConversionSequence (const CoreNode &c1, const CoreNode &c2, CONVERSION_FLAGS flags)
 
Result< DataConvert (const ConstDataPtr &source) const
 
const CoreNode & operator[] (Int index) const
 
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) const
 

Private Attributes

CONVERSION_FLAGS _flags
 
Int _count
 
CoreNode _sequence [2]
 

Member Typedef Documentation

◆ PartiallyOrdered

using PartiallyOrdered = std::true_type

Constructor & Destructor Documentation

◆ ConversionSequence() [1/3]

ConversionSequence ( )
default

Constructs an empty conversion sequence.

◆ ConversionSequence() [2/3]

ConversionSequence ( const CoreNode &  c1,
CONVERSION_FLAGS  flags 
)

Constructs a conversion sequence consisting of a single conversion node.

Parameters
[in]c1The conversion node.
[in]flagsThe conversion flags of the conversion.

◆ ConversionSequence() [3/3]

ConversionSequence ( const CoreNode &  c1,
const CoreNode &  c2,
CONVERSION_FLAGS  flags 
)

Constructs a conversion sequence consisting of a two conversion nodes.

Parameters
[in]c1The first conversion node.
[in]c2The second conversion node.
[in]flagsThe conversion flags of the conversion.

Member Function Documentation

◆ Convert()

Result<Data> Convert ( const ConstDataPtr source) const

◆ operator[]()

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.

◆ GetCount()

Int GetCount ( void  ) const

Returns the number of conversions of this sequence (from zero to two).

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) const

Returns a String representation of this @CLASS.

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

Member Data Documentation

◆ _flags

CONVERSION_FLAGS _flags
private

◆ _count

Int _count
private

◆ _sequence

CoreNode _sequence[2]
private