OpenASIP  2.0
TPEFSectionWriter.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2009 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file TPEFSectionWriter.hh
26  *
27  * Declaration of TPEFSectionWriter class.
28  *
29  * @author Mikael Lepistö 2003 (tmlepist-no.spam-cs.tut.fi)
30  *
31  * @note rating: yellow
32  */
33 
34 #ifndef TTA_TPEF_SECTION_WRITER_HH
35 #define TTA_TPEF_SECTION_WRITER_HH
36 
37 #include "SectionWriter.hh"
38 
39 #include "Section.hh"
40 #include "Exception.hh"
41 #include "TPEFBaseType.hh"
42 #include "TPEFHeaders.hh"
43 
44 namespace TPEF {
45 
46 /**
47  * Base class for all TPEF filetype writer classes.
48  */
50 protected:
52  virtual ~TPEFSectionWriter();
53 
54  virtual const BinaryWriter& parent() const;
55 
56  virtual void actualWriteHeader(
57  BinaryStream& stream,
58  const Section* sect) const;
59 
60  virtual void actualWriteData(
61  BinaryStream& stream,
62  const Section* sect) const;
63 
64  /// Returns SectionTypet hat actual reader or writer instance can handle.
65  virtual Section::SectionType type() const = 0;
66 
67  virtual void createKeys(const Section* sect) const;
68 
69  virtual void writeSize(BinaryStream& stream, const Section* sect) const;
70 
71  virtual void writeInfo(BinaryStream& stream, const Section* sect) const;
72 
73  virtual SectionId getSectionId() const;
74 
75  virtual Word elementSize(const Section* section) const;
76 
77 private:
79 
81  BinaryStream& stream,
82  const Section* sect) const;
83 };
84 }
85 
86 #endif
TPEF::SectionId
HalfWord SectionId
Type for storing binary file section ids.
Definition: TPEFBaseType.hh:43
TPEF::TPEFSectionWriter::parent
virtual const BinaryWriter & parent() const
Definition: TPEFSectionWriter.cc:78
TPEF::TPEFSectionWriter::createKeys
virtual void createKeys(const Section *sect) const
Definition: TPEFSectionWriter.cc:286
SectionWriter.hh
Exception.hh
TPEF::TPEFSectionWriter::type
virtual Section::SectionType type() const =0
Returns SectionTypet hat actual reader or writer instance can handle.
TPEF::BinaryStream
Definition: BinaryStream.hh:59
TPEFHeaders.hh
TPEF::Section
Definition: Section.hh:64
TPEF::TPEFSectionWriter::actualWriteData
virtual void actualWriteData(BinaryStream &stream, const Section *sect) const
Definition: TPEFSectionWriter.cc:193
TPEF::TPEFSectionWriter::writeBodyStartOffset
void writeBodyStartOffset(BinaryStream &stream, const Section *sect) const
Definition: TPEFSectionWriter.cc:245
TPEF::TPEFSectionWriter::~TPEFSectionWriter
virtual ~TPEFSectionWriter()
Definition: TPEFSectionWriter.cc:69
TPEF::TPEFSectionWriter::writeInfo
virtual void writeInfo(BinaryStream &stream, const Section *sect) const
Definition: TPEFSectionWriter.cc:233
TPEF::SectionWriter
Definition: SectionWriter.hh:58
Section.hh
TPEF::Section::SectionType
SectionType
Definition: Section.hh:69
TPEF::TPEFSectionWriter::getSectionId
virtual SectionId getSectionId() const
Definition: TPEFSectionWriter.cc:268
TPEFBaseType.hh
TPEF::TPEFSectionWriter::writeSize
virtual void writeSize(BinaryStream &stream, const Section *sect) const
Definition: TPEFSectionWriter.cc:218
TPEF::TPEFSectionWriter::actualWriteHeader
virtual void actualWriteHeader(BinaryStream &stream, const Section *sect) const
Definition: TPEFSectionWriter.cc:89
TPEF::TPEFSectionWriter
Definition: TPEFSectionWriter.hh:49
TPEF::BinaryWriter
Definition: BinaryWriter.hh:50
TPEF
Definition: Assembler.hh:43
TPEF::TPEFSectionWriter::elementSize
virtual Word elementSize(const Section *section) const
Definition: TPEFSectionWriter.cc:204
TPEF::TPEFSectionWriter::TPEFSectionWriter
TPEFSectionWriter()
Definition: TPEFSectionWriter.cc:63