MotorControlModuleSDFM_TMS3.../Projects/EFC_Communication/UMLibrary/systemic/CompareParams.hh
2024-06-07 11:12:56 +03:00

56 lines
1.0 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* CompareParams.hh
*
* Created on: 23 янв. 2022 г.
* Author: sozonov
*/
#ifndef UMLIBRARY_SYSTEMIC_COMPAREPARAMS_HH_
#define UMLIBRARY_SYSTEMIC_COMPAREPARAMS_HH_
#include <utility>
#include <cstring>
namespace systemic {
class CompareParams {
public:
typedef std::pair< char *, std::size_t > params_t;
CompareParams( params_t _first, params_t _second ) :
first_param( _first ), second_param( _second ), is_equal(false) {}
void compare() {
bool equal_size = first_param.second == second_param.second;
bool equal_data;
if( equal_size ) {
bool data_not_equal = std::memcmp(first_param.first, second_param.first, first_param.second);
equal_data = not data_not_equal;
}
is_equal = equal_size and equal_data;
}
const bool & state() { return is_equal; }
private:
params_t first_param;
params_t second_param;
bool is_equal;
};
} // namespace systemic
#endif /* UMLIBRARY_SYSTEMIC_COMPAREPARAMS_HH_ */