1 #ifndef ROSE_AstAttributeMechanism_H
2 #define ROSE_AstAttributeMechanism_H
5 #include <Sawyer/Attribute.h>
100 virtual OwnershipPolicy getOwnershipPolicy()
const;
111 : fromNode(fromNode), toNode(toNode), label(label), options(options) {}
127 : nodePtr(nodePtr), label(label), options(options) {}
182 return "AstAttribute";
190 virtual std::string toString();
195 virtual int packed_size();
196 virtual char* packed_data();
197 virtual void unpacked_data(
int size,
char* data );
203 virtual std::string additionalNodeOptions();
204 virtual std::vector<AttributeEdgeInfo> additionalEdgeInfo();
205 virtual std::vector<AttributeNodeInfo> additionalNodeInfo();
211 virtual bool commentOutNodeInGraph();
300 bool exists(
const std::string &name)
const;
342 bool replace(
const std::string &name,
AstAttribute *value);
357 AstAttribute* operator[](
const std::string &name)
const;
368 void remove(
const std::string &name);
417 : is_derived_(
false), value_(0) {}
420 : is_derived_(is_derived), value_(value) {}
425 virtual bool isDerived()
const {
return is_derived_; }
426 virtual double getValue()
const {
return value_; }
427 virtual void setValue(
double newVal) { value_ = newVal; }
429 virtual std::string
toString()
override;
471 const T&
get()
const {
return value_; }
472 T&
get() {
return value_; }
476 void set(
const T& value) { value_ = value; }
485 std::string expression;
497 return "AstRegExAttribute";
515 void setNode(
SgNode *node) {
set(node); }
526 std::vector<SgNode*> &getNodeList() {
return get(); }
527 void addNode(
SgNode *n) {
get().push_back(n); }
528 void setNode(
SgNode*,
int);
530 int size() {
return get().size(); }
541 int getValue() {
return get(); }
virtual std::string attribute_class_name() const override
Attribute class name.
AstAttributeMechanism()
Default constructor.
Support for attibutes to specify edges in the dot graphs.
@ CONTAINER_OWNERSHIP
Container owns attribute.
API and storage for attributes.
T & get()
Return the stored value by reference.
Base class for all IR node attribute values.
virtual AstAttribute * copy() const override
Virtual copy constructor.
virtual std::string toString()
Convert an attribute to a string.
AstValueAttribute(const T &value)
Constructs an attribute containing a specified value.
Attribute corresponding to a metric.
virtual AstAttribute * constructor() const
Virtual default constructor.
virtual std::string attribute_class_name() const override
Attribute class name.
virtual AstAttribute * copy() const override
Virtual copy constructor.
AstValueAttribute(const AstValueAttribute &other)
Copy constructor.
virtual char * packed_data()
Packing support.
IR node attribute that stores a copyable value.
virtual AstAttribute * copy() const
Virtual copy constructor.
const T & get() const
Return the stored value by reference.
virtual AstAttribute * copy() const override
Virtual copy constructor.
virtual void unpacked_data(int size, char *data)
Packing support.
@ CUSTOM_OWNERSHIP
Subclass defines ownership policy.
virtual std::string attribute_class_name() const
Attribute class name.
AstAttributeMechanism(const AstAttributeMechanism &other)
Copy constructor.
virtual std::string attribute_class_name() const override
Attribute class name.
This class represents the base class for all IR nodes within Sage III.
std::set< std::string > AttributeIdentifiers
Set of attribute names.
Stores named attributes in Sage IR nodes.
void set(const T &value)
Assign a new value.
T Value
Type of value this wrapper holds.
virtual AstAttribute * copy() const override
Virtual copy constructor.
virtual int packed_size()
Packing support.
Attribute containing a regex expression as a string.
AstValueAttribute()
Default constructor.
Attribute storing an SgNode.
virtual AstAttribute * copy() const override
Virtual copy constructor.
Support for adding nodes to DOT graphs.
virtual std::string attribute_class_name() const override
Attribute class name.
@ NO_OWNERSHIP
Attributes are always leaked.
virtual std::string attribute_class_name() const override
Attribute class name.
OwnershipPolicy
Who owns this attribute.