blob: d18dcc37e415dbcbb5de9c11b9c512d34a96172d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
//
// Copyright © 2020 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
#include <sstream>
#include <stdexcept>
#include <string>
#include "NetworkSockets.hpp"
namespace armnnProfiling
{
/// Socket Connection Exception for profiling
class SocketConnectionException : public std::exception
{
public:
explicit SocketConnectionException(const std::string& message, armnnUtils::Sockets::Socket socket)
: m_Message(message), m_Socket(socket), m_ErrNo(-1)
{};
explicit SocketConnectionException(const std::string& message, armnnUtils::Sockets::Socket socket, int errNo)
: m_Message(message), m_Socket(socket), m_ErrNo(errNo)
{};
/// @return - Error message of SocketProfilingConnection
virtual const char* what() const noexcept override
{
return m_Message.c_str();
}
/// @return - Socket File Descriptor of SocketProfilingConnection
/// or '-1', an invalid file descriptor
armnnUtils::Sockets::Socket GetSocketFd() const noexcept
{
return m_Socket;
}
/// @return - errno of SocketProfilingConnection
int GetErrorNo() const noexcept
{
return m_ErrNo;
}
private:
std::string m_Message;
armnnUtils::Sockets::Socket m_Socket;
int m_ErrNo;
};
} // namespace armnnProfiling
|