This is Unofficial EPICS BASE Doxygen Site
resourceLib.h File Reference
#include <new>
#include <typeinfo>
#include <stdio.h>
#include <limits.h>
#include <string.h>
#include <math.h>
#include <assert.h>
#include "tsSLList.h"
#include "epicsString.h"
#include "libComAPI.h"
+ Include dependency graph for resourceLib.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  resTableIter< T, ID >
 
class  resTableIterConst< T, ID >
 
class  resTable< T, ID >
 
class  resTableIter< T, ID >
 
class  resTableIterConst< T, ID >
 
class  intId< T, MIN_INDEX_WIDTH, MAX_ID_WIDTH >
 
class  chronIntId
 
class  chronIntIdResTable< ITEM >
 
class  chronIntIdRes< ITEM >
 
class  stringId
 

Typedefs

typedef size_t resTableIndex
 

Functions

template<class T >
resTableIndex integerHash (unsigned MIN_INDEX_WIDTH, unsigned MAX_ID_WIDTH, const T &id)
 

Typedef Documentation

typedef size_t resTableIndex

Definition at line 45 of file resourceLib.h.

Function Documentation

template<class T >
resTableIndex integerHash ( unsigned  MIN_INDEX_WIDTH,
unsigned  MAX_ID_WIDTH,
const T &  id 
)
inline

Definition at line 1032 of file resourceLib.h.

1034 {
1035  resTableIndex hashid = static_cast <resTableIndex> ( id );
1036 
1037  //
1038  // the intent here is to gurantee that all components of the
1039  // integer contribute even if the resTableIndex returned might
1040  // index a small table.
1041  //
1042  // On most compilers the optimizer will unroll this loop so this
1043  // is actually a very small inline function
1044  //
1045  // Experiments using the microsoft compiler show that this isnt
1046  // slower than switching on the architecture size and unrolling the
1047  // loop explicitly (that solution has resulted in portability
1048  // problems in the past).
1049  //
1050  unsigned width = MAX_ID_WIDTH;
1051  do {
1052  width >>= 1u;
1053  hashid ^= hashid>>width;
1054  } while (width>MIN_INDEX_WIDTH);
1055 
1056  //
1057  // the result here is always masked to the
1058  // proper size after it is returned to the "resTable" class
1059  //
1060  return hashid;
1061 }
size_t resTableIndex
Definition: resourceLib.h:45