RDK Documentation (Open Sourced RDK Components)
TRM.h
1
/*
2
* If not stated otherwise in this file or this component's Licenses.txt file the
3
* following copyright and licenses apply:
4
*
5
* Copyright 2016 RDK Management
6
*
7
* Licensed under the Apache License, Version 2.0 (the "License");
8
* you may not use this file except in compliance with the License.
9
* You may obtain a copy of the License at
10
*
11
* http://www.apache.org/licenses/LICENSE-2.0
12
*
13
* Unless required by applicable law or agreed to in writing, software
14
* distributed under the License is distributed on an "AS IS" BASIS,
15
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
* See the License for the specific language governing permissions and
17
* limitations under the License.
18
*/
19
20
21
/**
22
* @defgroup trm
23
* @{
24
* @defgroup common
25
* @{
26
**/
27
28
29
#ifndef TRM_TRM_H_
30
#define TRM_TRM_H_
31
32
#include <cstdio>
33
#include <stdexcept>
34
#include <stdint.h>
35
36
#define LOCAL_BEGIN_NAMESPACE namespace {
37
#define LOCAL_END_NAMESPACE }
38
#define TRM_BEGIN_NAMESPACE namespace TRM {
39
#define TRM_END_NAMESPACE }
40
41
#define UNUSED_VARIABLE(x) (void(x))
42
43
TRM_BEGIN_NAMESPACE
44
45
class
Exception
46
{
47
48
};
49
50
class
IllegalArgumentException
:
public
Exception
51
{
52
53
};
54
class
InvalidOperationException
:
public
Exception
55
{
56
57
};
58
class
ItemNotFoundException
:
public
Exception
59
{
60
61
};
62
class
ConnectionNotFoundException
:
public
Exception
63
{
64
65
};
66
class
AssertionFailureException
:
public
Exception
67
{
68
69
};
70
class
InvalidStateException
:
public
Exception
71
{
72
73
};
74
75
class
Empty
76
{
77
};
78
79
#define Assert(expr) do{\
80
if (!(expr)) {\
81
printf("[%s] failed at [%s][%d]\r\n", "Assert ", __FILE__, __LINE__);\
82
throw AssertionFailureException();\
83
}\
84
} while (0)
85
86
#define SafeAssert(expr) do{\
87
try {\
88
Assert(expr);\
89
}\
90
catch(...) {\
91
}\
92
}while(0)
93
94
#define MAKE_PAIR(v) v, #v
95
96
TRM_END_NAMESPACE
97
98
#include <functional>
99
#include <string>
100
namespace
std {
101
template
<>
class
less<const char*>
102
{
103
public
:
104
bool
operator()(
const
char
* lhs,
const
char
*rhs)
const
105
{
106
return
(std::string(lhs).compare(rhs) < 0);
107
}
108
};
109
}
110
111
112
#endif
113
114
115
/** @} */
116
/** @} */
TRM::AssertionFailureException
Definition:
TRM.h:66
TRM::Empty
Definition:
TRM.h:75
TRM::ConnectionNotFoundException
Definition:
TRM.h:62
TRM::Exception
Definition:
TRM.h:45
TRM::InvalidOperationException
Definition:
TRM.h:54
TRM::ItemNotFoundException
Definition:
TRM.h:58
TRM::InvalidStateException
Definition:
TRM.h:70
TRM::IllegalArgumentException
Definition:
TRM.h:50
components
generic
trm
common
include
trm
TRM.h
Generated on Thu Feb 9 2023 06:32:35 for RDK Documentation (Open Sourced RDK Components) by
1.8.17