srecord  1.65.0
logisim.h
Go to the documentation of this file.
1 //
2 // srecord - Manipulate EPROM load files
3 // Copyright (C) 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 General Public License for
13 // 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_OUTPUT_FILE_LOGISIM_H
20 #define SRECORD_OUTPUT_FILE_LOGISIM_H
21 
22 #include <srecord/output/file.h>
23 
24 namespace srecord {
25 
26 /**
27  * The output_file_logisim class is used to represent
28  * the processing neccessry to write a Logisim ROM file.
29  */
31  public output_file
32 {
33 public:
34  /**
35  * The destructor.
36  */
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 written.
45  */
46  static pointer create(const std::string &file_name);
47 
48 protected:
49  // See base class for documentation.
50  void write(const record &);
51 
52  // See base class for documentation.
53  void line_length_set(int);
54 
55  // See base class for documentation.
56  void address_length_set(int);
57 
58  // See base class for documentation.
59  int preferred_block_size_get(void) const;
60 
61  // See base class for documentation.
62  bool preferred_block_size_set(int nbytes);
63 
64  // See base class for documentation.
65  const char *format_name(void) const;
66 
67 private:
68  /**
69  * The constructor.
70  * Use #create instead.
71  */
72  output_file_logisim(const std::string &file_name);
73 
74  long address;
75  int line_length;
76  int column;
77 
78  void emit(int count, int value);
79 
80  /**
81  * The default constructor.
82  * Do not use.
83  */
85 
86  /**
87  * The copy constructor.
88  * Do not use.
89  */
91 
92  /**
93  * The assignment operator.
94  * Do not use.
95  */
96  output_file_logisim &operator=(const output_file_logisim &rhs);
97 };
98 
99 };
100 
101 // vim: set ts=8 sw=4 et :
102 #endif // SRECORD_OUTPUT_FILE_LOGISIM_H
The output_file_logisim class is used to represent the processing neccessry to write a Logisim ROM fi...
Definition: logisim.h:32
void address_length_set(int)
The address_length_set method is used to set the minimum number of bytes to be written for addresses ...
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...
virtual ~output_file_logisim()
The destructor.
static pointer create(const std::string &file_name)
The create class method is used to create new dynamically allocated instances of this class.
int preferred_block_size_get(void) const
The preferred_block_size_get method is used to get the proferred block size of the output fformat.
void write(const record &)
The write method is used to write a recordonto an output.
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...
const char * format_name(void) const
The format_name method is used to obtain the name of this output format.
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