qb  2.0.0.0
C++17 Actor Framework
qb Issue Watch Star Fork Follow @isndev
Loading...
Searching...
No Matches
Pipe.h
Go to the documentation of this file.
1
29
30#ifndef QB_PROXYPIPE_H
31#define QB_PROXYPIPE_H
32#include "ActorId.h"
33#include "Event.h"
34
35namespace qb {
36
46class Pipe {
47 friend class VirtualCore;
48
49 VirtualPipe *pipe;
50 ActorId dest;
51 ActorId source;
52
53 Pipe(VirtualPipe &i_pipe, ActorId i_dest, ActorId i_source) noexcept
54 : pipe(&i_pipe)
55 , dest(i_dest)
56 , source(i_source) {}
57
58public:
59 Pipe() = default;
60 Pipe(Pipe const &) = default;
61 Pipe &operator=(Pipe const &) = default;
62
73 template <typename _Event, typename... _Args>
74 _Event &push(_Args &&...args) const noexcept;
75
88 template <typename _Event, typename... _Args>
89 [[nodiscard]] _Event &allocated_push(std::size_t size,
90 _Args &&...args) const noexcept;
91
96 [[nodiscard]] inline ActorId
97 getDestination() const noexcept {
98 return dest;
99 }
100
105 [[nodiscard]] inline ActorId
106 getSource() const noexcept {
107 return source;
108 }
109};
110
117using pipe = Pipe;
118
119} // namespace qb
120#endif // QB_PROXYPIPE_H
Unique identifier for actors.
Definition ActorId.h:374
Represents a communication channel between actors.
Definition Pipe.h:46
_Event & push(_Args &&...args) const noexcept
Push an event to the pipe.
ActorId getSource() const noexcept
Get the source actor ID.
Definition Pipe.h:106
_Event & allocated_push(std::size_t size, _Args &&...args) const noexcept
Push an event with pre-allocated size to the pipe.
ActorId getDestination() const noexcept
Get the destination actor ID.
Definition Pipe.h:97
Actor and core identification for the QB Actor Framework.
Event system for the QB Actor Framework.
allocator::pipe< EventBucket > VirtualPipe
Pipe for event transmission in the actor system.
Definition Event.h:375
Pipe pipe
Alias for the Pipe class.
Definition Pipe.h:117