rippled
ripple
beast
insight
Event.h
1
//------------------------------------------------------------------------------
2
/*
3
This file is part of Beast: https://github.com/vinniefalco/Beast
4
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
5
6
Permission to use, copy, modify, and/or distribute this software for any
7
purpose with or without fee is hereby granted, provided that the above
8
copyright notice and this permission notice appear in all copies.
9
10
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
*/
18
//==============================================================================
19
20
#ifndef BEAST_INSIGHT_EVENT_H_INCLUDED
21
#define BEAST_INSIGHT_EVENT_H_INCLUDED
22
23
#include <ripple/beast/insight/EventImpl.h>
24
25
#include <date/date.h>
26
27
#include <
chrono
>
28
#include <
memory
>
29
30
namespace
beast
{
31
namespace
insight {
32
42
class
Event
final
43
{
44
public
:
45
using
value_type
=
EventImpl::value_type
;
46
50
Event
()
51
{
52
}
53
59
explicit
Event
(
std::shared_ptr<EventImpl>
const
&
impl
) :
m_impl
(
impl
)
60
{
61
}
62
64
template
<
class
Rep,
class
Period>
65
void
66
notify
(
std::chrono::duration<Rep, Period>
const
& value)
const
67
{
68
using namespace
std::chrono
;
69
if
(
m_impl
)
70
m_impl
->notify(date::ceil<value_type>(value));
71
}
72
73
std::shared_ptr<EventImpl>
const
&
74
impl
()
const
75
{
76
return
m_impl
;
77
}
78
79
private
:
80
std::shared_ptr<EventImpl>
m_impl
;
81
};
82
83
}
// namespace insight
84
}
// namespace beast
85
86
#endif
std::shared_ptr
STL class.
std::chrono::milliseconds
beast::insight::EventImpl::value_type
std::chrono::milliseconds value_type
Definition:
EventImpl.h:34
beast::insight::Event::m_impl
std::shared_ptr< EventImpl > m_impl
Definition:
Event.h:80
chrono
beast::insight::Event::Event
Event()
Create a null metric.
Definition:
Event.h:50
beast::insight::Event
A metric for reporting event timing.
Definition:
Event.h:42
memory
beast::insight::Event::Event
Event(std::shared_ptr< EventImpl > const &impl)
Create the metric reference the specified implementation.
Definition:
Event.h:59
beast::insight::Event::impl
std::shared_ptr< EventImpl > const & impl() const
Definition:
Event.h:74
beast::insight::Event::notify
void notify(std::chrono::duration< Rep, Period > const &value) const
Push an event notification.
Definition:
Event.h:66
beast
Definition:
base_uint.h:585
std::chrono
Generated by
1.8.17