File: impedance.hh

package info (click to toggle)
sqlsmith 1.4-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 540 kB
  • sloc: cpp: 3,221; sql: 175; makefile: 33; sh: 1
file content (46 lines) | stat: -rw-r--r-- 1,382 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
/// @file
/// @brief feedback to the grammar about failed productions


#ifndef IMPEDANCE_HH
#define IMPEDANCE_HH

#include <typeinfo>
#include <map>
#include "prod.hh"
#include "util.hh"
#include "log.hh"
#include "dut.hh"

struct impedance_visitor : prod_visitor {
  std::map<const char*, long> &_occured;
  std::map<const char*, bool> found;
  virtual void visit(struct prod *p);
  impedance_visitor(std::map<const char*, long> &occured);
  virtual ~impedance_visitor();
};

struct impedance_feedback : logger {
  virtual void executed(prod &query);
  virtual void error(prod &query, const dut::failure &e);
  impedance_feedback() { }
};

namespace impedance {
  bool matched(const char *p);
  inline bool matched(const std::type_info &id) { return matched(id.name()); }
  inline bool matched(prod *p) { return matched(typeid(*p)); }
  void retry(const char *p);
  inline void retry(const std::type_info &id) { return retry(id.name()); }
  inline void retry(prod *p) { return retry(typeid(*p)); }
  void limit(const char *p);
  inline void limit(const std::type_info &id) { return limit(id.name()); }
  inline void limit(prod *p) { return limit(typeid(*p)); }
  void fail(const char *p);
  inline void fail(const std::type_info &id) { return fail(id.name()); }
  inline void fail(prod *p) { return fail(typeid(*p)); }
  void report();
  void report(std::ostream &out);
}

#endif