EGSnrc C++ class library  Report PIRS-898 (2021)
Iwan Kawrakow, Ernesto Mainegra-Hing, Frederic Tessier, Reid Townson and Blake Walters
egs_ausgab_object.h
Go to the documentation of this file.
1 /*
2 ###############################################################################
3 #
4 # EGSnrc egs++ ausgab object headers
5 # Copyright (C) 2015 National Research Council Canada
6 #
7 # This file is part of EGSnrc.
8 #
9 # EGSnrc is free software: you can redistribute it and/or modify it under
10 # the terms of the GNU Affero General Public License as published by the
11 # Free Software Foundation, either version 3 of the License, or (at your
12 # option) any later version.
13 #
14 # EGSnrc is distributed in the hope that it will be useful, but WITHOUT ANY
15 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 # FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
17 # more details.
18 #
19 # You should have received a copy of the GNU Affero General Public License
20 # along with EGSnrc. If not, see <http://www.gnu.org/licenses/>.
21 #
22 ###############################################################################
23 #
24 # Author: Iwan Kawrakow, 2009
25 #
26 # Contributors:
27 #
28 ###############################################################################
29 */
30 
31 
37 #ifndef EGS_AUSGAB_OBJECT_
38 #define EGS_AUSGAB_OBJECT_
39 
40 #include "egs_application.h"
41 #include "egs_object_factory.h"
42 
43 #include <string>
44 #include <iostream>
45 using namespace std;
46 
61 class EGS_Input;
62 class EGS_Application;
63 
65 
66 public:
67 
69  EGS_AusgabObject(const string &Name="", EGS_ObjectFactory *f = 0) : EGS_Object(Name,f), app(0) {};
70 
80  EGS_AusgabObject(EGS_Input *input, EGS_ObjectFactory *f = 0) : EGS_Object(input,f), app(0) {};
81 
82  virtual ~EGS_AusgabObject() {};
83 
90  virtual int processEvent(EGS_Application::AusgabCall iarg) = 0;
91  virtual int processEvent(EGS_Application::AusgabCall iarg, int ir) {
92  return 0;
93  };
94 
100  virtual bool needsCall(EGS_Application::AusgabCall iarg) const {
101  return false;
102  };
103 
105  virtual void setApplication(EGS_Application *App) {
106  app = App;
107  };
108 
110  virtual void setCurrentCase(EGS_I64 ncase) {};
111 
117  const char *getObjectDescription() const {
118  return description.c_str();
119  };
120 
129  virtual bool storeState(ostream &data_out) const {
130  return true;
131  };
132 
142  virtual bool setState(istream &data_in) {
143  return true;
144  };
145 
154  virtual bool addState(istream &data_in) {
155  return true;
156  };
157 
169  virtual void resetCounter() {};
170 
177  virtual void reportResults() {};
178 
198  static void createAusgabObjects(EGS_Input *);
199 
208  static EGS_AusgabObject *getAusgabObject(const string &Name);
209 
217  static void addKnownAusgabObject(EGS_AusgabObject *o);
218 
227  static void addKnownTypeId(const char *name);
228 
230  static int nObjects();
231 
233  static EGS_AusgabObject *getObject(int j);
234 
235 protected:
236 
242  string description;
243 
246 
247 };
248 
249 #endif
Base egspp object.
#define EGS_EXPORT
Export symbols from the egspp library.
Definition: egs_libconfig.h:90
string description
A short ausgab object description.
virtual bool storeState(ostream &data_out) const
Store the source state into the stream data_out.
AusgabCall
Possible calls to the user scoring function ausgab().
virtual void resetCounter()
Reset the ausgab object state.
const char * getObjectDescription() const
Get a short description of this ausgab object.
virtual bool needsCall(EGS_Application::AusgabCall iarg) const
Is the ausgab call iarg relevant for this object?
EGS_AusgabObject(const string &Name="", EGS_ObjectFactory *f=0)
Construct an ausgab object named Name.
virtual bool setState(istream &data_in)
Set the ausgab object state based on data from the stream data_in.
virtual void reportResults()
Report results.
An object factory.
virtual bool addState(istream &data_in)
Add data from the stream data_in to the ausgab object state.
EGS_AusgabObject(EGS_Input *input, EGS_ObjectFactory *f=0)
Construct an ausgab object from the input pointed to by inp.
EGS_Object and EGS_ObjectFactory class header file.
A class for storing information in a tree-like structure of key-value pairs. This class is used throu...
Definition: egs_input.h:182
virtual void setCurrentCase(EGS_I64 ncase)
Set the current event.
virtual void setApplication(EGS_Application *App)
Set the application this object belongs to.
EGS_Application class header file.
Base class for advanced EGSnrc C++ applications.
EGS_Application * app
The application this object belongs to.