lm::LoadMonitor::PerformanceCounterEnumCache Class Reference

Base class for enumerator cache. More...

Inheritance diagram for lm::LoadMonitor::PerformanceCounterEnumCache:

lm::LoadMonitor::DriveEnumCache lm::LoadMonitor::MemoryEnumCache lm::LoadMonitor::NetworkEnumCache lm::LoadMonitor::ProcessorEnumCache lm::LoadMonitor::SystemEnumCache

Public Member Functions

 PerformanceCounterEnumCache (void)
 Create new cache object.
virtual ~PerformanceCounterEnumCache (void)
 Free all resources.
virtual bool AddToRefresher (IWbemConfigureRefresher *configure, IWbemServices *services)=0
 Add enumerator from this object to the refresher.
virtual void Release (void)=0
 Release all resources.
virtual bool QueryData (LoadSample &target)=0
 Query data from enumerator.
HRESULT GetEnumObjects (IWbemHiPerfEnum *wbem_enum, size_t *object_count, IWbemObjectAccess ***access_objects)
 Get objects from given enumeration.
void ClearEnumObjects (IWbemObjectAccess **access_objects, size_t object_count)
 Clear WMI objects.

Protected Member Functions

bool Cache (IWbemObjectAccess *access_object)
 Cache handles of all properties.
virtual bool CacheImpl (IWbemObjectAccess *access_object)=0
 Property caching implementation.

Protected Attributes

bool is_cached
 Are property handles cached?

Detailed Description

Base class for enumerator cache.

Classes derived from this base class should store all data related to enumerator of specific feature (e.g. enumerator ID, IDs of various properties, etc.).


Constructor & Destructor Documentation

lm::LoadMonitor::PerformanceCounterEnumCache::PerformanceCounterEnumCache ( void   )  [inline]

Create new cache object.

virtual lm::LoadMonitor::PerformanceCounterEnumCache::~PerformanceCounterEnumCache ( void   )  [inline, virtual]

Free all resources.

Empty method. Note that derived class should call Release() in its destructor to properly free all resources.


Member Function Documentation

virtual bool lm::LoadMonitor::PerformanceCounterEnumCache::AddToRefresher ( IWbemConfigureRefresher *  configure,
IWbemServices *  services 
) [pure virtual]

Add enumerator from this object to the refresher.

Parameters:
configure Pointer to the configure refresher object through which enumerator should be added.
services WMI service provider.
Returns:
true on success, false otherwise.

Implemented in lm::LoadMonitor::ProcessorEnumCache, lm::LoadMonitor::NetworkEnumCache, lm::LoadMonitor::MemoryEnumCache, lm::LoadMonitor::SystemEnumCache, and lm::LoadMonitor::DriveEnumCache.

bool lm::LoadMonitor::PerformanceCounterEnumCache::Cache ( IWbemObjectAccess *  access_object  )  [inline, protected]

Cache handles of all properties.

This method should be called only once in QueryData to cache IDs for all properties needed. This method provides just wrapper for actual caching that should be implemented in CacheImpl method.

Parameters:
access_object Instance of IWbemObjectAccess object which contains properties that require handles to be cached.
Returns:
true if IDs have been successfully cached, false otherwise. If caching failed, QueryData should also fail.

virtual bool lm::LoadMonitor::PerformanceCounterEnumCache::CacheImpl ( IWbemObjectAccess *  access_object  )  [protected, pure virtual]

Property caching implementation.

Implemented in lm::LoadMonitor::ProcessorEnumCache, lm::LoadMonitor::NetworkEnumCache, lm::LoadMonitor::MemoryEnumCache, lm::LoadMonitor::SystemEnumCache, and lm::LoadMonitor::DriveEnumCache.

void lm::LoadMonitor::PerformanceCounterEnumCache::ClearEnumObjects ( IWbemObjectAccess **  access_objects,
size_t  object_count 
)

Clear WMI objects.

Parameters:
access_objects Array containing pointers to the access objects that should be cleared. Note that this array will be deleted.
object_count Number of objects stored in array.

HRESULT lm::LoadMonitor::PerformanceCounterEnumCache::GetEnumObjects ( IWbemHiPerfEnum *  wbem_enum,
size_t *  object_count,
IWbemObjectAccess ***  access_objects 
)

Get objects from given enumeration.

Retrieve objects from enumerator and store result in newly allocated buffer. You have to free resulting buffer by yourself (with ClearEnumObjects method). Note that resulting buffer may be bigger than actual number of objects that will be stored in it.

Parameters:
wbem_enum Enumerator in which objects are currently stored.
object_count Pointer to variable which will receive number of objects that were stored in the enumerator. This cannot be NULL.
access_objects Pointer to an array of the IWbemObjectAccess pointers. This array will receive objects that were stored in enumerator. Array with correct size will be automatically allocated.
Returns:
Value which indicated status of the call.
Return values:
WBEM_S_NO_ERROR Call was successful.
WBEM_S_TIMEDOUT Enumerator was busy.
WBEM_E_NOT_FOUND Provider was not able to retrieve requested instance.
WBEM_E_PROVIDER_NOT_CAPABLE Provider was not able to rerieve specific instances.
WBEM_E_FAILED Internal failure, but the operation was valid.
WBEM_E_BUFFER_TOO_SMALL Buffer allocation failed.

virtual bool lm::LoadMonitor::PerformanceCounterEnumCache::QueryData ( LoadSample target  )  [pure virtual]

Query data from enumerator.

This method should query all objects stored in enumeration using GetEnumObjects and then query required properties and put resulting data in LoadSample provided in parameter. If anything fails, sample should remain unchanged.

Parameters:
target Sample to which all data will be put. All data will be allocated as necessary.
Returns:
true on succes, false otherwise. If unsuccessfull, sample will not be modified.

Implemented in lm::LoadMonitor::ProcessorEnumCache, lm::LoadMonitor::NetworkEnumCache, lm::LoadMonitor::MemoryEnumCache, lm::LoadMonitor::SystemEnumCache, and lm::LoadMonitor::DriveEnumCache.

virtual void lm::LoadMonitor::PerformanceCounterEnumCache::Release ( void   )  [pure virtual]

Release all resources.

This should release all enumerators and other COM objects with their Release methods.

Implemented in lm::LoadMonitor::ProcessorEnumCache, lm::LoadMonitor::NetworkEnumCache, lm::LoadMonitor::MemoryEnumCache, lm::LoadMonitor::SystemEnumCache, and lm::LoadMonitor::DriveEnumCache.


Field Documentation

bool lm::LoadMonitor::PerformanceCounterEnumCache::is_cached [protected]

Are property handles cached?


The documentation for this class was generated from the following files:
Generated on Tue Dec 19 17:43:49 2006 for Load Monitor for Windows by  doxygen 1.4.7