#include #include #include #include #include #include using namespace std; using namespace baosight; CacheMag::CacheMag(void) { LOG d("CacheMag::CacheMag"); p_tele = new BinaryTele(2000,"T_LOV_FDAAITEM"); p_btel = new BinaryTele(1010,"T_LOV_TELEITEM"); for(int i=2010;i<=2012;i++) { p_tele->ReBuild(i); for(int j=0;j<(*p_tele).size();j++) { ADDR addr; int teleId = 0; string addrall = string((*p_tele)[j].addr); string::size_type type = addrall.find_first_of(":"); addr.index = j; if(type != string::npos) { teleId = atoi(addrall.substr(0,type).c_str()); addr.mode = AD_MODE::NORMAL; addr.event= i;//atoi(addrall.substr(0,type).c_str()); addr.addr = atoi(addrall.substr(type+1).c_str())-1; } else { addr.mode = AD_MODE::UNKNOW; type = addrall.find_first_of("-"); if(type != string::npos) { string::size_type bit = addrall.find_last_of("-"); if(bit != string::npos) { teleId = atoi(addrall.substr(0,type).c_str()); addr.mode = AD_MODE::BINARY; addr.event= i;//atoi(addrall.substr(0,type).c_str()); addr.addr = atoi(addrall.substr(type+1,bit-type-1).c_str())-1; addr.addrbit = atoi(addrall.substr(bit+1).c_str()); } } } if(teleId != 0) { if(mv_tele.find(teleId) == mv_tele.end()) { vector vaddr; vaddr.push_back(addr); mv_tele.insert(make_pair(teleId,vaddr)); } else { mv_tele[teleId].push_back(addr); } } } } } CacheMag::~CacheMag(void) { } int CacheMag::CacheTele(int eventNo, const ::Ice::ByteSeq& seq) { LOG d("CacheMag::CacheTele"); if(eventNo >= 1010 & eventNo < 2030) { CMemTable tele(StringHelper::ToString(eventNo),1); memset(m_data,0,sizeof(m_data)); memcpy(m_data,&seq[0],seq.size()); tele.push(&m_data); d.Info()<<"plc tele:"<ReBuild(eventNo,(char*)&seq[0]); vector vaddr = mv_tele[eventNo]; for(int i=0;i cachet(StringHelper::ToString(vaddr[i].event),1); // d.Debug()<<"mode:"<7 || index < 0)continue; string bits = BitTool::Byte2Bits((*p_btel)[vaddr[i].addr].value[0]); // d.Debug()<<"bits:"<>=vaddr[i].addrbit; short bit = num&1; // (*cachet())[vaddr[i].index] = bit; memcpy(&(*cachet())[vaddr[i].index*sizeof(short)],&bit,sizeof(short)); } } else { // (*cachet())[vaddr[i].index] = (*p_btel)[vaddr[i].addr]; } // if(eventNo == 1010) // d.Debug()<<"cache tele:"<