OpenASIP  2.0
Public Member Functions | List of all members
AsciiProgramImageWriter Class Reference

#include <AsciiProgramImageWriter.hh>

Inheritance diagram for AsciiProgramImageWriter:
Inheritance graph
Collaboration diagram for AsciiProgramImageWriter:
Collaboration graph

Public Member Functions

 AsciiProgramImageWriter (const InstructionBitVector &bits)
 
virtual ~AsciiProgramImageWriter ()
 
virtual void writeImage (std::ostream &stream) const
 
- Public Member Functions inherited from AsciiImageWriter
 AsciiImageWriter (const BitVector &bits, int rowLength)
 
virtual ~AsciiImageWriter ()
 
- Public Member Functions inherited from BitImageWriter
virtual ~BitImageWriter ()
 

Additional Inherited Members

- Protected Member Functions inherited from AsciiImageWriter
const BitVectorbits () const
 
int rowLength () const
 
void writeSequence (std::ostream &stream, int length, bool padEnd=false) const
 
void writeHexSequence (std::ostream &stream, int length, bool padEnd=false) const
 

Detailed Description

This class writes ASCII program images.

Definition at line 43 of file AsciiProgramImageWriter.hh.

Constructor & Destructor Documentation

◆ AsciiProgramImageWriter()

AsciiProgramImageWriter::AsciiProgramImageWriter ( const InstructionBitVector bits)

The constructor.

Parameters
bitsThe program bits to be written.

Definition at line 42 of file AsciiProgramImageWriter.cc.

43  : AsciiImageWriter(bits, 0) {
44 }

◆ ~AsciiProgramImageWriter()

AsciiProgramImageWriter::~AsciiProgramImageWriter ( )
virtual

The destructor.

Definition at line 50 of file AsciiProgramImageWriter.cc.

50  {
51 }

Member Function Documentation

◆ writeImage()

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

Writes the program image to the given output stream.

Parameters
streamThe output stream.

Reimplemented from AsciiImageWriter.

Definition at line 60 of file AsciiProgramImageWriter.cc.

60  {
61 
62  const BitVector& bits = this->bits();
63  const InstructionBitVector* programBits =
64  dynamic_cast<const InstructionBitVector*>(&bits);
65  assert(programBits != NULL);
66 
67  unsigned int previousBoundary(0);
68  for (unsigned int i = 1; i < programBits->instructionCount(); i++) {
69  unsigned int instructionBoundary =
70  programBits->instructionStartingPoint(i);
71  writeSequence(stream, instructionBoundary - previousBoundary);
72  stream << std::endl;
73  previousBoundary = instructionBoundary;
74  }
75  writeSequence(stream, bits.size() - previousBoundary);
76  stream << std::endl;
77 }

References assert, AsciiImageWriter::bits(), InstructionBitVector::instructionCount(), InstructionBitVector::instructionStartingPoint(), and AsciiImageWriter::writeSequence().

Here is the call graph for this function:

The documentation for this class was generated from the following files:
AsciiImageWriter::AsciiImageWriter
AsciiImageWriter(const BitVector &bits, int rowLength)
Definition: AsciiImageWriter.cc:55
BitVector
Definition: BitVector.hh:44
AsciiImageWriter::writeSequence
void writeSequence(std::ostream &stream, int length, bool padEnd=false) const
Definition: AsciiImageWriter.cc:129
assert
#define assert(condition)
Definition: Application.hh:86
InstructionBitVector::instructionStartingPoint
unsigned int instructionStartingPoint(unsigned int index) const
Definition: InstructionBitVector.cc:269
InstructionBitVector::instructionCount
unsigned int instructionCount() const
Definition: InstructionBitVector.cc:254
AsciiImageWriter::bits
const BitVector & bits() const
Definition: AsciiImageWriter.cc:101
InstructionBitVector
Definition: InstructionBitVector.hh:50