srecord: input/filter/byte_swap.h Source File

srecord 1.65.0

Loading...
Searching...
No Matches
byte_swap.h
Go to the documentation of this file.
1//
2// srecord - manipulate eprom load files
3// Copyright (C) 2000-2002, 2005-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_BYTE_SWAP_H
21#define SRECORD_INPUT_FILTER_BYTE_SWAP_H
22
23#include <srecord/input/filter.h>
24#include <srecord/record.h>
25
26namespace srecord {
27
28/**
29 * The srecord::input_filter_byte_swap class is used to reverse the
30 * even-addressed and odd-addressed bytes in an input source.
31 */
32 class input_filter_byte_swap:
33 public input_filter
34{
35public:
36 /**
37 * The destructor.
38 */
39 virtual ~input_filter_byte_swap();
40
41private:
42 /**
43 * The constructor.
44 *
45 * @param deeper
46 * The incoming data sourec to be byte-swapped.
47 */
48 input_filter_byte_swap(const input::pointer &deeper);
49
50public:
51 /**
52 * The create class method is used to create new dynamically
53 * allocated instances of this class.
54 *
55 * @param deeper
56 * The incoming data sourec to be byte-swapped.
57 */
58 static pointer create(const input::pointer &deeper);
59
60protected:
61 // See base class for documentation.
62 bool read(record &record);
63
64 // See base class for documentation.
65 void command_line(arglex_tool *cmdln);
66
67private:
68 /**
69 * The buffer instance variable is used to remember the data
70 * fetched from the deeper data source.
71 */
72 record buffer;
73
74 /**
75 * The buffer_pos instance variable is used to remeber the byte
76 * position within the buffer instance variable.
77 */
78 size_t buffer_pos;
79
80 /**
81 * The mask instance variable is used to remember the bit mask to
82 * be xor-ed with the address to form the byte-swapped address.
83 * It defaults to 1, but can be altered by command line option.
84 */
85 record::address_t mask;
86
87 /**
88 * The default constructor. Do not use.
89 */
90 input_filter_byte_swap();
91
92 /**
93 * The copy constructor. Do not use.
94 */
95 input_filter_byte_swap(const input_filter_byte_swap &);
96
97 /**
98 * The assignment operator. Do not use.
99 */
100 input_filter_byte_swap &operator=(const input_filter_byte_swap &);
101};
102
103};
104
105#endif // SRECORD_INPUT_FILTER_BYTE_SWAP_H
srecord::arglex_tool
The srecord::arglex_tool is used to parse command line with srec-specific arguments.
Definition tool.h:41
srecord::input_filter_byte_swap::command_line
void command_line(arglex_tool *cmdln)
The command_line method is used by arglex_srec::get_input when parsing the command line,...
srecord::input_filter_byte_swap::~input_filter_byte_swap
virtual ~input_filter_byte_swap()
The destructor.
srecord::input_filter_byte_swap::read
bool read(record &record)
The read method is used to read one record from the input.
srecord::input_filter_byte_swap::create
static pointer create(const input::pointer &deeper)
The create class method is used to create new dynamically allocated instances of this class.
srecord::input_filter::input_filter
input_filter(input::pointer deeper)
The constructor.
srecord::input::pointer
std::shared_ptr< input > pointer
Definition input.h:41
srecord::record
The srecord::record class is used to represent a data record read from a file.
Definition record.h:35
srecord::record::address_t
uint32_t address_t
The type of record addresses.
Definition record.h:58
filter.h
srecord
Definition adler16.h:25
record.h