File: archiveBinary.h

package info (click to toggle)
groops 0%2Bgit20240830%2Bds-1
  • links: PTS, VCS
  • area: non-free
  • in suites: trixie
  • size: 11,052 kB
  • sloc: cpp: 134,939; fortran: 1,569; makefile: 20
file content (91 lines) | stat: -rw-r--r-- 2,485 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/***********************************************/
/**
* @file archiveBinary.h
*
* @brief Read/write archive files in binary format.
*
* @author Torsten Mayer-Guerr
* @date 2005-01-11
*
*/
/***********************************************/

#ifndef __GROOPS_ARCHIVEBINARY__
#define __GROOPS_ARCHIVEBINARY__

#include "archive.h"

/** @addtogroup archiveGroup */
/// @{

/***** CLASS ***********************************/

/** @brief Write archive files in binary format. */
class OutArchiveBinary : public OutArchive
{
public:
  OutArchiveBinary(std::ostream &_stream, const std::string &type, UInt version);
 ~OutArchiveBinary() {}

  OutArchiveBinary() = delete;
  OutArchiveBinary(const OutArchiveBinary &) = delete;
  OutArchiveBinary &operator=(const OutArchiveBinary &) = delete;

  ArchiveType archiveType() const override {return BINARY;}

protected:
  void save(const std::string &x) override;
  void save(const Int         &x) override;
  void save(const UInt        &x) override;
  void save(const Double      &x) override;
  void save(const Bool        &x) override;
  void save(const Time        &x) override;
  void save(const Angle       &x) override;
  void save(const Vector      &x) override;
  void save(const const_MatrixSlice  &x) override;
  void save(const SphericalHarmonics &x) override;
  void save(const Doodson     &x) override;
  void save(const GnssType    &x) override;

private:
  std::ostream &stream;
};

/***** CLASS ***********************************/

/** @brief Read archive files in binary format. */
class InArchiveBinary : public InArchive
{
  std::istream &stream;
  std::string  typeStr;
  UInt         _version;
  Bool         oldVersion;

public:
  InArchiveBinary(std::istream &_stream);
 ~InArchiveBinary() {}

  ArchiveType archiveType() const override {return BINARY;}
  std::string type()        const override {return typeStr;}
  UInt        version()     const override {return _version;}

protected:
  void load(std::string &x) override;
  void load(Int      &x) override;
  void load(UInt     &x) override;
  void load(Double   &x) override;
  void load(Bool     &x) override;
  void load(Time     &x) override;
  void load(Angle    &x) override;
  void load(Vector   &x) override;
  void load(Matrix   &x) override;
  void load(SphericalHarmonics &x) override;
  void load(Doodson  &x) override;
  void load(GnssType &x) override;
};

/***********************************************/

/// @}

#endif /* __GROOPS_ARCHIVEBINARY__ */