📄 base_object_impl.h
字号:
/*
Copyright (c) 2008, Intel Corporation.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
*///==============================================================================// base_Object_Impl.h// Declaration of base class ClassObjectImpl//==============================================================================#ifndef _CLIENT_BASE_OBJECT_IMPL_H#define _CLIENT_BASE_OBJECT_IMPL_H#include "./base_Object.h"#include "./base_Module.h"#include "./base_SmartPtr.h"#include <string>using namespace std;using namespace Intel::Mobile::BaseAPI;//==============================================================================class ObjectImpl{protected: Intel::Mobile::BaseAPI::Object *m_pOwner; // The public object that owns this implementation CLog& _Log; // The log object, by reference. long m_nRefcount; // SmartPtr reference counting. IntelMobileString m_sObjectType; // The Object Type description. //IPC support int m_nDataType; CRITICAL_SECTION m_csIpc;public: ObjectImpl( Intel::Mobile::BaseAPI::Object *pOwner, IntelMobileChar* pszObjectType ) : m_pOwner ( pOwner ), _Log ( GetModule().GetLog() ), m_nRefcount ( 0 ), m_nDataType ( 0 ), m_sObjectType( pszObjectType ) { InitializeCriticalSection(&m_csIpc); } virtual ~ObjectImpl() { DeleteCriticalSection(&m_csIpc); } virtual bool operator==( const ObjectImpl& rhs ) const = 0; long AddRef () { return m_nRefcount++;/*return ::InterlockedIncrement( &m_nRefcount );*/ } long Release() { long nNewCount = ::InterlockedDecrement( &m_nRefcount ); if ( nNewCount < 1 ) { delete this; } return nNewCount; } void SetOwner( Intel::Mobile::BaseAPI::Object *pOwner ) { m_pOwner = pOwner; } const IntelMobileString& GetObjectType () const { return m_sObjectType; } virtual Intel::Mobile::BaseAPI::Object* GetOwner () const { return m_pOwner; } CLog& GetLog () { return _Log; }/* void _Log( const IntelMobileChar* pszFormat, ... ) { va_list vaParams; va_start(vaParams, pszFormat); s_Log.DoLog( pszFormat, vaParams); //printf(", DoLog\n"); va_end(vaParams); }; void _Log( const IntelMobileChar* pszFormat, va_list vaParams ) { s_Log.DoLog( pszFormat, vaParams); //printf(", DoLog\n"); }; void _Log( const unsigned int logLevel, const IntelMobileChar* pszFormat, ... ) { va_list vaParams; va_start(vaParams, pszFormat); //s_Log.DoLog( pszFormat, vaParams); printf(", DoLog\n"); va_end(vaParams); }; void _Log( const unsigned int logLevel, const IntelMobileChar* pszFormat, va_list vaParams ) { //s_Log.DoLog( pszFormat, vaParams); printf(", DoLog\n"); }; void _Log( bool bStderr, const unsigned int logLevel, const IntelMobileChar* pszFormat, ... ) { va_list vaParams; va_start(vaParams, pszFormat); //s_Log.DoLog( pszFormat, vaParams); printf(", DoLog\n"); va_end(vaParams); }; void _Log( bool bStderr, const unsigned int logLevel, const IntelMobileChar* pszFormat, va_list vaParams ) { //s_Log.DoLog( pszFormat, vaParams); printf(", DoLog\n"); };*/};typedef SmartPtr<ObjectImpl> ObjectImplPtr;//==============================================================================#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -