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)
 
 COP_Signature (const UT_StringHolder &name, const UT_StringHolder &label, const UT_Array< COP_Type > &input_types, const UT_Array< bool > &input_null_states, const UT_Array< COP_Type > &output_types, const UT_Array< bool > &output_null_states)
 
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...
 
bool hasCableOutput () const
 Returns true if this signature has an output that is of cable type. More...
 
UT_Array< COP_CableStructure > makeInputCableStructures () const
 
const UT_StringHolder & getName () const
 Returns the internal name of this signature. More...
 
const UT_StringHolder & getLabel () 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_Type > myInputTypes
 List of input types for this signature. More...
 
UT_Array< COP_Type > myOutputTypes
 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 110 of file COP_Signature.h.

Constructor & Destructor Documentation

COP_Signature::COP_Signature ( )
inline

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

Definition at line 114 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). If a type is preceeded by 1,2,3 it specifies the dimension, 1: IMX_Attribute: COP_TYPE_ATTRIB_ 2: IMX_Layer: COP_TYPE_ 3: IMX_VDB: COP_TYPE_VDB_ The next symbol should be ifuvp to specify the type.

COP_Signature::COP_Signature ( const UT_StringHolder &  name,
const UT_StringHolder &  label,
const UT_Array< COP_Type > &  input_types,
const UT_Array< bool > &  input_null_states,
const UT_Array< COP_Type > &  output_types,
const UT_Array< bool > &  output_null_states 
)

Constructs a signature given lists of types and null states for inputs and outputs.

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 241 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 251 of file COP_Signature.h.

const UT_StringHolder& COP_Signature::getLabel ( ) const
inline

Returns the English label for this signature.

Definition at line 217 of file COP_Signature.h.

const UT_StringHolder& COP_Signature::getName ( ) const
inline

Returns the internal name of this signature.

Definition at line 215 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 246 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 256 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::hasCableOutput ( ) const

Returns true if this signature has an output 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 221 of file COP_Signature.h.

void COP_Signature::setName ( const UT_StringHolder &  name)
inline

Changes name of this signature.

Definition at line 219 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 275 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 267 of file COP_Signature.h.

UT_Array<COP_Type> COP_Signature::myInputTypes
protected

List of input types for this signature.

Definition at line 263 of file COP_Signature.h.

UT_StringHolder COP_Signature::myLabel
protected

The signature's label.

Definition at line 273 of file COP_Signature.h.

UT_StringHolder COP_Signature::myName
protected

The signature's internal name.

Definition at line 271 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 269 of file COP_Signature.h.

UT_Array<COP_Type> COP_Signature::myOutputTypes
protected

List of output types for this signature.

Definition at line 265 of file COP_Signature.h.


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