winstd::event_session Class Reference
Event Tracing for Windows API

ETW session. More...

`#include <WinStd/ETW.h>`

Inheritance diagram for winstd::event_session:

## Public Member Functions

| event_session ()
| Initializes a new empty session.
| event_session (handle_type h, const EVENT_TRACE_PROPERTIES *prop)
| Initializes a new session with an already available object handle. More...
| event_session (event_session &&other) noexcept
| Move constructor. More...
virtual | ~event_session ()
| Closes the session. More...
event_session & | operator= (event_session &&other) noexcept
| Move assignment. More...
| operator const EVENT_TRACE_PROPERTIES * () const
| Auto-typecasting operator. More...
LPCTSTR | name () const
| Auto-typecasting operator. More...
void | attach (handle_type h, EVENT_TRACE_PROPERTIES *prop)
| Sets a new session handle for the class. More...
ULONG | create (LPCTSTR SessionName, const EVENT_TRACE_PROPERTIES *Properties)
| Registers and starts an event tracing session. More...
ULONG | enable_trace (LPCGUID ProviderId, UCHAR Level, ULONGLONG MatchAnyKeyword=0, ULONGLONG MatchAllKeyword=0, ULONG EnableProperty=0, PEVENT_FILTER_DESCRIPTOR EnableFilterDesc=NULL)
| Enables the specified event trace provider. More...
ULONG | disable_trace (LPCGUID ProviderId, UCHAR Level, ULONGLONG MatchAnyKeyword=0, ULONGLONG MatchAllKeyword=0, ULONG EnableProperty=0, PEVENT_FILTER_DESCRIPTOR EnableFilterDesc=NULL)
| Disables the specified event trace provider. More...
Public Member Functions inherited from winstd::handle< TRACEHANDLE, 0 >
| handle () noexcept
| Initializes a new class instance with the object handle set to INVAL.
| handle (handle_type h) noexcept
| Initializes a new class instance with an already available object handle. More...
| handle (handle< handle_type, INVAL > &&h) noexcept
| Move constructor. More...
handle< handle_type, INVAL > & | operator= (handle_type h) noexcept
| Attaches already available object handle. More...
handle< handle_type, INVAL > & | operator= (handle< handle_type, INVAL > &&h) noexcept
| Move assignment. More...
| operator handle_type () const
| Auto-typecasting operator. More...
handle_type *& | operator* () const
| Returns the object handle value when the object handle is a pointer to a value (class, struct, etc.). More...
handle_type * | operator& ()
| Returns the object handle reference. More...
handle_type | operator-> () const
| Provides object handle member access when the object handle is a pointer to a class or struct. More...
bool | operator! () const
| Tests if the object handle is INVAL. More...
bool | operator< (handle_type h) const
| Is handle less than? More...
bool | operator<= (handle_type h) const
| Is handle less than or equal to? More...
bool | operator>= (handle_type h) const
| Is handle greater than or equal to? More...
bool | operator> (handle_type h) const
| Is handle greater than? More...
bool | operator!= (handle_type h) const
| Is handle not equal to? More...
bool | operator== (handle_type h) const
| Is handle equal to? More...
void | attach (handle_type h) noexcept
| Sets a new object handle for the class. More...
handle_type | detach ()
| Dismisses the object handle from this class. More...
void | free ()
| Destroys the object.

## Protected Member Functions

void | free_internal () noexcept override
| Releases the session. More...
virtual void | free_internal () noexcept=0
| Abstract member function that must be implemented by child classes to do the actual object destruction. More...

## Protected Attributes

std::unique_ptr< EVENT_TRACE_PROPERTIES > | m_prop
| Session properties.
Protected Attributes inherited from winstd::handle< TRACEHANDLE, 0 >
handle_type | m_h
| Object handle.

## Additional Inherited Members

Public Types inherited from winstd::handle< TRACEHANDLE, 0 >
typedef TRACEHANDLE | handle_type
| Datatype of the object handle this template class handles.
Static Public Attributes inherited from winstd::handle< TRACEHANDLE, 0 >
static const TRACEHANDLE | invalid
| Invalid handle value.

## Detailed Description

ETW session.

## Constructor & Destructor Documentation

## event_session() [1/2]

winstd::event_session::event_session | ( | handle_type | h,
|  | const EVENT_TRACE_PROPERTIES * | prop
| ) |  |

inline

Initializes a new session with an already available object handle.

Parameters

  [in] | h | Initial session handle value
  [in] | prop | Session properties

## event_session() [2/2]

winstd::event_session::event_session | ( | event_session && | other | ) |

inlinenoexcept

Move constructor.

Parameters

  [in,out] | other | A rvalue reference of another session

## ~event_session()

virtual winstd::event_session::~event_session | ( |  | ) |

inlinevirtual

Closes the session.

See also
  ControlTrace function

## Member Function Documentation

## attach()

void winstd::event_session::attach | ( | handle_type | h,
|  | EVENT_TRACE_PROPERTIES * | prop
| ) |  |

inline

Sets a new session handle for the class.

When the current session handle of the class is non-NULL, the session is destroyed first.

Parameters

  [in] | h | New session handle
  [in] | prop | Session properties

## create()

ULONG winstd::event_session::create | ( | LPCTSTR | SessionName,
|  | const EVENT_TRACE_PROPERTIES * | Properties
| ) |  |

inline

Registers and starts an event tracing session.

Returns
  - `ERROR_SUCCESS` when creation succeeds;
  - error code otherwise.

See also
  StartTrace function

## disable_trace()

ULONG winstd::event_session::disable_trace | ( | LPCGUID | ProviderId,
|  | UCHAR | Level,
|  | ULONGLONG | MatchAnyKeyword = `0`,
|  | ULONGLONG | MatchAllKeyword = `0`,
|  | ULONG | EnableProperty = `0`,
|  | PEVENT_FILTER_DESCRIPTOR | EnableFilterDesc = `NULL`
| ) |  |

inline

Disables the specified event trace provider.

Returns
  - `ERROR_SUCCESS` when succeeds;
  - error code otherwise.

See also
  EnableTraceEx function

## enable_trace()

ULONG winstd::event_session::enable_trace | ( | LPCGUID | ProviderId,
|  | UCHAR | Level,
|  | ULONGLONG | MatchAnyKeyword = `0`,
|  | ULONGLONG | MatchAllKeyword = `0`,
|  | ULONG | EnableProperty = `0`,
|  | PEVENT_FILTER_DESCRIPTOR | EnableFilterDesc = `NULL`
| ) |  |

inline

Enables the specified event trace provider.

Returns
  - `ERROR_SUCCESS` when succeeds;
  - error code otherwise.

See also
  EnableTraceEx function

## free_internal()

void winstd::event_session::free_internal | ( |  | ) |

inlineoverrideprotectedvirtualnoexcept

Releases the session.

See also
  ControlTrace function

Implements winstd::handle< TRACEHANDLE, 0 >.

## name()

LPCTSTR winstd::event_session::name | ( |  | ) | const

inline

Auto-typecasting operator.

Returns
  Session properties

## operator const EVENT_TRACE_PROPERTIES *()

winstd::event_session::operator const EVENT_TRACE_PROPERTIES * | ( |  | ) | const

inline

Auto-typecasting operator.

Returns
  Session properties

## operator=()

event_session & winstd::event_session::operator= | ( | event_session && | other | ) |

inlinenoexcept

Move assignment.

Parameters

  [in,out] | other | A rvalue reference of another object

The documentation for this class was generated from the following file:

- include/WinStd/ETW.h