class SgAttribute

Represents the base class of attributes.

Public Methods

SgAttribute* copy()
Get a copy of an attribute. This function does not copy the data field.
void* getAttributeData()
Get the data field of an attribute.
int getAttributeSize()
Get the size of the data field of an attribute.
int getAttributeType()
Get the type of an attribute.
SgExpression* getExpression()
idem for SgExpression.
int getfileNumber()
returns the fileNumber.
SgAttribute* getInlist(int num)
return the SgAttribute node numbered "num" from this node.
SgAttribute* getNext()
The attributes attached to the same node are chained through the next value.
void* getPtToSage()
Return a pointer to sage node the attribute is attached to
SgSymbol* getSgSymbol()
idem for SgSymbol.
SgStatement* getStatement()
Return the SgStatement pointer if it exists and if the attribute is attached to an SgStatement node
SgType* getType()
idem for SgType.
typenode getTypeNode()
Get the type of the node the attribute is attached to
int listLenght()
return the number of SgAttribute nodes linked from this one.
void resetPtToSage()
Set the pointer to the Sage node to NULL.
void save(FILE *file, void (*savefunction)(void *dat, FILE *f))
void save(FILE *file)
save the private field to the file.
void* setAttributeData(void *d)
Set the data field of an attribute.
void setAttributeSize(int s)
Set the size of the data field of an attribute.
void setAttributeType(int t)
Set the type of an attribute.
void setNext(SgAttribute *s)
Set the list chaining of an attribute.
void setPtToSage(void *sa)
Set the pointer to the Sage node.
void setPtToSage(SgSymbol &st)
idem for SgSymbol.
void setPtToSage(SgExpression &st)
idem for SgExpression.
void setPtToSage(SgType &st)
idem for SgType.
void setPtToSage(SgStatement &st)
Set the pointer to the Sage node and the typeNode to be BIFNODE.
SgAttribute(int t, void *pt, int size, SgType &st, int filenum)
Constructor for SgType attribute.
SgAttribute(int t, void *pt, int size, SgSymbol &st, int filenum)
Constructor for SgSymbol attribute.
SgAttribute(int t, void *pt, int size, SgExpression &st, int filenum)
Constructor for SgExpression attribute.
SgAttribute(int t, void *pt, int size, SgStatement &st, int filenum)
Constructor for SgStatement attribute
~SgAttribute()

Private Fields

void* data
the data;
int dataSize
the size of the data in bytes to allow data to be copied;
int fileNumber
the file methods;
SgAttribute* next
to the next attribute of a statements (do that way or not??);
void* ptToSage
pointer to SgStatement, SgExpression, ... ;
int type
a label;
typenode typeNode
indicates if SgStatement, SgExpression, ... ptToSage is pointed to;

Documentation

It is possible to add information to the Sage nodes using attributes. An attribute has two values:

1.a type: user supplied types must be positive integers; negative integers are reserved for the system; the reserved types

 
  are:

        #define DEPENDENCE_ATTRIBUTE -1001
        #define INDUCTION_ATTRIBUTE -1002
        #define ACCESS_ATTRIBUTE -1003 
        #define DEPGRAPH_ATTRIBUTE -1004 
        #define USEDLIST_ATTRIBUTE -1005 
        #define DEFINEDLIST_ATTRIBUTE -1006 
        #define NOGARBAGE_ATTRIBUTE -1007 
        #define GARBAGE_ATTRIBUTE -1008 
        #define ANNOTATION_EXPR_ATTRIBUTE -1009 

 2.data: the data field is a pointer to void that can be used to store any information. 
int type
a label;

void* data
the data;

int dataSize
the size of the data in bytes to allow data to be copied;

SgAttribute* next
to the next attribute of a statements (do that way or not??);

typenode typeNode
indicates if SgStatement, SgExpression, ... ptToSage is pointed to;

void* ptToSage
pointer to SgStatement, SgExpression, ... ;

int fileNumber
the file methods;

SgAttribute(int t, void *pt, int size, SgStatement &st, int filenum)
Constructor for SgStatement attribute. The parameter t is the type of the attribute, pt a pointer to the data and size the size of the data (in bytes). This last parameter is useful if no function is given for reading and saving the attributes. The parameter st is the statement the attribute is attached to. When an attribute is created this way, it does not appear in the attributes list of the SgStatement node, but it can be added using the addAttribute(SgAttribute *att) method.

SgAttribute(int t, void *pt, int size, SgSymbol &st, int filenum)
Constructor for SgSymbol attribute.

SgAttribute(int t, void *pt, int size, SgExpression &st, int filenum)
Constructor for SgExpression attribute.

SgAttribute(int t, void *pt, int size, SgType &st, int filenum)
Constructor for SgType attribute.

~SgAttribute()

int getAttributeType()
Get the type of an attribute.

void setAttributeType(int t)
Set the type of an attribute.

void* getAttributeData()
Get the data field of an attribute.

void* setAttributeData(void *d)
Set the data field of an attribute.

int getAttributeSize()
Get the size of the data field of an attribute.

void setAttributeSize(int s)
Set the size of the data field of an attribute.

typenode getTypeNode()
Get the type of the node the attribute is attached to. The type is an enumerate:

enum typenode {BIFNODE, LLNODE, SYMBNODE, TYPENODE,...}

corresponding respectively to SgStatement, SgExpression, SgSymbol, and SgType.

void* getPtToSage()
Return a pointer to sage node the attribute is attached to. According to getTypeNode(), this value can be casted to the right type.

void setPtToSage(void *sa)
Set the pointer to the Sage node.

void resetPtToSage()
Set the pointer to the Sage node to NULL.

void setPtToSage(SgStatement &st)
Set the pointer to the Sage node and the typeNode to be BIFNODE.

void setPtToSage(SgSymbol &st)
idem for SgSymbol.

void setPtToSage(SgExpression &st)
idem for SgExpression.

void setPtToSage(SgType &st)
idem for SgType.

SgStatement* getStatement()
Return the SgStatement pointer if it exists and if the attribute is attached to an SgStatement node. Otherwise this function returns NULL.

SgExpression* getExpression()
idem for SgExpression.

SgSymbol* getSgSymbol()
idem for SgSymbol.

SgType* getType()
idem for SgType.

int getfileNumber()
returns the fileNumber.

SgAttribute* copy()
Get a copy of an attribute. This function does not copy the data field.

SgAttribute* getNext()
The attributes attached to the same node are chained through the next value.

void setNext(SgAttribute *s)
Set the list chaining of an attribute.

int listLenght()
return the number of SgAttribute nodes linked from this one.

SgAttribute* getInlist(int num)
return the SgAttribute node numbered "num" from this node.

void save(FILE *file)
save the private field to the file.

void save(FILE *file, void (*savefunction)(void *dat, FILE *f))


This class has no child classes.

alphabetic index hierarchy of classes


Email contact: zgs@npac.syr.edu

generated by doc++