📄 counterthreshold_impl.cpp
字号:
} else { CStringHelper::Str2Param(vectRtn[0], retValue); LeaveCriticalSection(&m_csIpc); return retValue; } LeaveCriticalSection(&m_csIpc);} // GetThreshold()//==============================================================================// SetThreshold() : //==============================================================================bool IntCounterThresholdImpl::SetThreshold( int threshold ) { //reinterpret_cast<ServerIntCounterThreshold*> (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() : //==============================================================================int IntCounterThresholdImpl::GetOffset() { //return reinterpret_cast<ServerIntCounterThreshold*> (GetInterface())->GetOffset( ); //IPC support EnterCriticalSection(&m_csIpc); int 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; } LeaveCriticalSection(&m_csIpc);} // GetOffset()//==============================================================================// SetOffset() : //==============================================================================bool IntCounterThresholdImpl::SetOffset( int offset ) { //reinterpret_cast<ServerIntCounterThreshold*> (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* IntCounterThresholdImpl::GetInterface(){ EnterCriticalSection(&m_csIpc); if (m_pSvrThresholdObject == NULL) { //m_pSvrThresholdObject = GetNewServerThreshold(IntelMobileText("IntCounterThreshold")); //IPC support m_sName = "IntCounterThreshold"; 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); } LeaveCriticalSection(&m_csIpc); return (m_pSvrThresholdObject);} // GetInterface()//++++++++++++++++++++++++++++++++++++++++++++++++++++// // Class UIntCounterThreshold////++++++++++++++++++++++++++++++++++++++++++++++++++++//==============================================================================// C-Tor() : Explicit constructor//==============================================================================UIntCounterThresholdImpl::UIntCounterThresholdImpl( Object* pOwner, unsigned int threshold, unsigned int offset ) : CounterThresholdImpl( pOwner, IntelMobileText("UIntCounterThreshold") ){ SetThreshold( threshold ); if ( offset != 0U ) { SetOffset( offset ); }}//==============================================================================// GetThreshold() : //==============================================================================unsigned int UIntCounterThresholdImpl::GetThreshold() { //return reinterpret_cast<ServerUIntCounterThreshold*> (GetInterface())->GetThreshold(); //IPC support EnterCriticalSection(&m_csIpc); unsigned int 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 UIntCounterThresholdImpl::SetThreshold( unsigned int threshold ) { //reinterpret_cast<ServerUIntCounterThreshold*> (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 int UIntCounterThresholdImpl::GetOffset() { //return reinterpret_cast<ServerUIntCounterThreshold*> (GetInterface())->GetOffset(); //IPC support EnterCriticalSection(&m_csIpc); unsigned int 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 UIntCounterThresholdImpl::SetOffset( unsigned int offset ) { //reinterpret_cast<ServerUIntCounterThreshold*> (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* UIntCounterThresholdImpl::GetInterface(){ EnterCriticalSection(&m_csIpc); if (m_pSvrThresholdObject == NULL) { //m_pSvrThresholdObject = GetNewServerThreshold(IntelMobileText("UIntCounterThreshold")); //IPC support m_sName = "UIntCounterThreshold"; 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 Int64CounterThreshold////++++++++++++++++++++++++++++++++++++++++++++++++++++//==============================================================================// C-Tor() : Explicit constructor//==============================================================================Int64CounterThresholdImpl::Int64CounterThresholdImpl( Object* pOwner, __int64 threshold, __int64 offset ) : CounterThresholdImpl( pOwner, IntelMobileText("Int64CounterThreshold") ){ SetThreshold( threshold ); if ( offset != 0L ) { SetOffset( offset ); }}//==============================================================================// GetThreshold() : //==============================================================================__int64 Int64CounterThresholdImpl::GetThreshold() { //return reinterpret_cast<ServerInt64CounterThreshold*> (GetInterface())->GetThreshold(); //IPC support EnterCriticalSection(&m_csIpc); __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 Int64CounterThresholdImpl::SetThreshold( __int64 threshold ) { //reinterpret_cast<ServerInt64CounterThreshold*> (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() : //==============================================================================__int64 Int64CounterThresholdImpl::GetOffset() { //return reinterpret_cast<ServerInt64CounterThreshold*> (GetInterface())->GetOffset(); //IPC support EnterCriticalSection(&m_csIpc); __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("GetOffset"), hr ); LeaveCriticalSection(&m_csIpc); throw( ex ); } else { CStringHelper::Str2Param(vectRtn[0], retValue); LeaveCriticalSection(&m_csIpc); return retValue; }} // GetOffset()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -