ToolDAQFramework
|
#include <Utilities.h>
Public Member Functions | |
Utilities (zmq::context_t *zmqcontext) | |
Simple constructor. More... | |
bool | AddService (std::string ServiceName, unsigned int port, bool StatusQuery=false) |
Broadcasts an available service (only in remote mode) More... | |
Thread_args * | CreateThread (std::string ThreadName, void(*func)(std::string)) |
Thread_args * | CreateThread (std::string ThreadName, void(*func)(Thread_args *), Thread_args *args) |
Create a thread with more complicated data exchange definned by arguments. More... | |
bool | KillThread (Thread_args *&args) |
Kill a thread assosiated to args. More... | |
bool | KillThread (std::string ThreadName) |
Kill a thread by name. More... | |
template<typename T > | |
bool | KillThread (T *pointer) |
Kill a thread with args that inheirt form base Thread_args. More... | |
bool | MessageThread (Thread_args *args, std::string Message, bool block=true) |
Send simple string to String thread. More... | |
bool | MessageThread (std::string ThreadName, std::string Message, bool block=true) |
Send simple string to String thread. More... | |
template<typename T > | |
bool | ReceivePointer (zmq::socket_t *sock, T *&pointer) |
Receive a pointer over a ZMQ socket. More... | |
bool | RemoveService (std::string ServiceName) |
Removes service broadcasts for a service. More... | |
template<typename T > | |
bool | SendPointer (zmq::socket_t *sock, T *pointer) |
Send a pointer over a ZMQ socket. More... | |
int | UpdateConnections (std::string ServiceName, zmq::socket_t *sock, std::map< std::string, Store * > &connections) |
Dynamically connects a socket tp services broadcast with a specific name. More... | |
Static Private Member Functions | |
static void * | String_Thread (void *arg) |
Simpe string thread. More... | |
static void * | Thread (void *arg) |
Thread with args. More... | |
Private Attributes | |
zmq::context_t * | context |
ZMQ context pointer. More... | |
std::map< std::string, Thread_args * > | Threads |
Map of threads managed by the utilities class. More... | |
This class can be instansiated in a Tool and provides some helpful threading, dynamic socket descovery and promotion functionality
Contact: b.ric hard s@qmu l.ac .uk
Definition at line 82 of file Utilities.h.
Utilities::Utilities | ( | zmq::context_t * | zmqcontext | ) |
Simple constructor.
Definition at line 3 of file Utilities.cpp.
bool Utilities::AddService | ( | std::string | ServiceName, |
unsigned int | port, | ||
bool | StatusQuery = false |
||
) |
Broadcasts an available service (only in remote mode)
Definition at line 8 of file Utilities.cpp.
Thread_args * Utilities::CreateThread | ( | std::string | ThreadName, |
void(*)(std::string) | func | ||
) |
Definition at line 130 of file Utilities.cpp.
Thread_args * Utilities::CreateThread | ( | std::string | ThreadName, |
void(*)(Thread_args *) | func, | ||
Thread_args * | args | ||
) |
Create a thread with more complicated data exchange definned by arguments.
Definition at line 105 of file Utilities.cpp.
bool Utilities::KillThread | ( | Thread_args *& | args | ) |
Kill a thread assosiated to args.
Definition at line 234 of file Utilities.cpp.
bool Utilities::KillThread | ( | std::string | ThreadName | ) |
Kill a thread by name.
Definition at line 254 of file Utilities.cpp.
|
inline |
Kill a thread with args that inheirt form base Thread_args.
Definition at line 97 of file Utilities.h.
bool Utilities::MessageThread | ( | Thread_args * | args, |
std::string | Message, | ||
bool | block = true |
||
) |
Send simple string to String thread.
Definition at line 202 of file Utilities.cpp.
bool Utilities::MessageThread | ( | std::string | ThreadName, |
std::string | Message, | ||
bool | block = true |
||
) |
Send simple string to String thread.
Definition at line 229 of file Utilities.cpp.
|
inline |
Receive a pointer over a ZMQ socket.
Definition at line 116 of file Utilities.h.
bool Utilities::RemoveService | ( | std::string | ServiceName | ) |
Removes service broadcasts for a service.
Definition at line 28 of file Utilities.cpp.
|
inline |
Send a pointer over a ZMQ socket.
Definition at line 104 of file Utilities.h.
|
staticprivate |
|
staticprivate |
Thread with args.
Definition at line 187 of file Utilities.cpp.
int Utilities::UpdateConnections | ( | std::string | ServiceName, |
zmq::socket_t * | sock, | ||
std::map< std::string, Store * > & | connections | ||
) |
Dynamically connects a socket tp services broadcast with a specific name.
Definition at line 42 of file Utilities.cpp.
|
private |
ZMQ context pointer.
Definition at line 145 of file Utilities.h.
|
private |
Map of threads managed by the utilities class.
Definition at line 148 of file Utilities.h.