OverSim
cConstHashMapWatcher< KeyT, ValueT, CmpT > Class Template Reference

#include <hashWatch.h>

Public Member Functions

 cConstHashMapWatcher (const char *name, const UNORDERED_MAP< KeyT, ValueT, CmpT > &var)
const char * getClassName () const
virtual const char * getElemTypeName () const
virtual int size () const
virtual std::string at (int i) const
virtual std::string atIt () const

Protected Attributes

const UNORDERED_MAP< KeyT,
ValueT, CmpT > & 
m
UNORDERED_MAP< KeyT, ValueT,
CmpT >::const_iterator 
it
int itPos
std::string classname

Detailed Description

template<class KeyT, class ValueT, class CmpT>
class cConstHashMapWatcher< KeyT, ValueT, CmpT >

Definition at line 166 of file hashWatch.h.

Constructor & Destructor Documentation

template<class KeyT, class ValueT, class CmpT>
cConstHashMapWatcher< KeyT, ValueT, CmpT >::cConstHashMapWatcher ( const char *  name,
const UNORDERED_MAP< KeyT, ValueT, CmpT > &  var 
)
inline

Definition at line 174 of file hashWatch.h.

: cStdVectorWatcherBase(name), m(var) {
itPos=-1;
classname = std::string("unordered_map<")+opp_typename(typeid(KeyT))+","+opp_typename(typeid(ValueT))+">";
}

Member Function Documentation

template<class KeyT, class ValueT, class CmpT>
virtual std::string cConstHashMapWatcher< KeyT, ValueT, CmpT >::at ( int  i) const
inlinevirtual

Definition at line 181 of file hashWatch.h.

{
if (i==0) {
it=m.begin(); itPos=0;
} else if (i==itPos+1 && it!=m.end()) {
++it; ++itPos;
} else {
it=m.begin();
for (int k=0; k<i && it!=m.end(); k++) ++it;
itPos=i;
}
if (it==m.end()) {
return std::string("out of bounds");
}
return atIt();
}
template<class KeyT, class ValueT, class CmpT>
virtual std::string cConstHashMapWatcher< KeyT, ValueT, CmpT >::atIt ( ) const
inlinevirtual

Definition at line 196 of file hashWatch.h.

{
std::stringstream out;
out << it->first << " ==> " << it->second;
return out.str();
}
template<class KeyT, class ValueT, class CmpT>
const char* cConstHashMapWatcher< KeyT, ValueT, CmpT >::getClassName ( ) const
inline

Definition at line 178 of file hashWatch.h.

{return classname.c_str();}
template<class KeyT, class ValueT, class CmpT>
virtual const char* cConstHashMapWatcher< KeyT, ValueT, CmpT >::getElemTypeName ( ) const
inlinevirtual

Definition at line 179 of file hashWatch.h.

{return "struct pair<*,*>";}
template<class KeyT, class ValueT, class CmpT>
virtual int cConstHashMapWatcher< KeyT, ValueT, CmpT >::size ( ) const
inlinevirtual

Definition at line 180 of file hashWatch.h.

{return m.size();}

Member Data Documentation

template<class KeyT, class ValueT, class CmpT>
std::string cConstHashMapWatcher< KeyT, ValueT, CmpT >::classname
protected

Definition at line 172 of file hashWatch.h.

template<class KeyT, class ValueT, class CmpT>
UNORDERED_MAP<KeyT,ValueT,CmpT>::const_iterator cConstHashMapWatcher< KeyT, ValueT, CmpT >::it
mutableprotected

Definition at line 170 of file hashWatch.h.

template<class KeyT, class ValueT, class CmpT>
int cConstHashMapWatcher< KeyT, ValueT, CmpT >::itPos
mutableprotected

Definition at line 171 of file hashWatch.h.

template<class KeyT, class ValueT, class CmpT>
const UNORDERED_MAP<KeyT,ValueT,CmpT>& cConstHashMapWatcher< KeyT, ValueT, CmpT >::m
protected

Definition at line 169 of file hashWatch.h.


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