⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 base_property.h

📁 270的linux说明
💻 H
📖 第 1 页 / 共 2 页
字号:
        return true;    }protected:    T               _Value;  };//==============================================================================//// ServerArrayProperty//// Description: // Uses most functionality from ServerProperty, overrides the GetSize functions of course,// The class mirrors much of the functions from the ServerProperty, it just applies it to// a internally managed vector of values.//// The biggest implementation difference between this and the ServerProperty class is that// When GetValue is called, it is called with an index and returns the value only.  It // doesn't call a server implementation like with ServerProperty.////==============================================================================template <class T>class ServerArrayProperty : public ServerProperty<T>{public:    virtual ~ServerArrayProperty() {}    // Can't initialize array when defining the ServerArrayProperty...therefore only one constructor    ServerArrayProperty( ServerInstanceObject* pThis, const IntelMobileString& Name, bool IsSettable, bool IsStatic, int iMinPollRate )        : ServerProperty<T>( pThis, Name, IsSettable, IsStatic, iMinPollRate )     {}    size_t  GetMaxSize()    {         return _ValueArray.max_size();     }    size_t  GetSize()    {         return _ValueArray.size();     }    void    SetValue ( const size_t Offset, const T Value )    { try{         if ( !IsInitialized() || !IsStatic() )        {            SetValueImpl( Offset, Value );            SetValueImplOnDevice( Offset, Value );        }        else            throw E_FAIL;}catch( ServerException se){        throw se;}catch(...){        THROWIMEXCEPTION("8004401D");}    }    bool    GetValueShim()    {        return true;    }    T       GetValue ( const size_t Offset )    {try{        if ( !ServerProperty<T>::IsStatic() || !ServerProperty<T>::IsInitialized() ) // skip if static, unless first time to get ( is null = true )            GetValueImpl();        if ( ServerProperty<T>::IsCachedNull() )        {            //return S_FALSE to client            //on the client side, if S_FALSE, throw error            // in com server wrapper,         }        // if ( Offset <= GetMaxSize() && Offset <= GetSize() )        if ( Offset < GetMaxSize() && Offset < GetSize() )            return _ValueArray[Offset];        else        {            throw E_FAIL;        }}catch( ServerException se){	throw se;}catch(...){	THROWIMEXCEPTION("8004401E");}    }    T       GetArrayValue ( const size_t Offset )    {try{        if ( !ServerProperty<T>::IsStatic() || !ServerProperty<T>::IsInitialized() ) // skip if static, unless first time to get ( is null = true )            GetValueImpl();        if ( ServerProperty<T>::IsCachedNull() )        {            //return S_FALSE to client            //on the client side, if S_FALSE, throw error            // in com server wrapper,         }        // if ( Offset <= GetMaxSize() && Offset <= GetSize() )        if ( Offset < GetMaxSize() && Offset < GetSize() )            return _ValueArray[Offset];        else        {            throw E_FAIL;        }}catch( ServerException se){	throw se;}catch(...){	THROWIMEXCEPTION("8004401E");}    }    // This is necessary for functionality that needs to get the store value without querying the device    // It's ok to throw an error here, the server method that calls this should be aware that it    // should check for null first just like on the client.    // Server only function    T       GetCachedValue ( const size_t Offset )    {try{        if ( !IsCachedNull() )        {            if ( Offset <= GetMaxSize() && Offset <= GetSize() )                return _ValueArray[Offset];            else            {                throw E_FAIL;            }        }        else        {            throw E_FAIL;        }}catch( ServerException se){	throw se;}catch(...){	THROWIMEXCEPTION("8004401E");}    }    size_t  InsertValue ( const T Value )    {          // IMPORTANT NOTE: (actually same applies to all properties...)        //      It's up to the server owner of the property to set        //      the NULL value after it is finished updating it        if ( !IsInitialized() || !IsStatic() )            InsertValueImpl( Value );        else            throw E_FAIL;        return this->GetSize();    }    void Clear ()    {        _ValueArray.clear();    }protected:    virtual void InsertValueImpl ( const T Value )    {          _ValueArray.push_back( Value );           SetNull(false);        SetInitialized(true);    }    virtual bool SetValueImpl ( const size_t Offset, const T Value )    {        _ValueArray[Offset] = Value;             SetNull(false);        SetInitialized(true);        return true;    }    virtual bool SetValueImplOnDevice( const size_t Offset, const T Value )    {        return true;    }protected:    vector<T>       _ValueArray;     };typedef ServerProperty<IntelMobileByte>          ByteServerProperty;typedef ServerProperty<IntelMobileInt>           IntServerProperty;typedef ServerProperty<IntelMobileUInt>          UIntServerProperty;typedef ServerProperty<IntelMobileInt64>         Int64ServerProperty;typedef ServerProperty<IntelMobileUInt64>        UInt64ServerProperty;typedef ServerProperty<IntelMobileString>        StringServerProperty;typedef ServerProperty<IntelMobileBool>          BoolServerProperty;typedef ServerProperty<IntelMobileDate>          DateTimeServerProperty;typedef ServerProperty<IntelMobileFloat>         FloatServerProperty;/*typedef ServerProperty<IntelMobileProcessorHTStatusType>   HTStatusTypeServerProperty;typedef ServerProperty<IntelMobileBatteryConditionType>    ConditionTyperServerProperty;typedef ServerProperty<IntelMobilePowerSourceType>         StatusTypeServerProperty;typedef ServerProperty<IntelMobileCacheInfoType>           CacheTypeValueServerProperty;typedef ServerProperty<IntelMobileProtocolStatusType>      ProtocolStatusTypeServerProperty;typedef ServerProperty<IntelMobileProtocolModeType>        ProtocolModeTypeServerProperty;typedef ServerProperty<IntelMobileProtocolPowerType>       ProtocolPowerTypeServerPropery;typedef ServerProperty<IntelMobileNetworkAdapterType>      NetworkAdapterTypeServerProperty;typedef ServerProperty<IntelMobileNetConnectionStatusType> NetConnectionStatusTypeServerProperty;*/typedef IntServerProperty   HTStatusTypeServerProperty;typedef IntServerProperty   ConditionTyperServerProperty;typedef IntServerProperty   StatusTypeServerProperty;typedef IntServerProperty   CacheTypeValueServerProperty;typedef IntServerProperty   ProtocolStatusTypeServerProperty;typedef IntServerProperty   ProtocolModeTypeServerProperty;typedef IntServerProperty   ProtocolPowerTypeServerPropery;typedef IntServerProperty   NetworkAdapterTypeServerProperty;typedef IntServerProperty   NetConnectionStatusTypeServerProperty;typedef ServerArrayProperty<IntelMobileByte>     ByteArrayServerProperty;typedef ServerArrayProperty<IntelMobileInt>      IntArrayServerProperty;typedef ServerArrayProperty<IntelMobileUInt>     UIntArrayServerProperty;typedef ServerArrayProperty<IntelMobileInt64>    Int64ArrayServerProperty;typedef ServerArrayProperty<IntelMobileUInt64>   UInt64ArrayServerProperty;typedef ServerArrayProperty<IntelMobileString>   StringArrayServerProperty;typedef ServerArrayProperty<IntelMobileBool>     BoolArrayServerProperty;typedef ServerArrayProperty<IntelMobileDate>     DateTimeArrayServerProperty;typedef ServerArrayProperty<IntelMobileFloat>    FloatArrayServerProperty;#define CLASSEXPANSION(__ClassName,__ReturnType,__PropertyName,__IsSettable,__IsStatic, __iMinPollRate ) \class __ClassName:public ServerProperty<__ReturnType> \{ public: \    __ClassName ( ServerInstanceObject* pThis ): \        ServerProperty<__ReturnType> ( pThis, IntelMobileText(__PropertyName), __IsSettable, __IsStatic, __iMinPollRate ) {};\    __ClassName ( ServerInstanceObject* pThis, const __ReturnType myValue ): \        ServerProperty<__ReturnType> ( pThis, IntelMobileText(__PropertyName), myValue, __IsSettable, __IsStatic, __iMinPollRate ) {}; \    void        GetValueImpl ();};#define CLASSEXPANSION_SET(__ClassName,__ReturnType,__PropertyName,__IsSettable,__IsStatic, __iMinPollRate ) \class __ClassName:public ServerProperty<__ReturnType> \{ public: \    __ClassName ( ServerInstanceObject* pThis ): \        ServerProperty<__ReturnType> ( pThis, IntelMobileText(__PropertyName), __IsSettable, __IsStatic, __iMinPollRate ) {};\    __ClassName ( ServerInstanceObject* pThis, const __ReturnType myValue ): \        ServerProperty<__ReturnType> ( pThis, IntelMobileText(__PropertyName), myValue, __IsSettable, __IsStatic, __iMinPollRate ) {}; \    bool        SetValueImplOnDevice ( __ReturnType value );    \    void        GetValueImpl ();    };#define CLASSARRAYEXPANSION(__ClassName,__ReturnType,__PropertyName,__IsSettable,__IsStatic, __iMinPollRate) \class __ClassName:public ServerArrayProperty<__ReturnType> \{ public: \    __ClassName ( ServerInstanceObject* pThis ): \        ServerArrayProperty<__ReturnType> ( pThis, IntelMobileText(__PropertyName), __IsSettable, __IsStatic, __iMinPollRate ) {};\    void        GetValueImpl ();};#define CLASSARRAYEXPANSION_SET(__ClassName,__ReturnType,__PropertyName,__IsSettable,__IsStatic, __iMinPollRate ) \class __ClassName:public ServerArrayProperty<__ReturnType> \{ public: \    __ClassName ( ServerInstanceObject* pThis ): \        ServerArrayProperty<__ReturnType> ( pThis, IntelMobileText(__PropertyName), __IsSettable, __IsStatic, __iMinPollRate ) {};\    bool        SetValueImplOnDevice ( const size_t Offset, const __ReturnType Value ); \    void        GetValueImpl ();    };// For process-associated property#define CLASSEXPANSION_P(__ClassName,__ReturnType,__PropertyName,__IsSettable,__IsStatic, __iMinPollRate ) \class __ClassName:public ServerProperty<__ReturnType> \{ public: \    __ClassName ( ServerInstanceObject* pThis ): \        ServerProperty<__ReturnType> ( pThis, IntelMobileText(__PropertyName), __IsSettable, __IsStatic, /*true,*/ __iMinPollRate ) {};\    __ClassName ( ServerInstanceObject* pThis, const __ReturnType myValue ): \        ServerProperty<__ReturnType> ( pThis, IntelMobileText(__PropertyName), myValue, __IsSettable, __IsStatic, /*true,*/ __iMinPollRate ) {}; \	void		GetValueImpl (/*unsigned __int32 processId*/); };#define CLASSEXPANSION_SET_P(__ClassName,__ReturnType,__PropertyName,__IsSettable,__IsStatic, __iMinPollRate ) \class __ClassName:public ServerProperty<__ReturnType> \{ public: \    __ClassName ( ServerInstanceObject* pThis ): \        ServerProperty<__ReturnType> ( pThis, IntelMobileText(__PropertyName), __IsSettable, __IsStatic, /*true,*/ __iMinPollRate ) {};\    __ClassName ( ServerInstanceObject* pThis, const __ReturnType myValue ): \        ServerProperty<__ReturnType> ( pThis, IntelMobileText(__PropertyName), myValue, __IsSettable, __IsStatic, /*true,*/ __iMinPollRate ) {}; \	bool        SetValueImplOnDevice ( __ReturnType value/*, unsigned __int32 processId*/ );    \    void        GetValueImpl (/* unsigned __int32 processId*/ ); };#define CLASSARRAYEXPANSION_P(__ClassName,__ReturnType,__PropertyName,__IsSettable,__IsStatic, __iMinPollRate) \class __ClassName:public ServerArrayProperty<__ReturnType> \{ public: \    __ClassName ( ServerInstanceObject* pThis ): \        ServerArrayProperty<__ReturnType> ( pThis, IntelMobileText(__PropertyName), __IsSettable, __IsStatic, /*true,*/ __iMinPollRate ) {};\	void		GetValueImpl (/*unsigned __int32 processId*/);  };#define CLASSARRAYEXPANSION_SET_P(__ClassName,__ReturnType,__PropertyName,__IsSettable,__IsStatic, __iMinPollRate ) \class __ClassName:public ServerArrayProperty<__ReturnType> \{ public: \    __ClassName ( ServerInstanceObject* pThis ): \        ServerArrayProperty<__ReturnType> ( pThis, IntelMobileText(__PropertyName), __IsSettable, __IsStatic, /*true,*/ __iMinPollRate ) {};\	bool        SetArrayValueImplOnDevice ( const size_t Offset, const __ReturnType value/*, unsigned __int32 processId*/ );    \    void        GetValueImpl ( /*unsigned __int32 processId*/ );  };// define Dynamic Settable macro#define CLASSEXPANSION_DYNAMICSET(__ClassName,__ReturnType,__PropertyName,__IsSettable,__IsStatic, __iMinPollRate ) \class __ClassName:public ServerProperty<__ReturnType> \{ public: \    __ClassName ( ServerInstanceObject* pThis ): \        ServerProperty<__ReturnType> ( pThis, IntelMobileText(__PropertyName), __IsSettable, __IsStatic, /*false,*/ __iMinPollRate ) {};\    __ClassName ( ServerInstanceObject* pThis, const __ReturnType myValue ): \        ServerProperty<__ReturnType> ( pThis, IntelMobileText(__PropertyName), myValue, __IsSettable, __IsStatic, /*false,*/ __iMinPollRate ) {}; \    bool        SetValueImplOnDevice ( __ReturnType value );    \	bool        IsSettable(); \    void        GetValueImpl ();    };#define CLASSARRAYEXPANSION_DYNAMICSET(__ClassName,__ReturnType,__PropertyName,__IsSettable,__IsStatic, __iMinPollRate ) \class __ClassName:public ServerArrayProperty<__ReturnType> \{ public: \    __ClassName ( ServerInstanceObject* pThis ): \        ServerArrayProperty<__ReturnType> ( pThis, IntelMobileText(__PropertyName), __IsSettable, __IsStatic, /*false,*/ __iMinPollRate ) {};\    bool        SetArrayValueImplOnDevice ( const size_t Offset, const __ReturnType Value ); \	bool        IsSettable(); \    void        GetValueImpl ();    };// For process-associated property#define CLASSEXPANSION_DYNAMICSET_P(__ClassName,__ReturnType,__PropertyName,__IsSettable,__IsStatic, __iMinPollRate ) \class __ClassName:public ServerProperty<__ReturnType> \{ public: \    __ClassName ( ServerInstanceObject* pThis ): \        ServerProperty<__ReturnType> ( pThis, IntelMobileText(__PropertyName), __IsSettable, __IsStatic, /*true,*/ __iMinPollRate ) {};\    __ClassName ( ServerInstanceObject* pThis, const __ReturnType myValue ): \        ServerProperty<__ReturnType> ( pThis, IntelMobileText(__PropertyName), myValue, __IsSettable, __IsStatic, /*true,*/ __iMinPollRate ) {}; \	bool        SetValueImplOnDevice ( __ReturnType value/*, unsigned __int32 processId*/ );    \	bool        IsSettable(); \    void        GetValueImpl ( /*unsigned __int32 processId*/ ); };#define CLASSARRAYEXPANSION_DYNAMICSET_P(__ClassName,__ReturnType,__PropertyName,__IsSettable,__IsStatic, __iMinPollRate ) \class __ClassName:public ServerArrayProperty<__ReturnType> \{ public: \    __ClassName ( ServerInstanceObject* pThis ): \        ServerArrayProperty<__ReturnType> ( pThis, IntelMobileText(__PropertyName), __IsSettable, __IsStatic, /*true,*/ __iMinPollRate ) {};\	bool        SetArrayValueImplOnDevice ( const size_t Offset, const __ReturnType value/*, unsigned __int32 processId*/ );    \	bool        IsSettable(); \    void        GetValueImpl ( /*unsigned __int32 processId*/ );  };#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -