#include "AxisCfg.h" AxisCfg::AxisCfg(short id) :m_axis_id(id) , m_active_limit(new IntData("active_limit", u8"活性限制微米")) , m_negactive_limit(new IntData("negactive_limit", u8"消极限制微米")) , m_active_direct(new IntData("active_direct", u8"消极限制微米")) , m_OverLoadLimit(new FloatData("OverLoadLimit", u8"消极限制微米")) , m_ShowRefZero(new FloatData("ShowRefZero", u8"消极限制微米")) , m_ShowPosInv(new BoolData("ShowPosInv", u8"消极限制微米")) , m_IsUse(new BoolData("IsUse", u8"是否有用", true)) , m_MaxLoadValue(new FloatData("MaxLoadValue", u8"最大加载值")) , m_SafeLimit(new BoolData("SafeLimit", u8"安全限制", false)) { size_t ptrSize = sizeof(nullptr); //指针大小 void* startPtr = &m_startFlag + 1; size_t count = ((size_t)&m_endFlag - (size_t)startPtr) / ptrSize; InsertMp(startPtr, count); } AxisCfg::~AxisCfg() { } void AxisCfg::GetUpdateSql(vector& vec) { char buffer[2048]; sprintf_s(buffer, sizeof(buffer), "UPDATE %s SET %s=",TABLE_NAME.c_str(),FIELD_VALUE.c_str() ); string strhead = string(buffer); sprintf_s(buffer, sizeof(buffer), " WHERE %s=%d AND %s=", FIELD_AXIS_ID.c_str(), m_axis_id,FIELD_CODE.c_str()); string strtail = string(buffer); sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'", strhead.c_str(), to_string(m_active_limit->GetValue()).c_str(), strtail.c_str(), CODE_ACTIVE_LIMIT.c_str()); vec.push_back(buffer); sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'", strhead.c_str(), to_string(m_negactive_limit->GetValue()).c_str(), strtail.c_str(), CODE_NEGACTIVE_LIMIT.c_str()); vec.push_back(buffer); sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'", strhead.c_str(), to_string(m_active_direct->GetValue()).c_str(), strtail.c_str(), CODE_ACTIVE_DIRECT.c_str()); vec.push_back(buffer); sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'", strhead.c_str(), to_string(m_OverLoadLimit->GetValue()).c_str(), strtail.c_str(), CODE_OVER_LOAD_LIMIT.c_str()); vec.push_back(buffer); sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'", strhead.c_str(), to_string(m_ShowRefZero->GetValue()).c_str(), strtail.c_str(), CODE_SHOW_REF_ZERO.c_str()); vec.push_back(buffer); sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'", strhead.c_str(), to_string(m_ShowPosInv->GetValue()).c_str(), strtail.c_str(), CODE_SHOW_POS_INV.c_str()); vec.push_back(buffer); sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'", strhead.c_str(), to_string(m_MaxLoadValue->GetValue()).c_str(), strtail.c_str(), CODE_MAX_LOAD_VALUE.c_str()); vec.push_back(buffer); sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'", strhead.c_str(), m_SafeLimit?"1":"0", strtail.c_str(), CODE_SAFE_LIMIT.c_str()); vec.push_back(buffer); } string AxisCfg::TABLE_NAME = "AxisConfig"; string AxisCfg::FIELD_ID = "Id"; string AxisCfg::FIELD_AXIS_ID = "Axis_Id"; string AxisCfg::FIELD_CODE = "Axis_Code"; string AxisCfg::FIELD_VALUE = "Axis_Value"; string AxisCfg::CODE_NAME= "Name"; string AxisCfg::CODE_ACTIVE_LIMIT = "Active_Limit"; string AxisCfg::CODE_NEGACTIVE_LIMIT = "Negactive_Limit"; string AxisCfg::CODE_ACTIVE_DIRECT = "acitve_direct"; string AxisCfg::CODE_OVER_LOAD_LIMIT = "OverLoadLimit"; string AxisCfg::CODE_SHOW_POS_INV="ShowPosInv"; //显示位置置反 string AxisCfg::CODE_SHOW_REF_ZERO="ShowRefZero"; string AxisCfg::CODE_MAX_LOAD_VALUE = "MaxLoadValue"; string AxisCfg::CODE_SAFE_LIMIT = "SafeLimit";