2 This file is part of Smoothie (http://smoothieware.org/). The motion control part is heavily based on Grbl (https://github.com/simen/grbl).
3 Smoothie is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
4 Smoothie is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
5 You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>.
14 #include "ConfigValue.h"
16 class ConfigCache
: public std::vector
<ConfigValue
*> {
20 // If we find an existing value, replace it, otherwise, push it at the back of the list
21 void replace_or_push_back(ConfigValue
* new_value
){
23 bool value_exists
= false;
24 // For each already existing element
25 for( int i
=1; i
<this->size(); i
++){
26 // If this configvalue matches the checksum
29 while( new_value
->check_sums
[counter
] != 0x0000 && counter
< 3 ){
30 if(this->at(i
)->check_sums
[counter
] != new_value
->check_sums
[counter
] ){
36 if( match
== false ){ continue; }
39 // Replace with the provided value
41 this->at(i
) = new_value
;
45 // Value does not already exists, add to the list
46 if( value_exists
== false ){
47 this->push_back(new_value
);