Bridge++  Ver. 1.1.x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fieldIO.h
Go to the documentation of this file.
1 
10 #ifndef FIELDIO_INCLUDED
11 #define FIELDIO_INCLUDED
12 
13 #include <string>
14 #include <stdint.h>
15 
16 #include "field.h"
17 #include "index_lex.h"
18 #include "commonParameters.h"
19 #include "io_format.h"
20 
22 
48 class FieldIO
49 {
50  private:
52 
53  protected:
55 
57 
58  public:
59 
61  FieldIO(const IO_Format::Format *format) : m_format(format), m_vl(CommonParameters::Vlevel()) {}
62  virtual ~FieldIO() {}
63 
64  virtual void read_file(Field *v, std::string) = 0;
65  virtual void write_file(Field *v, std::string) = 0;
66 
67  void deliver(Field *vlocal, Field *vglobal);
68  void gather(Field *vglobal, Field *vlocal);
69 
70  protected:
71 
73  void byte_swap(void *buf, size_t size, size_t nmemb)
74  {
75  return convert_endian(buf, size, nmemb);
76  }
77 
79  void convert_endian(void *buf, size_t size, size_t nmemb);
80 
82  bool is_bigendian() const;
83 };
84 #endif