You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.0 KiB
C++
51 lines
1.0 KiB
C++
#pragma once
|
|
|
|
#include "nlohmann/json.hpp"
|
|
|
|
#include "GeneralUtils.h"
|
|
|
|
namespace nsMMF
|
|
{
|
|
// !!! Do Not change the order to support MMF use case
|
|
using InputStatus = struct _InputStatus {
|
|
char PtName[100]{};
|
|
bool On{ false };
|
|
|
|
// Assignment operator overload
|
|
_InputStatus& operator=(const _InputStatus& rhs)
|
|
{
|
|
//
|
|
strcpy_s(PtName, rhs.PtName);
|
|
|
|
On = rhs.On;
|
|
|
|
return *this;
|
|
}
|
|
};
|
|
}
|
|
|
|
namespace nsMMF
|
|
{
|
|
using namespace nlohmann;
|
|
using namespace nsUtils;
|
|
|
|
void from_json(const json& j, InputStatus& x);
|
|
void to_json(json& j, const InputStatus& x);
|
|
|
|
inline void from_json(const json& j, InputStatus& x)
|
|
{
|
|
std::string name = j.at("PtName").get<std::string>();
|
|
strcpy_s(x.PtName, name.c_str());
|
|
|
|
getValue(j, "On", x.On);
|
|
}
|
|
|
|
inline void to_json(json& j, const InputStatus& x)
|
|
{
|
|
j = nlohmann::json{
|
|
{ "PtName", x.PtName },
|
|
{ "On", x.On }
|
|
};
|
|
}
|
|
|
|
} |