bactria  0.0.1
The bactria library is a header-only C++14 library for profiling and tracing.
bactria::ranges::Event Class Reference

The event class. More...

#include <Event.hpp>

Inheritance diagram for bactria::ranges::Event:
Collaboration diagram for bactria::ranges::Event:

Public Member Functions

 Event ()
 The default constructor. More...
 
 Event (std::string name, std::uint32_t color=color::bactria_orange, Category category=Category{})
 The constructor. More...
 
 Event (const Event &other)
 The copy constructor. More...
 
auto operator= (const Event &rhs) -> Event &
 The copy assignment operator. More...
 
 Event (Event &&other) noexcept
 The move constructor. More...
 
auto operator= (Event &&rhs) noexcept -> Event &
 The move assignment operator. More...
 
 ~Event () override
 The destructor. More...
 
auto fire (std::string source, std::uint32_t lineno, std::string caller) noexcept -> void
 Fire the event. More...
 
auto set_action (std::function< std::string(void)> a) noexcept -> void
 Set a user-defined action for generating the event name. More...
 
- Public Member Functions inherited from bactria::ranges::Marker
 Marker ()=default
 Default constructor. More...
 
 Marker (std::string name, std::uint32_t color, Category category)
 Constructor. More...
 
 Marker (Marker const &other)=default
 Copy constructor. More...
 
auto operator= (Marker const &rhs) -> Marker &=default
 Copy-assignment operator. More...
 
 Marker (Marker &&other)=default
 Move constructor. More...
 
auto operator= (Marker &&rhs) -> Marker &=default
 Move-assignment operator. More...
 
virtual ~Marker ()=default
 Destroy the Marker object.
 
auto get_name () const noexcept -> std::string const &
 Return the marker's name. More...
 
auto get_c_name () const noexcept -> char const *
 Return the marker's name (C string). More...
 
auto get_color () const noexcept -> std::uint32_t
 Return the marker's color. More...
 
auto get_category () const noexcept -> Category const &
 Return the marker's category. More...
 

Additional Inherited Members

- Protected Attributes inherited from bactria::ranges::Marker
std::string m_name {"BACTRIA_GENERIC_MARKER"}
 The name assigned to the Marker. More...
 
std::uint32_t m_color {color::orange}
 The color assigned to the Marker. More...
 
Category m_category {}
 The Category assigned to the Marker. More...
 

Detailed Description

The event class.

The user can record his own events which will appear as special markers on the visualizer. In contrast to a Range, an event denotes a single point in time.

See also
Range

Constructor & Destructor Documentation

◆ Event() [1/4]

bactria::ranges::Event::Event ( )
inline

The default constructor.

The default constructor will generate an event with the name BACTRIA_GENERIC_EVENT, orange color and the generic Category.

◆ Event() [2/4]

bactria::ranges::Event::Event ( std::string  name,
std::uint32_t  color = color::bactria_orange,
Category  category = Category{} 
)
inline

The constructor.

The constructor will generate an event with the name name, the color color and the Category category.

Parameters
nameThe name as it should appear on the visualizer.
colorThe color as it should appear on the visualizer. Needs to be supplied in ARGB format.
categoryThe category this event should be assigned to. This allows for later filtering.

◆ Event() [3/4]

bactria::ranges::Event::Event ( const Event other)
inline

The copy constructor.

The copy constructor will generate a new event with the same properties as the original.

Parameters
otherThe event to copy the properties from.

◆ Event() [4/4]

bactria::ranges::Event::Event ( Event &&  other)
inlinenoexcept

The move constructor.

The move constructor will move the contents of the original event into this event. The original event will be in an invalid state; using it is undefined behaviour.

Parameters
otherThe Event to be moved.

◆ ~Event()

bactria::ranges::Event::~Event ( )
inlineoverride

The destructor.

The destructor will discard all internal contents of the event. After the call to the destructor the event will be in an invalid state; using it is undefined behaviour.

Member Function Documentation

◆ fire()

auto bactria::ranges::Event::fire ( std::string  source,
std::uint32_t  lineno,
std::string  caller 
) -> void
inlinenoexcept

Fire the event.

Firing the event generates an entry on the visualizer with this event's name, color and category. While the interface requires the source file, the line number and the calling function, this information may not be supported by all back-ends. In this case the parameters will be silently ignored.

Parameters
sourceThe source file where the event is fired. Should be __FILE__.
linenoThe source line where the event is fired. Should be __LINE__.
callerThe surrounding function of the event firing. Should be __func__.

◆ operator=() [1/2]

auto bactria::ranges::Event::operator= ( const Event rhs) -> Event&
inline

The copy assignment operator.

The copy assignment operator will generate a new event with the same properties as the original.

Parameters
rhsThe event to copy the properties from.

◆ operator=() [2/2]

auto bactria::ranges::Event::operator= ( Event &&  rhs) -> Event&
inlinenoexcept

The move assignment operator.

The move assignment operator will move the contents of the original event into this event. The original event will be in an invalid state; using it is undefined behaviour.

Parameters
rhsThe event to be moved.

◆ set_action()

auto bactria::ranges::Event::set_action ( std::function< std::string(void)>  a) -> void
inlinenoexcept

Set a user-defined action for generating the event name.

This method allows to specify a user-defined action which generates the name. It will be executed upon firing the event. This method will override the name specified in the constructor.

Parameters
aThe action to execute upon firing the event.
See also
fire

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