srecord  1.65.0
intel16.h
Go to the documentation of this file.
1 //
2 // srecord - manipulate eprom load files
3 // Copyright (C) 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_INTEL16_H
20 #define SRECORD_INPUT_FILE_INTEL16_H
21 
22 #include <srecord/input/file.h>
23 
24 namespace srecord
25 {
26 
27 /**
28  * The srecord::input_file_intel16 class is used to represent the parse state
29  * of an INHX16 formatted file.
30  */
32  public input_file
33 {
34 public:
35  /**
36  * The destructor.
37  */
39 
40  /**
41  * The create class method is used to create new dynamically
42  * allocated instances of this class.
43  *
44  * @param file_name
45  * The name of the file to be read.
46  * @returns
47  * smart pointer to new instance
48  */
49  static pointer create(const std::string &file_name);
50 
51 protected:
52  // See base class for documentation.
53  bool read(record &record);
54 
55  // See base class for documentation.
56  const char *get_file_format_name(void) const;
57 
58  // See base class for documentation.
59  int format_option_number(void) const;
60 
61 private:
62  /**
63  * The constructor.
64  *
65  * @param file_name
66  * The name of the file to be read.
67  */
68  input_file_intel16(const std::string &file_name);
69 
70  /**
71  * Read one record from the file. The read method is a wrapper
72  * around this method.
73  */
74  bool read_inner(record &);
75 
76  /**
77  * The data_record_count instance variable is used to remember the
78  * number of data records seen to date.
79  */
80  int data_record_count;
81 
82  /**
83  * The garbage_warning instance variable is used to remember wherther
84  * or not a warning has already been issued about garbage lines
85  * of input.
86  */
87  bool garbage_warning;
88 
89  /**
90  * The seen_some_input instance variable is used to remember whether
91  * or not the file contains any data.
92  */
93  bool seen_some_input;
94 
95  /**
96  * The termination_seen instance variable is used to remember
97  * whether or not a termination record has been seen yet.
98  */
99  bool termination_seen;
100 
101  /**
102  * The mode instance variable is used to remember what addressing
103  * mode the file is currently in.
104  */
105  enum { linear, segmented } mode;
106 
107  /**
108  * The address_base instance variable is used to remember the
109  * segment base address when in segmented addressing mode.
110  */
111  unsigned long address_base;
112 
113  /**
114  * The pushback instance variable is used to remember the previous
115  * record in the file. This is needed in some instances, but not always.
116  */
117  record *pushback;
118 
119  /**
120  * The end_seen instance variable is used to remember whether or
121  * not the end of file has been seen yet.
122  */
123  bool end_seen;
124 
125  /**
126  * The default constructor. Do not use.
127  */
129 
130  /**
131  * The copy constructor. Do not use.
132  */
134 
135  /**
136  * The assignment operator. Do not use.
137  */
138  input_file_intel16 &operator=(const input_file_intel16 &);
139 };
140 
141 };
142 
143 #endif // SRECORD_INPUT_FILE_INTEL16_H
144 // vim: set ts=8 sw=4 et :
The srecord::input_file_intel16 class is used to represent the parse state of an INHX16 formatted fil...
Definition: intel16.h:33
bool read(record &record)
The read method is used to read one record from the input.
static pointer create(const std::string &file_name)
The create class method is used to create new dynamically allocated instances of this class.
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.
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...
virtual ~input_file_intel16()
The destructor.
The srecord::input_file class is used to represent an generic input file.
Definition: file.h:37
std::shared_ptr< input > pointer
Definition: input.h:41
The srecord::record class is used to represent a data record read from a file.
Definition: record.h:35