rad 6.2.0
Loading...
Searching...
No Matches
utils.hpp
Go to the documentation of this file.
1
9#ifndef RAD_UTILS_HPP
10#define RAD_UTILS_HPP
11
12#include <rad/getPayload.hpp>
13#include <rad/logger.hpp>
14
15#include <string>
16
17namespace rad {
18
22class Utils {
23 public:
24 template <typename EVENT>
25 static const std::string GetRequestId(rad::AnyEvent const& event);
26
27 Utils() = delete;
28 Utils(const Utils&) = delete;
29 Utils& operator=(const Utils&) = delete;
30};
31
41template <typename EVENT>
42const std::string Utils::GetRequestId(rad::AnyEvent const& event) {
44
45 auto payload = rad::GetPayloadNothrow<EVENT>(event);
46 if (payload == nullptr) {
47 LOG4CPLUS_ERROR(GetLogger(), "Last event's payload is NULL!");
48 return "";
49 }
50 return payload->GetOriginatorId();
51}
52
53} // namespace rad
54
55#endif // RAD_UTILS_HPP
Definition anyEvent.hpp:52
Definition utils.hpp:22
static const std::string GetRequestId(rad::AnyEvent const &event)
Definition utils.hpp:42
Utils()=delete
Utils & operator=(const Utils &)=delete
Utils(const Utils &)=delete
Logger class.
#define RAD_TRACE(logger)
Definition logger.hpp:21
getPayload functions source file.
Definition actionsApp.cpp:23
log4cplus::Logger & GetLogger()
Definition logger.cpp:72