Confdump Agent  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends
Public Member Functions | Private Member Functions | Private Attributes | Friends
Confdump::System::Wmi::WbemQueryIterator Class Reference

Abstracts walking a IEnumWbemClassObject. More...

#include <WbemServices.hpp>

List of all members.

Public Member Functions

 WbemQueryIterator ()
 Construct a past-the-end iterator.
 WbemQueryIterator (boost::shared_ptr< IEnumWbemClassObject > enumerator)
 Construct a valid iterator.
 ~WbemQueryIterator ()

Private Member Functions

bool equal (const WbemQueryIterator &other) const
 operator== implementation, compares on the element_ .
void increment ()
 operator++ implementation, makes a Next() call on the underlying enumerator.
boost::shared_ptr
< IWbemClassObject > 
dereference () const
 operator* implementation

Private Attributes

boost::shared_ptr
< IEnumWbemClassObject > 
enumerator_
boost::shared_ptr
< IWbemClassObject > 
element_

Friends

class boost::iterator_core_access
class node_iter

Detailed Description

Abstracts walking a IEnumWbemClassObject.

This is a STL-compatible forward-only wrapper around the COM IEnumWbemClassObject. The interface of this class is empty because boost::iterator_facade provides it (so just assume that it works like a pointer to a shared_ptr<IWbemClassObject> that you can increment and derefence).

These operations and the constructor can throw ComError and WmiError instances.

The primary use of this class is to support WbemServices::execQuery(), but anything that deals with IEnumWbemClassObject can benefit from it.

Typical usage:

 shared_ptr<IEnumWbemClassObject> enumerator = ...
 boost::iterator_range<WbemQueryIterator> range( WbemQueryIterator( enumerator ), WbemQueryIterator() );
 BOOST_FOREACH( shared_ptr<IWbemClassObject> object, range )
     ...

The returned iterator_range object provides the begin() and end() accessors like on all STL-compatible containers (this makes it work with BOOST_FOREACH() too). These returned iterators are plain copies of the constructor arguments, respectively:

Definition at line 70 of file WbemServices.hpp.


Constructor & Destructor Documentation

Construct a past-the-end iterator.

Definition at line 38 of file WbemServices.cpp.

Confdump::System::Wmi::WbemQueryIterator::WbemQueryIterator ( boost::shared_ptr< IEnumWbemClassObject >  enumerator) [explicit]

Construct a valid iterator.

Definition at line 42 of file WbemServices.cpp.

References increment().

Definition at line 48 of file WbemServices.cpp.


Member Function Documentation

boost::shared_ptr<IWbemClassObject> Confdump::System::Wmi::WbemQueryIterator::dereference ( ) const [inline, private]

operator* implementation

Precondition:
This must be a valid iterator, or the code will assert(0).

Definition at line 104 of file WbemServices.hpp.

References element_.

bool Confdump::System::Wmi::WbemQueryIterator::equal ( const WbemQueryIterator other) const [private]

operator== implementation, compares on the element_ .

Exceptions:
ComError
WmiError

Definition at line 52 of file WbemServices.cpp.

References element_.

operator++ implementation, makes a Next() call on the underlying enumerator.

Exceptions:
ComError
WmiError

Definition at line 57 of file WbemServices.cpp.

References element_, enumerator_, Confdump::System::Wmi::guardComObject(), and Confdump::System::Wmi::throwOnWmiError().

Referenced by WbemQueryIterator().


Friends And Related Function Documentation

friend class boost::iterator_core_access [friend]

Definition at line 85 of file WbemServices.hpp.

friend class node_iter [friend]

Definition at line 86 of file WbemServices.hpp.


Member Data Documentation

boost::shared_ptr<IWbemClassObject> Confdump::System::Wmi::WbemQueryIterator::element_ [private]

Definition at line 107 of file WbemServices.hpp.

Referenced by dereference(), equal(), and increment().

boost::shared_ptr<IEnumWbemClassObject> Confdump::System::Wmi::WbemQueryIterator::enumerator_ [private]

Definition at line 106 of file WbemServices.hpp.

Referenced by increment().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends