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

#include <ArrayImageWriter.hh>

Inheritance diagram for ArrayImageWriter:
Inheritance graph
Collaboration diagram for ArrayImageWriter:
Collaboration graph

Public Member Functions

 ArrayImageWriter (const BitVector &bits, int rowLength)
 
virtual ~ArrayImageWriter ()
 
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

Writes the bit image with ASCII 1's and 0's such that each line is enveloped by " marks. Can be used to initialize an VHDL array, for example.

Definition at line 43 of file ArrayImageWriter.hh.

Constructor & Destructor Documentation

◆ ArrayImageWriter()

ArrayImageWriter::ArrayImageWriter ( const BitVector bits,
int  rowLength 
)

The constructor.

Parameters
bitsThe bits to write.
rowLengthLength of the rows to write.

Definition at line 45 of file ArrayImageWriter.cc.

45  :
47 }

◆ ~ArrayImageWriter()

ArrayImageWriter::~ArrayImageWriter ( )
virtual

The destructor.

Definition at line 53 of file ArrayImageWriter.cc.

53  {
54 }

Member Function Documentation

◆ writeImage()

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

Writes the bit image to the given stream.

Parameters
streamThe stream to write.

Reimplemented from AsciiImageWriter.

Reimplemented in VhdlImageWriter, ArrayProgramImageWriter, and VhdlProgramImageWriter.

Definition at line 63 of file ArrayImageWriter.cc.

63  {
64  int lineCount =
65  static_cast<int>(
66  ceil(static_cast<double>(bits().size()) / rowLength()));
67 
68  for (int line = 1; line < lineCount; line++) {
69  stream << "\"";
70  writeSequence(stream, rowLength());
71  stream << "\"," << std::endl;
72  }
73  stream << "\"";
74  bool padRemainingBits = true;
75  writeSequence(stream, rowLength(), padRemainingBits);
76  stream << "\"";
77 }

References AsciiImageWriter::bits(), AsciiImageWriter::rowLength(), and AsciiImageWriter::writeSequence().

Referenced by VhdlImageWriter::writeImage().

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
AsciiImageWriter::rowLength
int rowLength() const
Definition: AsciiImageWriter.cc:112
AsciiImageWriter::writeSequence
void writeSequence(std::ostream &stream, int length, bool padEnd=false) const
Definition: AsciiImageWriter.cc:129
AsciiImageWriter::bits
const BitVector & bits() const
Definition: AsciiImageWriter.cc:101