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 (int input, COP_Type type)
 Sets the type of an input. More...
 
void setOutput (int output, COP_Type type)
 Sets the type 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 (int index) const
 Get type of the input at the specified index. More...
 
COP_Type getOutputType (int index) const
 Get type of the output at the specified index. More...
 
bool inputsMatchOutputs (int i_start=0, int o_start=0) 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 (int index)
 Removes the input at the given index. More...
 
void removeOutput (int index)
 Removes the output at the given index. More...
 
UT_StringHolder format () const
 

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_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. The number of inputs and outputs is independent of this and set by the verb min/max Inputs/Outputs and the current state of the GUI. If not enough types are specified the last one is repeated for any extra inputs and outputs. This helps with making signatures reusable between different verbs.

Definition at line 59 of file COP_Signature.h.

Constructor & Destructor Documentation

COP_Signature::COP_Signature ( )
inline

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

Definition at line 63 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/1: COP_TYPE_FLOAT u/2: COP_TYPE_VECTOR2 v/3: COP_TYPE_VECTOR p/4: COP_TYPE_VECTOR4 g: COP_TYPE_GEO

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.

COP_Type COP_Signature::getInputType ( int  index) const

Get type of the input at the specified index.

const UT_StringHolder& COP_Signature::getLabel ( ) const
inline

Returns the English label for this signature.

Definition at line 132 of file COP_Signature.h.

const UT_StringHolder& COP_Signature::getName ( ) const
inline

Returns the internal name of this signature.

Definition at line 130 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.

COP_Type COP_Signature::getOutputType ( int  index) const

Get type of the output at the specified index.

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

Returns true if inputs (starting at i_start) are convertible from the outputs (starting at o_start). That is, false is returned if

  • (inputs - i_start) is larger (outputs - o_start), or
  • inputType(k) is not convertible into outputType(k-i_start+o_start) for some (inputs > k >= i_start).
void COP_Signature::removeInput ( int  index)

Removes the input at the given index.

void COP_Signature::removeOutput ( int  index)

Removes the output at the given index.

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

Sets the type of an input.

void COP_Signature::setLabel ( const UT_StringHolder label)
inline

Changes label for this signature.

Definition at line 136 of file COP_Signature.h.

void COP_Signature::setName ( const UT_StringHolder name)
inline

Changes name of this signature.

Definition at line 134 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 ( int  output,
COP_Type  type 
)

Sets the type of an output;.

Friends And Related Function Documentation

friend class COP_OperatorInfo
friend

Definition at line 155 of file COP_Signature.h.

Member Data Documentation

UT_Array<COP_Type> COP_Signature::myInputTypes
protected

List of input types for this signature.

Definition at line 147 of file COP_Signature.h.

UT_StringHolder COP_Signature::myLabel
protected

The signature's label.

Definition at line 153 of file COP_Signature.h.

UT_StringHolder COP_Signature::myName
protected

The signature's internal name.

Definition at line 151 of file COP_Signature.h.

UT_Array<COP_Type> COP_Signature::myOutputTypes
protected

List of output types for this signature.

Definition at line 149 of file COP_Signature.h.


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