| Remote Access Control |

# hexfile.cpp File Reference

## Detailed Description

Source file for a simple Intel HEX file writer.

- File: hexfile.cpp
- Compiler: Any PC C++ Compiler
- AppNote: AVR411 - Secure Rolling Code Algorithm for Wireless Link

Author:
  Atmel Corporation: http://www.atmel.com
  Support email: avr@atmel.com

$Name$

Revision
  792

Date
  2006-10-09 10:36:07 +0200 (ma, 09 okt 2006)

Copyright (c) 2006, Atmel Corporation All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. The name of ATMEL may not be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY ATMEL ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file hexfile.cpp.

`#include "hexfile.h"`
`#include <iomanip>`
`#include <stdexcept>`

Include dependency graph for hexfile.cpp:

Go to the source code of this file.

## Defines
#define | HEXDATARECORDTYPE ( (byte) 0x00 )
#define | HEXEOFRECORDTYPE ( (byte) 0x01 )
## Functions
std::ostream & | operator<< (std::ostream &os, const HEXFile &file)
HEXFile & | operator<< (HEXFile &file, const HEXRecord &record)
std::ostream & | operator<< (std::ostream &os, const HEXRecord &record)
HEXRecord & | operator<< (HEXRecord &record, std::vector< byte > data)
HEXRecord & | operator<< (HEXRecord &record, byte data)

## Define Documentation

#define HEXDATARECORDTYPE ( (byte) 0x00 )

HEX file record type ID for ordinary data records.

Definition at line 52 of file hexfile.cpp.

Referenced by HEXRecord::Print().

#define HEXEOFRECORDTYPE ( (byte) 0x01 )

HEX file record type ID for End-of-File records.

Definition at line 54 of file hexfile.cpp.

## Function Documentation

std::ostream& operator<< | ( | std::ostream & | os,
|  | const HEXFile & | file |
| ) |  |  |

Overloaded insertion operator to print a HEX file to an output stream.

Definition at line 158 of file hexfile.cpp.

References HEXFile::Print().

    00159 {
    00160         file.Print( os );
    00161         return os;
    00162 }

Here is the call graph for this function:

HEXFile& operator<< | ( | HEXFile & | file,
|  | const HEXRecord & | record |
| ) |  |  |

Overloaded insertion operator to add one record to a HEX file.

Definition at line 150 of file hexfile.cpp.

    00151 {
    00152         file.Add( record );
    00153         return file;
    00154 }

std::ostream& operator<< | ( | std::ostream & | os,
|  | const HEXRecord & | record |
| ) |  |  |

Overloaded insertion operator to print a record to an output stream.

Definition at line 132 of file hexfile.cpp.

    00133 {
    00134         record.Print( os );
    00135         return os;
    00136 }

HEXRecord& operator<< | ( | HEXRecord & | record,
|  | std::vector< byte > | data |
| ) |  |  |

Overloaded insertion operator to add a set of data bytes to a record.

Definition at line 124 of file hexfile.cpp.

    00125 {
    00126         record.Add( data );
    00127         return record;
    00128 }

HEXRecord& operator<< | ( | HEXRecord & | record,
|  | byte | data |
| ) |  |  |

Overloaded insertion operator to add one data byte to a record.

Definition at line 116 of file hexfile.cpp.

    00117 {
    00118         record.Add( data );
    00119         return record;
    00120 }

@DOC_TITLE@