📄 counterthreshold_impl.cpp
字号:
//==============================================================================// SetOffset() : //==============================================================================bool Int64CounterThresholdImpl::SetOffset( __int64 offset ) { //reinterpret_cast<ServerInt64CounterThreshold*> (GetInterface())->SetOffset( offset ); //IPC support EnterCriticalSection(&m_csIpc); vector<string> vectParam, vectRtn; vectParam.push_back(IntelMobileText("SetOffset")); vectParam.push_back(CStringHelper::Param2Str(offset)); HRESULT hr = GetIpcClient()->IpcCall(m_nDataType, (GetInterface()), vectParam, vectRtn); if ( FAILED( hr ) ) { IntelMobileException ex( IntelMobileText("Error setting Offset value"), m_sThresholdType.c_str(), IntelMobileText("SetOffset"), hr ); LeaveCriticalSection(&m_csIpc); throw( ex ); } LeaveCriticalSection(&m_csIpc); return true;} // SetOffset()//==============================================================================// GetInterface() : Returns the interface pointer, having instantiated it if needed.//==============================================================================void* Int64CounterThresholdImpl::GetInterface(){ EnterCriticalSection(&m_csIpc); if (m_pSvrThresholdObject == NULL) { //m_pSvrThresholdObject = GetNewServerThreshold(IntelMobileText("Int64CounterThreshold")); //IPC support m_sName = "Int64CounterThreshold"; m_nDataType = ID_TYPE_THRESHOLD; vector<string> vectParam, vectRtn; vectParam.push_back(CStringHelper::Param2Str(m_sName)); //printf("want to send %s\n",vectParam[0].c_str()); HRESULT hr = GetIpcClient()->IpcCall(m_nDataType, /*GetSvrObj()*/NULL, vectParam, vectRtn); //now GetSvrObj() should be null if ( FAILED( hr ) ) { IntelMobileException ex( IntelMobileText("Error setting GetInterface value"), m_sThresholdType.c_str(), IntelMobileText("GetInterface"), hr ); LeaveCriticalSection(&m_csIpc); throw( ex ); } else CStringHelper::Str2Param(vectRtn[0], (int &)m_pSvrThresholdObject); //printf("getted %s\n",vectRtn[0].c_str()); } LeaveCriticalSection(&m_csIpc); return (m_pSvrThresholdObject);} // GetInterface()//++++++++++++++++++++++++++++++++++++++++++++++++++++// // Class UInt64CounterThreshold////++++++++++++++++++++++++++++++++++++++++++++++++++++//==============================================================================// C-Tor() : Explicit constructor//==============================================================================UInt64CounterThresholdImpl::UInt64CounterThresholdImpl( Object* pOwner, unsigned __int64 threshold, unsigned __int64 offset ) : CounterThresholdImpl( pOwner, IntelMobileText("UInt64CounterThreshold") ){ SetThreshold( threshold ); if ( offset != 0U ) { SetOffset( offset ); }}//==============================================================================// GetThreshold() : //==============================================================================unsigned __int64 UInt64CounterThresholdImpl::GetThreshold() { //return reinterpret_cast<ServerUInt64CounterThreshold*> (GetInterface())->GetThreshold(); //IPC support EnterCriticalSection(&m_csIpc); unsigned __int64 retValue; vector<string> vectParam, vectRtn; vectParam.push_back(IntelMobileText("GetThreshold")); HRESULT hr = GetIpcClient()->IpcCall(m_nDataType, (GetInterface()), vectParam, vectRtn); if ( FAILED( hr ) ) { IntelMobileException ex( IntelMobileText("Error getting Threshold value"), m_sThresholdType.c_str(), IntelMobileText("GetThreshold"), hr ); LeaveCriticalSection(&m_csIpc); throw( ex ); } else { CStringHelper::Str2Param(vectRtn[0], retValue); LeaveCriticalSection(&m_csIpc); return retValue; }} // GetThreshold()//==============================================================================// SetThreshold() : //==============================================================================bool UInt64CounterThresholdImpl::SetThreshold( unsigned __int64 threshold ) { //reinterpret_cast<ServerUInt64CounterThreshold*> (GetInterface())->SetThreshold( threshold ); //IPC support EnterCriticalSection(&m_csIpc); vector<string> vectParam, vectRtn; vectParam.push_back(IntelMobileText("SetThreshold")); vectParam.push_back(CStringHelper::Param2Str(threshold)); HRESULT hr = GetIpcClient()->IpcCall(m_nDataType, (GetInterface()), vectParam, vectRtn); if ( FAILED( hr ) ) { IntelMobileException ex( IntelMobileText("Error setting Threshold value"), m_sThresholdType.c_str(), IntelMobileText("SetThreshold"), hr ); LeaveCriticalSection(&m_csIpc); throw( ex ); } LeaveCriticalSection(&m_csIpc); return true;} // SetThreshold()//==============================================================================// GetOffset() : //==============================================================================unsigned __int64 UInt64CounterThresholdImpl::GetOffset() { //return reinterpret_cast<ServerUInt64CounterThreshold*> (GetInterface())->GetOffset(); //IPC support EnterCriticalSection(&m_csIpc); unsigned __int64 retValue; vector<string> vectParam, vectRtn; vectParam.push_back(IntelMobileText("GetOffset")); HRESULT hr = GetIpcClient()->IpcCall(m_nDataType, (GetInterface()), vectParam, vectRtn); if ( FAILED( hr ) ) { IntelMobileException ex( IntelMobileText("Error retrieving Offset value"), m_sThresholdType.c_str(), IntelMobileText(""), hr ); LeaveCriticalSection(&m_csIpc); throw( ex ); } else { CStringHelper::Str2Param(vectRtn[0], retValue); LeaveCriticalSection(&m_csIpc); return retValue; }} // GetOffset()//==============================================================================// SetOffset() : //==============================================================================bool UInt64CounterThresholdImpl::SetOffset( unsigned __int64 offset ) { //reinterpret_cast<ServerUInt64CounterThreshold*> (GetInterface())->SetOffset( offset ); //IPC support EnterCriticalSection(&m_csIpc); vector<string> vectParam, vectRtn; vectParam.push_back(IntelMobileText("SetOffset")); vectParam.push_back(CStringHelper::Param2Str(offset)); HRESULT hr = GetIpcClient()->IpcCall(m_nDataType, (GetInterface()), vectParam, vectRtn); if ( FAILED( hr ) ) { IntelMobileException ex( IntelMobileText("Error setting Offset value"), m_sThresholdType.c_str(), IntelMobileText("SetOffset"), hr ); LeaveCriticalSection(&m_csIpc); throw( ex ); } LeaveCriticalSection(&m_csIpc); return true;} // SetOffset()//==============================================================================// GetInterface() : Returns the interface pointer, having instantiated it if needed.//==============================================================================void* UInt64CounterThresholdImpl::GetInterface(){ EnterCriticalSection(&m_csIpc); if (m_pSvrThresholdObject == NULL) { //m_pSvrThresholdObject = GetNewServerThreshold(IntelMobileText("UInt64CounterThreshold")); //IPC support m_sName = "UInt64CounterThreshold"; m_nDataType = ID_TYPE_THRESHOLD; vector<string> vectParam, vectRtn; vectParam.push_back(CStringHelper::Param2Str(m_sName)); //printf("want to send %s\n",vectParam[0].c_str()); HRESULT hr = GetIpcClient()->IpcCall(m_nDataType, /*GetSvrObj()*/NULL, vectParam, vectRtn); //now GetSvrObj() should be null if ( FAILED( hr ) ) { IntelMobileException ex( IntelMobileText("Error setting GetInterface value"), m_sThresholdType.c_str(), IntelMobileText("GetInterface"), hr ); LeaveCriticalSection(&m_csIpc); throw( ex ); } else CStringHelper::Str2Param(vectRtn[0], (int &)m_pSvrThresholdObject); //printf("getted %s\n",vectRtn[0].c_str()); } LeaveCriticalSection(&m_csIpc); return (m_pSvrThresholdObject);} // GetInterface()//++++++++++++++++++++++++++++++++++++++++++++++++++++// // Class DateCounterThreshold////++++++++++++++++++++++++++++++++++++++++++++++++++++//==============================================================================// C-Tor() : Explicit constructor//==============================================================================DateCounterThresholdImpl::DateCounterThresholdImpl( Object* pOwner, DATE threshold, DATE offset ) : CounterThresholdImpl( pOwner, IntelMobileText("DateCounterThreshold") ){ SetThreshold( threshold ); if ( offset != 0.0 ) { SetOffset( offset ); }}//==============================================================================// GetThreshold() : //==============================================================================DATE DateCounterThresholdImpl::GetThreshold() { //return reinterpret_cast<ServerDateCounterThreshold*> (GetInterface())->GetThreshold(); //IPC support EnterCriticalSection(&m_csIpc); DATE retValue; vector<string> vectParam, vectRtn; vectParam.push_back(IntelMobileText("GetThreshold")); HRESULT hr = GetIpcClient()->IpcCall(m_nDataType, (GetInterface()), vectParam, vectRtn); if ( FAILED( hr ) ) { IntelMobileException ex( IntelMobileText("Error getting Threshold value"), m_sThresholdType.c_str(), IntelMobileText("GetThreshold"), hr ); LeaveCriticalSection(&m_csIpc); throw( ex ); } CStringHelper::Str2Param(vectRtn[0], retValue); LeaveCriticalSection(&m_csIpc); return retValue;} // GetThreshold()//==============================================================================// SetThreshold() : //==============================================================================bool DateCounterThresholdImpl::SetThreshold( DATE threshold ) { //reinterpret_cast<ServerDateCounterThreshold*> (GetInterface())->SetThreshold( threshold ); //IPC support EnterCriticalSection(&m_csIpc); vector<string> vectParam, vectRtn; vectParam.push_back(IntelMobileText("SetThreshold")); vectParam.push_back(CStringHelper::Param2Str(threshold)); HRESULT hr = GetIpcClient()->IpcCall(m_nDataType, (GetInterface()), vectParam, vectRtn); if ( FAILED( hr ) ) { IntelMobileException ex( IntelMobileText("Error setting Threshold value"), m_sThresholdType.c_str(), IntelMobileText("SetThreshold"), hr ); LeaveCriticalSection(&m_csIpc); throw( ex ); } LeaveCriticalSection(&m_csIpc); return true;} // SetThreshold()//==============================================================================// GetOffset() : //==============================================================================DATE DateCounterThresholdImpl::GetOffset() { //return reinterpret_cast<ServerDateCounterThreshold*> (GetInterface())->GetOffset(); //IPC support EnterCriticalSection(&m_csIpc); DATE retValue; vector<string> vectParam, vectRtn; vectParam.push_back(IntelMobileText("GetOffset")); HRESULT hr = GetIpcClient()->IpcCall(m_nDataType, (GetInterface()), vectParam, vectRtn); if ( FAILED( hr ) ) { IntelMobileException ex( IntelMobileText("Error retrieving Offset value"), m_sThresholdType.c_str(), IntelMobileText("GetOffset"), hr ); LeaveCriticalSection(&m_csIpc); throw( ex ); } else { CStringHelper::Str2Param(vectRtn[0], retValue); LeaveCriticalSection(&m_csIpc); return retValue; }} // GetOffset()//==============================================================================// SetOffset() : //==============================================================================bool DateCounterThresholdImpl::SetOffset( DATE offset ) { //reinterpret_cast<ServerDateCounterThreshold*> (GetInterface())->SetOffset( offset ); //IPC support EnterCriticalSection(&m_csIpc); vector<string> vectParam, vectRtn; vectParam.push_back(IntelMobileText("SetOffset")); vectParam.push_back(CStringHelper::Param2Str(offset)); HRESULT hr = GetIpcClient()->IpcCall(m_nDataType, (GetInterface()), vectParam, vectRtn); if ( FAILED( hr ) ) { IntelMobileException ex( IntelMobileText("Error setting Offset value"), m_sThresholdType.c_str(), IntelMobileText("SetOffset"), hr ); LeaveCriticalSection(&m_csIpc); throw( ex ); } LeaveCriticalSection(&m_csIpc); return true;} // SetOffset()//==============================================================================// GetInterface() : Returns the interface pointer, having instantiated it if needed.//==============================================================================void* DateCounterThresholdImpl::GetInterface(){ EnterCriticalSection(&m_csIpc); if (m_pSvrThresholdObject == NULL) { //m_pSvrThresholdObject = GetNewServerThreshold(IntelMobileText("DateCounterThreshold")); //IPC support m_sName = "DateCounterThreshold"; m_nDataType = ID_TYPE_THRESHOLD; vector<string> vectParam, vectRtn; vectParam.push_back(CStringHelper::Param2Str(m_sName)); //printf("want to send %s\n",vectParam[0].c_str()); HRESULT hr = GetIpcClient()->IpcCall(m_nDataType, /*GetSvrObj()*/NULL, vectParam, vectRtn); //now GetSvrObj() should be null if ( FAILED( hr ) ) { IntelMobileException ex( IntelMobileText("Error setting GetInterface value"), m_sThresholdType.c_str(), IntelMobileText("GetInterface"), hr ); LeaveCriticalSection(&m_csIpc); throw( ex ); } else CStringHelper::Str2Param(vectRtn[0], (int &)m_pSvrThresholdObject); //printf("getted %s\n",vectRtn[0].c_str()); } LeaveCriticalSection(&m_csIpc); return (m_pSvrThresholdObject);} // GetInterface()//==============================================================================
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -