// ResDataNode.cpp : 定义 DLL 应用程序的导出函数。 // #include "stdafx.h" #include "ResDataNode.h" #include "PacketAnalizer.h" ResDataSubNodeContext::ResDataSubNodeContext(ResDataNode *Parent) { m_pParent = Parent; vector *m_pKeyDepth = new vector(); } ResDataSubNodeContext::~ResDataSubNodeContext() { delete m_pKeyDepth; } //get context ResDataSubNodeContext::operator int() { int ret = 0; ResDataObject &Obj = m_pParent->m_Data; m_pParent->Thread_Lock(); for (size_t i = 0; i < m_pKeyDepth->size(); i++) { Obj = Obj[(*m_pKeyDepth)[i].c_str()]; } ret = (int)Obj; m_pParent->Thread_UnLock(); return ret; } ResDataSubNodeContext::operator unsigned int() { unsigned int ret = 0; ResDataObject &Obj = m_pParent->m_Data; m_pParent->Thread_Lock(); for (size_t i = 0; i < m_pKeyDepth->size(); i++) { Obj = Obj[(*m_pKeyDepth)[i].c_str()]; } ret = (unsigned int)Obj; m_pParent->Thread_UnLock(); return ret; } ResDataSubNodeContext::operator INT64() { INT64 ret = 0; ResDataObject &Obj = m_pParent->m_Data; m_pParent->Thread_Lock(); for (size_t i = 0; i < m_pKeyDepth->size(); i++) { Obj = Obj[(*m_pKeyDepth)[i].c_str()]; } ret = (INT64)Obj; m_pParent->Thread_UnLock(); return ret; } ResDataSubNodeContext::operator UINT64() { UINT64 ret = 0; ResDataObject &Obj = m_pParent->m_Data; m_pParent->Thread_Lock(); for (size_t i = 0; i < m_pKeyDepth->size(); i++) { Obj = Obj[(*m_pKeyDepth)[i].c_str()]; } ret = (UINT64)Obj; m_pParent->Thread_UnLock(); return ret; } ResDataSubNodeContext::operator float() { float ret = 0; ResDataObject &Obj = m_pParent->m_Data; m_pParent->Thread_Lock(); for (size_t i = 0; i < m_pKeyDepth->size(); i++) { Obj = Obj[(*m_pKeyDepth)[i].c_str()]; } ret = (float)Obj; m_pParent->Thread_UnLock(); return ret; } ResDataSubNodeContext::operator double() { double ret = 0; ResDataObject &Obj = m_pParent->m_Data; m_pParent->Thread_Lock(); for (size_t i = 0; i < m_pKeyDepth->size(); i++) { Obj = Obj[(*m_pKeyDepth)[i].c_str()]; } ret = (double)Obj; m_pParent->Thread_UnLock(); return ret; } ResDataSubNodeContext::operator const char*() { const char* ret = 0; ResDataObject &Obj = m_pParent->m_Data; m_pParent->Thread_Lock(); for (size_t i = 0; i < m_pKeyDepth->size(); i++) { Obj = Obj[(*m_pKeyDepth)[i].c_str()]; } ret = (const char*)Obj; m_pParent->Thread_UnLock(); return ret; } ResDataSubNodeContext::operator ResDataObject() { ResDataObject ret; ResDataObject &Obj = m_pParent->m_Data; m_pParent->Thread_Lock(); for (size_t i = 0; i < m_pKeyDepth->size(); i++) { Obj = Obj[(*m_pKeyDepth)[i].c_str()]; } ret = Obj; m_pParent->Thread_UnLock(); return ret; } ResDataSubNodeContext ResDataSubNodeContext::operator [](const char *pKey) { ResDataSubNodeContext ret(m_pParent); ret = (*this); ret.m_pKeyDepth->push_back(pKey); return ret; } //set context ResDataSubNodeContext& ResDataSubNodeContext::operator = (const int tValue) { ResDataObject &Obj = m_pParent->m_Data; m_pParent->Thread_Lock(); for (size_t i = 0; i < m_pKeyDepth->size(); i++) { Obj = Obj[(*m_pKeyDepth)[i].c_str()]; } if ((int)Obj == tValue) { //do nothing } else { //assign Obj = tValue; //make notify //多层结构是个问题. //通知1层,2层都算作Context. if (m_pParent->m_pDevice) { ResDataObject Notify; ResDataObject NotifyData; Notify.add((*m_pKeyDepth)[0].c_str(), m_pParent->m_Data[(*m_pKeyDepth)[0].c_str()]); PacketAnalizer::MakeNotify(NotifyData, PACKET_CMD_PART_UPDATE, m_pParent->m_pMainKey->c_str(), Notify); m_pParent->m_pDevice->CmdFromLogicDev(&NotifyData); } } m_pParent->Thread_UnLock(); return (*this); } ResDataSubNodeContext& ResDataSubNodeContext::operator = (const unsigned int tValue) { ResDataObject &Obj = m_pParent->m_Data; m_pParent->Thread_Lock(); for (size_t i = 0; i < m_pKeyDepth->size(); i++) { Obj = Obj[(*m_pKeyDepth)[i].c_str()]; } if ((unsigned int)Obj == tValue) { //do nothing } else { //assign Obj = tValue; //make notify //多层结构是个问题. //通知1层,2层都算作Context. if (m_pParent->m_pDevice) { ResDataObject Notify; ResDataObject NotifyData; Notify.add((*m_pKeyDepth)[0].c_str(), m_pParent->m_Data[(*m_pKeyDepth)[0].c_str()]); PacketAnalizer::MakeNotify(NotifyData, PACKET_CMD_PART_UPDATE, m_pParent->m_pMainKey->c_str(), Notify); m_pParent->m_pDevice->CmdFromLogicDev(&NotifyData); } } m_pParent->Thread_UnLock(); return (*this); } ResDataSubNodeContext& ResDataSubNodeContext::operator = (const INT64 tValue) { ResDataObject &Obj = m_pParent->m_Data; m_pParent->Thread_Lock(); for (size_t i = 0; i < m_pKeyDepth->size(); i++) { Obj = Obj[(*m_pKeyDepth)[i].c_str()]; } if ((INT64)Obj == tValue) { //do nothing } else { //assign Obj = tValue; //make notify //多层结构是个问题. //通知1层,2层都算作Context. if (m_pParent->m_pDevice) { ResDataObject Notify; ResDataObject NotifyData; Notify.add((*m_pKeyDepth)[0].c_str(), m_pParent->m_Data[(*m_pKeyDepth)[0].c_str()]); PacketAnalizer::MakeNotify(NotifyData, PACKET_CMD_PART_UPDATE, m_pParent->m_pMainKey->c_str(), Notify); m_pParent->m_pDevice->CmdFromLogicDev(&NotifyData); } } m_pParent->Thread_UnLock(); return (*this); } ResDataSubNodeContext& ResDataSubNodeContext::operator = (const UINT64 tValue) { ResDataObject &Obj = m_pParent->m_Data; m_pParent->Thread_Lock(); for (size_t i = 0; i < m_pKeyDepth->size(); i++) { Obj = Obj[(*m_pKeyDepth)[i].c_str()]; } if ((UINT64)Obj == tValue) { //do nothing } else { //assign Obj = tValue; //make notify //多层结构是个问题. //通知1层,2层都算作Context. if (m_pParent->m_pDevice) { ResDataObject Notify; ResDataObject NotifyData; Notify.add((*m_pKeyDepth)[0].c_str(), m_pParent->m_Data[(*m_pKeyDepth)[0].c_str()]); PacketAnalizer::MakeNotify(NotifyData, PACKET_CMD_PART_UPDATE, m_pParent->m_pMainKey->c_str(), Notify); m_pParent->m_pDevice->CmdFromLogicDev(&NotifyData); } } m_pParent->Thread_UnLock(); return (*this); } ResDataSubNodeContext& ResDataSubNodeContext::operator = (const float tValue) { ResDataObject &Obj = m_pParent->m_Data; m_pParent->Thread_Lock(); for (size_t i = 0; i < m_pKeyDepth->size(); i++) { Obj = Obj[(*m_pKeyDepth)[i].c_str()]; } if ((float)Obj == tValue) { //do nothing } else { //assign Obj = tValue; //make notify //多层结构是个问题. //通知1层,2层都算作Context. if (m_pParent->m_pDevice) { ResDataObject Notify; ResDataObject NotifyData; Notify.add((*m_pKeyDepth)[0].c_str(), m_pParent->m_Data[(*m_pKeyDepth)[0].c_str()]); PacketAnalizer::MakeNotify(NotifyData, PACKET_CMD_PART_UPDATE, m_pParent->m_pMainKey->c_str(), Notify); m_pParent->m_pDevice->CmdFromLogicDev(&NotifyData); } } m_pParent->Thread_UnLock(); return (*this); } ResDataSubNodeContext& ResDataSubNodeContext::operator = (const double tValue) { ResDataObject &Obj = m_pParent->m_Data; m_pParent->Thread_Lock(); for (size_t i = 0; i < m_pKeyDepth->size(); i++) { Obj = Obj[(*m_pKeyDepth)[i].c_str()]; } if ((double)Obj == tValue) { //do nothing } else { //assign Obj = tValue; //make notify //多层结构是个问题. //通知1层,2层都算作Context. if (m_pParent->m_pDevice) { ResDataObject Notify; ResDataObject NotifyData; Notify.add((*m_pKeyDepth)[0].c_str(), m_pParent->m_Data[(*m_pKeyDepth)[0].c_str()]); PacketAnalizer::MakeNotify(NotifyData, PACKET_CMD_PART_UPDATE, m_pParent->m_pMainKey->c_str(), Notify); m_pParent->m_pDevice->CmdFromLogicDev(&NotifyData); } } m_pParent->Thread_UnLock(); return (*this); } ResDataSubNodeContext& ResDataSubNodeContext::operator = (const char* pVal) { ResDataObject &Obj = m_pParent->m_Data; m_pParent->Thread_Lock(); for (size_t i = 0; i < m_pKeyDepth->size(); i++) { Obj = Obj[(*m_pKeyDepth)[i].c_str()]; } if (Obj == pVal) { //do nothing } else { //assign Obj = pVal; //make notify //多层结构是个问题. //通知1层,2层都算作Context. if (m_pParent->m_pDevice) { ResDataObject Notify; ResDataObject NotifyData; Notify.add((*m_pKeyDepth)[0].c_str(), m_pParent->m_Data[(*m_pKeyDepth)[0].c_str()]); PacketAnalizer::MakeNotify(NotifyData, PACKET_CMD_PART_UPDATE, m_pParent->m_pMainKey->c_str(), Notify); m_pParent->m_pDevice->CmdFromLogicDev(&NotifyData); } } m_pParent->Thread_UnLock(); return (*this); } ResDataSubNodeContext& ResDataSubNodeContext::operator = (const ResDataSubNodeContext &tValue) { ResDataObject &SrcObj = tValue.m_pParent->m_Data; ResDataObject &ThisObj = m_pParent->m_Data; m_pParent->Thread_Lock(); tValue.m_pParent->Thread_Lock(); for (size_t i = 0; i < m_pKeyDepth->size(); i++) { ThisObj = ThisObj[(*m_pKeyDepth)[i].c_str()]; } for (size_t i = 0; i < tValue.m_pKeyDepth->size(); i++) { SrcObj = SrcObj[(*tValue.m_pKeyDepth)[i].c_str()]; } if (ThisObj == SrcObj) { //do nothing } else { //assign ThisObj = SrcObj; //make notify //多层结构是个问题. //通知1层,2层都算作Context. if (m_pParent->m_pDevice) { ResDataObject Notify; ResDataObject NotifyData; Notify.add((*m_pKeyDepth)[0].c_str(), m_pParent->m_Data[(*m_pKeyDepth)[0].c_str()]); PacketAnalizer::MakeNotify(NotifyData, PACKET_CMD_PART_UPDATE, m_pParent->m_pMainKey->c_str(), Notify); m_pParent->m_pDevice->CmdFromLogicDev(&NotifyData); } } m_pParent->Thread_UnLock(); tValue.m_pParent->Thread_UnLock(); return (*this); } //--------------------------------------------------------------------- ResDataNode::ResDataNode() { m_pDevice = 0; m_pMainKey = new string(); } ResDataNode::ResDataNode(const char *pkey) { m_pDevice = 0; m_pMainKey = new string(); (*m_pMainKey) = pkey; } ResDataNode::~ResDataNode(void) { delete m_pMainKey; m_pMainKey = 0; } size_t ResDataNode::Size() { return m_Data.size(); } const char *ResDataNode::GetKey() { const char *pResource = 0; Thread_Lock(); pResource = m_pMainKey->c_str(); Thread_UnLock(); return pResource; } void ResDataNode::SetKey(const char *pKey) { Thread_Lock(); (*m_pMainKey) = pKey; Thread_UnLock(); } ResDataNode& ResDataNode::operator = (ResDataObject &tValue) { Thread_Lock(); if (m_Data == tValue) { //do nothing } else { //assign m_Data = tValue; //make notify if (m_pDevice) { ResDataObject NotifyData; PacketAnalizer::MakeNotify(NotifyData, PACKET_CMD_UPDATE, m_pMainKey->c_str(), m_Data); m_pDevice->CmdFromLogicDev(&NotifyData); } } Thread_UnLock(); return (*this); } void ResDataNode::SetLogicDevice(LogicDevice *pDevice) { Thread_Lock(); m_pDevice = pDevice; Thread_UnLock(); } bool ResDataNode::AddStaticDesc(const char *pkey, ResDataObject &Context) { bool ret = true; Thread_Lock(); m_StaticDescript.update(pkey, Context); Thread_UnLock(); return ret; } bool ResDataNode::AddStaticDesc(const char *pKey, const char *pDesc) { bool ret = true; Thread_Lock(); m_StaticDescript.update(pKey, pDesc); Thread_UnLock(); return ret; } bool ResDataNode::AddStaticDesc(const char *pKey, FLOAT DescVal) { bool ret = true; Thread_Lock(); m_StaticDescript.update(pKey, DescVal); Thread_UnLock(); return ret; } bool ResDataNode::AddStaticDesc(const char *pKey, INT DescIdx) { bool ret = true; Thread_Lock(); m_StaticDescript.update(pKey, DescIdx); Thread_UnLock(); return ret; } ResDataObject &ResDataNode::GetStaticDescript() { return m_StaticDescript; } //GET----- ResDataNode::operator int() { int ret = 0; Thread_Lock(); ret = m_Data; Thread_UnLock(); return ret; } ResDataNode::operator unsigned int() { unsigned int ret = 0; Thread_Lock(); ret = m_Data; Thread_UnLock(); return ret; } ResDataNode::operator INT64() { INT64 ret = 0; Thread_Lock(); ret = m_Data; Thread_UnLock(); return ret; } ResDataNode::operator UINT64() { UINT64 ret = 0; Thread_Lock(); ret = m_Data; Thread_UnLock(); return ret; } ResDataNode::operator float() { float ret = 0; Thread_Lock(); ret = m_Data; Thread_UnLock(); return ret; } ResDataNode::operator double() { double ret = 0; Thread_Lock(); ret = m_Data; Thread_UnLock(); return ret; } ResDataNode::operator const char*() { const char* ret = 0; Thread_Lock(); ret = m_Data; Thread_UnLock(); return ret; } ResDataNode::operator ResDataObject() { ResDataObject ret; Thread_Lock(); ret = m_Data; Thread_UnLock(); return ret; } ResDataSubNodeContext ResDataNode::operator [](const char* pkey) { ResDataSubNodeContext ret(this); return ret[pkey]; } ResDataSubNodeContext ResDataNode::operator [](size_t Idx) { const char *pKey = 0; ResDataSubNodeContext ret(this); Thread_Lock(); pKey = m_Data.GetKey(Idx); Thread_UnLock(); return ret[pKey]; } //SET---------- ResDataNode& ResDataNode::operator = (int tValue) { Thread_Lock(); if ((int)m_Data == tValue) { //do nothing } else { if (m_pDevice) { ResDataObject Notify; ResDataObject NotifyData; Notify.add(m_pMainKey->c_str(), tValue); PacketAnalizer::MakeNotify(NotifyData, PACKET_CMD_UPDATE, m_pMainKey->c_str(), Notify); m_pDevice->CmdFromLogicDev(&NotifyData); } m_Data = tValue; } Thread_UnLock(); return (*this); } ResDataNode& ResDataNode::operator = (unsigned int tValue) { Thread_Lock(); if ((unsigned int)m_Data == tValue) { //do nothing } else { if (m_pDevice) { ResDataObject Notify; ResDataObject NotifyData; Notify.add(m_pMainKey->c_str(), tValue); PacketAnalizer::MakeNotify(NotifyData, PACKET_CMD_UPDATE, m_pMainKey->c_str(), Notify); m_pDevice->CmdFromLogicDev(&NotifyData); } m_Data = tValue; } Thread_UnLock(); return (*this); } ResDataNode& ResDataNode::operator = (INT64 tValue) { Thread_Lock(); if ((INT64)m_Data == tValue) { //do nothing } else { if (m_pDevice) { ResDataObject Notify; ResDataObject NotifyData; Notify.add(m_pMainKey->c_str(), tValue); PacketAnalizer::MakeNotify(NotifyData, PACKET_CMD_UPDATE, m_pMainKey->c_str(), Notify); m_pDevice->CmdFromLogicDev(&NotifyData); } m_Data = tValue; } Thread_UnLock(); return (*this); } ResDataNode& ResDataNode::operator = (UINT64 tValue) { Thread_Lock(); if ((UINT64)m_Data == tValue) { //do nothing } else { if (m_pDevice) { ResDataObject Notify; ResDataObject NotifyData; Notify.add(m_pMainKey->c_str(), tValue); PacketAnalizer::MakeNotify(NotifyData, PACKET_CMD_UPDATE, m_pMainKey->c_str(), Notify); m_pDevice->CmdFromLogicDev(&NotifyData); } m_Data = tValue; } Thread_UnLock(); return (*this); } ResDataNode& ResDataNode::operator = (float tValue) { Thread_Lock(); if ((float)m_Data == tValue) { //do nothing } else { if (m_pDevice) { ResDataObject Notify; ResDataObject NotifyData; Notify.add(m_pMainKey->c_str(), tValue); PacketAnalizer::MakeNotify(NotifyData, PACKET_CMD_UPDATE, m_pMainKey->c_str(), Notify); m_pDevice->CmdFromLogicDev(&NotifyData); } m_Data = tValue; } Thread_UnLock(); return (*this); } ResDataNode& ResDataNode::operator = (double tValue) { Thread_Lock(); if ((double)m_Data == tValue) { //do nothing } else { if (m_pDevice) { ResDataObject Notify; ResDataObject NotifyData; Notify.add(m_pMainKey->c_str(), tValue); PacketAnalizer::MakeNotify(NotifyData, PACKET_CMD_UPDATE, m_pMainKey->c_str(), Notify); m_pDevice->CmdFromLogicDev(&NotifyData); } m_Data = tValue; } Thread_UnLock(); return (*this); } ResDataNode& ResDataNode::operator = (const char* pVal) { string StrVal = pVal; Thread_Lock(); if ((const char *)m_Data == StrVal) { //do nothing } else { if (m_pDevice) { ResDataObject Notify; ResDataObject NotifyData; Notify.add(m_pMainKey->c_str(), pVal); PacketAnalizer::MakeNotify(NotifyData, PACKET_CMD_UPDATE, m_pMainKey->c_str(), Notify); m_pDevice->CmdFromLogicDev(&NotifyData); } m_Data = pVal; } Thread_UnLock(); return (*this); } ResDataNode& ResDataNode::operator = (ResDataNode &tValue) { Thread_Lock(); tValue.Thread_Lock(); // (*this) = tValue.m_Data; tValue.Thread_UnLock(); Thread_UnLock(); return (*this); } ResDataNode& ResDataNode::operator = (ResDataSubNodeContext &tValue) { ResDataObject ret = tValue; (*this) = ret; return (*this); } //ADD---------- bool ResDataNode::Add(ResDataObject &NodeObject) { const char *pKey = NodeObject.GetKey(0); return Add(pKey, NodeObject[pKey]); } bool ResDataNode::Add(const char *pkey, ResDataObject &Context) { bool ret = false; Thread_Lock(); int idx = m_Data.GetFirstOf(pkey); if (idx >= 0) { //exist TPRINTA_WARN("key[%s] already exist in add", pkey); } else { //new m_Data.add(pkey, Context); //make notify if (m_pDevice) { ResDataObject Notify; ResDataObject NotifyData; Notify.add(pkey, Context); PacketAnalizer::MakeNotify(NotifyData, PACKET_CMD_ADD, m_pMainKey->c_str(), Notify); m_pDevice->CmdFromLogicDev(&NotifyData); } ret = true; } Thread_UnLock(); return ret; } //DEL---------- bool ResDataNode::Del(const char *pkey) { bool ret = false; Thread_Lock(); int idx = m_Data.GetFirstOf(pkey); if (idx >= 0) { //exist //make notify if (m_pDevice) { ResDataObject Notify; ResDataObject NotifyData; //不要对象,只要KEY //Notify.add(pkey, m_Data[pkey]); Notify = pkey; PacketAnalizer::MakeNotify(NotifyData, PACKET_CMD_DEL, m_pMainKey->c_str(), Notify); m_pDevice->CmdFromLogicDev(&NotifyData); } ret = m_Data.eraseOneOf(pkey, (size_t)idx); } else { //new TPRINTA_WARN("key[%s] not exist in del", pkey); } Thread_UnLock(); return ret; } bool ResDataNode::Del(size_t Idx) { bool ret = false; Thread_Lock(); if (m_Data.size() > Idx) { //exist const char *pkey = m_Data.GetKey(Idx); ret = Del(pkey); } else { //new TPRINTA_WARN("key[%d] not exist in del", Idx); } Thread_UnLock(); return ret; } ResValue::ResValue() { AddStaticDesc(RES_CLASS_TYPE, RES_CLASS_VALUE); }; ResValue::~ResValue(void) { }; //SET---------- ResValue& ResValue::operator = (int tValue) { Thread_Lock(); if ((int)m_Data == tValue) { //do nothing } else { if (m_pDevice) { ResDataObject Notify; ResDataObject NotifyData; Notify.add(m_pMainKey->c_str(), tValue); PacketAnalizer::MakeNotify(NotifyData, PACKET_CMD_UPDATE, m_pMainKey->c_str(), Notify); m_pDevice->CmdFromLogicDev(&NotifyData); } m_Data = tValue; } Thread_UnLock(); return (*this); } ResValue& ResValue::operator = (unsigned int tValue) { Thread_Lock(); if ((unsigned int)m_Data == tValue) { //do nothing } else { if (m_pDevice) { ResDataObject Notify; ResDataObject NotifyData; Notify.add(m_pMainKey->c_str(), tValue); PacketAnalizer::MakeNotify(NotifyData, PACKET_CMD_UPDATE, m_pMainKey->c_str(), Notify); m_pDevice->CmdFromLogicDev(&NotifyData); } m_Data = tValue; } Thread_UnLock(); return (*this); } ResValue& ResValue::operator = (INT64 tValue) { Thread_Lock(); if ((INT64)m_Data == tValue) { //do nothing } else { if (m_pDevice) { ResDataObject Notify; ResDataObject NotifyData; Notify.add(m_pMainKey->c_str(), tValue); PacketAnalizer::MakeNotify(NotifyData, PACKET_CMD_UPDATE, m_pMainKey->c_str(), Notify); m_pDevice->CmdFromLogicDev(&NotifyData); } m_Data = tValue; } Thread_UnLock(); return (*this); } ResValue& ResValue::operator = (UINT64 tValue) { Thread_Lock(); if ((UINT64)m_Data == tValue) { //do nothing } else { if (m_pDevice) { ResDataObject Notify; ResDataObject NotifyData; Notify.add(m_pMainKey->c_str(), tValue); PacketAnalizer::MakeNotify(NotifyData, PACKET_CMD_UPDATE, m_pMainKey->c_str(), Notify); m_pDevice->CmdFromLogicDev(&NotifyData); } m_Data = tValue; } Thread_UnLock(); return (*this); } ResValue& ResValue::operator = (float tValue) { Thread_Lock(); if ((float)m_Data == tValue) { //do nothing } else { if (m_pDevice) { ResDataObject Notify; ResDataObject NotifyData; Notify.add(m_pMainKey->c_str(), tValue); PacketAnalizer::MakeNotify(NotifyData, PACKET_CMD_UPDATE, m_pMainKey->c_str(), Notify); m_pDevice->CmdFromLogicDev(&NotifyData); } m_Data = tValue; } Thread_UnLock(); return (*this); } ResValue& ResValue::operator = (double tValue) { Thread_Lock(); if ((double)m_Data == tValue) { //do nothing } else { if (m_pDevice) { ResDataObject Notify; ResDataObject NotifyData; Notify.add(m_pMainKey->c_str(), tValue); PacketAnalizer::MakeNotify(NotifyData, PACKET_CMD_UPDATE, m_pMainKey->c_str(), Notify); m_pDevice->CmdFromLogicDev(&NotifyData); } m_Data = tValue; } Thread_UnLock(); return (*this); } ResValue& ResValue::operator = (const char* pVal) { string StrVal = pVal; Thread_Lock(); if ((const char *)m_Data == StrVal) { //do nothing } else { if (m_pDevice) { ResDataObject Notify; ResDataObject NotifyData; Notify.add(m_pMainKey->c_str(), pVal); PacketAnalizer::MakeNotify(NotifyData, PACKET_CMD_UPDATE, m_pMainKey->c_str(), Notify); m_pDevice->CmdFromLogicDev(&NotifyData); } m_Data = pVal; } Thread_UnLock(); return (*this); } ResValue& ResValue::operator = (ResDataNode &tValue) { Thread_Lock(); ResDataObject Obj = tValue; // (*this) = Obj; Thread_UnLock(); return (*this); } ResValue& ResValue::operator = (ResDataObject &tValue) { Thread_Lock(); if (m_Data == tValue) { //do nothing } else { //assign m_Data = tValue; //make notify if (m_pDevice) { ResDataObject NotifyData; PacketAnalizer::MakeNotify(NotifyData, PACKET_CMD_UPDATE, m_pMainKey->c_str(), m_Data); m_pDevice->CmdFromLogicDev(&NotifyData); } } Thread_UnLock(); return (*this); } ResValue& ResValue::operator = (ResDataSubNodeContext &tValue) { ResDataObject ret = tValue; (*this) = ret; return (*this); } //GET----------:使用下标不要 ResDataSubNodeContext ResValue::operator [](const char* pkey) { throw ResDataObjectExption("deserted function for resValue::operator[str] "); ResDataSubNodeContext ret(this); return ret; }; ResDataSubNodeContext ResValue::operator [](size_t Idx) { throw ResDataObjectExption("deserted function for resValue::operator[idx]"); ResDataSubNodeContext ret(this); return ret; }; //ADD----------:不要 bool ResValue::Add(ResDataObject &NodeObject) { throw ResDataObjectExption("deserted function for resValue::Add1"); return false; }; bool ResValue::Add(const char *pkey, ResDataObject &Context) { throw ResDataObjectExption("deserted function for resValue::Add2"); return false; }; //DEL----------:不要 bool ResValue::Del(const char *pkey) { throw ResDataObjectExption("deserted function for resValue::Del[str]"); return false; }; bool ResValue::Del(size_t Idx) { throw ResDataObjectExption("deserted function for resValue::Del[idx]"); return false; }; //-------------------------------------------- ResStruct::ResStruct() { AddStaticDesc(RES_CLASS_TYPE, RES_CLASS_STRUCT); }; ResStruct::~ResStruct(void) { }; //FULL GET:use ResDataNode::GetContext //FULL SET ResStruct& ResStruct::operator = (ResStruct &Val) { ResDataNode &Target = (*this); ResDataNode &Src = Val; Target = Src; return (*this); }; //get: use operator [] //ADD&DEL不支持 //ADD----------:不要 bool ResStruct::Add(ResDataObject &NodeObject) { throw ResDataObjectExption("deserted function for ResStruct::Add1"); return false; }; bool ResStruct::Add(const char *pkey, ResDataObject &Context) { throw ResDataObjectExption("deserted function for ResStruct::Add1"); return false; }; //DEL----------:不要 bool ResStruct::Del(const char *pkey) { throw ResDataObjectExption("deserted function for ResStruct::Del[str]"); return false; }; bool ResStruct::Del(size_t Idx) { throw ResDataObjectExption("deserted function for resValue::Del[idx]"); return false; }; //----------------------------------- ResMap::ResMap() { AddStaticDesc(RES_CLASS_TYPE, RES_CLASS_MAP); }; ResMap::~ResMap(void) { };