Line 1... |
Line 1... |
// $Id: RlinkAddrMap.cpp 434 2011-12-02 19:17:38Z mueller $
|
// $Id: RlinkAddrMap.cpp 492 2013-02-24 22:14:47Z mueller $
|
//
|
//
|
// Copyright 2011- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
// Copyright 2011-2013 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
//
|
//
|
// This program is free software; you may redistribute and/or modify it under
|
// This program is free software; you may redistribute and/or modify it under
|
// the terms of the GNU General Public License as published by the Free
|
// the terms of the GNU General Public License as published by the Free
|
// Software Foundation, either version 2, or at your option any later version.
|
// Software Foundation, either version 2, or at your option any later version.
|
//
|
//
|
Line 11... |
Line 11... |
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
// for complete details.
|
// for complete details.
|
//
|
//
|
// Revision History:
|
// Revision History:
|
// Date Rev Version Comment
|
// Date Rev Version Comment
|
|
// 2013-02-03 481 1.0.2 use Rexception
|
// 2011-11-28 434 1.0.1 Print(): use proper cast for lp64 compatibility
|
// 2011-11-28 434 1.0.1 Print(): use proper cast for lp64 compatibility
|
// 2011-03-06 367 1.0 Initial version
|
// 2011-03-06 367 1.0 Initial version
|
// 2011-03-05 366 0.1 First draft
|
// 2011-03-05 366 0.1 First draft
|
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
|
|
/*!
|
/*!
|
\file
|
\file
|
\version $Id: RlinkAddrMap.cpp 434 2011-12-02 19:17:38Z mueller $
|
\version $Id: RlinkAddrMap.cpp 492 2013-02-24 22:14:47Z mueller $
|
\brief Implemenation of class RlinkAddrMap.
|
\brief Implemenation of class RlinkAddrMap.
|
*/
|
*/
|
|
|
#include <stdexcept>
|
|
#include <algorithm>
|
#include <algorithm>
|
|
|
#include "RlinkAddrMap.hpp"
|
#include "RlinkAddrMap.hpp"
|
|
|
#include "librtools/RosFill.hpp"
|
#include "librtools/RosFill.hpp"
|
#include "librtools/RosPrintf.hpp"
|
#include "librtools/RosPrintf.hpp"
|
|
#include "librtools/Rexception.hpp"
|
|
|
using namespace std;
|
using namespace std;
|
using namespace Retro;
|
|
|
|
/*!
|
/*!
|
\class Retro::RlinkAddrMap
|
\class Retro::RlinkAddrMap
|
\brief FIXME_text
|
\brief FIXME_docs
|
*/
|
*/
|
|
|
|
// all method definitions in namespace Retro
|
|
namespace Retro {
|
|
|
//------------------------------------------+-----------------------------------
|
//------------------------------------------+-----------------------------------
|
//! Default constructor
|
//! Default constructor
|
|
|
RlinkAddrMap::RlinkAddrMap()
|
RlinkAddrMap::RlinkAddrMap()
|
: fNameMap(),
|
: fNameMap(),
|
Line 88... |
Line 91... |
nmap_cit_t it = fNameMap.find(name);
|
nmap_cit_t it = fNameMap.find(name);
|
if (it == fNameMap.end()) return false;
|
if (it == fNameMap.end()) return false;
|
|
|
fMaxLength = 0; // force recalculate
|
fMaxLength = 0; // force recalculate
|
if (fNameMap.erase(name) == 0)
|
if (fNameMap.erase(name) == 0)
|
throw logic_error("RlinkAddrMap::Erase: fNameMap erase failed");
|
throw Rexception("RlinkAddrMap::Erase()",
|
|
"BugCheck: fNameMap erase failed");
|
if (fAddrMap.erase(it->second) == 0)
|
if (fAddrMap.erase(it->second) == 0)
|
throw logic_error("RlinkAddrMap::Erase: fAddrMap erase failed");
|
throw Rexception("RlinkAddrMap::Erase()",
|
|
"BugCheck: fAddrMap erase failed");
|
|
|
return true;
|
return true;
|
}
|
}
|
|
|
//------------------------------------------+-----------------------------------
|
//------------------------------------------+-----------------------------------
|
Line 105... |
Line 110... |
amap_cit_t it = fAddrMap.find(addr);
|
amap_cit_t it = fAddrMap.find(addr);
|
if (it == fAddrMap.end()) return false;
|
if (it == fAddrMap.end()) return false;
|
|
|
fMaxLength = 0; // force recalculate
|
fMaxLength = 0; // force recalculate
|
if (fAddrMap.erase(addr) == 0)
|
if (fAddrMap.erase(addr) == 0)
|
throw logic_error("RlinkAddrMap::Erase: fAddrMap erase failed");
|
throw Rexception("RlinkAddrMap::Erase()",
|
|
"BugCheck: fAddrMap erase failed");
|
if (fNameMap.erase(it->second) == 0)
|
if (fNameMap.erase(it->second) == 0)
|
throw logic_error("RlinkAddrMap::Erase: fNameMap erase failed");
|
throw Rexception("RlinkAddrMap::Erase()",
|
|
"BugCheck: fNameMap erase failed");
|
|
|
return true;
|
return true;
|
}
|
}
|
|
|
//------------------------------------------+-----------------------------------
|
//------------------------------------------+-----------------------------------
|
Line 179... |
Line 186... |
os << bl << (text?text:"--") << "RlinkAddrMap @ " << this << endl;
|
os << bl << (text?text:"--") << "RlinkAddrMap @ " << this << endl;
|
Print(os,ind+2);
|
Print(os,ind+2);
|
return;
|
return;
|
}
|
}
|
|
|
|
} // end namespace Retro
|
//------------------------------------------+-----------------------------------
|
|
#if (defined(Retro_NoInline) || defined(Retro_RlinkAddrMap_NoInline))
|
|
#define inline
|
|
#include "RlinkAddrMap.ipp"
|
|
#undef inline
|
|
#endif
|
|
|
|
No newline at end of file
|
No newline at end of file
|