remage
Simulation framework for HPGe-based experiments
Toggle main menu visibility
Loading...
Searching...
No Matches
RMGIpc.hh
1
// Copyright (C) 2025 Manuel Huber <https://orcid.org/0009-0000-5212-2999>
2
//
3
// This program is free software: you can redistribute it and/or modify it under
4
// the terms of the GNU Lesser General Public License as published by the Free
5
// Software Foundation, either version 3 of the License, or (at your option) any
6
// later version.
7
//
8
// This program is distributed in the hope that it will be useful, but WITHOUT
9
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11
// details.
12
//
13
// You should have received a copy of the GNU Lesser General Public License
14
// along with this program. If not, see <https://www.gnu.org/licenses/>.
15
16
#ifndef _RMG_IPC_HH_
17
#define _RMG_IPC_HH_
18
19
#include <string>
20
28
class
RMGIpc final {
29
30
public
:
31
32
RMGIpc() =
delete
;
33
36
static
void
Setup
(
int
ipc_pipe_fd_out,
int
ipc_pipe_fd_in,
int
proc_num);
37
40
static
std::string
CreateMessage
(
const
std::string& command,
const
std::string& param) {
41
// \x1e (record separator = end of entry)
42
// TODO: also implement a CreateMessage variant with \x1f (unit separator = key/value delimiter)
43
return
command +
"\x1e"
+ param;
44
}
45
50
static
bool
SendIpcNonBlocking
(std::string msg);
55
static
bool
SendIpcBlocking
(std::string msg);
56
57
private
:
58
59
inline
static
int
fIpcFdOut = -1;
60
inline
static
int
fIpcFdIn = -1;
61
inline
static
int
fProcNum = -1;
62
};
63
64
#endif
65
66
// vim: tabstop=2 shiftwidth=2 expandtab
RMGIpc::SendIpcBlocking
static bool SendIpcBlocking(std::string msg)
Send a blocking IPC message.
Definition
RMGIpc.cc:51
RMGIpc::Setup
static void Setup(int ipc_pipe_fd_out, int ipc_pipe_fd_in, int proc_num)
Set the IPC pipes file descriptors.
Definition
RMGIpc.cc:28
RMGIpc::CreateMessage
static std::string CreateMessage(const std::string &command, const std::string ¶m)
Create an IPC message with a key and a single value.
Definition
RMGIpc.hh:40
RMGIpc::SendIpcNonBlocking
static bool SendIpcNonBlocking(std::string msg)
Send a non-blocking IPC message.
Definition
RMGIpc.cc:92
include
RMGIpc.hh
Generated by
1.17.0