| 1 |
#ifndef INCLUDED_FLOATS_ |
| 2 |
#define INCLUDED_FLOATS_ |
| 3 |
|
| 4 |
#include <string> |
| 5 |
|
| 6 |
//floats |
| 7 |
class Reader; |
| 8 |
class Writer; |
| 9 |
|
| 10 |
class Floats |
| 11 |
{ |
| 12 |
enum Action |
| 13 |
{ |
| 14 |
READ, |
| 15 |
WRITE, |
| 16 |
ERROR, |
| 17 |
}; |
| 18 |
|
| 19 |
Action d_action; |
| 20 |
std::string d_filename; // name of the binary file |
| 21 |
|
| 22 |
static void (Floats::*s_action[])() const; // pointers to read and write |
| 23 |
|
| 24 |
public: |
| 25 |
Floats(int argc, char **argv); |
| 26 |
void run() const; |
| 27 |
|
| 28 |
private: |
| 29 |
void read() const; |
| 30 |
Reader coRead() const; |
| 31 |
|
| 32 |
void write() const; |
| 33 |
static Writer coWrite(); |
| 34 |
|
| 35 |
}; |
| 36 |
|
| 37 |
inline void Floats::run() const |
| 38 |
{ |
| 39 |
(this->*s_action[d_action])(); |
| 40 |
} |
| 41 |
//= |
| 42 |
#endif |