srecord: input/filter/message.h Source File

srecord 1.65.0

Loading...
Searching...
No Matches
message.h
Go to the documentation of this file.
1//
2// srecord - Manipulate EPROM load files
3// Copyright (C) 2009-2012 Peter Miller
4//
5// This program is free software; you can redistribute it and/or modify
6// it under the terms of the GNU Lesser General Public License as published by
7// the Free Software Foundation; either version 3 of the License, or (at
8// your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13// General Public License for more details.
14//
15// You should have received a copy of the GNU Lesser General Public License
16// along with this program. If not, see <http://www.gnu.org/licenses/>.
17//
18
19#ifndef SRECORD_INPUT_FILTER_MESSAGE_H
20#define SRECORD_INPUT_FILTER_MESSAGE_H
21
22#include <srecord/input/filter.h>
23#include <srecord/memory.h>
24
25namespace srecord
26{
27
28/**
29 * The srecord::input_filter_message class is used to represent an abstract
30 * base class for filters that must operate on the complete data, in
31 * order, in order to functions (e.g. CRC, message digest, etc).
32 *
33 * All of the machinery for accumulating the input data and eventually
34 * forwarding it on are in this common base class. The only methods
35 * that a derived class must supply are data block processing and
36 * results creation.
37 */
38 class input_filter_message:
39 public input_filter
40{
41public:
42 /**
43 * The destructor.
44 */
45 virtual ~input_filter_message();
46
47protected:
48 /**
49 * The constructor.
50 *
51 * @param deeper
52 * The data to be filtered.
53 * @param naked
54 * Whether or not to forward the data: true means result only
55 * with no data, false means result and data.
56 */
57 input_filter_message(const input::pointer &deeper, bool naked = false);
58
59 // See base class for documentation.
60 bool read(record &record);
61
62 /**
63 * The process method is used to process the data from the input.
64 *
65 * @param input
66 * The memory representation to be processed.
67 * @param output
68 * The filter's output.
69 */
70 virtual void process(const memory &input, record &output) = 0;
71
72 /**
73 * The get_algorithm_name method is used in error messages.
74 */
75 virtual const char *get_algorithm_name() const = 0;
76
77 /**
78 * The get_minimum_alignment method is used to obtain the minium
79 * require dbyte alignment. Returns 0 if irrelevant.
80 */
81 virtual unsigned get_minimum_alignment(void) const;
82
83private:
84 /**
85 * The naked instance variable is used to remember whether or not
86 * to forward the data: true means result only with no data, false
87 * means result and data.
88 */
89 bool naked;
90
91 /**
92 * The buffer instance variable is used to remember the contents
93 * of the deeper file. The deeper file must be read completely
94 * in order to calculate the result, and the input may be out of
95 * address order, necessitating this buffer.
96 */
97 memory buffer;
98
99 /**
100 * The buffer_pos instance variable is used to remember where we
101 * are up to in processing 'buffer'.
102 */
103 unsigned long buffer_pos;
104
105 /**
106 * The have_forwarded_header instance variable is used to remember
107 * whether we have returned the file header to our reader yet.
108 */
109 bool have_forwarded_header;
110
111 /**
112 * The have_given_result instance variable is used to remember
113 * whether we have returned the result to our reader yet.
114 */
115 bool have_given_result;
116
117 /**
118 * The have_forwarded_start_address instance variable is used to
119 * remember whether we have returned the execution start address to
120 * our reader yet.
121 */
122 bool have_forwarded_start_address;
123
124 /**
125 * The default constructor. Do not use.
126 */
127 input_filter_message();
128
129 /**
130 * The copy constructor. Do not use.
131 */
132 input_filter_message(const input_filter_message &);
133
134 /**
135 * The assignment operator. Do not use.
136 */
137 input_filter_message &operator=(const input_filter_message &);
138};
139
140};
141
142// vim: set ts=8 sw=4 et :
143#endif // SRECORD_INPUT_FILTER_MESSAGE_H
srecord::input_filter_message::get_algorithm_name
virtual const char * get_algorithm_name() const =0
The get_algorithm_name method is used in error messages.
srecord::input_filter_message::get_minimum_alignment
virtual unsigned get_minimum_alignment(void) const
The get_minimum_alignment method is used to obtain the minium require dbyte alignment.
srecord::input_filter_message::input_filter_message
input_filter_message(const input::pointer &deeper, bool naked=false)
The constructor.
srecord::input_filter_message::~input_filter_message
virtual ~input_filter_message()
The destructor.
srecord::input_filter_message::read
bool read(record &record)
The read method is used to read one record from the input.
srecord::input_filter_message::process
virtual void process(const memory &input, record &output)=0
The process method is used to process the data from the input.
srecord::input_filter::input_filter
input_filter(input::pointer deeper)
The constructor.
srecord::input
The srecord::input class is used to represent an abstract EPROM load file source.
Definition input.h:39
srecord::input::pointer
std::shared_ptr< input > pointer
Definition input.h:41
srecord::memory
The srecord::memory class is used to simulate memory contents.
Definition memory.h:40
srecord::output
The srecord::output class is used to represent an abstract output vector.
Definition output.h:39
srecord::record
The srecord::record class is used to represent a data record read from a file.
Definition record.h:35
filter.h
memory.h
srecord
Definition adler16.h:25