HyperspaceExplorer 0.7.1
|
Singleton to set the color scheme globally - proxies the color manager. More...
#include <ColorManager.h>
Classes | |
struct | BadColorManagerException |
Thrown by createColorManager() when name does not map to a ColorManager. More... | |
struct | ColorManagerUnsetException |
Thrown if a ColorManager function is called before a ColorManager has been set. More... | |
Public Types | |
typedef ColorManager *(* | CreateColMgrCallback )() |
callback function generating a ColorManager and returning a ColorManager* | |
Public Member Functions | |
void | setColorManager (ColorManager *cm) |
determine which coloring scheme to use | |
void | setFunction (Displayable *_f) |
proxy function for ColorManager::setFunction() | |
void | calibrateColor (const VecMath::Vector< 4 > &, const Color &=Color()) |
proxy function for ColorManager::calibrateColor() | |
void | setColor (const VecMath::Vector< 4 > &x) |
proxy function for ColorManager::setColor() | |
Color | getColor (const VecMath::Vector< 4 > &x) |
proxy function for ColorManager::getColor() | |
void | depthCueColor (double wmax, double wmin, double w, const VecMath::Vector< 4 > &x) |
proxy function for ColorManager::depthCueColor() | |
void | setRGB (const Color &_col) |
proxy function for ColorManager::setRGB() | |
std::string | getContents () |
debugging output | |
bool | registerColorManager (const std::string &, CreateColMgrCallback) |
Register a ColorManager class with a name, so we can instantiate it. | |
bool | unregisterColorManager (const std::string &) |
Unregister a ColorManager with the given name. | |
std::vector< std::string > | getRegisteredColorManagers () |
Returns a list of registered ColorManager s. | |
void | setColorManager (const std::string &) |
Set the ColorManager to a class registered by name. | |
bool | isColorManagerSet () const |
Returns whether a ColorManager has already been set. | |
Private Types | |
typedef std::map< std::string, CreateColMgrCallback > | CallbackMap |
stores a creator function with a string containing the class name | |
Private Member Functions | |
ColorManagerManager () | |
ColorManagerManager (const ColorManagerManager &) | |
ColorManagerManager & | operator= (const ColorManagerManager &) |
~ColorManagerManager () | |
Private Attributes | |
std::auto_ptr< ColorManager > | colorManager |
The proxied ColorManager. | |
CallbackMap | callbacks |
Stores the ColorManager creators. | |
Friends | |
class | Loki::CreateUsingNew< ColorManagerManager > |
Lets Loki::SingletonHolder instantiate a ColorManagerManager. |
Singleton to set the color scheme globally - proxies the color manager.
The object also serves as a Factory for ColorManager s, instantiating a ColorManager when given a string that describes it. It stores creator functions for all ColorManager implementations in a std::map indexed by a string.
It also returns a list of registered ColorManager s, which can be used to set up a menu to change the ColorManager (for example :-).
implement a map<Function *, ColorManager *> to store one ColorManager per function - this will probably break the existing interface
Shouldn't htis class implement the ColorManager interface? It delegates all calls to a ColorManager and serves as one, doesn't it?
ColorManagerManager::ColorManagerManager | ( | ) | [inline, private] |
disabled default constructor
ColorManagerManager::ColorManagerManager | ( | const ColorManagerManager & | ) | [private] |
disabled copy constructor
ColorManagerManager::~ColorManagerManager | ( | ) | [inline, private] |
disabled destructor
ColorManagerManager& ColorManagerManager::operator= | ( | const ColorManagerManager & | ) | [private] |
disabled assignment operator
bool ColorManagerManager::registerColorManager | ( | const std::string & | name, |
CreateColMgrCallback | creator | ||
) |
Register a ColorManager class with a name, so we can instantiate it.
name | The name by which this class is called from outside. This name is passed to setColorManager() to select the desired ColorManager. |
creator | A function which returns a new instance of the registered ColorManager |
const bool
in a global anonymous namespace. References callbacks, and std::map< _Key, _Tp, _Compare, _Alloc >::insert().
void ColorManagerManager::setColorManager | ( | const std::string & | name | ) |
Set the ColorManager to a class registered by name.
name | Name the ColorManager is known and registered by |
References callbacks, std::map< _Key, _Tp, _Compare, _Alloc >::end(), std::map< _Key, _Tp, _Compare, _Alloc >::find(), and setColorManager().
bool ColorManagerManager::unregisterColorManager | ( | const std::string & | name | ) |
Unregister a ColorManager with the given name.
I can't really think of a reason why one would want to unregister a ColorManager at runtime, so this function is just there for the sake of completeness. It's a one-liner anyway.
name | The name by which the ColorManager is called from outside |
References callbacks, and std::map< _Key, _Tp, _Compare, _Alloc >::erase().