ROSE  0.11.50.0
Tag.h
1 #ifndef ROSE_BinaryAnalysis_ModelChecker_Tag_H
2 #define ROSE_BinaryAnalysis_ModelChecker_Tag_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_BINARY_ANALYSIS
5 
6 #include <Rose/BinaryAnalysis/ModelChecker/Types.h>
7 
8 namespace Rose {
9 namespace BinaryAnalysis {
10 namespace ModelChecker {
11 
13 // Base class
15 
22 class Tag: public std::enable_shared_from_this<Tag> {
23 public:
24  using Ptr = TagPtr;
25 
26 private:
27  const size_t nodeStep_; // index of the step of the node to which this tag applies
28 
29 protected:
30  Tag(size_t nodeStep);
31 public:
32  virtual ~Tag();
33 
34 public:
41  size_t nodeStep() const;
42 
49  virtual std::string name() const = 0;
50 
57  virtual std::string printableName() const = 0;
58 
66  virtual void print(std::ostream&, const std::string &prefix) const = 0;
67 
74  virtual void toYaml(std::ostream&, const std::string &prefix) const = 0;
75 };
76 
78 // ThrowableTag
80 
82 struct ThrownTag {
83  Tag::Ptr tag;
84 };
85 
87 // NameTag
89 
93 class NameTag: public Tag {
94 public:
95  using Ptr = NameTagPtr;
96 
97 protected:
98  const std::string name_;
99 
100 protected:
101  explicit NameTag(size_t nodeStep, const std::string &name);
102 
103 public:
107  static Ptr instance(size_t nodeStep, const std::string &name);
108 
109 public:
110  virtual std::string name() const override;
111  virtual std::string printableName() const override;
112  virtual void print(std::ostream&, const std::string &prefix) const override;
113  virtual void toYaml(std::ostream&, const std::string &prefix) const override;
114 };
115 
116 } // namespace
117 } // namespace
118 } // namespace
119 
120 #endif
121 #endif
Exception wrapper for tags.
Definition: Tag.h:82
virtual std::string name() const =0
Property: Generic name of tag.
virtual void toYaml(std::ostream &, const std::string &prefix) const =0
Print multi-line information about the tag in YAML format.
Main namespace for the ROSE library.
virtual std::string name() const override
Property: Generic name of tag.
virtual void print(std::ostream &, const std::string &prefix) const override
Print multi-line information about the tag.
virtual void toYaml(std::ostream &, const std::string &prefix) const override
Print multi-line information about the tag in YAML format.
Information tagged to a path node.
Definition: Tag.h:22
virtual void print(std::ostream &, const std::string &prefix) const =0
Print multi-line information about the tag.
size_t nodeStep() const
Property: Node step.
Base class for tags that have a name.
Definition: Tag.h:93
virtual std::string printableName() const =0
String to identify this tag.
virtual std::string printableName() const override
String to identify this tag.
static Ptr instance(size_t nodeStep, const std::string &name)
Allocating constructor.