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) {
23 backs_.push_back(b);
24 }
25
26 /// Deletes all tracked backends.
28 for (int i = 0; i < backs_.size(); ++i) {
29 delete backs_[i];
30 }
31 }
32
33 private:
34 std::vector<RecBackend*> backs_;
35 };
36
37 virtual ~RecBackend() {}
38
39 /// Used to pass a list of new/collected Datum objects
40 virtual void Notify(DatumList data) = 0;
41
42 /// Used to uniquely identify a backend - particularly if there are more
43 /// than one in a simulation.
44 virtual std::string Name() = 0;
45
46 /// Flushes all buffered data in the backend to its final format/location.
47 virtual void Flush() = 0;
48
49 /// Closes the backend, if approriate.
50 virtual void Close() = 0;
51};
52
53} // namespace cyclus
54
55#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:27
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:37
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