HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
COP_Signature Class Reference

#include <COP_Signature.h>

Public Member Functions

 COP_Signature ()
 same as COP_Signature("default", "Default") More...
 
 COP_Signature (const UT_StringHolder &name, const UT_StringHolder &label)
 Constructs a new signature with the given name and label. More...
 
 COP_Signature (const UT_StringHolder &name, const UT_StringHolder &label, int inputs, int outputs)
 
 COP_Signature (const UT_StringHolder &name, const UT_StringHolder &label, const UT_StringRef &input_list, const UT_StringRef &output_list)
 
int getInputConversionCost (const UT_Array< COP_Type > &inputs, bool abort_on_impossible=false) const
 
void setNumberOfInputs (int inputs)
 
void setNumberOfOutputs (int outputs)
 
void setInput (OP_InputIdx input, COP_Type type)
 
void setInput (OP_InputIdx input, COP_Type type, bool is_null)
 
void setOutput (OP_OutputIdx output, COP_Type type)
 
void setOutput (OP_OutputIdx output, COP_Type type, bool is_null)
 
void setInputIsNull (OP_InputIdx input, bool is_null)
 Sets the connected state of an input. More...
 
void setOutputIsNull (OP_OutputIdx output, bool is_null)
 Sets the connected state of an output. More...
 
int getNumberOfInputs () const
 Returns the number of inputs. More...
 
int getNumberOfOutputs () const
 Returns the number of outputs. More...
 
COP_Type getInputType (OP_InputIdx index) const
 Get type of the input at the specified index. More...
 
COP_Type getOutputType (OP_OutputIdx index) const
 Get type of the output at the specified index. More...
 
bool isInputNull (OP_InputIdx index) const
 Get whether the input at the specified index is connected. More...
 
bool isOutputNull (OP_OutputIdx index) const
 Get whether the output at the specified index is connected. More...
 
bool inputsMatchOutputs (OP_InputIdx i_start=0, OP_OutputIdx o_start=0) const
 
bool inputsMatchOutputs (const COP_Signature &other, OP_InputIdx i_start=0, OP_OutputIdx o_start=0) const
 
bool hasCableInput () const
 Returns true if this signature has an input that is of cable type. More...
 
UT_Array< COP_CableStructuremakeInputCableStructures () const
 
const UT_StringHoldergetName () const
 Returns the internal name of this signature. More...
 
const UT_StringHoldergetLabel () const
 Returns the English label for this signature. More...
 
void setName (const UT_StringHolder &name)
 Changes name of this signature. More...
 
void setLabel (const UT_StringHolder &label)
 Changes label for this signature. More...
 
void removeInput (OP_InputIdx index)
 Removes the input at the given index. More...
 
void removeOutput (OP_OutputIdx index)
 Removes the output at the given index. More...
 
UT_StringHolder format () const
 
UT_StringHolder getInputFormat () const
 
UT_StringHolder getOutputFormat () const
 
bool operator== (const COP_Signature &other) const
 
const UT_Array< bool > & getInputNullStates () const
 Returns the array of input null states. More...
 
const UT_Array< bool > & getOutputNullStates () const
 Returns the array of output null states. More...
 
const UT_Array< COP_Type > & getInputTypes () const
 Returns the array of this signature's input types. More...
 
const UT_Array< COP_Type > & getOutputTypes () const
 Returns the array of this signature's output types. More...
 

Protected Attributes

UT_Array< COP_TypemyInputTypes
 List of input types for this signature. More...
 
UT_Array< COP_TypemyOutputTypes
 List of output types for this signature. More...
 
UT_Array< bool > myInputIsNull
 Flag for each input indicating whether it's null (unconnected). More...
 
UT_Array< bool > myOutputIsNull
 Flag for each output indicating whether it's null (unconnected). More...
 
UT_StringHolder myName
 The signature's internal name. More...
 
UT_StringHolder myLabel
 The signature's label. More...
 

Friends

class COP_OperatorInfo
 

Detailed Description

Signature for a node. Signature consists of a name (internal and label), and lists of types for the inputs and outputs.

Definition at line 92 of file COP_Signature.h.

Constructor & Destructor Documentation

COP_Signature::COP_Signature ( )
inline

same as COP_Signature("default", "Default")

Definition at line 96 of file COP_Signature.h.

COP_Signature::COP_Signature ( const UT_StringHolder name,
const UT_StringHolder label 
)

Constructs a new signature with the given name and label.

COP_Signature::COP_Signature ( const UT_StringHolder name,
const UT_StringHolder label,
int  inputs,
int  outputs 
)

Constructs a new signature with the given name, label, and number of inputs and outputs.

COP_Signature::COP_Signature ( const UT_StringHolder name,
const UT_StringHolder label,
const UT_StringRef input_list,
const UT_StringRef output_list 
)

Constructs a new signature with the given name, label, and lists of inputs and outputs. A character in a list corresponds to an input or output. Its type can be one of the following: i: COP_TYPE_INT m: COP_TYPE_METADATA f: COP_TYPE_FLOAT u: COP_TYPE_VECTOR2 v: COP_TYPE_VECTOR p: COP_TYPE_VECTOR4 g: COP_TYPE_GEO I: COP_TYPE_VDB_INT F: COP_TYPE_VDB_FLOAT V: COP_TYPE_VDB_VECTOR C: COP_TYPE_CABLE If a type is succeeded by the ! symbol, then it's marked as null (or not connected).

Member Function Documentation

UT_StringHolder COP_Signature::format ( ) const
int COP_Signature::getInputConversionCost ( const UT_Array< COP_Type > &  inputs,
bool  abort_on_impossible = false 
) const

Returns the cost of converting all inputs of this signature into types from the array. If abort_on_impossible is true, returns -1 if one of the inputs is not convertible.

