TVM
0.9.4
Source.h
Go to the documentation of this file.
1
3
#pragma once
4
5
#include <
tvm/api.h
>
6
#include <
tvm/event/enums.h
>
7
8
#include <map>
9
#include <memory>
10
#include <vector>
11
12
namespace
tvm
13
{
14
15
namespace
event
16
{
17
18
class
Listener;
19
20
/* todo or to consider:
21
- delayed notify in case the same notification might be issue several time in a row
22
(for example, several contacts are added/remove at several point in the code)
23
- time-stamped events or lazy processing, so that a same event arriving by two
24
different way to a listener is not processed twice.*/
25
26
class
TVM_DLLAPI
Source
27
{
28
public
:
29
virtual
~Source
() =
default
;
30
31
void
regist
(std::shared_ptr<Listener> user,
Type
evt);
32
void
notify
(
Type
evt);
33
34
private
:
39
std::map<Type, std::vector<std::weak_ptr<Listener>>> registrations_;
40
};
41
42
}
// namespace event
43
44
}
// namespace tvm
api.h
TVM_DLLAPI
#define TVM_DLLAPI
Definition:
api.h:35
tvm::event::Source
Definition:
Source.h:27
tvm::event::Source::notify
void notify(Type evt)
tvm::event::Source::~Source
virtual ~Source()=default
tvm::event::Source::regist
void regist(std::shared_ptr< Listener > user, Type evt)
enums.h
tvm::event::Type
Type
Definition:
enums.h:12
tvm
Definition:
Clock.h:12
include
tvm
event
Source.h
Generated by
1.9.1