CYCLUS
state_wrangler.h
Go to the documentation of this file.
1 #ifndef CYCLUS_SRC_STATE_WRANGLER_H_
2 #define CYCLUS_SRC_STATE_WRANGLER_H_
3 
4 #include <string>
5 
6 #include "db_init.h"
7 #include "infile_tree.h"
8 #include "query_backend.h"
9 
10 namespace cyclus {
11 
12 /// An abjstract interface that must be implemented by all simulation agents and
13 /// all agent member variables that have unexported internal state.
14 ///
15 /// These methods all do inter-related things. Notably, the InfileToDb,
16 /// InitFrom, and Snapshot methods must all write/read to/from the same database
17 /// tables (and table schemas). The InfileToDb method reads data from the
18 /// InfileTree that is first validated with the rng schema returned by the
19 /// schema method.
21  public:
22  /// Return a newly created/allocated object that is an exact copy of this.
23  /// Subclasses are expected to override the return type with their own
24  /// concrete type.
25  virtual StateWrangler* Clone() = 0;
26 
27  /// Translates info for the object from input file information to the database by reading
28  /// parameters from the passed InfileTree and recording data via the DbInit
29  /// variable. The simulation and agent id's are automatically injected in all
30  /// data transfered through di.
31  ///
32  /// Agent parameters in the InfileTree are scoped in the
33  /// "config/*" path. The superclass InitFrom expects the InfileTree
34  /// passed to it to be scoped identically to the tree passed to the agent's
35  /// InitFrom. - do NOT pass a changed-scope tree to the superclass.
36  ///
37  /// @warning this method MUST NOT modify the object's state.
38  virtual void InfileToDb(InfileTree* qe, DbInit di) = 0;
39 
40  /// Intializes an agent's internal state from an output database. Appropriate
41  /// simulation id, agent id, and time filters are automatically included in
42  /// all queries.
43  virtual void InitFrom(QueryableBackend* b) = 0;
44 
45  /// Snapshots agent-internal state to the output db via di. This method MUST
46  /// call the superclass' Snapshot method before doing any work. The simulation
47  /// and agent id's in addition to the snapshot time are automatically included
48  /// in all information transfered through di.
49  ///
50  /// @warning because a 'Time' field is automatically injected, that label
51  /// cannot be used for any other fields.
52  ///
53  /// @warning This method MUST NOT modify the agent's state.
54  virtual void Snapshot(DbInit di) = 0;
55 
56  /// Returns an object's xml rng schema for initializing from input files.
57  virtual std::string schema() = 0;
58 };
59 
60 } // namespace cyclus
61 
62 #endif // CYCLUS_SRC_STATE_WRANGLER_H_
An abjstract interface that must be implemented by all simulation agents and all agent member variabl...
virtual void InitFrom(QueryableBackend *b)=0
Intializes an agent&#39;s internal state from an output database.
double b(int nuc)
Computes the scattering length [cm] from the coherent and incoherent components.
Definition: pyne.cc:11180
A class for extracting information from a given XML parser.
Definition: infile_tree.h:22
virtual void Snapshot(DbInit di)=0
Snapshots agent-internal state to the output db via di.
virtual std::string schema()=0
Returns an object&#39;s xml rng schema for initializing from input files.
virtual StateWrangler * Clone()=0
Return a newly created/allocated object that is an exact copy of this.
DbInit provides an interface for agents to record data to the output db that automatically injects th...
Definition: db_init.h:14
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or.org/Osi/browser/trunk.
Definition: agent.cc:14
virtual void InfileToDb(InfileTree *qe, DbInit di)=0
Translates info for the object from input file information to the database by reading parameters from...
Interface implemented by backends that support rudimentary querying.