Inspector support for map<> with default sort.

* New: In Hurricane/Common.h, added inspector support for map<> using
    the default sort mechanism (less<>).
This commit is contained in:
Jean-Paul Chaput 2017-08-18 18:08:01 +02:00
parent e20ff9b2ed
commit 2127fa916b
2 changed files with 55 additions and 2 deletions

View File

@ -539,6 +539,58 @@ inline Hurricane::Record* getRecord ( std::list<Element>* l )
// Inspector Support for : "[const] std::map<Key,Element,Compare>*.
template<typename Key, typename Element>
inline std::string getString ( std::map<Key,Element>* m )
{
std::string name = "std::map<Element>:";
return name + getString<size_t>(m->size());
}
template<typename Key, typename Element>
inline Hurricane::Record* getRecord ( std::map<Key,Element>* m )
{
Hurricane::Record* record = NULL;
if ( !m->empty() ) {
record = new Hurricane::Record ( "std::map<Element>" );
typename std::map<Key,Element>::iterator iterator = m->begin();
while ( iterator != m->end() ) {
record->add ( getSlot<Element>(getString(iterator->first), iterator->second) );
++iterator;
}
}
return record;
}
template<typename Key, typename Element>
inline std::string getString ( const std::map<Key,Element>* m )
{
std::string name = "const std::map<Element>:";
return name + getString<size_t>(m->size());
}
template<typename Key, typename Element>
inline Hurricane::Record* getRecord ( const std::map<Key,Element>* m )
{
Hurricane::Record* record = NULL;
if ( !m->empty() ) {
record = new Hurricane::Record ( "const std::map<Element>" );
typename std::map<Key,Element>::const_iterator iterator = m->begin();
while ( iterator != m->end() ) {
record->add ( getSlot<const Element>(getString(iterator->first), iterator->second) );
++iterator;
}
}
return record;
}
// -------------------------------------------------------------------
// Inspector Support for : "[const] std::map<Key,Element,Compare>*.
template<typename Key, typename Element, typename Compare>
inline std::string getString ( std::map<Key,Element,Compare>* m )
{

View File

@ -109,10 +109,11 @@ namespace Hurricane {
if (cdebug.getMinLevel() < minLevel) minLevel = cdebug.getMinLevel();
if (cdebug.getMaxLevel() > maxLevel) maxLevel = cdebug.getMaxLevel();
if ( _singleton->_isTraced(symbol) )
if ( _singleton->_isTraced(symbol) ) {
_singleton->_levels.push( make_pair( cdebug.setMinLevel(minLevel)
, cdebug.setMaxLevel(maxLevel) ) );
else {
//cerr << "DebugSession::open() " << symbol << "min:" << minLevel << " max:" << maxLevel << endl;
} else {
_singleton->_levels.push ( make_pair( cdebug.getMinLevel()
, cdebug.getMaxLevel() ) );
}