libdballe  7.21
msgapi.h
1 #ifndef FDBA_MSGAPI_H
2 #define FDBA_MSGAPI_H
3 
4 #include "commonapi.h"
5 #include <dballe/core/defs.h>
6 
7 namespace wreport {
8 struct Var;
9 }
10 
11 namespace dballe {
12 struct File;
13 struct Messages;
14 struct Msg;
15 
16 namespace msg {
17 struct Importer;
18 struct Exporter;
19 }
20 
21 namespace fortran {
22 
24 {
25 protected:
26  enum {
27  STATE_BLANK = 1,
28  STATE_QUANTESONO = 2,
29  STATE_VOGLIOQUESTO = 4,
30  STATE_EOF = 8,
31  };
32  File* file;
37  unsigned int state;
43  std::string exporter_template;
49  std::vector<wreport::Var*> vars;
54  size_t curmsgidx;
55  int iter_ctx;
56  int iter_var;
63 
64 
70  bool readNextMessage();
71 
77  bool incrementMsgIters();
78 
82  Msg* curmsg();
83 
84  void flushVars();
85  void flushSubset();
86  void flushMessage();
87 
88 public:
98  MsgAPI(const char* fname, const char* mode, const char* type);
99  virtual ~MsgAPI();
100 
101  virtual void scopa(const char* repinfofile = 0);
102 
103  virtual int quantesono();
104  virtual void elencamele();
105 
106  virtual int voglioquesto();
107  virtual const char* dammelo();
108 
109  virtual void prendilo();
110  virtual void dimenticami();
111 
112  virtual int voglioancora();
113 
114  virtual void critica();
115  virtual void scusa();
116  virtual void remove_all();
117  virtual void messages_open_input(const char* filename, const char* mode, File::Encoding format, bool);
118  virtual void messages_open_output(const char* filename, const char* mode, File::Encoding format);
119  virtual bool messages_read_next();
120  virtual void messages_write_next(const char*);
121 };
122 
123 }
124 }
125 #endif
Encoding
Supported encodings.
Definition: file.h:20
std::vector< wreport::Var * > vars
Last variables written with prendilo.
Definition: msgapi.h:49
Trange vars_trange
Time range for vars.
Definition: msgapi.h:53
Level vars_level
Level for vars.
Definition: msgapi.h:51
Storage for related physical data.
Definition: msg.h:70
Common implementation of the set* and enq* machinery using input and output records.
Definition: commonapi.h:14
unsigned int state
State flag to track what actions have been performed in order to decide what to do next...
Definition: msgapi.h:37
Information on how a value has been sampled or computed with regards to time.
Definition: types.h:587
Message importer.
Definition: codec.h:32
Copyright (C) 2008–2010 ARPA-SIM urpsim@smr.arpa.emr.it
Definition: cmdline.h:17
msg::Importer * importer
Importer (NULL if we export)
Definition: msgapi.h:39
msg::Exporter * exporter
Exporter (NULL if we import)
Definition: msgapi.h:41
Vertical level or layer.
Definition: types.h:532
Msg * wmsg
Message subset being written.
Definition: msgapi.h:47
int cached_lcat
Local category set for the message that we are writing.
Definition: msgapi.h:62
int cached_subcat
Subcategory set for the message that we are writing.
Definition: msgapi.h:60
Ordered collection of messages.
Definition: message.h:67
Messages * msgs
Message being written.
Definition: msgapi.h:45
Message exporter.
Definition: codec.h:104
Common definitions.
std::string exporter_template
Template selected for exporter (empty if auto detect)
Definition: msgapi.h:43
int cached_cat
Category set for the message that we are writing.
Definition: msgapi.h:58
Definition: msgapi.h:23
File object for doing I/O on binary message streams.
Definition: file.h:17