GLIP-Lib
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | List of all members
Glip::CorePipeline::PipelineLayout Class Reference

Pipeline layout. More...

#include <Pipeline.hpp>

Inheritance diagram for Glip::CorePipeline::PipelineLayout:
Inheritance graph

Public Member Functions

 PipelineLayout (const std::string &type)
 PipelineLayout constructor. More...
 
 PipelineLayout (const AbstractPipelineLayout &c)
 PipelineLayout constructor. More...
 
int add (const AbstractFilterLayout &filterLayout, const std::string &name)
 Add a filter to the pipeline layout. More...
 
int add (const AbstractPipelineLayout &pipelineLayout, const std::string &name)
 Add a subpipeline to the pipeline layout. More...
 
int addInput (const std::string &name)
 Add an input port to the pipeline layout. More...
 
int addOutput (const std::string &name)
 Add an output port to the pipeline layout. More...
 
void connect (int filterOut, int portOut, int filterIn, int portIn)
 Create a connection between two elements or an element and this pipeline and raise an exception if any errors occur. More...
 
void connect (const std::string &filterOut, const std::string &portOut, const std::string &filterIn, const std::string &portIn)
 Create a connection between two elements or an element and this pipeline and raise an exception if any errors occur. More...
 
void connectToInput (int port, int filterIn, int portIn)
 Create a connection between an input port of this pipeline and one of its element and raise an exception if any errors occur. More...
 
void connectToInput (const std::string &port, const std::string &filterIn, const std::string &portIn)
 Create a connection between an input port of this pipeline and one of its element and raise an exception if any errors occur. More...
 
void connectToOutput (int filterOut, int portOut, int port)
 Create a connection between an output port of this pipeline and one of its element and raise an exception if any errors occur. More...
 
void connectToOutput (const std::string &filterOut, const std::string &portOut, const std::string &port)
 Create a connection between an output port of this pipeline and one of its element and raise an exception if any errors occur. More...
 
void autoConnect (void)
 Create automatically all connections based on the name of the input and output ports and the name of the input and output textures of all Filters. More...
 
- Public Member Functions inherited from Glip::CorePipeline::ComponentLayout
 ComponentLayout (const std::string &_layoutName)
 ComponentLayout constructor. More...
 
 ComponentLayout (const AbstractComponentLayout &)
 ComponentLayout constructor. More...
 
void setInputPortName (int i, const std::string &newName)
 Change the name of an input port. More...
 
void setOutputPortName (int i, const std::string &newName)
 Change the name of an output port. More...
 
- Public Member Functions inherited from Glip::CorePipeline::AbstractComponentLayout
 AbstractComponentLayout (const AbstractComponentLayout &)
 AbstractComponentLayout constructor. More...
 
void checkInputPort (int i) const
 Check the validity of an input port. Raise an exception if any errors occur. More...
 
void checkOutputPort (int i) const
 Check the validity of an output port. Raise an exception if any errors occur. More...
 
virtual std::string getFullName (void) const
 Returns the full name of this component (might be overloaded). More...
 
const std::string & getLayoutName (void) const
 Returns the layout name of this component. More...
 
int getNumInputPort (void) const
 Get the number of input ports. More...
 
const std::string & getInputPortName (int i) const
 Return the name of an input port. Raise an exception if any errors occur. More...
 
int getInputPortID (const std::string &name) const
 Get the index of an input port knowing its name. Raise an exception if any errors occur. More...
 
bool doesInputPortExist (const std::string &name) const
 Check if an input port exists, knowing its name. More...
 
int getNumOutputPort (void) const
 Get the number of output ports. More...
 
const std::string & getOutputPortName (int i) const
 Return the name of an output port. Raise an exception if any errors occur. More...
 
int getOutputPortID (const std::string &name) const
 Get the index of an output port knowing its name. Raise an exception if any errors occur. More...
 
bool doesOutputPortExist (const std::string &name) const
 Check if an output port exists, knowing its name. More...
 
- Public Member Functions inherited from Glip::CorePipeline::AbstractPipelineLayout
 AbstractPipelineLayout (const AbstractPipelineLayout &c)
 AbstractPipelineLayout constructor. More...
 
void checkElement (int i) const
 Check if element exists and raise an exception if any errors occur. More...
 
int getNumElements (void) const
 Get the number of elements. More...
 
int getNumConnections (void) const
 Get the number of connections. More...
 
