INFO_NODE Class Reference


Detailed Description

This class represents the attributes (information) attached to each node in a DDG.

Author:
Sid Touati
Each node (instruction) in a DDG has bsically two attributes :

In order to avoid possible bugs, the user should not try to set the internal integer node identifier. Such unique identifier is automatically created internally by the DDG library when creating a node.

Definition at line 83 of file info_node.h.


Public Member Functions

Creation


 INFO_NODE ()
 Default constructor. It constructs a node attribute with an instruction type "add_op" and and integer identifier equal to 0.
 INFO_NODE (int id, INSTRUCTIONS_TYPES opt)
 INFO_NODE (const INFO_NODE &in)
 INFO_NODE (int id, INSTRUCTIONS_TYPES opt, std::string inst_text)
Access Operations


bool check ()
 Returns OK if the object seems ok.
const int id () const
 Returns the integer identifier of the node attribute.
const INSTRUCTIONS_TYPES instruction_type () const
 Returns the instruction type of the node attribute.
std::string get_string_attribute () const
 Returns the textual attribute of the node.
int instruction_type_id () const
 Returns the id of tge instruction type of the node.
NodeFlag get_node_flag () const
 Returns the flag of the node.
Update Operations


void set_instruction_type (INSTRUCTIONS_TYPES opt)
 Sets an INSTRUCTIONS_TYPES object in the node attribute.
void set_string_attribute (std::string inst_text)
 Sets a textual attribue to the node. For instance, this textual attribute can be used to associate the textual code of the instruction.
void set_node_flag (const NodeFlag theValue)
 Set the flag of the node.

Friends

Input/Output stream operations


ostream & operator<< (ostream &os, INFO_NODE x)
 Output stream of the node attributes in the form : node_id INSTRUCTIONS_TYPES_attributes.
istream & operator>> (istream &is, INFO_NODE &x)
 Input stream of the node attribute. Reads the node id and its INSTRUCTIONS_TYPES attribute.

Constructor & Destructor Documentation

INFO_NODE ( int  id,
INSTRUCTIONS_TYPES  opt 
)

Constructor with two arguments

Parameters:
[in] id An integer identifier.
[in] opt The INSTRUCTIONS_TYPES object describing the generic instruction of the node.

INFO_NODE ( int  id,
INSTRUCTIONS_TYPES  opt,
std::string  inst_text 
)

Constructor with three arguments

Parameters:
[in] id An integer identifier.
[in] opt The INSTRUCTIONS_TYPES object describing the generic instruction of the node.
[in] inst_text The textual representation of the instruction


Member Function Documentation

void set_string_attribute ( std::string  inst_text  )  [inline]

Sets a textual attribue to the node. For instance, this textual attribute can be used to associate the textual code of the instruction.

Remarks:
  • Currently, a textual attribute is a single textual line. Hence, it should not contain the newline character \n. If such character exists in the string, the current implementation of the method replaces it by a white space.
  • Double quotes characters " should be specialized. They should be written as \" inside the string attribute.

Definition at line 162 of file info_node.h.


January 2009, by Sid Touati (Copyright INRIA and University of Versailles)