#include <IdKey.h>
Public Methods | |
| IdKey (const Identifier id) | |
| Construct an IdKey from an Identifier. More... | |
| IdKey (const std::deque< unsigned int > id) | |
| Construct an IdKey from a deque. More... | |
| IdKey () | |
| ~IdKey () | |
Private Types | |
| typedef std::vector< unsigned int >::const_iterator | KeyIt |
Private Methods | |
| template<class Container> void | fillFrom (const Container &con) |
| template function which does the actual work of building the new IdKey. More... | |
Private Attributes | |
| std::vector< unsigned int > | m_key |
| Compressed identifier is stored in /a m_key. More... | |
Friends | |
| class | ltkey |
Definition at line 15 of file IdKey.h.
|
|
|
|
|
Construct an IdKey from an Identifier.
Definition at line 12 of file IdKey.cxx. References fillFrom().
00012 {
00013 fillFrom(id);
00014 }
|
|
|
Construct an IdKey from a deque.
Definition at line 16 of file IdKey.cxx. References fillFrom().
00016 {
00017 fillFrom(id);
00018 }
|
|
|
Definition at line 23 of file IdKey.h.
00023 {}
|
|
|
Definition at line 83 of file IdKey.cxx. References m_key.
|
|
||||||||||
|
template function which does the actual work of building the new IdKey. In principle it could be instantiated for any container whose value type is unsigned int. Definition at line 24 of file IdKey.cxx. References m_key. Referenced by IdKey().
00024 {
00025
00026 typename Container::const_iterator start = con.begin();
00027 typename Container::const_iterator stop = con.end();
00028
00029 const unsigned int inSize = con.size();
00030
00031 m_key.reserve((inSize + 3) / 4);
00032 unsigned int out = 0;
00033 unsigned int iByte = 0;
00034
00035 typename Container::const_iterator inIt = start;
00036
00037 for (; inIt != stop; ++inIt) {
00038 unsigned int cur = *inIt + 1;
00039
00040 if (cur > maxVal) {
00041 // not allowed
00042 assert(maxVal > cur);
00043 }
00044 out *= moveLeft;
00045 out += cur;
00046 iByte++;
00047 if (iByte == 4) { // store the word; re-init for next word
00048 m_key.push_back(out);
00049 out = 0;
00050 iByte = 0;
00051 }
00052 }
00053
00054 if (iByte) {
00055 while (iByte < 4) {
00056 out *= moveLeft;
00057 iByte++;
00058 }
00059 m_key.push_back(out);
00060 }
00061 }
|
|
|
|
|
|
Compressed identifier is stored in /a m_key.
|
1.2.13.1 written by Dimitri van Heesch,
© 1997-2001