ROSE 0.11.145.192
Public Member Functions | Protected Attributes | List of all members
MetricAttribute Class Reference

Description

Attribute corresponding to a metric.

A metric attribute represents a numeric value obtained by either dynamic analysis (gprof or hpct) or static analysis (for example number of flop operations in a function) It MetricAttribute can be a raw (observed), or a propagated (derived) count It containes no name-string, because the attribute is stored in an AttributeMechanism-map, where the name is the key.

Definition at line 411 of file AstAttributeMechanism.h.

#include <midend/astProcessing/AstAttributeMechanism.h>

Inheritance diagram for MetricAttribute:
Inheritance graph
[legend]
Collaboration diagram for MetricAttribute:
Collaboration graph
[legend]

Public Member Functions

 MetricAttribute (double value, bool is_derived=false)
 
virtual AstAttributecopy () const override
 Virtual copy constructor.
 
virtual std::string attribute_class_name () const override
 Attribute class name.
 
virtual bool isDerived () const
 
virtual double getValue () const
 
virtual void setValue (double newVal)
 
virtual std::string toString () override
 Convert an attribute to a string.
 
virtual int packed_size () override
 Packing support.
 
virtual char * packed_data () override
 Packing support.
 
virtual void unpacked_data (int size, char *data) override
 Packing support.
 
MetricAttributeoperator+= (const MetricAttribute &other)
 
MetricAttributeoperator-= (const MetricAttribute &other)
 
MetricAttributeoperator*= (const MetricAttribute &other)
 
MetricAttributeoperator/= (const MetricAttribute &other)
 
- Public Member Functions inherited from AstAttribute
virtual OwnershipPolicy getOwnershipPolicy () const
 Who owns this attribute.
 
virtual AstAttributeconstructor () const
 Virtual default constructor.
 
virtual AstAttributecopy ()
 
virtual bool commentOutNodeInGraph ()
 Eliminate IR nodes in DOT graphs.
 
virtual std::string additionalNodeOptions ()
 DOT support.
 
virtual std::vector< AttributeEdgeInfoadditionalEdgeInfo ()
 DOT support.
 
virtual std::vector< AttributeNodeInfoadditionalNodeInfo ()
 DOT support.
 

Protected Attributes

bool is_derived_
 
double value_
 

Additional Inherited Members

- Public Types inherited from AstAttribute
enum  OwnershipPolicy {
  CONTAINER_OWNERSHIP ,
  NO_OWNERSHIP ,
  CUSTOM_OWNERSHIP ,
  UNKNOWN_OWNERSHIP
}
 Who owns this attribute. More...
 

Constructor & Destructor Documentation

◆ MetricAttribute() [1/2]

MetricAttribute::MetricAttribute ( )
inline

Definition at line 417 of file AstAttributeMechanism.h.

◆ MetricAttribute() [2/2]

MetricAttribute::MetricAttribute ( double  value,
bool  is_derived = false 
)
inline

Definition at line 420 of file AstAttributeMechanism.h.

Member Function Documentation

◆ copy()

virtual AstAttribute * MetricAttribute::copy ( ) const
overridevirtual

Virtual copy constructor.

Copy-constructs a new object on the heap and returns its pointer. All subclasses must implement this in order to instantiate the correct dynamic type, although many don't. If this copy method returns a null pointer (like the base implementation) then the attribute is not copied as part of copying its container. E.g., an attribute stored in an AST will not be copied when the AST is copied if that attribute is directly derived from AstAttribute and fails to implement copy. If a subclass fails to implement copy and inherits from a class that does implement a copy that returns non-null, then the copied attribute will have an incorrect dynamic type.

It would be nice if we could make this pure virtual, but unfortunately ROSETTA-generated code fails to compile because it generates an instantiation of this interface (whether or not that code is ever executed is unkown). [Robb Matzke 2015-11-10]

Reimplemented from AstAttribute.

◆ attribute_class_name()

virtual std::string MetricAttribute::attribute_class_name ( ) const
overridevirtual

Attribute class name.

Returns the name of the dynamic type. All subclasses must implement this in order to return the correct type name, although many don't. If a subclass fails to implement this then it will return an incorrect class name.

It would be nice if this could be pure virtual, but unfortunately ROSETTA-generated code fails to compile because it generates an instantiation of this interface (whether or not that code is ever executed is unknown). [Robb Matzke 2015-11-10]

Reimplemented from AstAttribute.

◆ isDerived()

virtual bool MetricAttribute::isDerived ( ) const
inlinevirtual

Definition at line 426 of file AstAttributeMechanism.h.

◆ getValue()

virtual double MetricAttribute::getValue ( ) const
inlinevirtual

Definition at line 427 of file AstAttributeMechanism.h.

◆ setValue()

virtual void MetricAttribute::setValue ( double  newVal)
inlinevirtual

Definition at line 428 of file AstAttributeMechanism.h.

◆ toString()

virtual std::string MetricAttribute::toString ( )
overridevirtual

Convert an attribute to a string.

This is used by other components to print the value of an attribute. For example the pdf generation calls this function to print the value of an attribute in the pdf file. The default implementation is to return the attribute address in the heap as a string.

Reimplemented from AstAttribute.

◆ packed_size()

virtual int MetricAttribute::packed_size ( )
overridevirtual

Packing support.

Reimplemented from AstAttribute.

◆ packed_data()

virtual char * MetricAttribute::packed_data ( )
overridevirtual

Packing support.

Reimplemented from AstAttribute.

◆ unpacked_data()

virtual void MetricAttribute::unpacked_data ( int  size,
char *  data 
)
overridevirtual

Packing support.

Reimplemented from AstAttribute.

Member Data Documentation

◆ is_derived_

bool MetricAttribute::is_derived_
protected

Definition at line 413 of file AstAttributeMechanism.h.

◆ value_

double MetricAttribute::value_
protected

Definition at line 414 of file AstAttributeMechanism.h.


The documentation for this class was generated from the following file: