torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
torc::architecture::DigestStream Class Reference

Encapsulation of a device or family digest stream. More...

#include <DigestStream.hpp>

+ Inheritance diagram for torc::architecture::DigestStream:
+ Collaboration diagram for torc::architecture::DigestStream:

Public Member Functions

 DigestStream (const boost::filesystem::path &inPath)
 Public constructor. More...
 
size_t getBytesRead (void) const
 Returns the number of bytes read. More...
 
void readSectionHeader (string &outHeader)
 Read and return a section header. More...
 
std::istream & read (uint8_t &outValue)
 Read and return a uint8_t. More...
 
std::istream & read (uint16_t &outValue)
 Read and return a uint16_t. More...
 
std::istream & read (uint32_t &outValue)
 Read and return a uint32_t. More...
 
std::istream & read (char *s, std::streamsize n)
 Read and return a character string. More...
 

Protected Types

typedef std::string string
 Imported type name. More...
 
typedef boost::uint16_t uint16_t
 Imported type name. More...
 
typedef boost::uint32_t uint32_t
 Imported type name. More...
 
typedef char DigestSectionHeader [16]
 Definition of a digest section header. More...
 

Protected Attributes

size_t mBytesRead
 The number of bytes read. More...
 

Detailed Description

Encapsulation of a device or family digest stream.

DigestStreams are used to read family and device database files.

Definition at line 32 of file DigestStream.hpp.

Member Typedef Documentation

typedef char torc::architecture::DigestStream::DigestSectionHeader[16]
protected

Definition of a digest section header.

Definition at line 42 of file DigestStream.hpp.

typedef std::string torc::architecture::DigestStream::string
protected

Imported type name.

Definition at line 36 of file DigestStream.hpp.

typedef boost::uint16_t torc::architecture::DigestStream::uint16_t
protected

Imported type name.

Definition at line 38 of file DigestStream.hpp.

typedef boost::uint32_t torc::architecture::DigestStream::uint32_t
protected

Imported type name.

Definition at line 40 of file DigestStream.hpp.

Constructor & Destructor Documentation

torc::architecture::DigestStream::DigestStream ( const boost::filesystem::path &  inPath)
inline

Public constructor.

Definition at line 48 of file DigestStream.hpp.

49  : gzifstream(inPath.string().c_str(), ios_base::in), mBytesRead(0) {}
size_t mBytesRead
The number of bytes read.

Member Function Documentation

size_t torc::architecture::DigestStream::getBytesRead ( void  ) const
inline

Returns the number of bytes read.

Definition at line 52 of file DigestStream.hpp.

52 { return mBytesRead; }
size_t mBytesRead
The number of bytes read.

+ Here is the caller graph for this function:

std::istream& torc::architecture::DigestStream::read ( uint8_t &  outValue)
inline

Read and return a uint8_t.

Parameters
outValueThe uint8_t that was read from the stream.

Definition at line 64 of file DigestStream.hpp.

64  {
65  gzifstream::read(reinterpret_cast<char*>(&outValue), sizeof(uint8_t));
66  //outValue = ntohs(outValue); // no endian conversion needed for single bytes
67  mBytesRead += sizeof(uint8_t);
68  return *this;
69  }
size_t mBytesRead
The number of bytes read.

+ Here is the caller graph for this function:

std::istream& torc::architecture::DigestStream::read ( uint16_t outValue)
inline

Read and return a uint16_t.

Parameters
outValueThe uint16_t that was read from the stream.

Definition at line 72 of file DigestStream.hpp.

72  {
73  gzifstream::read(reinterpret_cast<char*>(&outValue), sizeof(uint16_t));
74  outValue = ntohs(outValue); // endian conversion
75  mBytesRead += sizeof(uint16_t);
76  return *this;
77  }
boost::uint16_t uint16_t
Imported type name.
size_t mBytesRead
The number of bytes read.
std::istream& torc::architecture::DigestStream::read ( uint32_t outValue)
inline

Read and return a uint32_t.

Parameters
outValueThe uint32_t that was read from the stream.

Definition at line 80 of file DigestStream.hpp.

80  {
81  gzifstream::read(reinterpret_cast<char*>(&outValue), sizeof(uint32_t));
82  outValue = ntohl(outValue); // endian conversion
83  mBytesRead += sizeof(uint32_t);
84  return *this;
85  }
size_t mBytesRead
The number of bytes read.
boost::uint32_t uint32_t
Imported type name.
std::istream& torc::architecture::DigestStream::read ( char *  s,
std::streamsize  n 
)
inline

Read and return a character string.

This overrides the superclass behavior exclusively for the sake of tracking the number of bytes read.

Parameters
sThe character pointer to read into.
nThe number of characters to read.

Definition at line 91 of file DigestStream.hpp.

91  {
92  gzifstream::read(s, n);
93  mBytesRead += n;
94  return *this;
95  }
size_t mBytesRead
The number of bytes read.
void torc::architecture::DigestStream::readSectionHeader ( string outHeader)
inline

Read and return a section header.

Parameters
outHeaderThe section header that was read from the stream.

Definition at line 56 of file DigestStream.hpp.

56  {
57  DigestSectionHeader sectionHeader;
58  gzifstream::read(static_cast<char*>(sectionHeader), sizeof(sectionHeader));
59  mBytesRead += sizeof(sectionHeader);
60  outHeader.assign(sectionHeader, sizeof(sectionHeader));
61  }
size_t mBytesRead
The number of bytes read.
char DigestSectionHeader[16]
Definition of a digest section header.

+ Here is the caller graph for this function:

Field Documentation

size_t torc::architecture::DigestStream::mBytesRead
protected

The number of bytes read.

Definition at line 45 of file DigestStream.hpp.


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