libdballe 9.6
msgapi.h
1#ifndef DBALLE_FORTRAN_MSGAPI_H
2#define DBALLE_FORTRAN_MSGAPI_H
3
4#include "commonapi.h"
5#include <dballe/fwd.h>
6#include <dballe/msg/fwd.h>
7#include <dballe/core/defs.h>
8
9namespace wreport {
10struct Var;
11}
12
13namespace dballe {
14namespace fortran {
15
17{
18protected:
19 enum {
20 STATE_BLANK = 1,
21 STATE_QUANTESONO = 2,
22 STATE_VOGLIOQUESTO = 4,
23 STATE_EOF = 8,
24 };
25 File* file;
30 unsigned int state;
34 std::string exporter_template;
36 Exporter* exporter = nullptr;
37 size_t curmsgidx;
44
45
52
53
54public:
56 std::shared_ptr<impl::Message> wmsg = nullptr;
58 std::vector<std::shared_ptr<dballe::Message>>* msgs = nullptr;
59
69 MsgAPI(const char* fname, const char* mode, const char* type);
70 virtual ~MsgAPI();
71
75 const impl::Message* curmsg() const;
77 void flushSubset();
78 void flushMessage();
79 void set_exporter(const char* template_name);
80
81 void reinit_db(const char* repinfofile=0) override;
82 int query_stations() override;
83 int query_data() override;
84 void insert_data() override;
85 void remove_data() override;
86 void remove_all() override;
87 void messages_open_input(const char* filename, const char* mode, Encoding format, bool) override;
88 void messages_open_output(const char* filename, const char* mode, Encoding format) override;
89 bool messages_read_next() override;
90 void messages_write_next(const char*) override;
91};
92
93}
94}
95#endif
Message exporter interface.
Definition: exporter.h:67
File object for doing I/O on binary message streams.
Definition: file.h:18
Message importer interface.
Definition: importer.h:72
Common implementation of the set* and enq* machinery using input and output records.
Definition: commonapi.h:153
Definition: msgapi.h:17
const impl::Message * curmsg() const
Get a pointer to the current message being read or written.
int cached_cat
Category set for the message that we are writing.
Definition: msgapi.h:39
std::string exporter_template
Name of the last exporter template set.
Definition: msgapi.h:34
Exporter * exporter
Exporter (NULL if we import)
Definition: msgapi.h:36
int cached_lcat
Local category set for the message that we are writing.
Definition: msgapi.h:43
bool readNextMessage()
Read the next message.
Importer * importer
Importer (NULL if we export)
Definition: msgapi.h:32
std::vector< std::shared_ptr< dballe::Message > > * msgs
Message being written.
Definition: msgapi.h:58
std::shared_ptr< impl::Message > wmsg
Message subset being written.
Definition: msgapi.h:56
int cached_subcat
Subcategory set for the message that we are writing.
Definition: msgapi.h:41
unsigned int state
State flag to track what actions have been performed in order to decide what to do next.
Definition: msgapi.h:30
MsgAPI(const char *fname, const char *mode, const char *type)
Storage for related physical data.
Definition: msg.h:131
Common definitions.