srecord: input/file/fairchild.h Source File

srecord 1.65.0

Loading...
Searching...
No Matches
fairchild.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_FAIRCHILD_H
20#define SRECORD_INPUT_FILE_FAIRCHILD_H
21
22#include <srecord/input/file.h>
23
24namespace srecord {
25
26/**
27 * The srecord::input_file_fairchild class is used to represent the parse
28 * stat ewhen reading a file in Fairchild Fairbug format.
29 */
30 class input_file_fairchild:
31 public input_file
32{
33public:
34 /**
35 * The destructor.
36 */
37 virtual ~input_file_fairchild();
38
39 /**
40 * The create class method is used to create new dynamically
41 * allocated instances of this class.
42 *
43 * @param file_name
44 * The name of the file to be read.
45 * @returns
46 * smart pointer to new instance
47 */
48 static pointer create(const std::string &file_name);
49
50protected:
51 // See base class for documentation.
52 bool read(record &record);
53
54 // See base class for documentation.
55 const char *get_file_format_name(void) const;
56
57 // See base class for documentation.
58 int format_option_number(void) const;
59
60private:
61 /**
62 * The constructor.
63 *
64 * @param file_name
65 * The name of the file to be read.
66 */
67 input_file_fairchild(const std::string &file_name);
68
69 /**
70 * The get_nibble method gets a single hex-digit from input.
71 * We override the one in the base class because the checksum is
72 * nibble-based, not byte-based.
73 */
74 int get_nibble(void);
75
76 /**
77 * The get_byte method gets a two hex-digit from input and assembles
78 * them (big-endian) into a byte. We override the one in the base
79 * class because the checksum is nibble-based, not byte-based.
80 */
81 int get_byte(void);
82
83 /**
84 * The header_seen instance variable is used to member whether the
85 * file header has been processed yet.
86 */
87 bool header_seen;
88
89 /**
90 * The address instance variable is used to member the address at
91 * the currebt point in the input file.
92 */
93 unsigned long address;
94
95 /**
96 * The file_contains_data instance variable is used to member
97 * whether any data records have been seen yet.
98 */
99 bool file_contains_data;
100
101 /**
102 * The default constructor. Do not use.
103 */
104 input_file_fairchild();
105
106 /**
107 * The copy constructor. Do not use.
108 */
109 input_file_fairchild(const input_file_fairchild &);
110
111 /**
112 * The assignment operator.
113 */
114 input_file_fairchild &operator=(const input_file_fairchild &);
115};
116
117};
118
119#endif // SRECORD_INPUT_FILE_FAIRCHILD_H
120// vim: set ts=8 sw=4 et :
srecord::input_file_fairchild::~input_file_fairchild
virtual ~input_file_fairchild()
The destructor.
srecord::input_file_fairchild::read
bool read(record &record)
The read method is used to read one record from the input.
srecord::input_file_fairchild::get_file_format_name
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.
srecord::input_file_fairchild::create
static pointer create(const std::string &file_name)
The create class method is used to create new dynamically allocated instances of this class.
srecord::input_file_fairchild::format_option_number
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...
srecord::input_file::input_file
input_file(const std::string &file_name)
The constructor.
srecord::input_file::get_nibble
virtual int get_nibble(void)
The get_nibble method is used to fetch one hexadecimal digit from the input, via the get_char method.
srecord::input_file::get_byte
virtual int get_byte(void)
The get_byte method is used to fetch a byte value from the input.
srecord::input_file::pointer
std::shared_ptr< input_file > pointer
Definition file.h:39
srecord::record
The srecord::record class is used to represent a data record read from a file.
Definition record.h:35
file.h
srecord
Definition adler16.h:25