Line 1... |
Line 1... |
// $Id: RlinkCommandList.cpp 380 2011-04-25 18:14:52Z mueller $
|
// $Id: RlinkCommandList.cpp 495 2013-03-06 17:13:48Z 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-05-06 495 1.0.3 add RlinkContext to Print() args
|
|
// 2013-02-03 481 1.0.2 use Rexception
|
// 2011-04-25 380 1.0.1 use boost/foreach
|
// 2011-04-25 380 1.0.1 use boost/foreach
|
// 2011-03-05 366 1.0 Initial version
|
// 2011-03-05 366 1.0 Initial version
|
// 2011-01-15 355 0.1 First draft
|
// 2011-01-15 355 0.1 First draft
|
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
|
|
/*!
|
/*!
|
\file
|
\file
|
\version $Id: RlinkCommandList.cpp 380 2011-04-25 18:14:52Z mueller $
|
\version $Id: RlinkCommandList.cpp 495 2013-03-06 17:13:48Z mueller $
|
\brief Implemenation of class RlinkCommandList.
|
\brief Implemenation of class RlinkCommandList.
|
*/
|
*/
|
|
|
#include <string>
|
#include <string>
|
#include <stdexcept>
|
|
|
|
#include "boost/foreach.hpp"
|
#include "boost/foreach.hpp"
|
#define foreach BOOST_FOREACH
|
#define foreach_ BOOST_FOREACH
|
|
|
#include "RlinkCommandList.hpp"
|
#include "RlinkCommandList.hpp"
|
|
|
#include "librtools/RosPrintf.hpp"
|
#include "librtools/RosPrintf.hpp"
|
#include "librtools/RosFill.hpp"
|
#include "librtools/RosFill.hpp"
|
|
#include "librtools/Rexception.hpp"
|
|
|
using namespace std;
|
using namespace std;
|
using namespace Retro;
|
|
|
|
/*!
|
/*!
|
\class Retro::RlinkCommandList
|
\class Retro::RlinkCommandList
|
\brief FIXME_docs
|
\brief FIXME_docs
|
*/
|
*/
|
|
|
|
// all method definitions in namespace Retro
|
|
namespace Retro {
|
|
|
//------------------------------------------+-----------------------------------
|
//------------------------------------------+-----------------------------------
|
//! Default constructor
|
//! Default constructor
|
|
|
RlinkCommandList::RlinkCommandList()
|
RlinkCommandList::RlinkCommandList()
|
: fList()
|
: fList()
|
Line 64... |
Line 68... |
//------------------------------------------+-----------------------------------
|
//------------------------------------------+-----------------------------------
|
//! Destructor
|
//! Destructor
|
|
|
RlinkCommandList::~RlinkCommandList()
|
RlinkCommandList::~RlinkCommandList()
|
{
|
{
|
foreach (RlinkCommand* pcmd, fList) { delete pcmd; }
|
foreach_ (RlinkCommand* pcmd, fList) { delete pcmd; }
|
}
|
}
|
|
|
//------------------------------------------+-----------------------------------
|
//------------------------------------------+-----------------------------------
|
//! FIXME_docs
|
//! FIXME_docs
|
|
|
Line 194... |
Line 198... |
//! FIXME_docs
|
//! FIXME_docs
|
|
|
void RlinkCommandList::LastVolatile()
|
void RlinkCommandList::LastVolatile()
|
{
|
{
|
if (fList.size() == 0)
|
if (fList.size() == 0)
|
throw out_of_range("RlinkCommandList::LastExpect: list empty");
|
throw Rexception("RlinkCommandList::LastVolatile()",
|
|
"Bad state: list empty");
|
fList[fList.size()-1]->SetFlagBit(RlinkCommand::kFlagVol);
|
fList[fList.size()-1]->SetFlagBit(RlinkCommand::kFlagVol);
|
return;
|
return;
|
}
|
}
|
|
|
//------------------------------------------+-----------------------------------
|
//------------------------------------------+-----------------------------------
|
//! FIXME_docs
|
//! FIXME_docs
|
|
|
void RlinkCommandList::LastExpect(RlinkCommandExpect* exp)
|
void RlinkCommandList::LastExpect(RlinkCommandExpect* exp)
|
{
|
{
|
if (fList.size() == 0)
|
if (fList.size() == 0)
|
throw out_of_range("RlinkCommandList::LastExpect: list empty");
|
throw Rexception("RlinkCommandList::LastExpect()",
|
|
"Bad state: list empty");
|
fList[fList.size()-1]->SetExpect(exp);
|
fList[fList.size()-1]->SetExpect(exp);
|
return;
|
return;
|
}
|
}
|
|
|
//------------------------------------------+-----------------------------------
|
//------------------------------------------+-----------------------------------
|
Line 223... |
Line 229... |
}
|
}
|
|
|
//------------------------------------------+-----------------------------------
|
//------------------------------------------+-----------------------------------
|
//! FIXME_docs
|
//! FIXME_docs
|
|
|
void RlinkCommandList::Print(std::ostream& os, const RlinkAddrMap* pamap,
|
void RlinkCommandList::Print(std::ostream& os, const RlinkContext& cntx,
|
size_t abase, size_t dbase, size_t sbase) const
|
const RlinkAddrMap* pamap, size_t abase,
|
|
size_t dbase, size_t sbase) const
|
{
|
{
|
foreach (RlinkCommand* pcmd, fList) {
|
foreach_ (RlinkCommand* pcmd, fList) {
|
pcmd->Print(os, pamap, abase, dbase, sbase);
|
pcmd->Print(os, cntx, pamap, abase, dbase, sbase);
|
}
|
}
|
return;
|
return;
|
}
|
}
|
|
|
//------------------------------------------+-----------------------------------
|
//------------------------------------------+-----------------------------------
|
Line 257... |
Line 264... |
RlinkCommandList&
|
RlinkCommandList&
|
Retro::RlinkCommandList::operator=( const RlinkCommandList& rhs)
|
Retro::RlinkCommandList::operator=( const RlinkCommandList& rhs)
|
{
|
{
|
if (&rhs == this) return *this;
|
if (&rhs == this) return *this;
|
|
|
foreach (RlinkCommand* pcmd, fList) { delete pcmd; }
|
foreach_ (RlinkCommand* pcmd, fList) { delete pcmd; }
|
fList.clear();
|
fList.clear();
|
for (size_t i=0; i<rhs.Size(); i++) AddCommand(rhs[i]);
|
for (size_t i=0; i<rhs.Size(); i++) AddCommand(rhs[i]);
|
return *this;
|
return *this;
|
}
|
}
|
|
|
Line 279... |
Line 286... |
const Retro::RlinkCommand& Retro::RlinkCommandList::operator[](size_t ind) const
|
const Retro::RlinkCommand& Retro::RlinkCommandList::operator[](size_t ind) const
|
{
|
{
|
return *fList.at(ind);
|
return *fList.at(ind);
|
}
|
}
|
|
|
//------------------------------------------+-----------------------------------
|
} // end namespace Retro
|
#if (defined(Retro_NoInline) || defined(Retro_RlinkCommandList_NoInline))
|
|
#define inline
|
|
#include "RlinkCommandList.ipp"
|
|
#undef inline
|
|
#endif
|
|
|
|
No newline at end of file
|
No newline at end of file
|