Rev 2004 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 2004 | Rev 2005 | ||
|---|---|---|---|
| Line 44... | Line 44... | ||
| 44 | 44 | ||
| 45 | Code::Code() |
45 | Code::Code() |
| 46 | { |
46 | { |
| 47 | LOG_DEBUG_ENTER; |
47 | LOG_DEBUG_ENTER; |
| 48 | 48 | ||
| 49 | this->Reset(); |
49 | this->Reset(false); |
| 50 | //this->data_.insert(this->data_.begin(), 0xFF, MAX_BUFFER_SIZE); |
50 | //this->data_.insert(this->data_.begin(), 0xFF, MAX_BUFFER_SIZE); |
| 51 | 51 | ||
| 52 | LOG_DEBUG_EXIT; |
52 | LOG_DEBUG_EXIT; |
| 53 | } |
53 | } |
| 54 | 54 | ||
| Line 56... | Line 56... | ||
| 56 | { |
56 | { |
| 57 | LOG_DEBUG_ENTER; |
57 | LOG_DEBUG_ENTER; |
| 58 | LOG_DEBUG_EXIT; |
58 | LOG_DEBUG_EXIT; |
| 59 | } |
59 | } |
| 60 | 60 | ||
| 61 | void Code::Reset() |
61 | void Code::Reset(bool fill) |
| 62 | { |
62 | { |
| 63 | LOG_DEBUG_ENTER; |
63 | LOG_DEBUG_ENTER; |
| 64 | 64 | ||
| 65 | this->address_lower_ = MAX_BUFFER_SIZE; |
65 | this->address_lower_ = MAX_BUFFER_SIZE; |
| 66 | this->address_upper_ = 0; |
66 | this->address_upper_ = 0; |
| 67 | this->is_valid_ = false; |
67 | this->is_valid_ = false; |
| 68 | 68 | ||
| - | 69 | common::Byteset empty_vector; |
|
| - | 70 | this->data_.swap(empty_vector); |
|
| - | 71 | ||
| - | 72 | if (fill) |
|
| - | 73 | { |
|
| 69 | this->data_.reserve(MAX_BUFFER_SIZE); |
74 | this->data_.reserve(MAX_BUFFER_SIZE); |
| 70 | std::fill(this->data_.begin(), this->data_.begin() + MAX_BUFFER_SIZE, 0xFF); |
75 | std::fill(this->data_.begin(), this->data_.begin() + MAX_BUFFER_SIZE, 0xFF); |
| - | 76 | } |
|
| 71 | 77 | ||
| 72 | LOG_DEBUG_EXIT; |
78 | LOG_DEBUG_EXIT; |
| 73 | } |
79 | } |
| 74 | 80 | ||
| 75 | void Code::CalculateChecksum() |
81 | void Code::CalculateChecksum() |
| Line 143... | Line 149... | ||
| 143 | 149 | ||
| 144 | common::StringList lines; |
150 | common::StringList lines; |
| 145 | 151 | ||
| 146 | boost::algorithm::split(lines, data, boost::is_any_of("\n"), boost::algorithm::token_compress_on); |
152 | boost::algorithm::split(lines, data, boost::is_any_of("\n"), boost::algorithm::token_compress_on); |
| 147 | 153 | ||
| 148 | this->Reset(); |
154 | this->Reset(true); |
| 149 | 155 | ||
| 150 | unsigned int byte_count; |
156 | unsigned int byte_count; |
| 151 | unsigned int addess; |
157 | unsigned int addess; |
| 152 | unsigned int record_type; |
158 | unsigned int record_type; |
| 153 | 159 | ||