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

#include <ShaderStage.h>

Public Member Functions

 VariableBlock (const string &name, const string &instance)
 
const stringgetName () const
 Get the name of this block. More...
 
void setName (const string &name)
 Set the name of this block. More...
 
const stringgetInstance () const
 Get the instance name of this block. More...
 
void setInstance (const string &instance)
 Set the instance name of this block. More...
 
bool empty () const
 Return true if the block has no variables. More...
 
size_t size () const
 Return the number of variables in this block. More...
 
ShaderPortoperator[] (size_t index)
 Return a variable by index. More...
 
const ShaderPortoperator[] (size_t index) const
 Return a variable by index. More...
 
const vector< ShaderPort * > & getVariableOrder () const
 Return a const reference to our variable order vector. More...
 
ShaderPortoperator[] (const string &name)
 
const ShaderPortoperator[] (const string &name) const
 
ShaderPortfind (const string &name)
 
const ShaderPortfind (const string &name) const
 
ShaderPortfind (const ShaderPortPredicate &predicate)
 Find a port based on a predicate. More...
 
ShaderPortadd (const TypeDesc *type, const string &name, ValuePtr value=nullptr, bool shouldWiden=false)
 
void add (ShaderPortPtr port)
 Add an existing shader port to this block. More...
 

Detailed Description

A block of variables in a shader stage

Definition at line 60 of file ShaderStage.h.

Constructor & Destructor Documentation

VariableBlock::VariableBlock ( const string name,
const string instance 
)
inline

Definition at line 63 of file ShaderStage.h.

Member Function Documentation

ShaderPort* VariableBlock::add ( const TypeDesc type,
const string name,
ValuePtr  value = nullptr,
bool  shouldWiden = false 
)

Add a new shader port to this block.

Parameters
typeThe desired shader port type
nameThe shader port name
valueThe value to attach to the shader port
shouldWidenWhen false, an exception is thrown if the type of the existing port with the same name does not match the requested type. When true, the types can mismatch, and the type of any existing port is widened to match the requested type when necessary.
Returns
A new shader port, or a pre-existing shader port with the same name.
void VariableBlock::add ( ShaderPortPtr  port)

Add an existing shader port to this block.

bool VariableBlock::empty ( void  ) const
inline

Return true if the block has no variables.

Definition at line 82 of file ShaderStage.h.

ShaderPort* VariableBlock::find ( const string name)

Return a variable by name. Returns nullptr if no variable is found by the given name.

const ShaderPort* VariableBlock::find ( const string name) const

Return a variable by name. Returns nullptr if no variable is found by the given name.

ShaderPort* VariableBlock::find ( const ShaderPortPredicate predicate)

Find a port based on a predicate.

const string& VariableBlock::getInstance ( ) const
inline

Get the instance name of this block.

Definition at line 76 of file ShaderStage.h.

const string& VariableBlock::getName ( ) const
inline

Get the name of this block.

Definition at line 70 of file ShaderStage.h.

const vector<ShaderPort*>& VariableBlock::getVariableOrder ( ) const
inline

Return a const reference to our variable order vector.

Definition at line 94 of file ShaderStage.h.

ShaderPort* VariableBlock::operator[] ( size_t  index)
inline

Return a variable by index.

Definition at line 88 of file ShaderStage.h.

const ShaderPort* VariableBlock::operator[] ( size_t  index) const
inline

Return a variable by index.

Definition at line 91 of file ShaderStage.h.

ShaderPort* VariableBlock::operator[] ( const string name)

Return a variable by name. Throws exception if no variable is found by the given name.

const ShaderPort* VariableBlock::operator[] ( const string name) const

Return a variable by name. Throws exception if no variable is found by the given name.

void VariableBlock::setInstance ( const string instance)
inline

Set the instance name of this block.

Definition at line 79 of file ShaderStage.h.

void VariableBlock::setName ( const string name)
inline

Set the name of this block.

Definition at line 73 of file ShaderStage.h.

size_t VariableBlock::size ( void  ) const
inline

Return the number of variables in this block.

Definition at line 85 of file ShaderStage.h.


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