COPASI API  4.16.103
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CProcessReport Class Reference

#include <CProcessReport.h>

Inheritance diagram for CProcessReport:
Inheritance graph
[legend]
Collaboration diagram for CProcessReport:
Collaboration graph
[legend]

Public Member Functions

size_t addItem (const std::string &name, const std::string &value, const std::string *pEndValue=NULL)
 
size_t addItem (const std::string &name, const C_INT32 &value, const C_INT32 *pEndValue=NULL)
 
size_t addItem (const std::string &name, const unsigned C_INT32 &value, const unsigned C_INT32 *pEndValue=NULL)
 
size_t addItem (const std::string &name, const C_FLOAT64 &value, const C_FLOAT64 *pEndValue=NULL)
 
 CProcessReport (const unsigned int &maxTime=0)
 
virtual bool finish ()
 
virtual bool finishItem (const size_t &handle)
 
virtual bool isValidHandle (const size_t handle) const
 
virtual bool proceed ()
 
virtual bool progress ()
 
virtual bool progressItem (const size_t &handle)
 
virtual bool reset ()
 
virtual bool resetItem (const size_t &handle)
 
virtual bool setName (const std::string &name)
 
virtual ~CProcessReport ()
 

Protected Member Functions

virtual size_t addItem (const std::string &name, const CCopasiParameter::Type &type, const void *pValue, const void *pEndValue=NULL)
 

Protected Attributes

std::string mName
 
CCopasiTimeVariablempEndTime
 
CVector< CProcessReportItem * > mProcessReportItemList
 

Detailed Description

Definition at line 92 of file CProcessReport.h.

Constructor & Destructor Documentation

CProcessReport::CProcessReport ( const unsigned int &  maxTime = 0)

Default Constructor

Parameters
constunsigned int & maxTime (Default: 0)

Definition at line 70 of file CProcessReport.cpp.

References CCopasiTimeVariable::getCurrentWallTime(), LLONG_CONST, mpEndTime, and mProcessReportItemList.

70  :
72  mpEndTime(NULL)
73 {
74  mProcessReportItemList[0] = NULL;
75 
76  if (maxTime > 0)
77  {
79  }
80 }
CVector< CProcessReportItem * > mProcessReportItemList
static CCopasiTimeVariable getCurrentWallTime()
Definition: CopasiTime.cpp:160
#define LLONG_CONST(n)
Definition: copasi.h:89
CCopasiTimeVariable * mpEndTime
CProcessReport::~CProcessReport ( )
virtual

Destructor

Definition at line 82 of file CProcessReport.cpp.

References mpEndTime, mProcessReportItemList, pdelete, and CVectorCore< CType >::size().

83 {
84  size_t i, imax = mProcessReportItemList.size();
85 
86  for (i = 0; i < imax; i++)
88 
90 }
#define pdelete(p)
Definition: copasi.h:215
CVector< CProcessReportItem * > mProcessReportItemList
size_t size() const
Definition: CVector.h:100
CCopasiTimeVariable * mpEndTime

Member Function Documentation

size_t CProcessReport::addItem ( const std::string &  name,
const std::string &  value,
const std::string *  pEndValue = NULL 
)

Add a process report item to to the list of reporting items. The return value is the handle of the item and can be used to indicate process, finish, or reset the item. If the method fails C_INVALID_INDEX is returned.

Parameters
conststd::string & name
conststd::string & value
conststd::string * pEndValue = NULL
Returns
size_t handle

Definition at line 92 of file CProcessReport.cpp.

References CCopasiParameter::STRING.

Referenced by CProgressBar::addItem(), addItem(), CModel::buildStoi(), CBitPatternMethod::calculate(), CBitPatternTreeMethod::calculate(), CEFMAlgorithm::calculateNextTableau(), CModel::compile(), SBMLImporter::createCModelFromSBMLDocument(), CNewtonMethod::doIntegration(), SBMLImporter::importEvents(), SBMLImporter::importInitialAssignments(), CSSAMethod::initialize(), COptMethodEP::initialize(), COptMethodDE::initialize(), COptMethodSRES::initialize(), COptMethodPS::initialize(), COptMethodGA::initialize(), COptMethodGASR::initialize(), COptMethodHookeJeeves::initialize(), COptMethodCoranaWalk::initialize(), COptMethodLevenbergMarquardt::initialize(), COptMethodNelderMead::initialize(), COptMethodSA::initialize(), CEFMAlgorithm::initialize(), COptMethodSS::initialize(), CBitPatternMethod::initialize(), CBitPatternTreeMethod::initialize(), LUfactor(), SBMLImporter::parseSBML(), SEDMLImporter::parseSEDML(), CSensMethod::process(), CScanTask::process(), CLyapTask::process(), CTrajectoryTask::process(), CTSSATask::process(), CCrossSectionTask::process(), CNewtonMethod::processNewton(), SBMLImporter::removeUnusedFunctions(), COptProblem::setCallBack(), CMIRIAMResources::updateMIRIAMResources(), and CMIRIAMResources::updateMIRIAMResourcesFromFile().

