srecord  1.65.0
signetics.h
Go to the documentation of this file.
1 //
2 // srecord - manipulate eprom load files
3 // Copyright (C) 2001, 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_OUTPUT_FILE_SIGNETICS_H
21 #define SRECORD_OUTPUT_FILE_SIGNETICS_H
22 
23 #include <srecord/output/file.h>
24 
25 namespace srecord
26 {
27 
28 class record; // forward
29 
30 /**
31  * The srecord::output_file_signetics class is used to represent output to
32  * a file using the Signetiocs format.
33  */
35  public output_file
36 {
37 public:
38  /**
39  * The destructor.
40  */
42 
43 private:
44  /**
45  * The constructor. It is private on purpose, use the #create
46  * class method instead.
47  *
48  * @param file_name
49  * The name of the file to be written. The special name "-"
50  * indicates the standard output is to be used.
51  */
52  output_file_signetics(const std::string &file_name);
53 
54 public:
55  /**
56  * The create class method is used to create new dynamically
57  * allocated instances of this class.
58  *
59  * @param file_name
60  * The name of the file to be written.
61  */
62  static pointer create(const std::string &file_name);
63 
64 protected:
65  // See base class for documentation.
66  void write(const record &);
67 
68  // See base class for documentation.
69  void line_length_set(int);
70 
71  // See base class for documentation.
72  void address_length_set(int);
73 
74  // See base class for documentation.
76 
77  // See base class for documentation.
78  bool preferred_block_size_set(int nbytes);
79 
80  // See base class for documentation.
81  const char *format_name() const;
82 
83  /**
84  * See base class for documentation. We over-ride the base
85  * implementation because signetics uses its own XOR-ROL algorithm.
86  */
87  void checksum_add(unsigned char);
88 
89 private:
90  /**
91  * The pref_block_size is used to remember the preferred block
92  * size. Set by the line_length_set() method. Read by the
93  * preferred_block_size_get() method.
94  */
95  int pref_block_size;
96 
97  /**
98  * The last_address instance variable is used to remember the
99  * address immediatly beyond the last adress of data in the file.
100  * This is used to write the file termination record.
101  */
102  unsigned long last_address;
103 
104  /**
105  * The write_inner method is used to write one line/record to the
106  * output. It is called by the write() method.
107  */
108  void write_inner(int, unsigned long, int, const void *, int);
109 
110  /**
111  * The default constructor. Do not use.
112  */
114 
115  /**
116  * The copy constructor. Do not use.
117  */
119 
120  /**
121  * The assignment operator. Do not use.
122  */
123  output_file_signetics &operator=(const output_file_signetics &);
124 };
125 
126 };
127 
128 #endif // SRECORD_OUTPUT_FILE_SIGNETICS_H
The srecord::output_file_signetics class is used to represent output to a file using the Signetiocs f...
Definition: signetics.h:36
void checksum_add(unsigned char)
See base class for documentation.
bool preferred_block_size_set(int nbytes)
The preferred_block_size_set method is is to set a precific number of bytes for the preferred block s...
void line_length_set(int)
The set_line_length method is used to set the maximum length of an output line, for those formats for...
static pointer create(const std::string &file_name)
The create class method is used to create new dynamically allocated instances of this class.
virtual ~output_file_signetics()
The destructor.
void write(const record &)
The write method is used to write a recordonto an output.
const char * format_name() const
The format_name method is used to obtain the name of this output format.
void address_length_set(int)
The address_length_set method is used to set the minimum number of bytes to be written for addresses ...
int preferred_block_size_get() const
The preferred_block_size_get method is used to get the proferred block size of the output fformat.
The srecord::output_file class is used to represent a generic output file.
Definition: file.h:35
std::shared_ptr< output > pointer
Definition: output.h:41
The srecord::record class is used to represent a data record read from a file.
Definition: record.h:35