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

COM management (un/initialize) More...

#include <ComContext.hpp>

List of all members.

Classes

class  GuardImpl
 Implementation of the Guard, use ComContext::Guard instead. More...

Public Types

typedef boost::shared_ptr
< GuardImpl
Guard
 A suitable Guard to keep around while you need COM.

Public Member Functions

Guard getGuard ()
 Returns a COM guard.
 ComContext ()
 ~ComContext ()

Static Private Attributes

static boost::weak_ptr< GuardImplinstance_

Detailed Description

COM management (un/initialize)

Magically ensures that COM is initialized and configured when you use it and uninitialized when you're done.

Just make sure to have a ComContext::Guard copy somewhere until you don't need COM anymore.

 ComContext::Guard guard = ComContext().getGuard();

This class is not thread-safe.

How it works: the guards (a shared_ptr type) keep a reference count, when it drops to zero CoUninitialize() is called. Because COM cannot be initialized (or uninitialized) more than once at once in the current thread/program, getGuard() will make sure that all returned guards reference the same counter. So, the object referenced by the guards is in substance a singleton.

ComContext has no data members for now, but might get some in the future when it will allow to configure COM more finely (that's why getGuard() is not static).

Definition at line 59 of file ComContext.hpp.


Member Typedef Documentation

A suitable Guard to keep around while you need COM.

Definition at line 61 of file ComContext.hpp.


Constructor & Destructor Documentation

Definition at line 46 of file ComContext.cpp.

Definition at line 50 of file ComContext.cpp.


Member Function Documentation

Returns a COM guard.

COM will stay initialized while you have such a guard around.

Exceptions:
ComError

Definition at line 34 of file ComContext.cpp.

References instance_.

Referenced by Confdump::System::Win32Dumper::doQueryTable(), and Confdump::System::WmiDumper::initWbemServices().


Member Data Documentation

The static (hence global) variable that ensures that all Guard instances reference the same counter.

Definition at line 98 of file ComContext.hpp.

Referenced by getGuard().


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