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

Generated for Nemo v2.4.0b by  doxygen 1.9.1 -- Nemo is hosted on  Download Nemo

Locations of visitors to this page
Catalogued on GSR