libwreport  2.14
dds-printer.h
1 /*
2  * bulletin/dds-printer - Print a DDS using the interpreter
3  *
4  * Copyright (C) 2011 ARPA-SIM <urpsim@smr.arpa.emr.it>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18  *
19  * Author: Enrico Zini <enrico@enricozini.com>
20  */
21 
22 #ifndef WREPORT_BULLETIN_DDS_PRINTER_H
23 #define WREPORT_BULLETIN_DDS_PRINTER_H
24 
25 #include <wreport/bulletin.h>
26 #include <wreport/bulletin/internals.h>
27 #include <vector>
28 #include <cstdio>
29 
30 namespace wreport {
31 namespace bulletin {
32 
37 {
38  std::vector<Varcode> stack;
39  FILE* out;
40 
41  void print_context(Varinfo info, unsigned var_pos);
42  void print_context(Varcode code, unsigned var_pos);
43 
44 public:
53  DDSPrinter(const Bulletin& b, FILE* out);
54  virtual ~DDSPrinter();
55 
56  virtual void do_start_subset(unsigned subset_no, const Subset& current_subset);
57  virtual void do_attr(Varinfo info, unsigned var_pos, Varcode attr_code);
58  virtual void do_var(Varinfo info);
59  virtual const Var& do_semantic_var(Varinfo info);
60  virtual const Var& do_bitmap(Varcode code, Varcode rep_code, Varcode delayed_code, const Opcodes& ops);
61  virtual void do_char_data(Varcode code);
62  void do_associated_field(unsigned bit_count, unsigned significance);
63 
64  virtual void r_replication(Varcode code, Varcode delayed_code, const Opcodes& ops);
65  virtual void d_group_begin(Varcode code);
66  virtual void d_group_end(Varcode code);
67 };
68 
69 }
70 }
71 
72 #endif
virtual void do_char_data(Varcode code)
Request processing of C05yyy character data.
Holds a wreport variable.
Definition: var.h:50
virtual void do_attr(Varinfo info, unsigned var_pos, Varcode attr_code)
Request processing, according to info, of the attribute attr_code of the variable in position var_pos...
Intermediate representation of parsed values, ordered according to a BUFR or CREX message template...
Common bulletin::Visitor base for visitors that do not modify the bulletin.
Definition: internals.h:278
virtual const Var & do_bitmap(Varcode code, Varcode rep_code, Varcode delayed_code, const Opcodes &ops)
Request processing of a data present bitmap.
Storage for the decoded data of a BUFR or CREX message.
Definition: bulletin.h:63
bulletin::Visitor that prints the bulletin contents and its structure
Definition: dds-printer.h:36
virtual void d_group_begin(Varcode code)
Notify the start of a D group.
virtual void d_group_end(Varcode code)
Notify the end of a D group.
const Subset * current_subset
Current subset (used to refer to past variables)
Definition: internals.h:116
virtual void r_replication(Varcode code, Varcode delayed_code, const Opcodes &ops)
opcode::Visitor methods implementation
void do_associated_field(unsigned bit_count, unsigned significance)
Request processing of bit_count bits of associated field with the given significance.
virtual void do_start_subset(unsigned subset_no, const Subset &current_subset)
Notify the start of a subset.
Sequence of opcodes, as a slice of a Varcode vector.
Definition: opcode.h:50
short unsigned int Varcode
Holds the WMO variable code of a variable.
Definition: varinfo.h:78
DDSPrinter(const Bulletin &b, FILE *out)
Create a new DDS printer.
Main namespace.
Definition: buffers.h:30
Smart pointer to handle/use varinfos.
Definition: varinfo.h:336
virtual const Var & do_semantic_var(Varinfo info)
Request processing, according to info, of a data variabile that is significant for controlling the en...
Represent a BUFR/CREX data subset as a list of decoded variables.
Definition: subset.h:40
virtual void do_var(Varinfo info)
Request processing, according to info, of a data variable.