Logging into dirfile with buffer in memory. More...
#include <loggers.h>
Public Member Functions | |
| dirfilelog (string dirname0, int maxlen0) | |
| Default constructor. | |
| void | init () |
| Initialize storage. | |
| void | step () |
| Shifts storage position for another time step. | |
| void | finalize () |
| Finalize storing information. | |
| void | write_buffers (int Len) |
| Write memory storage to disk. | |
| void | from_setting (const Setting &set) |
| UI for dirfilelog (Kst file format). | |
| void | logit (int id, const vec &v) |
| log this vector | |
| void | logit (int id, const double &d) |
| log this double | |
| void | itsave (const char *fname) |
Save values into an itfile named after fname. | |
| virtual int | add (const RV &rv, string prefix="") |
| virtual string | to_string () |
| This method returns a basic info about the current instance. | |
| virtual void | to_setting (Setting &set) const |
| This method save all the instance properties into the Setting structure. | |
| virtual void | validate () |
| This method TODO. | |
Protected Attributes | |
| string | dirname |
| name of the directory | |
| Array< string > | scalarnames |
| Automatically generated. | |
| int | maxlen |
| Maximum length of vectors stored in memory. | |
| int | ind |
| Currect record to be written. | |
| Array< mat > | vectors |
| Storage. | |
| string | itfilename |
| name of it file to save results | |
| Array< RV > | entries |
| RVs of all logged variables. | |
| Array< string > | names |
| Names of logged quantities, e.g. names of algorithm variants. | |
Logging into dirfile with buffer in memory.
Dirfile is a special format used by the kst program. See documentation of kst for description.
This format is used to store scalars, hence multivariate RVs must be separated.
| bdm::dirfilelog::dirfilelog | ( | string | dirname0, | |
| int | maxlen0 | |||
| ) | [inline] |
Default constructor.
| dirname0 | name of the directory in which to store the results | |
| maxlen0 | length of the memory buffers, when full the buffers will be dumped to HDD and returned to the beginning. |
| virtual int bdm::logger::add | ( | const RV & | rv, | |
| string | prefix = "" | |||
| ) | [inline, virtual, inherited] |
returns an identifier which will be later needed for calling the logit() function For empty RV it returns -1, this entry will be ignored by logit().
References bdm::logger::entries, and bdm::logger::names.
Referenced by bdm::stateDS::log_add(), bdm::ArxDS::log_add(), bdm::BM::log_add(), and bdm::DS::log_add().
| void bdm::dirfilelog::from_setting | ( | const Setting & | set | ) | [virtual] |
UI for dirfilelog (Kst file format).
logger = { class = "dirfilelog"; dirname = "directory_for_files"; // resulting files will be stored there maxlen = 100; // size of memory buffer, when full results are written to disk }
Reimplemented from bdm::memlog.
References dirname, bdm::memlog::maxlen, and scalarnames.
| void bdm::dirfilelog::write_buffers | ( | int | Len | ) |
Write memory storage to disk.
| Len | length of buffer to be written, if 0 the file is truncated at 0. |
References bdm_assert_debug, dirname, bdm::logger::entries, bdm::memlog::maxlen, scalarnames, and bdm::memlog::vectors.
Referenced by finalize(), init(), and step().
1.6.1