1 #ifndef _ots_mm_udp_interface_h_
2 #define _ots_mm_udp_interface_h_
7 #include <netinet/in.h>
12 #include <sys/socket.h>
13 #include <sys/types.h>
24 #define __COUT_HDR__ ""
29 #define __FILENAME__ \
30 (__builtin_strrchr(__FILE__, '/') ? __builtin_strrchr(__FILE__, '/') + 1 : __FILE__)
31 #define __MF_SUBJECT__ __FILENAME__
32 #define __MF_DECOR__ (__MF_SUBJECT__)
34 #define __COUT_HDR_L__ ":" << std::dec << __LINE__ << " |\t"
35 #define __COUT_HDR_FL__ __FILENAME__ << "" << __COUT_HDR_L__
36 #define TLOG(X) std::cout << QUOTE(X) << ": " << __COUT_HDR_FL__
37 #define __COUT_ERR__ TLOG(TLVL_ERROR) << __COUT_HDR__
38 #define __COUT_WARN__ TLOG(TLVL_WARN) << __COUT_HDR__
39 #define __COUT_INFO__ TLOG(TLVL_INFO) << __COUT_HDR__
42 TLOG(TLVL_DEBUG) << __COUT_HDR__
45 TLOG(TLVL_TRACE) << __COUT_HDR__
48 std::stringstream ss; \
49 ss << "|" << __MF_DECOR__ << ": " << __COUT_HDR_FL__ << __COUT_HDR__
50 #define __SS_THROW__ \
52 __COUT_ERR__ << "\n" << ss.str(); \
53 throw std::runtime_error(ss.str()); \
55 #define __SS_THROW_ONLY__ \
57 throw std::runtime_error(ss.str()); \
59 #define __E__ std::endl
61 #define __COUTV__(X) __COUT__ << QUOTE(X) << " = " << X << __E__
62 #define __COUTVS__(LVL, X) \
63 TLOG(TLVL_DEBUG + LVL) << __COUT_HDR__ << QUOTE(X) << " = " << X << __E__
65 std::string vectorToString(
const std::vector<std::string>& setToReturn,
66 const std::string& delimeter =
", ");
67 void getVectorFromString(
const std::string& inputString,
68 std::vector<std::string>& listToReturn,
69 const std::set<char>& delimiter = {
',',
'|',
'&'},
70 const std::set<char>& whitespace = {
' ',
'\t',
'\n',
'\r'},
71 std::vector<char>* listOfDelimiters = 0,
72 bool decodeURIComponents =
false);
73 std::vector<std::string> getVectorFromString(
74 const std::string& inputString,
75 const std::set<char>& delimiter = {
',',
'|',
'&'},
76 const std::set<char>& whitespace = {
' ',
'\t',
'\n',
'\r'},
77 std::vector<char>* listOfDelimiters = 0,
78 bool decodeURIComponents =
false);
89 std::string getCommandList(
const std::string& targetFE);
90 int getCommandInputCount(
const std::string& targetFE,
const std::string& command);
91 int getCommandOutputCount(
const std::string& targetFE,
const std::string& command);
92 std::string getCommandInputName(
const std::string& targetFE,
93 const std::string& command,
96 const std::string& command,
98 std::string
runCommand(
const std::string& targetFE,
99 const std::string& command,
100 const std::string& inputs);
105 static std::string encodeURIComponent(
const std::string& data);
106 static std::string decodeHTMLEntities(
const std::string& data);
110 struct sockaddr_in mm_ai_addr;
112 std::string fullXML_;
std::string getFrontendList(void)
returns CSV list of Front-end interface UIDs
ots_mm_udp_interface(const char *mm_ip, int mm_port)
static std::string decodeURIComponent(const std::string &data)
std::string runCommand(const std::string &targetFE, const std::string &command, const std::string &inputs)
const std::string & getFrontendMacroInfo(void)
returns CSV list of Front-end interface UIDs
std::string getCommandOutputName(const std::string &targetFE, const std::string &command, int outputIndex)
Note: if std::map does not complicate interface too much for ROOT/pyton, could make this const std::s...