srecord 1.65.0
 
Loading...
Searching...
No Matches
positive.h
Go to the documentation of this file.
1//
2// srecord - manipulate eprom load files
3// Copyright (C) 2000-2002, 2005-2008, 2010 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
8// (at 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
13// GNU Lesser 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
17// <http://www.gnu.org/licenses/>.
18//
19
20#ifndef SRECORD_INPUT_FILTER_CHECKSUM_POSITIVE_H
21#define SRECORD_INPUT_FILTER_CHECKSUM_POSITIVE_H
22
24
25namespace srecord {
26
27/**
28 * The srecord::input_filter_checksum_positive class is used to represent the
29 * state of a checksum filter that inserts a positive sum into the data.
30 */
31class input_filter_checksum_positive:
33{
34public:
35 /**
36 * The destructor.
37 */
39
40private:
41 /**
42 * The constructor.
43 *
44 * @param deeper
45 * The deeper input source being checksummed.
46 * @param address
47 * The address to place the checksum.
48 * @param length
49 * The number of bytes of checksum to be placed into the result.
50 * @param end
51 * The byte order.
52 * @param width
53 * The width of the values being summed. Usually 1 byte, but
54 * wider combinations are possible. If you use something
55 * wider, it is assumed that they are alligned on multiples of
56 * that width, no provision for an offset is provided.
57 */
58 input_filter_checksum_positive(const input::pointer &deeper, int address,
59 int length, endian_t end, int width = 1);
60
61public:
62 /**
63 * The create class method is used to create new dynamically
64 * allocated instances of this class.
65 *
66 * @param deeper
67 * The incoming data source to be filtered
68 * @param address
69 * The address to place the checksum.
70 * @param length
71 * The number of bytes of checksum to be placed into the result.
72 * @param end
73 * The byte order.
74 * @param width
75 * The width of the values being summed. Usually 1 byte, but
76 * wider combinations are possible. If you use something
77 * wider, it is assumed that they are alligned on multiples of
78 * that width, no provision for an offset is provided.
79 */
80 static pointer create(const input::pointer &deeper, int address, int length,
81 endian_t end, int width = 1);
82
83protected:
84 // See base class for documentation.
86
87private:
88 /**
89 * The default constructor. Do not use.
90 */
91 input_filter_checksum_positive();
92
93 /**
94 * The copy constructor. Do not use.
95 */
96 input_filter_checksum_positive(const input_filter_checksum_positive &);
97
98 /**
99 * The assignment operator. Do not use.
100 */
101 input_filter_checksum_positive &operator=(
102 const input_filter_checksum_positive &);
103};
104
105};
106
107#endif // SRECORD_INPUT_FILTER_CHECKSUM_POSITIVE_H
virtual ~input_filter_checksum_positive()
The destructor.
static pointer create(const input::pointer &deeper, int address, int length, endian_t end, int width=1)
The create class method is used to create new dynamically allocated instances of this class.
sum_t calculate()
The calculate method is used to calculate the checksum to be written into the output,...
int length
The length instance variable is used to remember how many bytes of checksum are to be emitted.
Definition checksum.h:81
input_filter_checksum(input::pointer deeper, int address, int length, endian_t end, int width=1)
The constructor.
endian_t end
The end instance variable is used to remember whether the summation for the checksum is bigendian or ...
Definition checksum.h:87
int width
The width instance variable is used to remember the swathe width as the incoming bytes are added to t...
Definition checksum.h:100
std::shared_ptr< input > pointer
Definition input.h:41
endian_t
Definition endian.h:27