95 {
96  return addItem(name, CCopasiParameter::STRING, &value, pEndValue);
97 }
size_t addItem(const std::string &name, const std::string &value, const std::string *pEndValue=NULL)
size_t CProcessReport::addItem ( const std::string &  name,
const C_INT32 value,
const C_INT32 pEndValue = NULL 
)

Add a process report item to to the list of reporting items. The return value is the handle of the item and can be used to indicate process, finish, or reset the item. If the method fails C_INVALID_INDEX is returned.

Parameters
conststd::string & name
constC_INT32 & value
constC_INT32 * pEndValue = NULL
Returns
size_t handle

Definition at line 99 of file CProcessReport.cpp.

References addItem(), and CCopasiParameter::INT.

102 {
103  return addItem(name, CCopasiParameter::INT, &value, pEndValue);
104 }
size_t addItem(const std::string &name, const std::string &value, const std::string *pEndValue=NULL)
size_t CProcessReport::addItem ( const std::string &  name,
const unsigned C_INT32 value,
const unsigned C_INT32 pEndValue = NULL 
)

Add a process report item to to the list of reporting items. The return value is the handle of the item and can be used to indicate process, finish, or reset the item. If the method fails C_INVALID_INDEX is returned.

Parameters
conststd::string & name
constunsigned C_INT32 & value
constunsigned C_INT32 * pEndValue = NULL
Returns
size_t handle

Definition at line 106 of file CProcessReport.cpp.

References addItem(), and CCopasiParameter::UINT.

109 {
110  return addItem(name, CCopasiParameter::UINT, &value, pEndValue);
111 }
size_t addItem(const std::string &name, const std::string &value, const std::string *pEndValue=NULL)
size_t CProcessReport::addItem ( const std::string &  name,
const C_FLOAT64 value,
const C_FLOAT64 pEndValue = NULL 
)

Add a process report item to to the list of reporting items. The return value is the handle of the item and can be used to indicate process, finish, or reset the item. If the method fails C_INVALID_INDEX is returned.

Parameters
conststd::string & name
constC_FLOAT64 & value
constC_FLOAT64 * pEndValue = NULL
Returns
size_t handle

Definition at line 113 of file CProcessReport.cpp.

References addItem(), and CCopasiParameter::DOUBLE.

116 {
117  return addItem(name, CCopasiParameter::DOUBLE, &value, pEndValue);
118 }
size_t addItem(const std::string &name, const std::string &value, const std::string *pEndValue=NULL)
size_t CProcessReport::addItem ( const std::string &  name,
const CCopasiParameter::Type type,
const void pValue,
const void pEndValue = NULL 
)
protectedvirtual

Add a process report item to to the list of reporting items. The return value is the handle of the item and can be used to indicate process, finish, or reset the item. If the method fails C_INVALID_INDEX is returned.

Parameters
conststd::string & name
constCCopasiParameter::Type & type
constvoid * pValue
constvoid * pEndValue = NULL
Returns
size_t handle

Reimplemented in CProgressBar.

Definition at line 120 of file CProcessReport.cpp.

References mProcessReportItemList, CVector< CType >::resize(), and CVectorCore< CType >::size().

124 {
125  size_t i, imax = mProcessReportItemList.size();
126 
127  for (i = 0; i < imax; i++)
128  if (mProcessReportItemList[i] == NULL) break;
129 
130  size_t handle = i;
131 
132  if (i == imax) // We need to resize.
133  {
135  mProcessReportItemList.resize(2 * imax); // Note, imax is never zero
136 
137  for (i = 0; i < imax; i++) // Copy existing items
138  mProcessReportItemList[i] = tmp[i];
139 
140  imax *= 2;
141 
142  while (i < imax) mProcessReportItemList[i++] = NULL;
143  }
144 
145  mProcessReportItemList[handle] = new CProcessReportItem(name, type, pValue, pEndValue);
146  return handle;
147 }
void resize(size_t size, const bool &copy=false)
Definition: CVector.h:301
CVector< CProcessReportItem * > mProcessReportItemList
size_t size() const
Definition: CVector.h:100
bool CProcessReport::finish ( )
virtual

Indicate that all items are finished reporting. All item handles loose their validity. If the return value is false the calling process must halt execution and return.

Parameters
boolcontinue

Reimplemented in CProgressBar.

Definition at line 188 of file CProcessReport.cpp.

References finishItem(), mProcessReportItemList, and CVectorCore< CType >::size().

