Fluxus::PDataContainer Class Reference

#include <PDataContainer.h>

Inheritance diagram for Fluxus::PDataContainer:

Inheritance graph
[legend]

Public Member Functions

 PDataContainer ()
 PDataContainer (const PDataContainer &other)
virtual ~PDataContainer ()
virtual PDataContainerClone () const=0
void Clear ()
 Clear all pdata, leaves the container empty.
void AddData (const string &name, PData *pd)
void CopyData (const string &name, string newname)
template<class T>
vector< T > * GetDataVec (const string &name)
void RemoveDataVec (const string &name)
 Destroys a pdata array.
bool GetDataInfo (const string &name, char &type, unsigned int &size) const
template<class T>
void SetData (const string &name, unsigned int index, T s)
template<class T>
GetData (const string &name, unsigned int index) const
 Todo: no const [] for m_PData[name] so m_PData has to be mutable???
template<class T>
PDataDataOp (const string &op, const string &name, T operand)
 Runs a pdata operation on the given pdata array.
PDataGetDataRaw (const string &name)
 Gets the whole pdata array, returns NULL if it doesn't exist.
const PDataGetDataRawConst (const string &name) const
 Gets the whole const pdata array, returns NULL if it doesn't exist.
void SetDataRaw (const string &name, PData *pd)
 Sets the whole pdata array.
template<class S, class T>
PDataFindOperate (const string &name, TypedPData< S > *a, T b)
void Resize (unsigned int size)
 Erases all current data!
unsigned int Size () const
 Returns the size of pdata for this object.
void GetDataNames (vector< string > &names) const
 Returns a vector of names of PData that this container contains.

Protected Member Functions

virtual void PDataDirty ()=0
 Called when a named pdata mapping changes.

Protected Attributes

map< string, PData * > m_PData

Detailed Description

The base pdata container class. Primitive data (pdata) means vertex data, colours, positions, etc etc which are not generated internally and need to be accessed by users. All primitive data should be stored using pdata arrays, with the following caviats:

Definition at line 43 of file PDataContainer.h.


Constructor & Destructor Documentation

PDataContainer::PDataContainer (  ) 

Definition at line 21 of file PDataContainer.cpp.

PDataContainer::PDataContainer ( const PDataContainer other  ) 

Definition at line 25 of file PDataContainer.cpp.

PDataContainer::~PDataContainer (  )  [virtual]

Definition at line 35 of file PDataContainer.cpp.


Member Function Documentation

virtual PDataContainer* Fluxus::PDataContainer::Clone (  )  const [pure virtual]

Implemented in Fluxus::BlobbyPrimitive, Fluxus::LocatorPrimitive, Fluxus::NURBSPrimitive, Fluxus::ParticlePrimitive, Fluxus::PixelPrimitive, Fluxus::PolyPrimitive, Fluxus::Primitive, Fluxus::RibbonPrimitive, and Fluxus::TextPrimitive.

void PDataContainer::Clear (  ) 

Clear all pdata, leaves the container empty.

Reimplemented in Fluxus::PolyPrimitive.

Definition at line 40 of file PDataContainer.cpp.

void PDataContainer::AddData ( const string &  name,
PData pd 
)

Make a new pdata array, fails if one already exists with this name

Definition at line 99 of file PDataContainer.cpp.

void PDataContainer::CopyData ( const string &  name,
string  newname 
)

Copy data from one array to another - deletes the old one if it exists

Definition at line 111 of file PDataContainer.cpp.

template<class T>
vector< T > * Fluxus::PDataContainer::GetDataVec ( const string &  name  ) 

Retrieves a pointer to the internal vector by name Returns NULL if it doesn't exist, or is not the type given in the template call.

Definition at line 132 of file PDataContainer.h.

void PDataContainer::RemoveDataVec ( const string &  name  ) 

Destroys a pdata array.

Definition at line 132 of file PDataContainer.cpp.

bool PDataContainer::GetDataInfo ( const string &  name,
char &  type,
unsigned int &  size 
) const

From the supplied name, fills in information about this pdata, returns false if it doesn't actually exist

Definition at line 67 of file PDataContainer.cpp.

template<class T>
void Fluxus::PDataContainer::SetData ( const string &  name,
unsigned int  index,
s 
)

Sets an element of the array. Not checked, for speed - use GetDataInfo() to check

Definition at line 119 of file PDataContainer.h.

template<class T>
T Fluxus::PDataContainer::GetData ( const string &  name,
unsigned int  index 
) const

Todo: no const [] for m_PData[name] so m_PData has to be mutable???

Gets an element of the array. Not checked, for speed - use GetDataInfo() to check

Definition at line 126 of file PDataContainer.h.

template<class T>
PData * Fluxus::PDataContainer::DataOp ( const string &  op,
const string &  name,
operand 
)

Runs a pdata operation on the given pdata array.

Definition at line 152 of file PDataContainer.h.

PData * PDataContainer::GetDataRaw ( const string &  name  ) 

Gets the whole pdata array, returns NULL if it doesn't exist.

Definition at line 145 of file PDataContainer.cpp.

const PData * PDataContainer::GetDataRawConst ( const string &  name  )  const

Gets the whole const pdata array, returns NULL if it doesn't exist.

Definition at line 156 of file PDataContainer.cpp.

void PDataContainer::SetDataRaw ( const string &  name,
PData pd 
)

Sets the whole pdata array.

Definition at line 167 of file PDataContainer.cpp.

template<class S, class T>
PData * Fluxus::PDataContainer::FindOperate ( const string &  name,
TypedPData< S > *  a,
b 
)

Maps the name of a pdata operator to the actual object, all pdata ops need to be registered inside this function (see below)

Definition at line 183 of file PDataContainer.h.

void PDataContainer::Resize ( unsigned int  size  ) 

Erases all current data!

Definition at line 48 of file PDataContainer.cpp.

unsigned int PDataContainer::Size (  )  const

Returns the size of pdata for this object.

Definition at line 57 of file PDataContainer.cpp.

void PDataContainer::GetDataNames ( vector< string > &  names  )  const

Returns a vector of names of PData that this container contains.

Definition at line 180 of file PDataContainer.cpp.

virtual void Fluxus::PDataContainer::PDataDirty (  )  [protected, pure virtual]

Called when a named pdata mapping changes.

Implemented in Fluxus::BlobbyPrimitive, Fluxus::LocatorPrimitive, Fluxus::NURBSPrimitive, Fluxus::ParticlePrimitive, Fluxus::PixelPrimitive, Fluxus::PolyPrimitive, and Fluxus::RibbonPrimitive.


Field Documentation

map<string,PData*> Fluxus::PDataContainer::m_PData [mutable, protected]

Todo: no const [] for m_PData[name] so m_PData has to be mutable??? (see below)

Todo:
replace with a hashmap?

Definition at line 114 of file PDataContainer.h.


The documentation for this class was generated from the following files:
Generated on Wed Sep 17 21:16:50 2008 for The Fluxus Renderer (libfluxus) by  doxygen 1.5.1