srecord 1.65.0
 
Loading...
Searching...
No Matches
srecord::input_filter_checksum Class Referenceabstract

The srecord::input_filter_checksum class is an abstraction of various checksums to be ammplied to input sources. More...

#include <checksum.h>

Inheritance diagram for srecord::input_filter_checksum:
Collaboration diagram for srecord::input_filter_checksum:

Public Member Functions

virtual ~input_filter_checksum ()
 The destructor.
 
- Public Member Functions inherited from srecord::input_filter
virtual ~input_filter ()
 The destructor.
 
std::string filename () const
 The filename method is used to get the name of the input file being processed.
 
std::string filename_and_line () const
 The filename_and_line method is used to get the name and current line number within the file.
 
const char * get_file_format_name () const
 The get_file_format_name method is used to find out the name of the file format being read.
 
void disable_checksum_validation ()
 The disable_checksum_validation method is used to have this input stream ignore checksum errors.
 
- Public Member Functions inherited from srecord::input
virtual ~input ()
 The destructor.
 
virtual void fatal_error (const char *,...) const FORMAT_PRINTF(2
 The fatal_error method is used to report problems parsing the file.
 
virtual void virtual void fatal_error_errno (const char *,...) const FORMAT_PRINTF(2
 The fatal_error_errno method is used to report problems reading the input file.
 
virtual void virtual void virtual void warning (const char *,...) const FORMAT_PRINTF(2
 The warning method is used to report potential (but non-fatal) problems parsing the file.
 
void set_quit (quit &)
 The set_quit method is used to set the disposition of the error messages, and the "exit" implementation.
 
void reset_quit (void)
 The reset_quit method is used to cause the disposition of the error messages, and the "exit" back to the default.
 
virtual void command_line (srecord::arglex_tool *cmdln)
 The command_line method is used by arglex_srec::get_input when parsing the command line, to give a format or filter an opportunity to grab extra arguments off the command line.
 

Protected Types

typedef unsigned long sum_t
 

Protected Member Functions

bool read (record &record)
 The read method is used to read one record from the input.
 
 input_filter_checksum (input::pointer deeper, int address, int length, endian_t end, int width=1)
 The constructor.
 
virtual sum_t calculate (void)=0
 The calculate method is used to calculate the checksum to be written into the output, based on the "sum" instance variable.
 
bool generate (record &record)
 The generate method is used to generate the final data record, once all of the deeper input has been passed through, based on the calculated checksum.
 
- Protected Member Functions inherited from srecord::input_filter
 input_filter (input::pointer deeper)
 The constructor.
 
- Protected Member Functions inherited from srecord::input
 input ()
 The default constructor.
 

Protected Attributes

int checksum_address
 The checksum_address instance variable is used to remember where to place the checksum at the end of the data.
 
int length
 The length instance variable is used to remember how many bytes of checksum are to be emitted.
 
endian_t end
 The end instance variable is used to remember whether the summation for the checksum is bigendian or little endian.
 
sum_t sum
 The sum instance variable is used to remember the running checksum of the incoming data source.
 
int width
 The width instance variable is used to remember the swathe width as the incoming bytes are added to the running sum.
 
- Protected Attributes inherited from srecord::input_filter
pointer ifp
 

Additional Inherited Members

- Public Types inherited from srecord::input
typedef std::shared_ptr< inputpointer
 

Detailed Description

The srecord::input_filter_checksum class is an abstraction of various checksums to be ammplied to input sources.

Definition at line 35 of file checksum.h.

Member Typedef Documentation

◆ sum_t

typedef unsigned long srecord::input_filter_checksum::sum_t
protected

Definition at line 69 of file checksum.h.

Constructor & Destructor Documentation

◆ ~input_filter_checksum()

virtual srecord::input_filter_checksum::~input_filter_checksum ( )
virtual

The destructor.

◆ input_filter_checksum()

srecord::input_filter_checksum::input_filter_checksum ( input::pointer deeper,
int address,
int length,
endian_t end,
int width = 1 )
protected

The constructor.

May only be called by derived classes.

Parameters
deeperThe deeper input source being checksummed.
addressThe address to place the checksum.
lengthThe number of bytes of checksum to be placed into the result.
endThe byte order
widthThe width of the values being summed. Usually 1 byte, but wider combinations are possible. If you use something wider, it is assumed that they are alligned on multiples of that width, no provision for an offset is provided.

References end, length, and width.

Referenced by generate().

Member Function Documentation

◆ read()

bool srecord::input_filter_checksum::read ( record & rec)
protectedvirtual

The read method is used to read one record from the input.

It returns 0 at the end of the input, and 1 if a record is read successfully.

See the srecord::record documentation (header file) for details of the various record types.

Note: there is no guarantee that a header record will appear first, or that a execution start address record will appear last.

Parameters
recWhere to put the returned data.
Returns
bool; true if data was read, false if at end-of-file

Reimplemented from srecord::input_filter.

◆ calculate()

virtual sum_t srecord::input_filter_checksum::calculate ( void )
protectedpure virtual

The calculate method is used to calculate the checksum to be written into the output, based on the "sum" instance variable.

Implemented in srecord::input_filter_checksum_bitnot, srecord::input_filter_checksum_negative, and srecord::input_filter_checksum_positive.

◆ generate()

bool srecord::input_filter_checksum::generate ( record & record)
protected

The generate method is used to generate the final data record, once all of the deeper input has been passed through, based on the calculated checksum.

Parameters
recordWhere to place the returned data.
Returns
bool; false if end-of-file, true if data available

References input_filter_checksum().

Member Data Documentation

◆ checksum_address

int srecord::input_filter_checksum::checksum_address
protected

The checksum_address instance variable is used to remember where to place the checksum at the end of the data.

Definition at line 75 of file checksum.h.

◆ length

◆ end

◆ sum

sum_t srecord::input_filter_checksum::sum
protected

The sum instance variable is used to remember the running checksum of the incoming data source.

Definition at line 93 of file checksum.h.

◆ width


The documentation for this class was generated from the following file: