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

📄 base_threshold.h

📁 270的linux说明
💻 H
📖 第 1 页 / 共 2 页
字号:
/*

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_Threshold.h : //            Declaration of the class ThresholdBase//==============================================================================// This is base class for the server impementaion of Thresholds. Thresholds // differ from the general architecture in that the design relies heavily upon// the functionality provided by the COm layer, therefore the specializations of// Threshold are implemented in the COM layer, not the server layer.//// This is due to the fact that Thresholds are generated from the client, not // by a server 'class factory' (the core impl objects) and we are therfore left// to deal with interface pointers rather than object pointers or references.//==============================================================================#ifndef _BASE_THRESHOLD_H#define _BASE_THRESHOLD_H#include "inc/framework/base_Object.h"#include "inc/framework/base_Event.h"#include "inc/framework/base_EventDispatcher.h"#include "inc/framework/ThresholdManager.h"#include "inc/common/collection.h"#include <string>using namespace std;class ServerPropertyBase;class ServerEvent;//==============================================================================// Class: ThresholdBaseclass ThresholdBase : public ServerObject, public EventDispatcher{protected:    long                     m_lGranularityPeriod; // Check rate, in ms.    long                     m_PollrateMultiplier; // Multiple of the thread polling interval    long                     m_PollrateCounter;    // Counter for above multiplier.    ServerPropertyBase*      m_pObservedProperty;  // The monitored property    bool                     m_bActive;            // Is this being monitired?    bool                     m_bFirstPass;         // Is it the first check?	mutable CRITICAL_SECTION m_csLock;             // Lock for member access/updatepublic:    ThresholdBase( CLog         &theLog,                    long         nGranularityPeriod );    virtual ~ThresholdBase();//    virtual bool operator==( const ThresholdBase& rhs ) = 0;    long         GetGranularityPeriod ();    virtual void SetGranularityPeriod ( long lPeriod ) = 0;    void         SetPollrateMultiplier( long lBaseRate );    void         SetObservedProperty  ( ServerPropertyBase* pProperty );	ServerPropertyBase*  GetObservedProperty();    bool         IsActive             () const;    virtual void SetActive            ( bool bActive );    virtual bool CheckValue() = 0; // This is the hook to the functionality of specific types}; // ThresholdBase//====================================// collection definitiontypedef Collection< ThresholdBase* > ThresholdCollection;//==============================================================================//==============================================================================// Base class ServerThresholdclass ServerThreshold : public ThresholdBase{protected:    ThresholdManager&  m_ThresholdManager;    bool operator==( const ServerThreshold& rhs );public:	ServerThreshold( CLog&              theLog,                     ThresholdManager&  thresholdManager,                                          long               nGranularityPeriod = 10000 ); // Defalt 10sec.	virtual ~ServerThreshold();    ThresholdManager&  GetThresholdManager();    void SetGranularityPeriod ( long lPeriod );    virtual void SetActive( bool bActive );              virtual bool CheckValue();protected:	virtual ::EventBase::EventType TestThresholdReached() = 0;};//==============================================================================//==============================================================================// Base class ServerValueThreshold class ServerValueThreshold : public ServerThreshold{protected:    bool m_bNotifyMatch;    bool m_bNotifyDiffer;public:	ServerValueThreshold( CLog&              theLog,                          ThresholdManager&  thresholdManager,                                                    long               nGranularityPeriod = 10000 ); // Defalt 10sec.	virtual ~ServerValueThreshold();public:    bool GetNotifyMatch () const         { return m_bNotifyMatch;  }    bool GetNotifyDiffer() const         { return m_bNotifyDiffer; }    void SetNotifyMatch ( bool bNotify ) { m_bNotifyMatch  = bNotify; }    void SetNotifyDiffer( bool bNotify ) { m_bNotifyDiffer = bNotify; }};//==============================================================================// class ServerStringValueThresholdclass ServerStringValueThreshold : public ServerValueThreshold{protected:    IntelMobileString m_sValue;    IntelMobileString m_sPriorValue;public:	ServerStringValueThreshold( const IntelMobileChar*     value,                                CLog&              theLog,                                ThresholdManager&  thresholdManager,                                                                long               nGranularityPeriod = 10000 );	virtual ~ServerStringValueThreshold();    const IntelMobileChar* GetValue() const                 { return m_sValue.c_str(); }    void           SetValue( const IntelMobileChar* value ) { m_sValue = value; }    protected:	virtual ::EventBase::EventType TestThresholdReached(); };//==============================================================================//==============================================================================// Base class ServerCounterThreshold class ServerCounterThreshold : public ServerThreshold{protected:    bool m_bNotify;public:    ServerCounterThreshold( CLog&              theLog,                            ThresholdManager&  thresholdManager,                                                        long               nGranularityPeriod = 10000 ); // Default 10sec.    virtual ~ServerCounterThreshold();public:    bool GetNotify() const         { return m_bNotify; }    void SetNotify( bool bNotify ) { m_bNotify = bNotify; }};//==============================================================================// ServerByteCounterThresholdclass  ServerByteCounterThreshold : public ServerCounterThreshold{protected:    BYTE m_uThreshold;    BYTE m_uPriorValue;    BYTE m_uOffset;public:    ServerByteCounterThreshold( BYTE               threshold,                                CLog&              theLog,                                ThresholdManager&  thresholdManager,                                                                long               nGranularityPeriod = 10000 );    virtual ~ServerByteCounterThreshold();    UCHAR GetThreshold() const             { return m_uThreshold; }    UCHAR GetOffset   () const             { return m_uOffset; }    void  SetThreshold( UCHAR  threshold ) { m_uThreshold = threshold; }    void  SetOffset   ( UCHAR  nOffset   ) { m_uOffset    = nOffset;   }protected:	virtual ::EventBase::EventType TestThresholdReached(); };//==============================================================================// ServerIntCounterThresholdclass  ServerIntCounterThreshold : public ServerCounterThreshold{protected:    long m_nThreshold;    long m_nPriorValue;    long m_nOffset;public:    ServerIntCounterThreshold( long               threshold,                               CLog&              theLog,                               ThresholdManager&  thresholdManager,                                                              long               nGranularityPeriod = 10000 );    virtual ~ServerIntCounterThreshold();    long  GetThreshold() const            { return m_nThreshold; }    long  GetOffset   () const            { return m_nOffset; }    void  SetThreshold( long  threshold ) { m_nThreshold = threshold; }    void  SetOffset   ( long  offset    ) { m_nOffset    = offset;    }protected:	virtual ::EventBase::EventType TestThresholdReached(); };//==============================================================================// ServerUIntCounterThresholdclass  ServerUIntCounterThreshold : public ServerCounterThreshold{protected:    unsigned long m_uThreshold;    unsigned long m_uPriorValue;    unsigned long m_uOffset;public:    ServerUIntCounterThreshold( unsigned long      threshold,                                CLog&              theLog,                                ThresholdManager&  thresholdManager,                                                                long               nGranularityPeriod = 10000 );    virtual ~ServerUIntCounterThreshold();    unsigned long GetThreshold() const             { return m_uThreshold; }    unsigned long GetOffset   () const             { return m_uOffset; }    void  SetThreshold( unsigned long  threshold ) { m_uThreshold = threshold; }    void  SetOffset   ( unsigned long  offset    ) { m_uOffset    = offset;    }protected:	virtual ::EventBase::EventType TestThresholdReached(); };//==============================================================================// ServerInt64CounterThresholdclass  ServerInt64CounterThreshold : public ServerCounterThreshold{protected:    __int64 m_nThreshold;    __int64 m_nPriorValue;    __int64 m_nOffset;public:    ServerInt64CounterThreshold( __int64            threshold,                                 CLog&              theLog,                                 ThresholdManager&  thresholdManager,                                                                  long               nGranularityPeriod = 10000 );    virtual ~ServerInt64CounterThreshold();    __int64 GetThreshold() const              { return m_nThreshold; }

⌨️ 快捷键说明

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