ROSE  0.11.145.0
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Rose::BinaryAnalysis::SerialInput Class Reference

Description

Input binary analysis state.

Reads a previously saved binary analysis state file to re-initialize ROSE to a previous state.

Definition at line 437 of file SerialIo.h.

#include <Rose/BinaryAnalysis/SerialIo.h>

Inheritance diagram for Rose::BinaryAnalysis::SerialInput:
Inheritance graph
[legend]
Collaboration diagram for Rose::BinaryAnalysis::SerialInput:
Collaboration graph
[legend]

Public Types

using Ptr = SerialInputPtr
 Reference counting pointer. More...
 
- Public Types inherited from Rose::BinaryAnalysis::SerialIo
enum  Format {
  BINARY,
  TEXT,
  XML
}
 Format of the state file. More...
 
enum  Savable {
  NO_OBJECT = 0x00000000,
  PARTITIONER = 0x00000001,
  AST = 0x00000002,
  END_OF_DATA = 0x0000fffe,
  ERROR = 0x0000ffff,
  USER_DEFINED = 0x00010000,
  USER_DEFINED_LAST = 0xffffffff
}
 Types of objects that can be saved. More...
 
using Ptr = SerialIoPtr
 Reference counting pointer. More...
 

Public Member Functions

void open (const boost::filesystem::path &fileName) override
 Attach a file. More...
 
void close () override
 Detach a file. More...
 
Savable nextObjectType ()
 Type of next object in the input stream. More...
 
Partitioner2::PartitionerPtr loadPartitioner ()
 Load a partitioner from the input stream. More...
 
SgNodeloadAst ()
 Load an AST from the input stream. More...
 
template<class T >
loadObject (Savable objectTypeId)
 Load an object from the input stream. More...
 
template<class T >
void loadObject (Savable objectTypeId, T &object)
 Load an object from the input stream. More...
 
- Public Member Functions inherited from Rose::BinaryAnalysis::SerialIo
virtual ~SerialIo ()
 Destructor. More...
 
bool isOpen () const
 Whether a file is attached. More...
 
Savable objectType () const
 Type ID for next object. More...
 
Format format () const
 Property: File format. More...
 
void format (Format)
 Property: File format. More...
 
Progress::Ptr progress () const
 Property: Progress reporter. More...
 
void progress (const Progress::Ptr &)
 Property: Progress reporter. More...
 
- Public Member Functions inherited from Sawyer::SharedObject
 SharedObject ()
 Default constructor. More...
 
 SharedObject (const SharedObject &)
 Copy constructor. More...
 
virtual ~SharedObject ()
 Virtual destructor. More...
 
SharedObjectoperator= (const SharedObject &)
 Assignment. More...
 

Static Public Member Functions

static Ptr instance ()
 Factory method to create a new instance. More...
 
- Static Public Member Functions inherited from Rose::BinaryAnalysis::SerialIo
static Savable userSavable (unsigned offset)
 Create a new Savable enum constant. More...
 

Protected Member Functions

void advanceObjectType ()
 
- Protected Member Functions inherited from Rose::BinaryAnalysis::SerialIo
void setIsOpen (bool b)
 
void objectType (Savable)
 

Additional Inherited Members

- Static Public Attributes inherited from Rose::BinaryAnalysis::SerialIo
static Sawyer::Message::Facility mlog
 Message facility. More...
 
- Protected Attributes inherited from Rose::BinaryAnalysis::SerialIo
Sawyer::ProgressBar< size_t > progressBar_
 
int fd_
 

Member Typedef Documentation

Reference counting pointer.

Definition at line 440 of file SerialIo.h.

Member Function Documentation

void Rose::BinaryAnalysis::SerialInput::open ( const boost::filesystem::path &  )
overridevirtual

Attach a file.

When opening an output stream, the file is created or truncated; when opening an input stream the file must already exist. If a file is already attached, then the previous file is closed first before this new one is opened.

Throws an Exception if the file cannot be attached or the previous if any, cannot be closed.

Thread safety: This method is not thread-safe.

Implements Rose::BinaryAnalysis::SerialIo.

void Rose::BinaryAnalysis::SerialInput::close ( )
overridevirtual

Detach a file.

If a file is attached to this I/O object, that file is closed and this object is set to its detached state. This is a no-op if no file is attached.

Throws an Exception if the file cannot be detached.

The close method is automatically called during object destruction, although its exceptions are suppressed in that situation.

Thread safety: This method is not thread-safe.

Implements Rose::BinaryAnalysis::SerialIo.

static Ptr Rose::BinaryAnalysis::SerialInput::instance ( )
inlinestatic

Factory method to create a new instance.

The returned instance is in a detached state, therefore the open method needs to be called before any I/O operation can be invoked.

Definition at line 468 of file SerialIo.h.

Savable Rose::BinaryAnalysis::SerialInput::nextObjectType ( )

Type of next object in the input stream.

Returns an indication for the type of the next item in the input stream.

Throws an Exception if no file is attached.

Thread safety: This method is not thread safe.

Partitioner2::PartitionerPtr Rose::BinaryAnalysis::SerialInput::loadPartitioner ( )

Load a partitioner from the input stream.

Initializes the specified partitioner with data from the input stream.

Throws an Exception if no file is attached to this I/O object or if the next object to be read from the input is not a partitioner, or if any other errors occur while reading the partitioner.

SgNode* Rose::BinaryAnalysis::SerialInput::loadAst ( )

Load an AST from the input stream.

Loads an AST from the intput stream and returns a pointer to its root. If a null AST was stored, then a null pointer is returned.

Throws an Exception if no file is attached to this I/O object or if the next object to be read from the input is not an AST, or if any other errors occur while reading the AST.

template<class T >
T Rose::BinaryAnalysis::SerialInput::loadObject ( Savable  objectTypeId)
inline

Load an object from the input stream.

An object with the specified tag must exist as the next item in the stream. Such an object is created, initialized from the stream, and returned. If an object is provided as the second argument, then it's initialized from the stream.

Definition at line 503 of file SerialIo.h.

template<class T >
void Rose::BinaryAnalysis::SerialInput::loadObject ( Savable  objectTypeId,
T &  object 
)
inline

Load an object from the input stream.

An object with the specified tag must exist as the next item in the stream. Such an object is created, initialized from the stream, and returned. If an object is provided as the second argument, then it's initialized from the stream.

Definition at line 509 of file SerialIo.h.

References Rose::BinaryAnalysis::SerialIo::ERROR, Rose::BinaryAnalysis::SerialIo::isOpen(), Sawyer::ProgressBarSettings::minimumUpdateInterval(), Rose::BinaryAnalysis::SerialIo::objectType(), Sawyer::ProgressBar< T, S >::prefix(), Rose::BinaryAnalysis::SerialIo::progress(), and Sawyer::ProgressBar< T, S >::value().


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