Referenced by CProgressBar::finish(), and main().

189 {
190  bool success = true;
191  size_t i, imax = mProcessReportItemList.size();
192 
193  for (i = 0; i < imax; i++)
194  if (mProcessReportItemList[i] && !finishItem(i)) success = false;
195 
196  return success;
197 }
CVector< CProcessReportItem * > mProcessReportItemList
virtual bool finishItem(const size_t &handle)
size_t size() const
Definition: CVector.h:100
bool CProcessReport::finishItem ( const size_t &  handle)
virtual

Indicate that item handle is finished reporting. The handle of that item is no longer valid after the call. If the return value is false the calling process must halt execution and return.

Parameters
constsize_t & handle
boolcontinue

Reimplemented in CProgressBar.

Definition at line 199 of file CProcessReport.cpp.

References isValidHandle(), mProcessReportItemList, and pdelete.

Referenced by CModel::buildStoi(), CSSAMethod::calculate(), CEFMAlgorithm::calculate(), CBitPatternMethod::calculate(), CBitPatternTreeMethod::calculate(), CEFMAlgorithm::calculateFluxModes(), CEFMAlgorithm::calculateNextTableau(), CModel::compile(), SBMLImporter::createCModelFromSBMLDocument(), CNewtonMethod::doIntegration(), finish(), CCrossSectionTask::finish(), SBMLImporter::importEvents(), SBMLImporter::importInitialAssignments(), COptMethodDE::initialize(), COptMethodGA::initialize(), COptMethodSS::initialize(), LUfactor(), COptMethodDE::optimise(), COptMethodSRES::optimise(), COptMethodSS::optimise(), COptMethodGA::optimise(), COptMethodPS::optimise(), COptMethodGASR::optimise(), COptMethodHookeJeeves::optimise(), COptMethodSA::optimise(), COptMethodCoranaWalk::optimise(), COptMethodLevenbergMarquardt::optimise(), COptMethodNelderMead::optimise(), COptMethodEP::optimise(), SBMLImporter::parseSBML(), SEDMLImporter::parseSEDML(), CSensMethod::process(), CLyapTask::process(), CTrajectoryTask::process(), CTSSATask::process(), CNewtonMethod::processNewton(), SBMLImporter::removeUnusedFunctions(), and CMIRIAMResources::updateMIRIAMResources().

200 {
201  if (!isValidHandle(handle)) return false;
202 
204  return true;
205 }
#define pdelete(p)
Definition: copasi.h:215
virtual bool isValidHandle(const size_t handle) const
CVector< CProcessReportItem * > mProcessReportItemList
bool CProcessReport::isValidHandle ( const size_t  handle) const
virtual

Check whether the handle is valid, i.e., usable in progress, reset and finish.

Definition at line 207 of file CProcessReport.cpp.

References mProcessReportItemList, and CVectorCore< CType >::size().

Referenced by CProgressBar::finishItem(), finishItem(), CProgressBar::progressItem(), progressItem(), CProgressBar::resetItem(), resetItem(), and CProgressBar::slotFinishItem().

208 {
209  return (handle < mProcessReportItemList.size() &&
210  mProcessReportItemList[handle] != NULL);
211 }
CVector< CProcessReportItem * > mProcessReportItemList
size_t size() const
Definition: CVector.h:100
bool CProcessReport::proceed ( )
virtual

Check whether processing shall proceed. If the return value is false the calling process must halt execution and return. This method is provided so that lengthy processing without advances in any of the reporting items can check whether continuation is requested.

Parameters
boolcontinue

Reimplemented in CProgressBar.

Definition at line 165 of file CProcessReport.cpp.

References CCopasiTimeVariable::getCurrentWallTime(), and mpEndTime.

Referenced by CEFMAlgorithm::calculateNextTableau(), CBitPatternTreeMethod::combine(), CBitPatternMethod::combine(), CTrajectoryTask::processStep(), CCrossSectionTask::processStep(), progress(), progressItem(), and resetItem().

166 {
167  if (mpEndTime == NULL) return true;
168 
170 }
static CCopasiTimeVariable getCurrentWallTime()
Definition: CopasiTime.cpp:160
CCopasiTimeVariable * mpEndTime
bool CProcessReport::progress ( )
virtual

Report process on all items. If the return value is false the calling process must halt execution and return.

Parameters
boolcontinue

Definition at line 149 of file CProcessReport.cpp.

References mProcessReportItemList, proceed(), progressItem(), and CVectorCore< CType >::size().

150 {
151  bool success = true;
152  size_t i, imax = mProcessReportItemList.size();
153 
154  for (i = 0; i < imax; i++)
155  if (mProcessReportItemList[i] && !progressItem(i)) success = false;
156 
157  return success && proceed();
158 }
CVector< CProcessReportItem * > mProcessReportItemList
virtual bool progressItem(const size_t &handle)
virtual bool proceed()
size_t size() const
Definition: CVector.h:100
bool CProcessReport::progressItem ( const size_t &  handle)
virtual

