12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- #ifndef __HEADCOUNT_CFG_H
- #define __HEADCOUNT_CFG_H
- #include "MAS_AlgoDef.h"
- #define NAMESPACE_HEADCOUNT_BEGIN namespace headcount {
- #define NAMESPACE_HEADCOUNT_END };
- NAMESPACE_MAS_BEGIN
- NAMESPACE_HEADCOUNT_BEGIN
- struct HeadCountCfg {
- TZ_INT TimeThreshold;
- HeadCountCfg() : TimeThreshold(60){}
- std::string toJson() const
- {
- tzc::json::JsonDoc document;
- document.SetObject();
- tzc::json::setFiled(document, "TimeThreshold", TimeThreshold);
- return tzc::json::ValueToJson(document);
- }
- static TZ_BOOL fromJson(const std::string & json, HeadCountCfg & value)
- {
- tzc::json::JsonDoc document;
- document.Parse(json.c_str());
- if (document.HasParseError())
- {
- return false;
- }
- value.TimeThreshold = tzc::json::getFiled(document, "TimeThreshold", 60);
- return true;
- }
- };
- struct HeadCountStrategyExterns {
- std::string Description;
- HeadCountStrategyExterns() : Description("") {}
- std::string toJson() const
- {
- tzc::json::JsonDoc document;
- document.SetObject();
- tzc::json::setFiled(document, "Description", Description);
- return tzc::json::ValueToJson(document);
- }
- static TZ_BOOL fromJson(const std::string & json, HeadCountStrategyExterns & value)
- {
- tzc::json::JsonDoc document;
- document.Parse(json.c_str());
- if (document.HasParseError())
- {
- return false;
- }
- value.Description = tzc::json::getFiled(document, "Description", "");
- return true;
- }
- };
- NAMESPACE_HEADCOUNT_END
- NAMESPACE_MAS_END
- #endif
|