gpucalc::Task Class Reference

Main class for our computation. More...

#include <task.h>

Inheritance diagram for gpucalc::Task:

Inheritance graph

List of all members.

Public Member Functions

virtual void addActiveKernel (Kernel *ActiveKernel)=0
virtual void addCompilerParamsToActiveKernel (const std::string &Parameters)=0
 Add compiler parameters to active kernel.
virtual void addDataToActiveKernel (const Data &data)=0
 Transfer data from CPU side to GPU side.
virtual void addResultToActiveKernel (Data &result)=0
virtual void compile ()=0
 Compiles this task.
virtual void compute ()=0
 Performs computation and stores result in Data pointer.
virtual KernelgetActiveKernel () const =0
 Returns active kernel.
const std::string & getClassName () const
 Returns name of class of our object.
const std::string & getObjectName () const
 Returns name of our object.
virtual DatagetResultData () const =0
void getSpecificParameter (const std::string &ParameterName, void *ParameterValue)
 Method for obtaining some specific parameters, such as texture specific params, and so on.
bool isLocked () const
 returns state of object.
virtual void removeDataFromActiveKernel (const Data &data)=0
 Removes data from active kernel.
virtual void removeKernel (Kernel *kernel)=0
 Removes kernel from our Task.
virtual void removeResultFromActiveKernel (const Data &result)=0
 Task (const std::string &TaskClassName, const std::string &TaskName)
 Default constructor.
virtual ~Task ()

Protected Member Functions

void addSpecificParameter (const std::string &ParameterName, void *ParameterValue, size_t Size)
virtual void computeOneKernel (Texture *RenderTarget)=0
void lock ()
void unlock ()


Detailed Description

Main class for our computation.

In user namespace we work only with such entities as: task, data, kernel and so on... So we must abstract from graphical termins: shaders, textures, framebuffers.

This class provides all necessary methods for performing computations, and gives necessary abstraction level.

Todo:
Create Kernel iterator.

Definition at line 124 of file task.h.


Constructor & Destructor Documentation

gpucalc::Task::Task ( const std::string &  TaskClassName,
const std::string &  TaskName 
) [inline]

Default constructor.

This constructor is private because we must create object with TaskManager::createTask()

Definition at line 139 of file task.h.

00139                                                                     : Object(TaskClassName, TaskName)
00140    {
00141    }

virtual gpucalc::Task::~Task (  )  [inline, virtual]

Definition at line 145 of file task.h.

00146    {
00147    }


Member Function Documentation

virtual void gpucalc::Task::addActiveKernel ( Kernel ActiveKernel  )  [pure virtual]

Implemented in gpucalc::SimpleTask.

virtual void gpucalc::Task::addCompilerParamsToActiveKernel ( const std::string &  Parameters  )  [pure virtual]

Add compiler parameters to active kernel.

Implemented in gpucalc::SimpleTask.

virtual void gpucalc::Task::addDataToActiveKernel ( const Data data  )  [pure virtual]

Transfer data from CPU side to GPU side.

Data can be represented as Array or as Element.

Note:
Data adds to active kernel, so if you want to add same data to other kernels, you must set them(kernels) as active, and after that add data.

Implemented in gpucalc::SimpleTask.

virtual void gpucalc::Task::addResultToActiveKernel ( Data result  )  [pure virtual]

Implemented in gpucalc::SimpleTask.

void gpucalc::Object::addSpecificParameter ( const std::string &  ParameterName,
void *  ParameterValue,
size_t  Size 
) [inline, protected, inherited]

Definition at line 254 of file object.h.

00255    {
00256     SpecificParametersMap::iterator i = mSpecificParameters.find(ParameterName);
00257     if (i != mSpecificParameters.end())
00258     {
00259      mSpecificParameters.erase(i);
00260     }
00261     mSpecificParameters[ParameterName] = Any(ParameterValue, Size);
00262    }

virtual void gpucalc::Task::compile (  )  [pure virtual]

Compiles this task.

Implemented in gpucalc::SimpleTask.

virtual void gpucalc::Task::compute (  )  [pure virtual]

Performs computation and stores result in Data pointer.

Resulting Data must be set by calling method Task::AddResultDataToActiveKernel()

Implemented in gpucalc::SimpleTask.

virtual void gpucalc::Task::computeOneKernel ( Texture RenderTarget  )  [protected, pure virtual]

Implemented in gpucalc::SimpleTask.

virtual Kernel* gpucalc::Task::getActiveKernel (  )  const [pure virtual]

Returns active kernel.

Implemented in gpucalc::SimpleTask.

const std::string& gpucalc::Object::getClassName (  )  const [inline, inherited]

Returns name of class of our object.

Definition at line 92 of file object.h.

00093    {
00094     return mClassName;
00095    }

const std::string& gpucalc::Object::getObjectName (  )  const [inline, inherited]

Returns name of our object.

Definition at line 101 of file object.h.

00102    {
00103     return mObjectName;
00104    }

virtual Data& gpucalc::Task::getResultData (  )  const [pure virtual]

Implemented in gpucalc::SimpleTask.

void gpucalc::Object::getSpecificParameter ( const std::string &  ParameterName,
void *  ParameterValue 
) [inline, inherited]

Method for obtaining some specific parameters, such as texture specific params, and so on.

Parameters:
ParameterName - name of parameter, usually it similar to specific method of some object (for example, GLTextureID)
ParameterValue - contain value of named parameter, it must be allocated and have sufficient size.
Todo:
Think for better realization.

Definition at line 128 of file object.h.

00129    {
00130     SpecificParametersMap::iterator i = mSpecificParameters.find(ParameterName);
00131     if (i != mSpecificParameters.end())
00132     {
00133      i->second.copyValue(ParameterValue);
00134     }
00135     else
00136     {
00137      Except<ERR_ITEM_NOT_FOUND>(this, "Parameter \"" + ParameterName + "\" does not exists.", "Object::getSpecificParameter()", __FILE__, __LINE__);
00138     }
00139    }

bool gpucalc::Object::isLocked (  )  const [inline, inherited]

returns state of object.

If object is locked then we cannot change some state of it, because object is used in computation. If object is unlocked then we can change some state of it, object is not in computation.

Definition at line 113 of file object.h.

00114    {
00115     return mIsLocked;
00116    }

void gpucalc::Object::lock (  )  [inline, protected, inherited]

Definition at line 265 of file object.h.

00266    {
00267     mIsLocked = true;
00268    }

virtual void gpucalc::Task::removeDataFromActiveKernel ( const Data data  )  [pure virtual]

Removes data from active kernel.

Implemented in gpucalc::SimpleTask.

virtual void gpucalc::Task::removeKernel ( Kernel kernel  )  [pure virtual]

Removes kernel from our Task.

Implemented in gpucalc::SimpleTask.

virtual void gpucalc::Task::removeResultFromActiveKernel ( const Data result  )  [pure virtual]

Implemented in gpucalc::SimpleTask.

void gpucalc::Object::unlock (  )  [inline, protected, inherited]

Definition at line 271 of file object.h.

00272    {
00273     mIsLocked = false;
00274    }


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

Generated on Thu Mar 5 22:36:46 2009 for gpucalc by  doxygen 1.5.6