Report process on item handle. If the return value is false the calling process must halt execution and return.

Parameters
constsize_t & handle
boolcontinue

Reimplemented in CProgressBar.

Definition at line 160 of file CProcessReport.cpp.

References isValidHandle(), and proceed().

Referenced by CModel::buildStoi(), CFitProblem::calculate(), CBitPatternMethod::calculate(), CBitPatternTreeMethod::calculate(), COptProblem::calculate(), CFitProblem::calculateCrossValidation(), CEFMAlgorithm::calculateFluxModes(), CEFMAlgorithm::calculateNextTableau(), CBitPatternTreeMethod::combine(), CBitPatternMethod::combine(), CModel::compile(), SBMLImporter::createCModelFromSBMLDocument(), CSensMethod::do_target_calculation(), CNewtonMethod::doIntegration(), CCrossSectionTask::eventCallBack(), SBMLImporter::importEvents(), SBMLImporter::importInitialAssignments(), LUfactor(), CLyapTask::methodCallback(), COptMethodDE::optimise(), COptMethodSRES::optimise(), COptMethodSS::optimise(), COptMethodGA::optimise(), COptMethodPS::optimise(), COptMethodHookeJeeves::optimise(), COptMethodGASR::optimise(), COptMethodSA::optimise(), COptMethodNelderMead::optimise(), COptMethodLevenbergMarquardt::optimise(), COptMethodCoranaWalk::optimise(), COptMethodEP::optimise(), CTrajectoryTask::process(), CTSSATask::process(), CScanTask::processCallback(), CNewtonMethod::processNewton(), progress(), SBMLImporter::removeUnusedFunctions(), COptProblem::setSolution(), CMIRIAMResources::updateMIRIAMResources(), and CMIRIAMResources::updateMIRIAMResourcesFromFile().

161 {
162  return isValidHandle(handle) && proceed();
163 }
virtual bool isValidHandle(const size_t handle) const
virtual bool proceed()
bool CProcessReport::reset ( )
virtual

Reset all item handle. This means that the values of the items have changed but not as part of a continuous process. If you run multiple processes call reset between them. If the return value is false the calling process must halt execution and return.

Parameters
boolcontinue

Definition at line 172 of file CProcessReport.cpp.

References mProcessReportItemList, resetItem(), and CVectorCore< CType >::size().

Referenced by CProgressBar::resetItem().

173 {
174  bool success = true;
175  size_t i, imax = mProcessReportItemList.size();
176 
177  for (i = 0; i < imax; i++)
178  if (mProcessReportItemList[i] && !resetItem(i)) success = false;
179 
180  return success;
181 }
virtual bool resetItem(const size_t &handle)
CVector< CProcessReportItem * > mProcessReportItemList
size_t size() const
Definition: CVector.h:100
bool CProcessReport::resetItem ( const size_t &  handle)
virtual

Reset item handle. This means that the value of the item has changed but not as part of a continuous process. If you run multiple processes call reset between them. If the return value is false the calling process must halt execution and return.

Parameters
constsize_t & handle
boolcontinue

Reimplemented in CProgressBar.

Definition at line 183 of file CProcessReport.cpp.

References isValidHandle(), and proceed().

Referenced by reset().

184 {
185  return isValidHandle(handle) && proceed();
186 }
virtual bool isValidHandle(const size_t handle) const
virtual bool proceed()
bool CProcessReport::setName ( const std::string &  name)
virtual

Set the name of the process.

Parameters
conststd::string & name
Returns
success

Reimplemented in CProgressBar.

Definition at line 213 of file CProcessReport.cpp.

References mName.

Referenced by CModel::compile(), SBMLImporter::parseSBML(), SEDMLImporter::parseSEDML(), CSensMethod::process(), CScanTask::process(), CLyapTask::process(), CTrajectoryTask::process(), CTSSATask::process(), CCrossSectionTask::process(), CNewtonMethod::processInternal(), CProgressBar::slotSetName(), and CMIRIAMResources::updateMIRIAMResources().

214 {
215  mName = name;
216  return true;
217 }
std::string mName

Member Data Documentation

std::string CProcessReport::mName
protected

The name of the process.

Definition at line 263 of file CProcessReport.h.

Referenced by setName().

CCopasiTimeVariable* CProcessReport::mpEndTime
protected

The time the process should stop.

Definition at line 268 of file CProcessReport.h.

Referenced by CProcessReport(), proceed(), and ~CProcessReport().

CVector< CProcessReportItem * > CProcessReport::mProcessReportItemList
protected

The documentation for this class was generated from the following files: