ROSE  0.9.6a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AST_FILE_IO Class Reference

Class holding stat ic data and functions supporting File I/O. More...

#include <AST_FILE_IO.h>

Classes

class  MemoryCheckingTraversalForAstFileIO
 

Public Types

typedef AstAttribute
*(AstAttribute::* 
CONSTRUCTOR )(void)
 

Public Member Functions

template<class TYPE >
void registerAttribute ()
 

Static Public Member Functions

static void startUp (SgProject *root)
 
static unsigned long getSizeOfMemoryPool (const int position)
 
static unsigned long getSizeOfMemoryPoolUpToAst (AstData *astInPool, const int position)
 
static unsigned long getAccumulatedPoolSizeOfNewAst (const int position)
 
static unsigned long getAccumulatedPoolSizeOfAst (AstData *astInPool, const int position)
 
static unsigned long getPoolSizeOfNewAst (const int sgVariant)
 
static unsigned long getTotalNumberOfNodesOfAstInMemoryPool ()
 
static unsigned long getTotalNumberOfNodesOfNewAst ()
 
static bool areFreepointersContainingGlobalIndices ()
 
static unsigned long getGlobalIndexFromSgClassPointer (SgNode *pointer)
 
static SgNodegetSgClassPointerFromGlobalIndex (unsigned long globalIndex)
 
static void compressAstInMemoryPool ()
 
static void resetValidAstAfterWriting ()
 
static void clearAllMemoryPools ()
 
static void deleteStaticData ()
 
static void deleteStoredAsts ()
 
static void setStaticDataOfAst (AstData *astInPool)
 
static int getNumberOfAsts ()
 
static void addNewAst (AstData *newAst)
 
static void extendMemoryPoolsForRebuildingAST ()
 
static void writeASTToStream (std::ostream &out)
 
static void writeASTToFile (std::string fileName)
 
static std::string writeASTToString ()
 
static SgProjectreadASTFromStream (std::istream &in)
 
static SgProjectreadASTFromFile (std::string fileName)
 
static SgProjectreadASTFromString (const std::string &s)
 
static void printFileMaps ()
 
static void printListOfPoolSizes ()
 
static void printListOfPoolSizesOfAst (int index)
 
static AstDatagetAst (int index)
 
static AstDatagetAstWithRoot (SgProject *root)
 
template<class TYPE >
static void registerAttribute ()
 
static const std::map
< std::string, CONSTRUCTOR > & 
getRegisteredAttributes ()
 
static void reset ()
 
static void display (const std::string &label)
 

Private Types

enum  { totalNumberOfIRNodes = 783 }
 

Static Private Member Functions

static unsigned long binarySearch (unsigned long globalIndex, int start=0, int end=totalNumberOfIRNodes)
 
static unsigned long linearSearch (unsigned long globalIndex)
 
static SgNodegetPointerFromGlobalIndex (unsigned long globalIndex)
 

Static Private Attributes

static std::map< std::string,
CONSTRUCTOR
registeredAttributes
 
static bool freepointersOfCurrentAstAreSetToGlobalIndices
 
static unsigned long listOfMemoryPoolSizes [totalNumberOfIRNodes+1]
 
static std::vector< AstData * > vectorOfASTs
 
static AstDataactualRebuildAst
 

Detailed Description

Class holding stat ic data and functions supporting File I/O.

Todo:
Consider making this a namespace.
Todo:
For the general file IO we should consider a special file name, similar to "rose_..."

Test of the AST File I/O mechanism include:

  • 1) writes the AST out to a source file, the first source file, and compiles it
  • 2) writes out the AST as a binary file
  • 3) deletes the AST (clears all the memory pools)
  • 4) reads in the binary file and runs all AST tests
  • 5) writes the AST out to a source file, the second source file, and compiles it
  • 6) runs a diff between the first source file and the second source file
  • 7) Using a new program that just reads the binary AST file, he reads the binary AST file
  • 8) writes the AST out to a source file, the first source file, and compiles it
  • 9) runs a diff between the first source file and the third source file

Definition at line 18 of file AST_FILE_IO.h.

Member Typedef Documentation

typedef AstAttribute*(AstAttribute::* AST_FILE_IO::CONSTRUCTOR)(void)

Definition at line 39 of file AST_FILE_IO.h.

Member Enumeration Documentation

anonymous enum
private
Enumerator
totalNumberOfIRNodes 

Definition at line 44 of file AST_FILE_IO.h.

Member Function Documentation

static unsigned long AST_FILE_IO::binarySearch ( unsigned long  globalIndex,
int  start = 0,
int  end = totalNumberOfIRNodes 
)
staticprivate
static unsigned long AST_FILE_IO::linearSearch ( unsigned long  globalIndex)
staticprivate
static SgNode* AST_FILE_IO::getPointerFromGlobalIndex ( unsigned long  globalIndex)
staticprivate
static void AST_FILE_IO::startUp ( SgProject root)
static
static unsigned long AST_FILE_IO::getSizeOfMemoryPool ( const int  position)
static
static unsigned long AST_FILE_IO::getSizeOfMemoryPoolUpToAst ( AstData astInPool,
const int  position 
)
static
static unsigned long AST_FILE_IO::getAccumulatedPoolSizeOfNewAst ( const int  position)
static
static unsigned long AST_FILE_IO::getAccumulatedPoolSizeOfAst ( AstData astInPool,
const int  position 
)
static
static unsigned long AST_FILE_IO::getPoolSizeOfNewAst ( const int  sgVariant)
static
static unsigned long AST_FILE_IO::getTotalNumberOfNodesOfAstInMemoryPool ( )
static
static unsigned long AST_FILE_IO::getTotalNumberOfNodesOfNewAst ( )
static
static bool AST_FILE_IO::areFreepointersContainingGlobalIndices ( )
static
static unsigned long AST_FILE_IO::getGlobalIndexFromSgClassPointer ( SgNode pointer)
static
static SgNode* AST_FILE_IO::getSgClassPointerFromGlobalIndex ( unsigned long  globalIndex)
static
static void AST_FILE_IO::compressAstInMemoryPool ( )
static
static void AST_FILE_IO::resetValidAstAfterWriting ( )
static
static void AST_FILE_IO::clearAllMemoryPools ( )
static
static void AST_FILE_IO::deleteStaticData ( )
static
static void AST_FILE_IO::deleteStoredAsts ( )
static
static void AST_FILE_IO::setStaticDataOfAst ( AstData astInPool)
static
static int AST_FILE_IO::getNumberOfAsts ( )
static
static void AST_FILE_IO::addNewAst ( AstData newAst)
static
static void AST_FILE_IO::extendMemoryPoolsForRebuildingAST ( )
static
static void AST_FILE_IO::writeASTToStream ( std::ostream &  out)
static
static void AST_FILE_IO::writeASTToFile ( std::string  fileName)
static
static std::string AST_FILE_IO::writeASTToString ( )
static
static SgProject* AST_FILE_IO::readASTFromStream ( std::istream &  in)
static
static SgProject* AST_FILE_IO::readASTFromFile ( std::string  fileName)
static
static SgProject* AST_FILE_IO::readASTFromString ( const std::string &  s)
static
static void AST_FILE_IO::printFileMaps ( )
static
static void AST_FILE_IO::printListOfPoolSizes ( )
static
static void AST_FILE_IO::printListOfPoolSizesOfAst ( int  index)
static
static AstData* AST_FILE_IO::getAst ( int  index)
static
static AstData* AST_FILE_IO::getAstWithRoot ( SgProject root)
static
template<class TYPE >
static void AST_FILE_IO::registerAttribute ( )
static
const std::map< std::string, AST_FILE_IO::CONSTRUCTOR > & AST_FILE_IO::getRegisteredAttributes ( )
inlinestatic

Definition at line 117 of file AST_FILE_IO.h.

References registeredAttributes.

static void AST_FILE_IO::reset ( )
static
static void AST_FILE_IO::display ( const std::string &  label)
static
template<class TYPE >
void AST_FILE_IO::registerAttribute ( )
inline

Definition at line 107 of file AST_FILE_IO.h.

References name, and registeredAttributes.

Member Data Documentation

std :: map< std::string, CONSTRUCTOR > AST_FILE_IO::registeredAttributes
staticprivate

Definition at line 47 of file AST_FILE_IO.h.

Referenced by getRegisteredAttributes(), and registerAttribute().

bool AST_FILE_IO::freepointersOfCurrentAstAreSetToGlobalIndices
staticprivate

Definition at line 48 of file AST_FILE_IO.h.

unsigned long AST_FILE_IO::listOfMemoryPoolSizes[totalNumberOfIRNodes+1]
staticprivate

Definition at line 49 of file AST_FILE_IO.h.

std::vector<AstData*> AST_FILE_IO::vectorOfASTs
staticprivate

Definition at line 52 of file AST_FILE_IO.h.

AstData* AST_FILE_IO::actualRebuildAst
staticprivate

Definition at line 53 of file AST_FILE_IO.h.


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