srecord 1.65.0
 
Loading...
Searching...
No Matches
wilson.h
Go to the documentation of this file.
1//
2// srecord - manipulate eprom load files
3// Copyright (C) 2000-2003, 2006-2008, 2010, 2011, 2013 Peter Miller
4//
5// This program is free software; you can redistribute it and/or modify it
6// 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 your
8// option) any later version.
9//
10// This program is distributed in the hope that it will be useful, but WITHOUT
11// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13// 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_FILE_WILSON_H
20#define SRECORD_INPUT_FILE_WILSON_H
21
22#include <srecord/input/file.h>
23
24namespace srecord {
25
26/**
27 * The srecord::input_file_wilson clas sis used to represent the parse state
28 * of an input file in Wilson format. (Named after the person who wasked
29 * for it; I still don't have an official definition of this format,
30 * but it is very much like a binary(ish) form of the Motorola format.)
31 */
32class input_file_wilson:
33 public input_file
34{
35public:
36 /**
37 * The destructor.
38 */
40
41 /**
42 * The create class method is used to create new dynamically
43 * allocated instances of this class.
44 *
45 * @param file_name
46 * The name of the file to be read.
47 * @returns
48 * smart pointer to new instance
49 */
50 static pointer create(const std::string &file_name);
51
52protected:
53 // See base class for documentation.
55
56 // See base class for documentation.
57 const char *get_file_format_name(void) const;
58
59 // See base class for documentation.
60 bool is_binary(void) const;
61
62 // See base class for documentation.
63 int format_option_number(void) const;
64
65 /**
66 * The get_byte method is used to get a byte of input. We override
67 * because the byte encoding is one character of input sometimes,
68 * and two characters of input at other times.
69 */
70 virtual int get_byte(void);
71
72private:
73 /**
74 * The constructor.
75 *
76 * @param file_name
77 * The name of the file to be read.
78 */
79 input_file_wilson(const std::string &file_name);
80
81private:
82 /**
83 * The read_inner method is used to read a record from the input.
84 * The #read method is a wrapper around this method.
85 */
86 bool read_inner(record &);
87
88 /**
89 * The garbage_warning instance variable is used to remember whether
90 * a warning about garbage input has been issued yet.
91 */
92 bool garbage_warning;
93
94 /**
95 * The seen_some_input instance variable is used to remember whether
96 * this file contains any data so far.
97 */
98 bool seen_some_input;
99
100 /**
101 * The termination_seen instance variable is used to remember
102 * whether the termination record has been seen yet.
103 */
104 bool termination_seen;
105
106 /**
107 * The default constructor. Do not use.
108 */
109 input_file_wilson();
110
111 /**
112 * The copy constructor. Do not use.
113 */
114 input_file_wilson(const input_file_wilson &);
115
116 /**
117 * The assignment operator. Do not use.
118 */
119 input_file_wilson &operator=(const input_file_wilson &);
120};
121
122};
123
124#endif // SRECORD_INPUT_FILE_WILSON_H
125// vim: set ts=8 sw=4 et :
bool is_binary(void) const
The is_binary method is used to to determine whether or not a file format is binary (true) of text (f...
int format_option_number(void) const
The format_option_number method is used to obtain the option number, which can then be turned into te...
bool read(record &record)
The read method is used to read one record from the input.
virtual int get_byte(void)
The get_byte method is used to get a byte of input.
virtual ~input_file_wilson()
The destructor.
const char * get_file_format_name(void) const
The get_file_format_name method is used to find out the name of the file format being read.
static pointer create(const std::string &file_name)
The create class method is used to create new dynamically allocated instances of this class.
input_file(const std::string &file_name)
The constructor.
std::shared_ptr< input_file > pointer
Definition file.h:39
The srecord::record class is used to represent a data record read from a file.
Definition record.h:35