ROSE 2.1.0
Loading...
Searching...
No Matches
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 430 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.
 
- Public Types inherited from Rose::BinaryAnalysis::SerialIo
using Ptr = SerialIoPtr
 Reference counting pointer.
 
using Format = Serialization::Format
 

Public Member Functions

void open (const boost::filesystem::path &fileName) override
 Attach a file.
 
void close () override
 Detach a file.
 
Serialization::FrameRecord readAndValidateRecord (Serialization::Savable expectedType)
 Read a frame record from the container and validate its metadata.
 
Serialization::Savable nextObjectType ()
 Type of next object in the input stream.
 
Partitioner2::PartitionerPtr loadPartitioner ()
 Load a partitioner from the input stream.
 
SgNodeloadAst ()
 Load an AST from the input stream.
 
template<class T >
loadObject (Serialization::Savable objectTypeId)
 Load an object from the input stream.
 
template<class T >
void loadObject (Serialization::Savable objectTypeId, T &object)
 Load an object from the input stream.
 
- Public Member Functions inherited from Rose::BinaryAnalysis::SerialIo
virtual ~SerialIo ()
 Destructor.
 
bool isOpen () const
 Whether a file is attached.
 
Serialization::Savable objectType () const
 Type ID for next object.
 
Serialization::Format format () const
 Property: File format.
 
void format (Serialization::Format)
 Property: File format.
 
Progress::Ptr progress () const
 Property: Progress reporter.
 
void progress (const Progress::Ptr &)
 Property: Progress reporter.
 

Static Public Member Functions

static Ptr instance ()
 Factory method to create a new instance.
 
- Static Public Member Functions inherited from Rose::BinaryAnalysis::SerialIo
static void registerSerialization (SerializationRegistration)
 
static const Sawyer::Optional< SerializationRegistrationfindSerialization (Serialization::Format)
 
static Serialization::Savable userSavable (unsigned offset)
 Create a new Savable enum constant.
 

Protected Member Functions

void advanceObjectType ()
 
void checkCompatibility (const std::string &fileVersion)
 
- Protected Member Functions inherited from Rose::BinaryAnalysis::SerialIo
void setIsOpen (bool b)
 
void objectType (Serialization::Savable)
 
Serialization::ProgressCallback makeProgressCB (const std::string &phase)
 Create progress callbacks that wraps the IO progress reporting.
 

Additional Inherited Members

- Static Public Attributes inherited from Rose::BinaryAnalysis::SerialIo
static Sawyer::Message::Facility mlog
 Message facility.
 
static constexpr Format BINARY = Serialization::BINARY
 
static constexpr Format TEXT = Serialization::TEXT
 
static constexpr Format XML = Serialization::XML
 
- Protected Attributes inherited from Rose::BinaryAnalysis::SerialIo
Sawyer::ProgressBar< size_t > progressBar_
 
int fd_
 

Member Typedef Documentation

◆ Ptr

Reference counting pointer.

Definition at line 433 of file SerialIo.h.

Constructor & Destructor Documentation

◆ SerialInput()

Rose::BinaryAnalysis::SerialInput::SerialInput ( )
inlineprotected

Definition at line 440 of file SerialIo.h.

Member Function Documentation

◆ open()

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.

◆ close()

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.

◆ instance()

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 451 of file SerialIo.h.

◆ readAndValidateRecord()

Serialization::FrameRecord Rose::BinaryAnalysis::SerialInput::readAndValidateRecord ( Serialization::Savable  expectedType)

Read a frame record from the container and validate its metadata.

Parameters
expectedTypeThe expected object type for the record
Returns
The validated frame record
Exceptions
Exceptionif the record's metadata doesn't match expectations

Referenced by loadObject().

◆ nextObjectType()

Serialization::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.

◆ loadPartitioner()

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.

◆ loadAst()

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

Load an AST from the input stream.

Loads an AST from the input 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.

◆ loadObject() [1/2]

template<class T >
T Rose::BinaryAnalysis::SerialInput::loadObject ( Serialization::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 496 of file SerialIo.h.

◆ loadObject() [2/2]

template<class T >
void Rose::BinaryAnalysis::SerialInput::loadObject ( Serialization::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 504 of file SerialIo.h.

References Rose::BinaryAnalysis::SerialIo::isOpen(), Rose::BinaryAnalysis::SerialIo::objectType(), and readAndValidateRecord().


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