CYCLUS
Loading...
Searching...
No Matches
rec_backend.h
Go to the documentation of this file.
1#ifndef CYCLUS_SRC_REC_BACKEND_H_
2#define CYCLUS_SRC_REC_BACKEND_H_
3
4#include <vector>
5
6#include <boost/intrusive_ptr.hpp>
7
8#include "datum.h"
9
10namespace cyclus {
11
12typedef std::vector<Datum*> DatumList;
13
14/// An abstract base class for listeners (e.g. output databases) that want
15/// to receive data generated by the simulation.
17 public:
18 /// Convenience class for using a stack variable to auto-destruct a Recbackend
19 class Deleter {
20 public:
21 /// Add another backend b to be deleted when the Deleter is destructed.
22 void Add(RecBackend* b) { backs_.push_back(b); }
23
24 /// Deletes all tracked backends.
26 for (int i = 0; i < backs_.size(); ++i) {
27 delete backs_[i];
28 }
29 }
30
31 private:
32 std::vector<RecBackend*> backs_;
33 };
34
35 virtual ~RecBackend() {}
36
37 /// Used to pass a list of new/collected Datum objects
38 virtual void Notify(DatumList data) = 0;
39
40 /// Used to uniquely identify a backend - particularly if there are more
41 /// than one in a simulation.
42 virtual std::string Name() = 0;
43
44 /// Flushes all buffered data in the backend to its final format/location.
45 virtual void Flush() = 0;
46
47 /// Closes the backend, if approriate.
48 virtual void Close() = 0;
49};
50
51} // namespace cyclus
52
53#endif // CYCLUS_SRC_REC_BACKEND_H_
Convenience class for using a stack variable to auto-destruct a Recbackend.
Definition rec_backend.h:19
void Add(RecBackend *b)
Add another backend b to be deleted when the Deleter is destructed.
Definition rec_backend.h:22
~Deleter()
Deletes all tracked backends.
Definition rec_backend.h:25
An abstract base class for listeners (e.g.
Definition rec_backend.h:16
virtual void Flush()=0
Flushes all buffered data in the backend to its final format/location.
virtual void Close()=0
Closes the backend, if approriate.
virtual ~RecBackend()
Definition rec_backend.h:35
virtual std::string Name()=0
Used to uniquely identify a backend - particularly if there are more than one in a simulation.
virtual void Notify(DatumList data)=0
Used to pass a list of new/collected Datum objects.
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or....
Definition agent.cc:14
std::vector< Datum * > DatumList
Definition rec_backend.h:12