OpenASIP  2.0
Public Member Functions | Static Private Member Functions | Private Attributes | List of all members
RawImageWriter Class Reference

#include <RawImageWriter.hh>

Inheritance diagram for RawImageWriter:
Inheritance graph
Collaboration diagram for RawImageWriter:
Collaboration graph

Public Member Functions

 RawImageWriter (const BitVector &bits)
 
virtual ~RawImageWriter ()
 
virtual void writeImage (std::ostream &stream) const
 
- Public Member Functions inherited from BitImageWriter
virtual ~BitImageWriter ()
 

Static Private Member Functions

static char character (const BitVector &bits, unsigned int startIndex)
 

Private Attributes

const BitVectorbits_
 The bits to be written. More...
 

Detailed Description

Bit image writer that writes a real binary image.

Definition at line 43 of file RawImageWriter.hh.

Constructor & Destructor Documentation

◆ RawImageWriter()

RawImageWriter::RawImageWriter ( const BitVector bits)

The constructor.

Parameters
bitsThe bits to be written.

Definition at line 41 of file RawImageWriter.cc.

41  : bits_(bits) {
42 }

◆ ~RawImageWriter()

RawImageWriter::~RawImageWriter ( )
virtual

The destructor.

Definition at line 48 of file RawImageWriter.cc.

48  {
49 }

Member Function Documentation

◆ character()

char RawImageWriter::character ( const BitVector bits,
unsigned int  startIndex 
)
staticprivate

Returns the byte of the given bit vector that starts at the given index.

Parameters
bitsThe bit vector.
startIndexThe start index.
Returns
The byte.

Definition at line 74 of file RawImageWriter.cc.

74  {
75  unsigned int vectorSize = bits.size();
76  char character = 0;
77  if (bits[startIndex]) {
78  character++;
79  }
80  for (int i = 1; i < 8; i++) {
81  character = character << 1;
82  if (startIndex + i < vectorSize && bits[startIndex + i]) {
83  character++;
84  }
85  }
86  return character;
87 }

Referenced by writeImage().

◆ writeImage()

void RawImageWriter::writeImage ( std::ostream &  stream) const
virtual

Writes the bit image to the given output stream.

Parameters
streamThe output stream.

Implements BitImageWriter.

Definition at line 58 of file RawImageWriter.cc.

58  {
59  unsigned int size = bits_.size();
60  for (unsigned int i = 0; i < size; i += 8) {
61  stream << character(bits_, i);
62  }
63 }

References bits_, and character().

Here is the call graph for this function:

Member Data Documentation

◆ bits_

const BitVector& RawImageWriter::bits_
private

The bits to be written.

Definition at line 54 of file RawImageWriter.hh.

Referenced by writeImage().


The documentation for this class was generated from the following files:
RawImageWriter::character
static char character(const BitVector &bits, unsigned int startIndex)
Definition: RawImageWriter.cc:74
RawImageWriter::bits_
const BitVector & bits_
The bits to be written.
Definition: RawImageWriter.hh:54