Nemo  2.4.2
Simulate forward-in-time genetic evolution in a spatially explicit, individual-based stochastic simulator
binarydatasaver.h
Go to the documentation of this file.
1 
27 #ifndef BINARYDATASAVER_H
28 #define BINARYDATASAVER_H
29 
30 #include <string>
31 #include <map>
32 #include "lifecycleevent.h"
33 #include "filehandler.h"
34 #include "binarystoragebuffer.h"
35 
43 
44 private:
45 
47 
50  unsigned int _generation;
51 
52 // std::map<unsigned int, off_t> _offset_table;
53 
55 
56  vector< unsigned int > _occurrences;
57 
58  vector< unsigned int >::const_iterator _current_occurrence;
59 
60  int _fdesc;
61 
62  void setFileDescriptor ();
63  int getFileDescriptor () { return _fdesc;}
64 
65  void printHeader();
66  void storeData();
67  void printOffsetTable();
68  void finish();
69 
70 public:
71 
72  BinaryDataSaver ();
74 
75  static pid_t PID;
76 
77 
78  void printData();
79 
80  //implements LifeCycleEvent:
81  virtual bool setParameters ();
82  virtual void execute ();
83  virtual BinaryDataSaver* clone ( ) {return new BinaryDataSaver();}
84  //implements FileHandler:
85  virtual vector< string > ifExist( );
86  virtual void FHwrite ();
87  virtual void FHread (string& filename) {}
88  //implements SimComponent
89  virtual void loadFileServices ( FileServices* loader ) {loader->attach(this);}
90  virtual void loadStatServices ( StatServices* loader ) {}
91  virtual bool resetParameterFromSource (std::string param, SimComponent* cmpt) {return false;}
92  virtual age_t removeAgeClass ( ) {return 0;}
93  virtual age_t addAgeClass ( ) {return 0;}
94  virtual age_t requiredAgeClass () {return 0;}
95 };
96 
97 #endif
A class to handle simulation data saving in binary format.
Definition: binarydatasaver.h:42
std::string _tar_cmd
Definition: binarydatasaver.h:48
void storeData()
Definition: binarydatasaver.cc:312
BinaryStorageBuffer _buff
Definition: binarydatasaver.h:46
virtual void loadStatServices(StatServices *loader)
Definition: binarydatasaver.h:90
virtual age_t requiredAgeClass()
Definition: binarydatasaver.h:94
void finish()
Definition: binarydatasaver.cc:442
virtual void FHwrite()
Definition: binarydatasaver.cc:265
void setFileDescriptor()
Definition: binarydatasaver.cc:351
virtual void execute()
Definition: binarydatasaver.cc:217
bool _isPeriodic
Definition: binarydatasaver.h:49
static pid_t PID
Definition: binarydatasaver.h:75
void printOffsetTable()
Definition: binarydatasaver.cc:377
virtual bool resetParameterFromSource(std::string param, SimComponent *cmpt)
Definition: binarydatasaver.h:91
vector< unsigned int > _occurrences
Definition: binarydatasaver.h:56
std::string _dir
Definition: binarydatasaver.h:48
int getFileDescriptor()
Definition: binarydatasaver.h:63
virtual bool setParameters()
Definition: binarydatasaver.cc:72
unsigned int _generation
Definition: binarydatasaver.h:50
void printData()
Definition: binarydatasaver.cc:366
int _fdesc
Definition: binarydatasaver.h:60
void printHeader()
Definition: binarydatasaver.cc:288
virtual vector< string > ifExist()
Definition: binarydatasaver.cc:151
vector< unsigned int >::const_iterator _current_occurrence
Definition: binarydatasaver.h:58
off_t _offsetDataStart
Definition: binarydatasaver.h:54
~BinaryDataSaver()
Definition: binarydatasaver.h:73
virtual BinaryDataSaver * clone()
Definition: binarydatasaver.h:83
virtual void loadFileServices(FileServices *loader)
Definition: binarydatasaver.h:89
BinaryDataSaver()
Definition: binarydatasaver.cc:52
std::string _uncomp_cmd
Definition: binarydatasaver.h:48
virtual age_t addAgeClass()
Definition: binarydatasaver.h:93
virtual void FHread(string &filename)
Definition: binarydatasaver.h:87
std::string _comp_ext
Definition: binarydatasaver.h:48
virtual age_t removeAgeClass()
Definition: binarydatasaver.h:92
std::string _tar_ext
Definition: binarydatasaver.h:48
std::string _comp_cmd
Definition: binarydatasaver.h:48
A class to store any kind of data in a char buffer before unloading it in a binary data file.
Definition: binarystoragebuffer.h:42
Interface to handle file input/output for any SimComponent.
Definition: filehandler.h:51
A class to manage the files associated with each components of the simulation.
Definition: fileservices.h:50
virtual void attach(Handler *FH)
Attaches the FileHandler to the current list (_writers) of the FileServices.
Definition: fileservices.cc:59
Base class of the Life Cycle Events, declares the LCE interface.
Definition: lifecycleevent.h:71
Interface to all basic components of a simulation (traits, life cycle events, pop,...
Definition: simcomponent.h:43
The Service class used to manage the StatHandler objects.
Definition: statservices.h:48
unsigned int age_t
Age class flags.
Definition: types.h:44

Generated for Nemo v2.4.2 by  doxygen 1.9.1

Catalogued on GSR