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

#include <hashWatch.h>

Public Member Functions

 cStdMultiMapWatcher (const char *name, std::multimap< 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

std::multimap< KeyT, ValueT,
CmpT > & 
m
std::multimap< KeyT, ValueT,
CmpT >::iterator 
it
int itPos
std::string classname

Detailed Description

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

Definition at line 254 of file hashWatch.h.

Constructor & Destructor Documentation

template<class KeyT, class ValueT, class CmpT>
cStdMultiMapWatcher< KeyT, ValueT, CmpT >::cStdMultiMapWatcher ( const char *  name,
std::multimap< KeyT, ValueT, CmpT > &  var 
)
inline

Definition at line 262 of file hashWatch.h.

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

Member Function Documentation

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

Definition at line 269 of file hashWatch.h.

{
// std::map doesn't support random access iterator and iteration is slow,
// so we have to use a trick, knowing that Tkenv will call this function with
// i=0, i=1, etc...
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 cStdMultiMapWatcher< KeyT, ValueT, CmpT >::atIt ( ) const
inlinevirtual

Definition at line 287 of file hashWatch.h.

Referenced by cStdMultiMapWatcher< KeyT, ValueT, CmpT >::at().

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

Definition at line 266 of file hashWatch.h.

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

Definition at line 267 of file hashWatch.h.

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

Definition at line 268 of file hashWatch.h.

{return m.size();}

Member Data Documentation

template<class KeyT, class ValueT, class CmpT>
std::string cStdMultiMapWatcher< KeyT, ValueT, CmpT >::classname
protected
template<class KeyT, class ValueT, class CmpT>
std::multimap<KeyT,ValueT,CmpT>::iterator cStdMultiMapWatcher< KeyT, ValueT, CmpT >::it
mutableprotected
template<class KeyT, class ValueT, class CmpT>
int cStdMultiMapWatcher< KeyT, ValueT, CmpT >::itPos
mutableprotected
template<class KeyT, class ValueT, class CmpT>
std::multimap<KeyT,ValueT,CmpT>& cStdMultiMapWatcher< KeyT, ValueT, CmpT >::m
protected

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