salsa 0.7.1
Loading...
Searching...
No Matches
ActorZmq.hh
1#pragma once
2
3#include <czmq.h>
4
5#include "Actor.hh"
6#include "Log.hh"
7#include "PollerZmq.hh"
8
9namespace Salsa {
18
19class ActorZmq : public Actor {
20public:
21 ActorZmq();
22 virtual ~ActorZmq();
23
24 virtual void pipe(void * pipe);
25 virtual int init();
26 virtual int exec();
27 virtual int finish();
28
30 void timeout(int t) { mTimeout = t; }
32 int timeout() const { return mTimeout; }
33
34 virtual void * wait();
35
36 zpoller_t * poller() const;
37 PollerZmq * pollerZmq() const;
38
40 bool terminated() const { return mTerminated; }
41
42 static void SalsaActorFn(zsock_t * pPipe, void * pArgv);
43
45 static void SalsaActorForkFn(zsock_t * pPipe, void * pArgv);
46
47protected:
48 zsock_t * mpPipe = nullptr;
49 PollerZmq * mpPoller = nullptr;
50 bool mTerminated = false;
51 int mTimeout = -1;
52
53private:
55 static void actorProcwaitSupport_(zsock_t * pipe, void * argv);
56};
57
58} // namespace Salsa
ZeroMQ implementation of salsa actor class.
Definition ActorZmq.hh:19
int timeout() const
Returns timeout.
Definition ActorZmq.hh:32
virtual int init()
First function.
Definition ActorZmq.cc:378
virtual void * wait()
Definition ActorZmq.cc:426
int mTimeout
Poller timeout.
Definition ActorZmq.hh:51
virtual void pipe(void *pipe)
Setter for pipe.
Definition ActorZmq.cc:359
static void actorProcwaitSupport_(zsock_t *pipe, void *argv)
Support actor method (used for PID waiting)
Definition ActorZmq.cc:311
PollerZmq * pollerZmq() const
Definition ActorZmq.cc:480
bool mTerminated
Flag if actor should be terminated.
Definition ActorZmq.hh:50
bool terminated() const
Flag if actor should be terminated.
Definition ActorZmq.hh:40
zpoller_t * poller() const
Definition ActorZmq.cc:473
static void SalsaActorFn(zsock_t *pPipe, void *pArgv)
Definition ActorZmq.cc:22
void timeout(int t)
Sets timeout.
Definition ActorZmq.hh:30
PollerZmq * mpPoller
Internal poller.
Definition ActorZmq.hh:49
zsock_t * mpPipe
Zmq pipe socket.
Definition ActorZmq.hh:48
virtual int exec()
Main function.
Definition ActorZmq.cc:393
virtual int finish()
Last function.
Definition ActorZmq.cc:415
static void SalsaActorForkFn(zsock_t *pPipe, void *pArgv)
Actor function with fork capability.
Definition ActorZmq.cc:57
virtual ~ActorZmq()
Definition ActorZmq.cc:12
Base salsa actor class.
Definition Actor.hh:17
salsa node class
Definition PollerZmq.hh:16