Line 1... |
Line 1... |
// $Id: RlinkCommandList.cpp 576 2014-08-02 12:24:28Z mueller $
|
// $Id: RlinkCommandList.cpp 606 2014-11-24 07:08:51Z mueller $
|
//
|
//
|
// Copyright 2011-2014 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
// Copyright 2011-2014 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
|
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
|
|
// 2014-11-23 606 1.2 new rlink v4 iface
|
// 2014-08-02 576 1.1 rename LastExpect->SetLastExpect
|
// 2014-08-02 576 1.1 rename LastExpect->SetLastExpect
|
// 2013-05-06 495 1.0.3 add RlinkContext to Print() args
|
// 2013-05-06 495 1.0.3 add RlinkContext to Print() args
|
// 2013-02-03 481 1.0.2 use Rexception
|
// 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 576 2014-08-02 12:24:28Z mueller $
|
\version $Id: RlinkCommandList.cpp 606 2014-11-24 07:08:51Z mueller $
|
\brief Implemenation of class RlinkCommandList.
|
\brief Implemenation of class RlinkCommandList.
|
*/
|
*/
|
|
|
#include <string>
|
#include <string>
|
|
|
Line 50... |
Line 51... |
|
|
//------------------------------------------+-----------------------------------
|
//------------------------------------------+-----------------------------------
|
//! Default constructor
|
//! Default constructor
|
|
|
RlinkCommandList::RlinkCommandList()
|
RlinkCommandList::RlinkCommandList()
|
: fList()
|
: fList(),
|
|
fLaboIndex(-1)
|
{
|
{
|
fList.reserve(16); // should prevent most re-alloc's
|
fList.reserve(16); // should prevent most re-alloc's
|
}
|
}
|
|
|
//------------------------------------------+-----------------------------------
|
//------------------------------------------+-----------------------------------
|
Line 166... |
Line 168... |
}
|
}
|
|
|
//------------------------------------------+-----------------------------------
|
//------------------------------------------+-----------------------------------
|
//! FIXME_docs
|
//! FIXME_docs
|
|
|
size_t RlinkCommandList::AddStat()
|
size_t RlinkCommandList::AddLabo()
|
{
|
{
|
RlinkCommand* pcmd = new RlinkCommand();
|
RlinkCommand* pcmd = new RlinkCommand();
|
pcmd->CmdStat();
|
pcmd->CmdLabo();
|
return AddCommand(pcmd);
|
return AddCommand(pcmd);
|
}
|
}
|
|
|
//------------------------------------------+-----------------------------------
|
//------------------------------------------+-----------------------------------
|
//! FIXME_docs
|
//! FIXME_docs
|
Line 196... |
Line 198... |
}
|
}
|
|
|
//------------------------------------------+-----------------------------------
|
//------------------------------------------+-----------------------------------
|
//! FIXME_docs
|
//! FIXME_docs
|
|
|
void RlinkCommandList::LastVolatile()
|
|
{
|
|
size_t ncmd = fList.size();
|
|
if (ncmd == 0)
|
|
throw Rexception("RlinkCommandList::LastVolatile()",
|
|
"Bad state: list empty");
|
|
fList[ncmd-1]->SetFlagBit(RlinkCommand::kFlagVol);
|
|
return;
|
|
}
|
|
|
|
//------------------------------------------+-----------------------------------
|
|
//! FIXME_docs
|
|
|
|
void RlinkCommandList::SetLastExpect(RlinkCommandExpect* pexp)
|
void RlinkCommandList::SetLastExpect(RlinkCommandExpect* pexp)
|
{
|
{
|
size_t ncmd = fList.size();
|
size_t ncmd = fList.size();
|
if (ncmd == 0)
|
if (ncmd == 0)
|
throw Rexception("RlinkCommandList::SetLastExpect()",
|
throw Rexception("RlinkCommandList::SetLastExpect()",
|
Line 224... |
Line 213... |
//------------------------------------------+-----------------------------------
|
//------------------------------------------+-----------------------------------
|
//! FIXME_docs
|
//! FIXME_docs
|
|
|
void RlinkCommandList::Clear()
|
void RlinkCommandList::Clear()
|
{
|
{
|
|
foreach_ (RlinkCommand* pcmd, fList) { delete pcmd; }
|
fList.clear();
|
fList.clear();
|
|
fLaboIndex = -1;
|
return;
|
return;
|
}
|
}
|
|
|
//------------------------------------------+-----------------------------------
|
//------------------------------------------+-----------------------------------
|
//! FIXME_docs
|
//! FIXME_docs
|
Line 250... |
Line 240... |
void RlinkCommandList::Dump(std::ostream& os, int ind, const char* text) const
|
void RlinkCommandList::Dump(std::ostream& os, int ind, const char* text) const
|
{
|
{
|
RosFill bl(ind);
|
RosFill bl(ind);
|
os << bl << (text?text:"--") << "RlinkCommandList @ " << this << endl;
|
os << bl << (text?text:"--") << "RlinkCommandList @ " << this << endl;
|
|
|
|
os << bl << " fLaboIndex: " << fLaboIndex << endl;
|
for (size_t i=0; i<Size(); i++) {
|
for (size_t i=0; i<Size(); i++) {
|
string pref("fList[");
|
string pref("fList[");
|
pref << RosPrintf(i) << RosPrintf("]: ");
|
pref << RosPrintf(i) << RosPrintf("]: ");
|
fList[i]->Dump(os, ind+2, pref.c_str());
|
fList[i]->Dump(os, ind+2, pref.c_str());
|
}
|
}
|