UT_StringHolder COP_Signature::getInputFormat ( ) const

Returns the format string for encoding all inputs (including their null states).

const UT_Array<bool>& COP_Signature::getInputNullStates ( ) const
inline

Returns the array of input null states.

Definition at line 209 of file COP_Signature.h.

COP_Type COP_Signature::getInputType ( OP_InputIdx  index) const

Get type of the input at the specified index.

const UT_Array<COP_Type>& COP_Signature::getInputTypes ( ) const
inline

Returns the array of this signature's input types.

Definition at line 219 of file COP_Signature.h.

const UT_StringHolder& COP_Signature::getLabel ( ) const
inline

Returns the English label for this signature.

Definition at line 185 of file COP_Signature.h.

const UT_StringHolder& COP_Signature::getName ( ) const
inline

Returns the internal name of this signature.

Definition at line 183 of file COP_Signature.h.

int COP_Signature::getNumberOfInputs ( ) const

Returns the number of inputs.

int COP_Signature::getNumberOfOutputs ( ) const

Returns the number of outputs.

UT_StringHolder COP_Signature::getOutputFormat ( ) const

Returns the format string for encoding all outputs (including their null states).

const UT_Array<bool>& COP_Signature::getOutputNullStates ( ) const
inline

Returns the array of output null states.

Definition at line 214 of file COP_Signature.h.

COP_Type COP_Signature::getOutputType ( OP_OutputIdx  index) const

Get type of the output at the specified index.

const UT_Array<COP_Type>& COP_Signature::getOutputTypes ( ) const
inline

Returns the array of this signature's output types.

Definition at line 224 of file COP_Signature.h.

bool COP_Signature::hasCableInput ( ) const

Returns true if this signature has an input that is of cable type.

bool COP_Signature::inputsMatchOutputs ( OP_InputIdx  i_start = 0,
OP_OutputIdx  o_start = 0 
) const

Returns true if inputs of this signature (starting at i_start) are convertible from its outputs (starting at o_start).

bool COP_Signature::inputsMatchOutputs ( const COP_Signature other,
OP_InputIdx  i_start = 0,
OP_OutputIdx  o_start = 0 
) const

Returns true if inputs of this signature (starting at i_start) are convertible from outputs of the other signature (starting at o_start). That is, false is returned if other.outputType(k) is not convertible into inputType(k-o_start+i_start) for some k. Only checks valid input and output indices.

bool COP_Signature::isInputNull ( OP_InputIdx  index) const

Get whether the input at the specified index is connected.

bool COP_Signature::isOutputNull ( OP_OutputIdx  index) const

Get whether the output at the specified index is connected.

UT_Array<COP_CableStructure> COP_Signature::makeInputCableStructures ( ) const

Makes a list of cable structures for the inputs. Each cable stucture has a single field that's the same type as the corresponding input on this signature.

bool COP_Signature::operator== ( const COP_Signature other) const

Two signatures are equivalent if all input and output states match exactly.

void COP_Signature::removeInput ( OP_InputIdx  index)

Removes the input at the given index.

void COP_Signature::removeOutput ( OP_OutputIdx  index)

Removes the output at the given index.

void COP_Signature::setInput ( OP_InputIdx  input,
COP_Type  type 
)

Sets the type of an input. If null state of the input is not provided, it will stay unchanged from the previous setting.

void COP_Signature::setInput ( OP_InputIdx  input,
COP_Type  type,
bool  is_null 
)
void COP_Signature::setInputIsNull ( OP_InputIdx  input,
bool  is_null 
)

Sets the connected state of an input.

void COP_Signature::setLabel ( const UT_StringHolder label)
inline

Changes label for this signature.

Definition at line 189 of file COP_Signature.h.

void COP_Signature::setName ( const UT_StringHolder name)
inline

Changes name of this signature.

Definition at line 187 of file COP_Signature.h.

void COP_Signature::setNumberOfInputs ( int  inputs)

Sets the number of inputs for this signature. If the current size is not zero, the last entry is duplicated to fill array.

void COP_Signature::setNumberOfOutputs ( int  outputs)

Sets the number of outputs for this signature. If the current size is not zero, the last entry is duplicated to fill array.

void COP_Signature::setOutput ( OP_OutputIdx  output,
COP_Type  type 
)

Sets the type of an output. If null state of the output is not provided, it will stay unchanged from the previous setting.

void COP_Signature::setOutput ( OP_OutputIdx  output,
COP_Type  type,
bool  is_null 
)
void COP_Signature::setOutputIsNull ( OP_OutputIdx  output,
bool  is_null 
)

Sets the connected state of an output.

Friends And Related Function Documentation

friend class COP_OperatorInfo
friend

Definition at line 243 of file COP_Signature.h.

Member Data Documentation

UT_Array<bool> COP_Signature::myInputIsNull
protected

Flag for each input indicating whether it's null (unconnected).

Definition at line 235 of file COP_Signature.h.

UT_Array<COP_Type> COP_Signature::myInputTypes
protected

List of input types for this signature.

Definition at line 231 of file COP_Signature.h.

UT_StringHolder COP_Signature::myLabel
protected

The signature's label.

Definition at line 241 of file COP_Signature.h.

UT_StringHolder COP_Signature::myName
protected

The signature's internal name.

Definition at line 239 of file COP_Signature.h.

UT_Array<bool> COP_Signature::myOutputIsNull
protected

Flag for each output indicating whether it's null (unconnected).

Definition at line 237 of file COP_Signature.h.

UT_Array<COP_Type> COP_Signature::myOutputTypes
protected

List of output types for this signature.

Definition at line 233 of file COP_Signature.h.


The documentation for this class was generated from the following file: