Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Member Functions | Protected Attributes | Private Types | Private Member Functions | Static Private Member Functions | Static Private Attributes | List of all members
CShaderParams< value_t > Class Template Reference

Represents a mapping of name strings to value, for use with CShaderDefines (values are strings) and CShaderUniforms (values are vec4s). More...

#include <ShaderDefines.h>

Classes

struct  SItems
 

Public Member Functions

 CShaderParams ()
 Create an empty map of defines. More...
 
void Set (CStrIntern name, const value_t &value)
 Add a name and associated value to the map of parameters. More...
 
void SetMany (const CShaderParams &params)
 Add all the names and values from another set of parameters. More...
 
std::map< CStrIntern, value_t > GetMap () const
 Return a copy of the current name/value mapping. More...
 
size_t GetHash () const
 Return a hash of the current mapping. More...
 
bool operator< (const CShaderParams &b) const
 Compare with some arbitrary total order. More...
 
bool operator== (const CShaderParams &b) const
 Fast equality comparison. More...
 
bool operator!= (const CShaderParams &b) const
 Fast inequality comparison. More...
 

Protected Attributes

SItemsm_Items
 

Private Types

typedef boost::unordered_map
< SItems, shared_ptr< SItems > > 
InternedItems_t
 

Private Member Functions

 CShaderParams (SItems *items)
 

Static Private Member Functions

static SItemsGetInterned (const SItems &items)
 Returns a pointer to an SItems equal to items. More...
 
static CShaderParams CreateEmpty ()
 

Static Private Attributes

static InternedItems_t s_InternedItems
 
static CShaderParams s_Empty
 

Detailed Description

template<typename value_t>
class CShaderParams< value_t >

Represents a mapping of name strings to value, for use with CShaderDefines (values are strings) and CShaderUniforms (values are vec4s).

Stored as interned vectors of name-value pairs, to support high performance comparison operators.

Not thread-safe - must only be used from the main thread.

Definition at line 39 of file ShaderDefines.h.

Member Typedef Documentation

template<typename value_t>
typedef boost::unordered_map<SItems, shared_ptr<SItems> > CShaderParams< value_t >::InternedItems_t
private

Definition at line 112 of file ShaderDefines.h.

Constructor & Destructor Documentation

template<typename value_t >
CShaderParams< value_t >::CShaderParams ( )

Create an empty map of defines.

Definition at line 106 of file ShaderDefines.cpp.

template<typename value_t >
CShaderParams< value_t >::CShaderParams ( SItems items)
private

Definition at line 112 of file ShaderDefines.cpp.

Member Function Documentation

template<typename value_t >
CShaderParams< value_t > CShaderParams< value_t >::CreateEmpty ( )
staticprivate

Definition at line 117 of file ShaderDefines.cpp.

template<typename value_t >
size_t CShaderParams< value_t >::GetHash ( ) const

Return a hash of the current mapping.

Definition at line 176 of file ShaderDefines.cpp.

template<typename value_t >
CShaderParams< value_t >::SItems * CShaderParams< value_t >::GetInterned ( const SItems items)
staticprivate

Returns a pointer to an SItems equal to items.

The pointer will be valid forever, and the same pointer will be returned for any subsequent requests for an equal items list.

Definition at line 87 of file ShaderDefines.cpp.

template<typename value_t >
std::map< CStrIntern, value_t > CShaderParams< value_t >::GetMap ( ) const

Return a copy of the current name/value mapping.

Definition at line 167 of file ShaderDefines.cpp.

template<typename value_t>
bool CShaderParams< value_t >::operator!= ( const CShaderParams< value_t > &  b) const
inline

Fast inequality comparison.

Definition at line 90 of file ShaderDefines.h.

template<typename value_t>
bool CShaderParams< value_t >::operator< ( const CShaderParams< value_t > &  b) const
inline

Compare with some arbitrary total order.

The order may be different each time the application is run (it is based on interned memory addresses).

Definition at line 74 of file ShaderDefines.h.

template<typename value_t>
bool CShaderParams< value_t >::operator== ( const CShaderParams< value_t > &  b) const
inline

Fast equality comparison.

Definition at line 82 of file ShaderDefines.h.

template<typename value_t>
void CShaderParams< value_t >::Set ( CStrIntern  name,
const value_t &  value 
)

Add a name and associated value to the map of parameters.

If the name is already defined, its value will be replaced.

Definition at line 125 of file ShaderDefines.cpp.

template<typename value_t >
void CShaderParams< value_t >::SetMany ( const CShaderParams< value_t > &  params)

Add all the names and values from another set of parameters.

If any name is already defined in this object, its value will be replaced.

Definition at line 151 of file ShaderDefines.cpp.

Member Data Documentation

template<typename value_t>
SItems* CShaderParams< value_t >::m_Items
protected

Definition at line 109 of file ShaderDefines.h.

template<typename value_t>
CShaderParams CShaderParams< value_t >::s_Empty
staticprivate

Definition at line 124 of file ShaderDefines.h.

template<typename value_t>
InternedItems_t CShaderParams< value_t >::s_InternedItems
staticprivate

Definition at line 113 of file ShaderDefines.h.


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