#include <HxImgFtorTable.h>
Public Methods | |
| void | insert (const HxImgFtorKey &key, HxImgFunctor *f) |
| Insert a (key,functor) combination. More... | |
| HxImgFunctor * | find (const HxImgFtorKey &key) |
| Find functor based on given key. More... | |
| void | addImgFtorObserver (HxImgFtorObserver *) |
| Add an image functor observer. More... | |
| STD_OSTREAM & | put (STD_OSTREAM &) const |
| Put on the given stream. More... | |
| ~HxImgFtorTable () | |
| Destructor. More... | |
Static Public Methods | |
| HxImgFtorTable & | instance () |
| Access to this singleton class. More... | |
Protected Methods | |
| HxImgFtorTable () | |
| HxImgFtorTable (const HxImgFtorTable &) | |
|
|
Destructor.
00033 {
00034 #ifdef CD_TRACE
00035 HxEnvironment::instance()->outputStream()
00036 << "HxImgFtorTable::~HxImgFtorTable()" << STD_ENDL;
00037 #endif
00038 }
|
|
|
Access to this singleton class.
00046 {
00047 static HxImgFtorTable _instance;
00048 return _instance;
00049 }
|
|
||||||||||||
|
Insert a (key,functor) combination.
00053 {
00054 _map[key] = f;
00055
00056 static int entryNum = 0;
00057 static HxRegKey* entryKey
00058 = HxRegistry::instance().insertKey("/imagefunctortable/entries");
00059 HxRegKey* classKey
00060 = entryKey->insertKey(key.getClassName());
00061 HxString entryName("entry");
00062 entryName += makeString(entryNum++);
00063 classKey->insertValue(entryName, HxRegData(key.toString()));
00064
00065 ObserverList::iterator p;
00066 for (p = _observerList.begin(); p != _observerList.end(); p++)
00067 (*p)->inserted(key, *f);
00068 }
|
|
|
Find functor based on given key.
00072 {
00073 Map::iterator i;
00074 #ifdef IF_DEBUG
00075 HxEnvironment::instance()->outputStream()
00076 << "Was requested to find " << key << STD_ENDL;
00077 HxEnvironment::instance()->flush();
00078 #endif IF_DEBUG
00079 i = _map.find(key);
00080 if (i == _map.end())
00081 return 0;
00082 #ifdef IF_DEBUG
00083 HxEnvironment::instance()->outputStream()
00084 << "And indeed found" << STD_ENDL << " ==> ";
00085 HxEnvironment::instance()->flush();
00086 ((*i).second)->put(HxEnvironment::instance()->outputStream());
00087 HxEnvironment::instance()->outputStream() << STD_ENDL;
00088 HxEnvironment::instance()->flush();
00089 #endif IF_DEBUG
00090 return (*i).second;
00091 }
|
|
|
Add an image functor observer.
00095 {
00096 _observerList.push_back(observer);
00097 }
|
|
|
Put on the given stream.
00101 {
00102 Map::const_iterator i;
00103 os << "HxImgFtorTable" << STD_ENDL;
00104 for(i = _map.begin();i != _map.end();i++)
00105 {
00106 os << (*i).first << STD_ENDL;
00107 }
00108 return os;
00109 }
|
1.2.12 written by Dimitri van Heesch,
© 1997-2001