void getInfoElements (int &numFilters, int &numPipelines, int &numUniformVariables)
 Get the total number of Filters and Pipelines contained by this pipeline. More...
 
int getElementIndex (const std::string &name) const
 Get the ID of an element knowing its name. More...
 
bool doesElementExist (const std::string &name) const
 Check if an element exists knowing its name. More...
 
ComponentKind getElementKind (int i) const
 Get the kind of an element. More...
 
const std::string & getElementName (int i) const
 Get the name of an element. More...
 
int getElementID (int i) const
 Get element ID in global structure. More...
 
int getElementID (const std::string &name) const
 Get element ID in global structure. More...
 
AbstractComponentLayoutcomponentLayout (int i) const
 Get the component layout by its index. More...
 
AbstractComponentLayoutcomponentLayout (const std::string &name) const
 Get the component layout by its name. More...
 
AbstractFilterLayoutfilterLayout (int i) const
 Get the filter layout by its index. More...
 
AbstractFilterLayoutfilterLayout (const std::string &name) const
 Get the filter layout by its name. More...
 
AbstractPipelineLayoutpipelineLayout (int i) const
 Get the pipeline layout by its index. More...
 
AbstractPipelineLayoutpipelineLayout (const std::string &name) const
 Get the pipeline layout by its name. More...
 
Connection getConnection (int i) const
 Get the connection by its ID. More...
 
bool check (bool exception=true)
 Check the validity of the pipeline layout. More...
 

Additional Inherited Members

- Public Types inherited from Glip::CorePipeline::AbstractPipelineLayout
enum  ComponentKind {
  THIS_PIPELINE = -1,
  FILTER = 0,
  PIPELINE = 1
}
 Flags describing the component kind. More...
 
- Protected Member Functions inherited from Glip::CorePipeline::ComponentLayout
int addOutputPort (const std::string &name)
 Add an output port. More...
 
int addInputPort (const std::string &name)
 Add an input port. More...
 
- Protected Member Functions inherited from Glip::CorePipeline::AbstractComponentLayout
 AbstractComponentLayout (const std::string &_layoutName)
 AbstractComponentLayout constructor. More...
 
 AbstractComponentLayout (const std::string &_layoutName, const std::vector< std::string > &_inputPorts, const std::vector< std::string > &_outputPorts)
 AbstractComponentLayout constructor. More...
 
- Protected Member Functions inherited from Glip::CorePipeline::AbstractPipelineLayout
 AbstractPipelineLayout (const std::string &type)
 AbstractPipelineLayout constructor. More...
 
void setElementID (int i, int ID)
 Set element ID in global structure or raise an exception if any errors occur. More...
 
std::vector< ConnectiongetConnectionDestinations (int id, int p)
 Get all destinations of an output port. More...
 
Connection getConnectionSource (int id, int p)
 Get the source of an input port. More...
 

Detailed Description

Pipeline layout.

How to create a pipeline layout :

// Create the layout with a name (the "type" of the layout) :
PipelineLayout sobelLayout("SobelFilter");
// Add one input and one output with their name :
sobelLayout.addInput("intputImage");
sobelLayout.addInput("imageDerivatives");
// Add an instance of a filter previously created (see FilterLayout for more information) :
sobelLayout.add(sobelFilter, "instSobelFilter");
// It also work with another PipelineLayout object, adding a sub pipeline.
// If the port names of the FilterLayout don't correspond to those of the PipelineLayout, you have to explicitly declare the connections :
// Connection going from input "inputImage" of this pipeline to the input port "inputTexture" of the filter "sobelFilter" :
sobelLayout.connectToInput("inputImage", "sobelFilter", "inputTexture");
// In the case of multiple elements (works for filter to sub-pipeline, filter to filter, sub-pipeline to filter
// or sub-pipeline to sub-pipeline connections).
// you will use the following syntax for a connection from output Element1::outputE1 to input Element2::inputE2 :
// someLayout.connect("Element1","outputE1","Element2","inputE2");
// Connection going from input "inputImage" of this pipeline to the input port "inputTexture" of the filter "sobelFilter" :
sobelLayout.connectToOutput("sobelFilter", "outputTexture", "imageDerivatives");
// In the case where you are using explicit names (same names indicate a connection), then you can use the automatic method :
// sobelLayout.autoConnect();
// Which is equivalent to :
// sobelLayout.connectToInput("inputImage", "sobelFilter", "inputImage");
// sobelLayout.connectToOutput("sobelFilter", "imageDerivatives", "imageDerivatives");
// If you save the id of the elements, you can use the ID connection method but it usually is harder to read in code afterward.

