Line 1... |
Line 1... |
// $Id: Rstats.cpp 368 2011-03-12 09:58:53Z mueller $
|
// $Id: Rstats.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-03-06 367 1.0.1 use max from algorithm
|
// 2011-03-06 367 1.0.1 use max from algorithm
|
// 2011-02-06 359 1.0 Initial version
|
// 2011-02-06 359 1.0 Initial version
|
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
|
|
/*!
|
/*!
|
\file
|
\file
|
\version $Id: Rstats.cpp 368 2011-03-12 09:58:53Z mueller $
|
\version $Id: Rstats.cpp 492 2013-02-24 22:14:47Z mueller $
|
\brief Implemenation of Rstats .
|
\brief Implemenation of Rstats .
|
*/
|
*/
|
|
|
#include <stdexcept>
|
|
#include <algorithm>
|
#include <algorithm>
|
|
|
#include "Rstats.hpp"
|
#include "Rstats.hpp"
|
|
|
#include "RosFill.hpp"
|
#include "RosFill.hpp"
|
#include "RosPrintf.hpp"
|
#include "RosPrintf.hpp"
|
|
#include "Rexception.hpp"
|
|
|
using namespace std;
|
using namespace std;
|
using namespace Retro;
|
|
|
|
/*!
|
/*!
|
\class Retro::Rstats
|
\class Retro::Rstats
|
\brief FIXME_docs
|
\brief FIXME_docs
|
*/
|
*/
|
|
|
|
// all method definitions in namespace Retro
|
|
namespace Retro {
|
|
|
//------------------------------------------+-----------------------------------
|
//------------------------------------------+-----------------------------------
|
//! Default constructor
|
//! Default constructor
|
|
|
Rstats::Rstats()
|
Rstats::Rstats()
|
: fValue(),
|
: fValue(),
|
Line 143... |
Line 148... |
for (size_t i=0; i<Size(); i++) maxlen = max(maxlen, fName[i].length());
|
for (size_t i=0; i<Size(); i++) maxlen = max(maxlen, fName[i].length());
|
|
|
for (size_t i=0; i<Size(); i++) {
|
for (size_t i=0; i<Size(); i++) {
|
os << bl << " " << fName[i] << ":" << RosFill(maxlen-fName[i].length()+1)
|
os << bl << " " << fName[i] << ":" << RosFill(maxlen-fName[i].length()+1)
|
<< RosPrintf(fValue[i], "f", 12)
|
<< RosPrintf(fValue[i], "f", 12)
|
<< " \"" << fText[i] << "\"" << endl;
|
<< " '" << fText[i] << "'" << endl;
|
}
|
}
|
|
|
return;
|
return;
|
}
|
}
|
|
|
Line 169... |
Line 174... |
fPrec = rhs.fPrec;
|
fPrec = rhs.fPrec;
|
|
|
// otherwise check hash and copy only values
|
// otherwise check hash and copy only values
|
} else {
|
} else {
|
if (Size() != rhs.Size() || fHash != rhs.fHash) {
|
if (Size() != rhs.Size() || fHash != rhs.fHash) {
|
throw invalid_argument("Rstats::oper=: assign incompatible stats");
|
throw Rexception("Rstats::oper=()",
|
|
"Bad args: assign incompatible stats");
|
}
|
}
|
fValue = rhs.fValue;
|
fValue = rhs.fValue;
|
}
|
}
|
|
|
return *this;
|
return *this;
|
Line 183... |
Line 189... |
//! FIXME_docs
|
//! FIXME_docs
|
|
|
Rstats& Rstats::operator-(const Rstats& rhs)
|
Rstats& Rstats::operator-(const Rstats& rhs)
|
{
|
{
|
if (Size() != rhs.Size() || fHash != rhs.fHash) {
|
if (Size() != rhs.Size() || fHash != rhs.fHash) {
|
throw invalid_argument("Rstats::oper-: subtract incompatible stats");
|
throw Rexception("Rstats::oper-()",
|
|
"Bad args: subtract incompatible stats");
|
}
|
}
|
|
|
for (size_t i=0; i<fValue.size(); i++) {
|
for (size_t i=0; i<fValue.size(); i++) {
|
fValue[i] -= rhs.fValue[i];
|
fValue[i] -= rhs.fValue[i];
|
}
|
}
|
Line 203... |
Line 210... |
fValue[i] *= rhs;
|
fValue[i] *= rhs;
|
}
|
}
|
return *this;
|
return *this;
|
}
|
}
|
|
|
//------------------------------------------+-----------------------------------
|
} // end namespace Retro
|
#if (defined(Retro_NoInline) || defined(Retro_Rstats_NoInline))
|
|
#define inline
|
|
#include "Rstats.ipp"
|
|
#undef inline
|
|
#endif
|
|
|
|
No newline at end of file
|
No newline at end of file
|