libspatialSEIR  0.1
Bayesian Spatial SEIR Modeling
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
IOProvider.hpp
Go to the documentation of this file.
1 #include<iostream>
2 #include<fstream>
3 #include<vector>
4 #include<cstdio>
5 #include<time.h>
6 
7 #ifndef IO_PROVIDER_INC
8 #define IO_PROVIDER_INC
9 
10 
12 #ifdef LSS_USE_STDIO
13 
14 struct LSSCout {};
15 extern LSSCout lssCout;
16 
17 template <typename T>
18  LSSCout& operator<< (LSSCout &s, const T &x) {
19  std::cout << x;
20  return s;
21  }
22 #endif
23 #ifndef LSS_USE_STDIO
24 #include <Rcpp.h>
25 /*
26 struct LSSCout {};
27 extern LSSCout lssCout;
28 
29 template <typename T>
30  LSSCout& operator<< (LSSCout &s, const T &x) {
31  Rcpp::Rcout << x;
32  return s;
33  }
34 */
35 #endif
36 
37 
38 namespace SpatialSEIR
39 {
40  //Forward declare required classes
41  class ModelContext;
42 
44  {
46  };
47 
49  {
51  int timeIndex;
52  };
53 
59  class IOProvider
60  {
61  public:
62  //methods
63  //Empty Constructor
64  IOProvider();
65  //Full Constructor
67  std::string* outFilePath,
68  int* iterationStride);
69  //Initialize
70  int populate(ModelContext* context,
71  std::string* outFilePath,
72  int* iterationStride);
73  //Methods
75  void setTrace(int locationIndex);
78  void setTrace(int locationIndex, int timeIndex);
79  int close();
80  int fileInit();
81  int catIter(int iteration);
82  ~IOProvider();
83 
84  //Attributes
87  bool* isOpen;
88  time_t* timer;
89  time_t* startTime;
90  std::vector<TimeLocationTrace*> *timeLocationTraces;
91  std::vector<LocationTrace*> *locationTraces;
92  std::ofstream* outFileStream;
93  std::string* outFilePath;
94  };
95 
96 }
97 
98 #endif
Definition: IOProvider.hpp:59
int close()
Definition: IOProvider.cpp:357
~IOProvider()
Definition: IOProvider.cpp:89
int locationIndex
Definition: IOProvider.hpp:50
ModelContext ** context
Definition: IOProvider.hpp:85
int * iterationStride
Definition: IOProvider.hpp:86
Definition: IOProvider.hpp:48
std::string * outFilePath
Definition: IOProvider.hpp:93
int locationIndex
Definition: IOProvider.hpp:45
std::vector< TimeLocationTrace * > * timeLocationTraces
Definition: IOProvider.hpp:90
int populate(ModelContext *context, std::string *outFilePath, int *iterationStride)
Definition: IOProvider.cpp:109
int timeIndex
Definition: IOProvider.hpp:51
std::ofstream * outFileStream
Definition: IOProvider.hpp:92
bool * isOpen
Definition: IOProvider.hpp:87
int fileInit()
Definition: IOProvider.cpp:130
LSSCout lssCout
Definition: IOProvider.cpp:9
Definition: IOProvider.hpp:43
IOProvider()
Definition: IOProvider.cpp:13
void setTrace(int locationIndex)
Definition: IOProvider.cpp:26
int catIter(int iteration)
Definition: IOProvider.cpp:253
Definition: ModelContext.hpp:82
time_t * timer
Definition: IOProvider.hpp:88
time_t * startTime
Definition: IOProvider.hpp:89
std::vector< LocationTrace * > * locationTraces
Definition: IOProvider.hpp:91