diff --git a/dll/commdll.dll b/dll/commdll.dll index 15646d2..b462410 100644 Binary files a/dll/commdll.dll and b/dll/commdll.dll differ diff --git a/dll/commdllD.dll b/dll/commdllD.dll index e7430c0..61c9897 100644 Binary files a/dll/commdllD.dll and b/dll/commdllD.dll differ diff --git a/dll/iodll.dll b/dll/iodll.dll index 8f3499d..48f6956 100644 Binary files a/dll/iodll.dll and b/dll/iodll.dll differ diff --git a/dll/iodllD.dll b/dll/iodllD.dll index 5877943..7ae9dcb 100644 Binary files a/dll/iodllD.dll and b/dll/iodllD.dll differ diff --git a/dll/mcctrdll.dll b/dll/mcctrdll.dll index 10afb06..336efa8 100644 Binary files a/dll/mcctrdll.dll and b/dll/mcctrdll.dll differ diff --git a/dll/mcctrdllD.dll b/dll/mcctrdllD.dll index 4da307f..ac3926f 100644 Binary files a/dll/mcctrdllD.dll and b/dll/mcctrdllD.dll differ diff --git a/dll/secsgemdll.dll b/dll/secsgemdll.dll index 21f3ac1..a374cbd 100644 Binary files a/dll/secsgemdll.dll and b/dll/secsgemdll.dll differ diff --git a/dll/secsgemdllD.dll b/dll/secsgemdllD.dll index 89b1d36..d3b7532 100644 Binary files a/dll/secsgemdllD.dll and b/dll/secsgemdllD.dll differ diff --git a/dll/utility.dll b/dll/utility.dll index 2de3573..978faea 100644 Binary files a/dll/utility.dll and b/dll/utility.dll differ diff --git a/dll/utilityD.dll b/dll/utilityD.dll index 8552a27..8d90365 100644 Binary files a/dll/utilityD.dll and b/dll/utilityD.dll differ diff --git a/utility/Include/GeneralUtils.h b/utility/Include/GeneralUtils.h new file mode 100644 index 0000000..e9fc884 --- /dev/null +++ b/utility/Include/GeneralUtils.h @@ -0,0 +1,26 @@ +#pragma once + +#include "nlohmann/json.hpp" + +namespace nsUtils +{ + template + bool IsWithinTol(T Offset, T Tol) + { + if (Offset > Tol || Offset < -Tol) + { + return false; + } + + return true; + } + + template + inline void getValue(const nlohmann::json& j, const std::string& fieldname, T& value) + { + if (j.contains(fieldname)) + { + j.at(fieldname).get_to(value); + } + } +} \ No newline at end of file diff --git a/utility/Include/KeyValueStruct.h b/utility/Include/KeyValueStruct.h new file mode 100644 index 0000000..8419efd --- /dev/null +++ b/utility/Include/KeyValueStruct.h @@ -0,0 +1,64 @@ +#pragma once + +#include + +// thirdparty +#include "nlohmann/json.hpp" + +// project +#include "GeneralUtils.h" + +namespace nsKeyValue +{ + using stKeyValue = struct _stKeyValue + { + std::string Name; + double Value{ 0.0 }; + }; + + using stKeyValueBool = struct _stKeyValueBool + { + std::string Name; + bool Value{}; + }; +}; + +namespace nsKeyValue +{ + using namespace nlohmann; + using namespace nsUtils; + + void from_json(const json& j, stKeyValue& x); + void to_json(json& j, const stKeyValue& x); + + void from_json(const json& j, stKeyValueBool& x); + void to_json(json& j, const stKeyValueBool& x); + + inline void from_json(const json& j, stKeyValue& x) + { + getValue(j, "Name", x.Name); + getValue(j, "Value", x.Value); + } + + inline void to_json(json& j, const stKeyValue& x) + { + j = nlohmann::json{ + { "Name", x.Name }, + { "Value", x.Value } + }; + } + + inline void from_json(const json& j, stKeyValueBool& x) + { + getValue(j, "Name", x.Name); + getValue(j, "Value", x.Value); + } + + inline void to_json(json& j, const stKeyValueBool& x) + { + j = nlohmann::json{ + { "Name", x.Name }, + { "Value", x.Value } + }; + } +} \ No newline at end of file diff --git a/utility/Include/TraceConfig.h b/utility/Include/TraceConfig.h new file mode 100644 index 0000000..a7eff99 --- /dev/null +++ b/utility/Include/TraceConfig.h @@ -0,0 +1,95 @@ +#pragma once + +#include +#include + +#include "KeyValueStruct.h" + +#include "DllDefines.h" + +namespace nsTrace +{ + using stTrace = struct + { + std::vector Trace; + std::vector TraceTiming; + }; + +} + +namespace nsTrace +{ + using namespace nlohmann; + using namespace nsUtils; + + void from_json(const json& j, stTrace& x); + void to_json(json& j, const stTrace& x); + + inline void from_json(const json& j, stTrace& x) + { + getValue(j, "Trace", x.Trace); + getValue(j, "TraceTiming", x.TraceTiming); + } + + inline void to_json(json& j, const stTrace& x) + { + j = nlohmann::json{ + { "Trace", x.Trace }, + { "TraceTiming", x.TraceTiming } + }; + } +} + +namespace nsTraceConfig +{ + const std::string HARDWARE_TRACE_CONFIG = "d:/machine/config/trace/hardwareTrace.json"; + const std::string CLASS_TRACE_CONFIG = "d:/machine/config/trace/classTrace.json"; + const std::string MODULE_TRACE_CONFIG = "d:/machine/config/trace/hardwareTrace.json"; +} + +class UTILITYDLL CTraceConfig +{ +public: + /** + * @brief + * @summary + * @param strFilePath Name of Trace file. eg: d:/machine/config/trace/HardwareTrace.json, d:/machine/config/trace/ModuleTrace.json, d:/machine/config/trace/classTrace.json + */ + CTraceConfig(const std::string& strFilePath); + virtual ~CTraceConfig(); + + /** + * @brief Init Memory Parameters + */ + void InitParameters(); + + /** + * @brief Get config object + * @return nsTrace::stTrace object (read Only) + */ + const nsTrace::stTrace& Get(); + + /** + * @brief Check Trace Enable + * @param strName Name of Trace + * @return true=enable trace + */ + bool IsTrace(const std::string& strName); + + /** + * @brief Check Trace Timing Enable + * @param strName Name of Trace Data + * @return true=enable trace data + */ + bool IsTraceTiming(const std::string& strName); + +private: + /** + * @brief Load config from file + * @param strFilePath File Path to load from + */ + void Load(const std::string& strFilePath); + + std::string m_strFilePath; + nsTrace::stTrace m_config; +}; diff --git a/utility/lib/utility.lib b/utility/lib/utility.lib index c2c3c7c..80567bd 100644 Binary files a/utility/lib/utility.lib and b/utility/lib/utility.lib differ diff --git a/utility/lib/utilityD.lib b/utility/lib/utilityD.lib index 12584ce..d330ac1 100644 Binary files a/utility/lib/utilityD.lib and b/utility/lib/utilityD.lib differ