srecord 1.65.0
 
Loading...
Searching...
No Matches
fletcher16.h
Go to the documentation of this file.
1//
2// srecord - Manipulate EPROM load files
3// Copyright (C) 2009-2011 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_FLETCHER16_H
20#define SRECORD_INPUT_FILTER_MESSAGE_FLETCHER16_H
21
22#include <srecord/fletcher16.h>
23#include <srecord/endian.h>
25
26namespace srecord
27{
28
29/**
30 * The srecord::input_filter_message_fletcher16 class is used to represent
31 * the state of a checksum filter that inserts an Fletcher 16 checksum
32 * into the data.
33 */
34class input_filter_message_fletcher16:
36{
37public:
38 /**
39 * The destructor.
40 */
42
43private:
44 /**
45 * The constructor.
46 *
47 * @param deeper
48 * The incoming data source to be filtered
49 * @param address
50 * where to place the checksum
51 * @param end
52 * The byte order.
53 */
54 input_filter_message_fletcher16(const input::pointer &deeper,
55 unsigned long address, endian_t end);
56
57public:
58 /**
59 * The create class method is used to create new dynamically
60 * allocated instances of this class.
61 *
62 * @param deeper
63 * The incoming data source to be filtered
64 * @param address
65 * where to place the checksum
66 * @param end
67 * The byte order.
68 */
69 static pointer create(const input::pointer &deeper, unsigned long address,
70 endian_t end);
71
72protected:
73 // See base class for documentation.
75
76 // See base class for documentation.
77 const char *get_algorithm_name() const;
78
79 // See base class for documentation.
81
82private:
83 /**
84 * The address instance variable is used to remember where to place
85 * the Fletcher 16 checksum in memory.
86 */
87 unsigned long address;
88
89 /**
90 * The end instance variable is used to remember whether the byte
91 * order is big-endian or little-endian.
92 */
93 endian_t end;
94
95 unsigned char sum1;
96
97 unsigned char sum2;
98
99 int answer;
100
101 /**
102 * The default constructor. Do not use.
103 */
104 input_filter_message_fletcher16();
105
106 /**
107 * The copy constructor. Do not use.
108 */
109 input_filter_message_fletcher16(const input_filter_message_fletcher16 &);
110
111 /**
112 * The assignment operator. Do not use.
113 */
114 input_filter_message_fletcher16 &operator=(
115 const input_filter_message_fletcher16 &);
116};
117
118};
119
120// vim: set ts=8 sw=4 et :
121#endif // SRECORD_INPUT_FILTER_MESSAGE_FLETCHER16_H
The srecord::arglex_tool is used to parse command line with srec-specific arguments.
Definition tool.h:41
void command_line(srecord::arglex_tool *cmdln)
The command_line method is used by arglex_srec::get_input when parsing the command line,...
const char * get_algorithm_name() const
The get_algorithm_name method is used in error messages.
static pointer create(const input::pointer &deeper, unsigned long address, endian_t end)
The create class method is used to create new dynamically allocated instances of this class.
virtual ~input_filter_message_fletcher16()
The destructor.
void process(const memory &input, record &output)
The process method is used to process the data from the input.
input_filter_message(const input::pointer &deeper, bool naked=false)
The constructor.
The srecord::input class is used to represent an abstract EPROM load file source.
Definition input.h:39
std::shared_ptr< input > pointer
Definition input.h:41
The srecord::memory class is used to simulate memory contents.
Definition memory.h:40
The srecord::output class is used to represent an abstract output vector.
Definition output.h:39
The srecord::record class is used to represent a data record read from a file.
Definition record.h:35
endian_t
Definition endian.h:27