1 #ifndef CYCLUS_SRC_HDF5_BACK_H_ 2 #define CYCLUS_SRC_HDF5_BACK_H_ 9 #include "boost/filesystem.hpp" 91 virtual inline void Flush() { H5Fflush(file_, H5F_SCOPE_GLOBAL); }
99 virtual std::set<std::string>
Tables();
108 void LoadTableTypes(
std::string title, hid_t dset, hsize_t ncols);
112 hid_t CreateFLStrType(
int n);
115 void CreateTable(
Datum* d);
129 template <
typename T, DbTypes U>
130 T VLRead(
const char* rawkey);
137 template <
typename T, DbTypes U>
138 Digest VLWrite(
const T& x);
140 template <
typename T, DbTypes U>
142 return VLWrite<T, U>(x->
cast<T>());
156 hid_t VLDataset(
DbTypes dbtype,
bool forkeys);
163 void AppendVLKey(hid_t dset,
DbTypes dbtype,
const Digest& key);
173 void InsertVLVal(hid_t dset,
DbTypes dbtype,
const Digest& key,
175 void InsertVLVal(hid_t dset,
DbTypes dbtype,
const Digest& key,
181 hvl_t VLValToBuf(
const std::vector<int>& x);
182 hvl_t VLValToBuf(
const std::vector<float>& x);
183 hvl_t VLValToBuf(
const std::vector<double>& x);
184 hvl_t VLValToBuf(
const std::vector<std::string>& x);
185 hvl_t VLValToBuf(
const std::vector<cyclus::Blob>& x);
186 hvl_t VLValToBuf(
const std::vector<boost::uuids::uuid>& x);
187 hvl_t VLValToBuf(
const std::set<int>& x);
188 hvl_t VLValToBuf(
const std::set<float>& x);
189 hvl_t VLValToBuf(
const std::set<double>& x);
190 hvl_t VLValToBuf(
const std::set<std::string>& x);
191 hvl_t VLValToBuf(
const std::set<cyclus::Blob>& x);
192 hvl_t VLValToBuf(
const std::set<boost::uuids::uuid>& x);
193 hvl_t VLValToBuf(
const std::list<bool>& x);
194 hvl_t VLValToBuf(
const std::list<int>& x);
195 hvl_t VLValToBuf(
const std::list<float>& x);
196 hvl_t VLValToBuf(
const std::list<double>& x);
197 hvl_t VLValToBuf(
const std::list<std::string>& x);
198 hvl_t VLValToBuf(
const std::list<cyclus::Blob>& x);
199 hvl_t VLValToBuf(
const std::list<boost::uuids::uuid>& x);
200 hvl_t VLValToBuf(
const std::map<int, bool>& x);
201 hvl_t VLValToBuf(
const std::map<int, int>& x);
202 hvl_t VLValToBuf(
const std::map<int, float>& x);
203 hvl_t VLValToBuf(
const std::map<int, double>& x);
204 hvl_t VLValToBuf(
const std::map<int, std::string>& x);
205 hvl_t VLValToBuf(
const std::map<int, cyclus::Blob>& x);
206 hvl_t VLValToBuf(
const std::map<int, boost::uuids::uuid>& x);
207 hvl_t VLValToBuf(
const std::map<std::string, bool>& x);
208 hvl_t VLValToBuf(
const std::map<std::string, int>& x);
209 hvl_t VLValToBuf(
const std::map<std::string, float>& x);
210 hvl_t VLValToBuf(
const std::map<std::string, double>& x);
211 hvl_t VLValToBuf(
const std::map<std::string, std::string>& x);
212 hvl_t VLValToBuf(
const std::map<std::string, cyclus::Blob>& x);
213 hvl_t VLValToBuf(
const std::map<std::string, boost::uuids::uuid>& x);
214 hvl_t VLValToBuf(
const std::map<std::pair<int, std::string>,
double>& x);
215 hvl_t VLValToBuf(
const std::map<
std::string, std::vector<double>>& x);
216 hvl_t VLValToBuf(
const std::map<
std::string, std::map<int, double>>& x);
217 hvl_t VLValToBuf(
const std::map<
std::string, std::pair<
double, std::map<int, double>>>& x);
218 hvl_t VLValToBuf(
const std::map<
int, std::map<std::string, double>>& x);
219 hvl_t VLValToBuf(
const std::map<
std::string, std::vector<std::pair<
int, std::pair<std::string, std::string>>>>& x);
220 hvl_t VLValToBuf(
const std::list<std::pair<int, int>>& x);
222 hvl_t VLValToBuf(
const std::map<
std::string, std::map<std::string, int>>& x);
223 hvl_t VLValToBuf(
const std::vector<std::pair<std::pair<double, double>, std::map<std::string, double>>>& x);
224 hvl_t VLValToBuf(
const std::vector<std::pair<
int, std::pair<std::string, std::string>>>& x);
225 hvl_t VLValToBuf(
const std::map<std::pair<std::string, std::string>,
int>& x);
226 hvl_t VLValToBuf(
const std::map<
std::string, std::map<std::string, double>>& x);
233 template <
typename T>
234 T VLBufToVal(
const hvl_t& buf);
238 bool closed_ =
false;
258 std::set<hid_t> opened_types_;
265 std::map<std::string, size_t*> col_offsets_;
269 std::map<std::string, size_t*> col_sizes_;
272 std::map<std::string, size_t> schema_sizes_;
277 std::map<std::string, DbTypes*> schemas_;
281 std::map<std::string, hid_t> vldatasets_;
284 std::map<DbTypes, hid_t> vldts_;
287 std::map<DbTypes, std::set<Digest> > vlkeys_;
294 #endif // CYCLUS_SRC_HDF5_BACK_H_
virtual void Notify(DatumList data)
Used to pass a list of new/collected Datum objects.
Interface implemented by backends that support recording and querying.
Meta data and results of a query.
DbTypes
This is the master list of all supported database types.
virtual void Flush()
Flushes all buffered data in the backend to its final format/location.
An Recorder backend that writes data to an hdf5 file.
virtual std::list< ColumnInfo > Schema(std::string table)
Return information about all columns of a table.
Used to specify and send a collection of key-value pairs to the Recorder for recording.
The digest type for SHA1s.
virtual std::string Name()
Used to uniquely identify a backend - particularly if there are more than one in a simulation...
virtual void Close()
Closes and flushes the backend.
Hdf5Back(std::string path)
Creates a new backend writing data to the specified file.
virtual std::map< std::string, DbTypes > ColumnTypes(std::string table)
Return a map of column names of the specified table to the associated database type.
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or.org/Osi/browser/trunk.
virtual ~Hdf5Back()
cleans up resources and closes the file.
std::vector< Datum * > DatumList
virtual std::set< std::string > Tables()
Return a set of all table names currently in the database.
virtual QueryResult Query(std::string table, std::vector< Cond > *conds)
Return a set of rows from the specificed table that match all given conditions.