Constructor & Destructor Documentation

PipelineLayout::PipelineLayout ( const std::string &  type)

PipelineLayout constructor.

Parameters
typeThe typename.
PipelineLayout::PipelineLayout ( const AbstractPipelineLayout c)

PipelineLayout constructor.

Parameters
cCopy.

Member Function Documentation

int PipelineLayout::add ( const AbstractFilterLayout filterLayout,
const std::string &  name 
)

Add a filter to the pipeline layout.

Parameters
filterLayoutThe filter layout.
nameThe name of the element.
Returns
The ID of the element added.
int PipelineLayout::add ( const AbstractPipelineLayout pipelineLayout,
const std::string &  name 
)

Add a subpipeline to the pipeline layout.

Parameters
pipelineLayoutThe pipeline layout.
nameThe name of the element.
Returns
The ID of the element added.
int PipelineLayout::addInput ( const std::string &  name)

Add an input port to the pipeline layout.

Parameters
nameThe name of the new input port.
Returns
The ID of the new input port.
int PipelineLayout::addOutput ( const std::string &  name)

Add an output port to the pipeline layout.

Parameters
nameThe name of the new output port.
Returns
The ID of the new output port.
void PipelineLayout::autoConnect ( void  )

Create automatically all connections based on the name of the input and output ports and the name of the input and output textures of all Filters.

This function will automatically make the connection based on the name of the input and output ports and the name of the different textures in the shaders used.

All of the names of the output textures (defined with out vec4 in the fragment shaders) and the input ports of this pipeline must be unique, it will raise an exception otherwise.

void PipelineLayout::connect ( int  filterOut,
int  portOut,
int  filterIn,
int  portIn 
)

Create a connection between two elements or an element and this pipeline and raise an exception if any errors occur.

Parameters
filterOutThe ID of the output element (a FilterLayout, a PipelineLayout or THIS_PIPELINE).
portOutThe ID of the output port.
filterInThe ID of the input element (a FilterLayout, a PipelineLayout or THIS_PIPELINE).
portInThe ID of the input port.
void PipelineLayout::connect ( const std::string &  filterOut,
const std::string &  portOut,
const std::string &  filterIn,
const std::string &  portIn 
)

Create a connection between two elements or an element and this pipeline and raise an exception if any errors occur.

Parameters
filterOutThe name of the output element (a FilterLayout, a PipelineLayout or THIS_PIPELINE).
portOutThe name of the output port.
filterInThe name of the input element (a FilterLayout, a PipelineLayout or THIS_PIPELINE).
portInThe name of the input port.
void PipelineLayout::connectToInput ( int  port,
int  filterIn,
int  portIn 
)

Create a connection between an input port of this pipeline and one of its element and raise an exception if any errors occur.

Parameters
portThe ID of the port for this pipeline.
filterInThe ID of the input element (a FilterLayout, a PipelineLayout or THIS_PIPELINE).
portInThe ID of the input port.
void PipelineLayout::connectToInput ( const std::string &  port,
const std::string &  filterIn,
const std::string &  portIn 
)

Create a connection between an input port of this pipeline and one of its element and raise an exception if any errors occur.

void PipelineLayout::connectToInput(const std::string& port, const std::string& filterIn, const std::string& portIn)

Parameters
portThe name of the port for this pipeline.
filterInThe name of the input element (a FilterLayout, a PipelineLayout or THIS_PIPELINE).
portInThe name of the input port.
void PipelineLayout::connectToOutput ( int  filterOut,
int  portOut,
int  port 
)

Create a connection between an output port of this pipeline and one of its element and raise an exception if any errors occur.

Parameters
filterOutThe ID of the output element (a FilterLayout, a PipelineLayout or THIS_PIPELINE).
portOutThe ID of the output port.
portThe ID of the port for this pipeline.
void PipelineLayout::connectToOutput ( const std::string &  filterOut,
const std::string &  portOut,
const std::string &  port 
)

Create a connection between an output port of this pipeline and one of its element and raise an exception if any errors occur.

Parameters
filterOutThe name of the output element (a FilterLayout, a PipelineLayout or THIS_PIPELINE).
portOutThe name of the output port.
portThe name of the port for this pipeline.

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