mns.cpp
Go to the documentation of this file.
1#include "mns.h"
2
3#include <sstream>
4
5#include "../MemoryID.h"
6
8{
9
11 const std::string& errorMessage) :
12 ArMemError(makeMsg(function, errorMessage))
13 {
14 }
15
16 std::string
17 MemoryNameSystemQueryFailed::makeMsg(const std::string& function,
18 const std::string& errorMessage)
19 {
20 std::stringstream ss;
21 ss << "Failed to call '" << function << "' on the memory name system.\n";
22 if (not errorMessage.empty())
23 {
24 ss << "\n" << errorMessage;
25 }
26 return ss.str();
27 }
28
30 const std::string& errorMessage) :
31 ArMemError(makeMsg(memoryID, errorMessage))
32 {
33 }
34
35 std::string
36 CouldNotResolveMemoryServer::makeMsg(const MemoryID& memoryID, const std::string& errorMessage)
37 {
38 std::stringstream ss;
39 ss << "Could not resolve the memory name '" << memoryID << "'."
40 << "\nMemory server for '" << memoryID << "' is not registered.";
41 if (not errorMessage.empty())
42 {
43 ss << "\n" << errorMessage;
44 }
45 return ss.str();
46 }
47
49 const std::string& verb,
50 const MemoryID& memoryID,
51 const std::string& errorMessage) :
52 ArMemError(makeMsg(verb, memoryID, errorMessage))
53 {
54 }
55
56 std::string
58 const MemoryID& memoryID,
59 const std::string& errorMessage)
60 {
61 std::stringstream ss;
62 ss << "Failed to " << verb << " memory server for '" << memoryID
63 << "' in the Memory Name System (MNS).";
64 if (not errorMessage.empty())
65 {
66 ss << "\n" << errorMessage;
67 }
68 return ss.str();
69 }
70
71} // namespace armarx::armem::error
std::string str(bool escapeDelimiters=true) const
Get a string representation of this memory ID.
Definition MemoryID.cpp:102
ArMemError(const std::string &msg)
CouldNotResolveMemoryServer(const MemoryID &memoryID, const std::string &errorMessage="")
Definition mns.cpp:29
static std::string makeMsg(const MemoryID &memoryID, const std::string &errorMessage="")
Definition mns.cpp:36
MemoryNameSystemQueryFailed(const std::string &function, const std::string &errorMessage="")
Definition mns.cpp:10
static std::string makeMsg(const std::string &function, const std::string &errorMessage="")
Definition mns.cpp:17
ServerRegistrationOrRemovalFailed(const std::string &verb, const MemoryID &memoryID, const std::string &errorMessage="")
Definition mns.cpp:48
static std::string makeMsg(const std::string &verb, const MemoryID &memoryID, const std::string &errorMessage="")
Definition mns.cpp:57