COPASI API  4.16.103
CReport.h
Go to the documentation of this file.
1 // Copyright (C) 2010 - 2014 by Pedro Mendes, Virginia Tech Intellectual
2 // Properties, Inc., University of Heidelberg, and The University
3 // of Manchester.
4 // All rights reserved.
5 
6 // Copyright (C) 2008 - 2009 by Pedro Mendes, Virginia Tech Intellectual
7 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
8 // and The University of Manchester.
9 // All rights reserved.
10 
11 // Copyright (C) 2003 - 2007 by Pedro Mendes, Virginia Tech Intellectual
12 // Properties, Inc. and EML Research, gGmbH.
13 // All rights reserved.
14 
15 /****************************************************************************
16  *
17  * Created: Tue Aug 11 2003
18  * by: Liang Xu
19  *
20  * Created for COPASI by Liang Xu
21  ****************************************************************************/
22 
23 #ifndef COPASI_CReport
24 #define COPASI_CReport
25 
26 #include <string>
27 #include <vector>
28 #include <iostream>
29 
32 
34 
35 class CReportDefinition;
36 class CReportTable;
37 
38 class CReport : public COutputInterface
39 {
40  /**
41  * Enumeration of the report states.
42  */
43  enum State
44  {
45  Invalid = -1,
46  Compiled = 0,
56  };
57 
58 private:
60  std::ostream * mpOstream;
62 
64  std::string mTarget;
65  bool mAppend;
67 
68  std::vector< CCopasiObject * > mFooterObjectList;
69  std::vector< CCopasiObject * > mBodyObjectList;
70  std::vector< CCopasiObject * > mHeaderObjectList;
71 
75 
77 
78 public:
79  /**
80  * Default constructor.
81  */
82  CReport();
83 
84  /**
85  * Copy constructor.
86  * @param const CReport & src
87  */
88  CReport(const CReport & src);
89  /**
90  * cleanup
91  */
92  void cleanup();
93 
94  /**
95  * Destructor.
96  */
97  ~CReport();
98 
99  /**
100  * compile the object list from name vector
101  * @param std::vector< CCopasiContainer * > listOfContainer
102  * @param const CCopasiDataModel* pDataModel
103  * @return bool success
104  */
105  virtual bool compile(std::vector< CCopasiContainer * > listOfContainer, const CCopasiDataModel* pDataModel);
106 
107  /**
108  * Perform an output event for the current activity
109  * @param const Activity & activity
110  */
111  virtual void output(const Activity & activity);
112 
113  /**
114  * Introduce an additional separator into the output
115  * @param const Activity & activity
116  */
117  virtual void separate(const Activity & /* activity */);
118 
119  /**
120  * Finish the output
121  */
122  virtual void finish();
123 
124  /**
125  * Close the stream if applicable
126  */
127  virtual void close();
128 
129  /**
130  * returns the reference of the Report Tag
131  */
133 
134  /**
135  * Open the defined target stream or use the given argument
136  * @param const CCopasiDataModel * pDataModel,
137  * @param std::ostream * pOstream (default: NULL)
138  * @return std::ostream * mpOstream
139  */
140  std::ostream * open(const CCopasiDataModel * pDataModel,
141  std::ostream * pOstream = NULL);
142 
143  /**
144  * Retrieve a pointer to the ostream
145  * @return std::ostream * pOstream
146  */
147  std::ostream * getStream() const;
148 
149  /**
150  * sets the reference to the report
151  */
152  void setReportDefinition(CReportDefinition *reportDef);
153 
154  /**
155  * returns the target of the Report Tag
156  */
157  const std::string & getTarget() const;
158 
159  /**
160  * sets the reference to the report
161  * @param const std::string & target
162  */
163  void setTarget(const std::string & target);
164 
165  /**
166  * Returns whether the Report Tag is appended or not
167  * @return const bool & append
168  */
169  const bool & append() const;
170 
171  /**
172  * sets the append attribute if the report tag
173  * @param const bool & append
174  */
175  void setAppend(const bool & append);
176 
177  /**
178  * Returns whether a confirmation should be issued when overwriting a report
179  * @return const bool & confirmOverwite
180  */
181  const bool & confirmOverwrite() const;
182 
183  /**
184  * sets the confirmOverwrite attribute if the report tag
185  * @param const bool & confirmOverwrite
186  */
187  void setConfirmOverwrite(const bool & confirmOverwrite);
188 
189 private:
190  /**
191  * to print header
192  */
193  void printHeader();
194 
195  /**
196  * to print body
197  */
198  void printBody();
199 
200  /**
201  * to print footer
202  */
203  void printFooter();
204 
205  /**
206  * transfer every individual object list from name vector
207  */
209  const std::vector< CCopasiContainer * > * pListOfContainer,
210  std::vector< CCopasiObject * > & objectList,
211  CReport *& pReport,
212  const std::vector<CRegisteredObjectName>* nameVector);
213 
214  /**
215  * Compile the child report
216  * @param CReport * pReport
217  * @param std::vector< CCopasiContainer * > listOfContainer
218  * @return bool success
219  */
220  bool compileChildReport(CReport * pReport, std::vector< CCopasiContainer * > listOfContainer);
221 };
222 
223 #endif
void printFooter()
Definition: CReport.cpp:247
virtual void finish()
Definition: CReport.cpp:132
const bool & confirmOverwrite() const
Definition: CReport.cpp:101
virtual bool compile(std::vector< CCopasiContainer * > listOfContainer, const CCopasiDataModel *pDataModel)
Definition: CReport.cpp:299
bool mConfirmOverwrite
Definition: CReport.h:66
State mState
Definition: CReport.h:76
void cleanup()
Definition: CReport.cpp:73
const std::string & getTarget() const
Definition: CReport.cpp:89
std::ostream * mpOstream
Definition: CReport.h:60
void setAppend(const bool &append)
Definition: CReport.cpp:98
void setConfirmOverwrite(const bool &confirmOverwrite)
Definition: CReport.cpp:104
void printBody()
Definition: CReport.cpp:196
std::vector< CCopasiObject * > mHeaderObjectList
Definition: CReport.h:70
CReport * mpFooter
Definition: CReport.h:74
std::vector< CCopasiObject * > mFooterObjectList
Definition: CReport.h:68
const bool & append() const
Definition: CReport.cpp:95
std::string mTarget
Definition: CReport.h:64
std::ostream * getStream() const
Definition: CReport.cpp:392
bool compileChildReport(CReport *pReport, std::vector< CCopasiContainer * > listOfContainer)
Definition: CReport.cpp:429
std::vector< CCopasiObject * > mBodyObjectList
Definition: CReport.h:69
Header file of class CCopasiContainer.
void setTarget(const std::string &target)
Definition: CReport.cpp:92
CReportDefinition * mpReportDef
Definition: CReport.h:63
bool mStreamOwner
Definition: CReport.h:61
~CReport()
Definition: CReport.cpp:70
CReport()
Definition: CReport.cpp:34
std::ostream * open(const CCopasiDataModel *pDataModel, std::ostream *pOstream=NULL)
Definition: CReport.cpp:336
CReport * mpBody
Definition: CReport.h:73
virtual void close()
Definition: CReport.cpp:145
CReport * mpHeader
Definition: CReport.h:72
const CCopasiDataModel * mpDataModel
Definition: CReport.h:59
CReportDefinition * getReportDefinition()
Definition: CReport.cpp:83
void setReportDefinition(CReportDefinition *reportDef)
Definition: CReport.cpp:86
bool mAppend
Definition: CReport.h:65
void printHeader()
Definition: CReport.cpp:153
virtual void separate(const Activity &)
Definition: CReport.cpp:125
virtual void output(const Activity &activity)
Definition: CReport.cpp:107
void generateObjectsFromName(const std::vector< CCopasiContainer * > *pListOfContainer, std::vector< CCopasiObject * > &objectList, CReport *&pReport, const std::vector< CRegisteredObjectName > *nameVector)
Definition: CReport.cpp:395