forked from Abc-Arbitrage/Disruptor-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIEventTranslator.h
More file actions
32 lines (26 loc) · 1.03 KB
/
IEventTranslator.h
File metadata and controls
32 lines (26 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#pragma once
#include <cstdint>
#include <memory>
namespace Disruptor
{
/**
* Implementations translate (write) data representations into events claimed from the RingBuffer<T>.
* When publishing to the RingBuffer, provide an EventTranslator. The RingBuffer will select the next available event by sequence and provide
* it to the EventTranslator(which should update the event), before publishing the sequence update.
*
* \tparam T event implementation storing the data for sharing during exchange or parallel coordination of an event.
*/
template <class T>
class IEventTranslator
{
public:
virtual ~IEventTranslator() = default;
/**
* Translate a data representation into fields set in given event
*
* \param eventData event into which the data should be translated.
* \param sequence sequence that is assigned to event.
*/
virtual void translateTo(T& eventData, std::int64_t sequence) = 0;
};
} // namespace Disruptor