libwreport  2.8
internals.h
1 /*
2  * wreport/bulletin/internals - Bulletin implementation helpers
3  *
4  * Copyright (C) 2005--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_INTERNALS_H
23 #define WREPORT_BULLETIN_INTERNALS_H
24 
25 #include <wreport/varinfo.h>
26 #include <wreport/opcode.h>
27 #include <vector>
28 
29 namespace wreport {
30 struct Var;
31 struct Subset;
32 struct Bulletin;
33 
34 namespace bulletin {
35 
39 struct Bitmap
40 {
42  const Var* bitmap;
43 
48  std::vector<unsigned> refs;
49 
56  std::vector<unsigned>::const_reverse_iterator iter;
57 
69  unsigned old_anchor;
70 
71  Bitmap();
72  ~Bitmap();
73 
78  void reset();
79 
91  void init(const Var& bitmap, const Subset& subset, unsigned anchor);
92 
97  bool eob() const;
98 
103  unsigned next();
104 };
105 
110 struct Visitor : public opcode::Visitor
111 {
113  const Vartable* btable;
114 
117 
120 
123 
126 
132 
137  int c04_bits;
138 
141 
144 
151  unsigned data_pos;
152 
153 
154  Visitor();
155  virtual ~Visitor();
156 
162 
164  virtual void do_start_subset(unsigned subset_no, const Subset& current_subset);
165 
173  virtual void do_start_repetition(unsigned idx);
174 
179  virtual void do_associated_field(unsigned bit_count, unsigned significance) = 0;
180 
185  virtual void do_attr(Varinfo info, unsigned var_pos, Varcode attr_code) = 0;
186 
190  virtual void do_var(Varinfo info) = 0;
191 
202  virtual const Var& do_semantic_var(Varinfo info) = 0;
203 
219  virtual const Var& do_bitmap(Varcode code, Varcode rep_code, Varcode delayed_code, const Opcodes& ops) = 0;
220 
224  virtual void do_char_data(Varcode code) = 0;
225 
227  virtual void b_variable(Varcode code);
229  virtual void c_modifier(Varcode code);
230  virtual void c_change_data_width(Varcode code, int change);
231  virtual void c_change_data_scale(Varcode code, int change);
232  virtual void c_associated_field(Varcode code, Varcode sig_code, unsigned nbits);
233  virtual void c_char_data(Varcode code);
234  virtual void c_char_data_override(Varcode code, unsigned new_length);
235  virtual void c_quality_information_bitmap(Varcode code);
236  virtual void c_substituted_value_bitmap(Varcode code);
237  virtual void c_substituted_value(Varcode code);
238  virtual void c_local_descriptor(Varcode code, Varcode desc_code, unsigned nbits);
239  virtual void r_replication(Varcode code, Varcode delayed_code, const Opcodes& ops);
241 };
242 
248 struct BaseVisitor : public Visitor
249 {
255  unsigned current_var;
256 
259 
261  Var& get_var();
263  Var& get_var(unsigned var_pos) const;
264 
265  virtual void do_start_subset(unsigned subset_no, const Subset& current_subset);
266  virtual const Var& do_bitmap(Varcode code, Varcode rep_code, Varcode delayed_code, const Opcodes& ops);
267 };
268 
274 struct ConstBaseVisitor : public Visitor
275 {
281  unsigned current_var;
282 
285 
287  const Var& get_var();
289  const Var& get_var(unsigned var_pos) const;
290 
291  virtual void do_start_subset(unsigned subset_no, const Subset& current_subset);
292  virtual const Var& do_bitmap(Varcode code, Varcode rep_code, Varcode delayed_code, const Opcodes& ops);
293 };
294 
295 }
296 }
297 
298 #endif