📄 base_instanceobject.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_InstanceObject.h////==============================================================================#ifndef _BASE_INSTANCEOBJECT#define _BASE_INSTANCEOBJECT#include "inc/framework/base_EventDispatcher.h"#include "inc/framework/base_Property.h"#include "inc/framework/base_Object.h"#include "inc/framework/base_Event.h"#include "inc/framework/base_InstanceCollection.h"#include <string>using namespace std;class ServerPropertyBase;class ServerPropertyMap;class ServerInstanceObject : public ServerObject, public EventDispatcher{ friend class ServerInstanceCollection; friend class ServerPropertyBase; public: virtual bool IsAvailable( IntelMobileString methodName ) ; virtual IntelMobileString InvokeMethod( IntelMobileString szName, IntelMobileString param ); ServerInstanceObject( CLog &theLog, const IntelMobileString sType ); ServerInstanceObject( const IntelMobileString sType ); virtual ~ServerInstanceObject(); virtual const IntelMobileString& GetKey() { return m_sKey; } // Always stored in LOWERCASE! bool GetProperty( ServerPropertyBase** pProperty, IntelMobileString sName ); bool operator== ( ServerInstanceObject &rhs ); bool GetPropertyImpl( ServerPropertyBase** pProperty, vector<ServerPropertyMap>* pPropertyList, IntelMobileString sName );// something invalidated collection, notifies parent collection and all its parents' collection recursively virtual void Modify( ServerEvent::EventType eType ); // Initializes key information (device id, index, etc) based on Key passed in. This is the same key as in the provider configuration file. virtual bool Initialize( const IntelMobileString& pszFullInterfaceId ) = 0;// Initializes all properties within the PropertyList, called from the specific Object initialize function or constructor. bool InitializeProperties(); //==============================================================================// These might be taken out, depends on Threshold implementation taking over// this functionality.// Get the rate at which a thread should poll given the characteristics of the// properties within the object. int GetTheta() const; void RefreshProperties() const;//============================================================================== int RemoveInstance();protected: typedef IntelMobileString (*pFunc)(IntelMobileString szName, IntelMobileString param, ServerInstanceObject *pInstObj); typedef map<IntelMobileString, pFunc> mS2M; mS2M m_mapStr2Method; typedef mS2M::iterator mS2Mi; void AddMethod(IntelMobileString sName, pFunc pProxy); void RemoveMethod(IntelMobileString sName); ServerInstanceCollection* __cParentCollection; vector<ServerPropertyMap> *PropertyList; IntelMobileString m_sKey;};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -