A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
callback.cc
Go to the documentation of this file.
1
#include "
callback.h
"
2
#include "
log.h
"
3
4
NS_LOG_COMPONENT_DEFINE
(
"Callback"
);
5
6
namespace
ns3 {
7
8
CallbackValue::CallbackValue
()
9
: m_value ()
10
{
11
NS_LOG_FUNCTION
(
this
);
12
}
13
CallbackValue::CallbackValue
(
const
CallbackBase
&base)
14
: m_value (base)
15
{
16
}
17
CallbackValue::~CallbackValue
()
18
{
19
NS_LOG_FUNCTION
(
this
);
20
}
21
void
22
CallbackValue::Set
(
CallbackBase
base)
23
{
24
NS_LOG_FUNCTION
(&base);
25
26
m_value
= base;
27
}
28
Ptr<AttributeValue>
29
CallbackValue::Copy
(
void
)
const
30
{
31
NS_LOG_FUNCTION
(
this
);
32
return
Create<CallbackValue> (
m_value
);
33
}
34
std::string
35
CallbackValue::SerializeToString
(
Ptr<const AttributeChecker>
checker)
const
36
{
37
NS_LOG_FUNCTION
(
this
<< checker);
38
std::ostringstream oss;
39
oss <<
PeekPointer
(
m_value
.
GetImpl
());
40
return
oss.str ();
41
}
42
bool
43
CallbackValue::DeserializeFromString
(std::string value,
Ptr<const AttributeChecker>
checker)
44
{
45
NS_LOG_FUNCTION
(
this
<< value << checker);
46
return
false
;
47
}
48
49
ATTRIBUTE_CHECKER_IMPLEMENT
(
Callback
);
50
51
}
// namespace ns3
52
53
#if (__GNUC__ >= 3)
54
55
#include <cstdlib>
56
#include <cxxabi.h>
57
#include "
log.h
"
58
59
namespace
ns3 {
60
61
std::string
62
CallbackBase::Demangle
(
const
std::string& mangled)
63
{
64
NS_LOG_FUNCTION
(mangled);
65
66
int
status;
67
char
* demangled = abi::__cxa_demangle (mangled.c_str (),
68
NULL, NULL, &status);
69
70
std::string ret;
71
if
(status == 0) {
72
NS_ASSERT
(demangled);
73
ret = demangled;
74
}
75
else
if
(status == -1) {
76
NS_LOG_UNCOND
(
"Callback demangling failed: Memory allocation failure occured."
);
77
ret = mangled;
78
}
79
else
if
(status == -2) {
80
NS_LOG_UNCOND
(
"Callback demangling failed: Mangled name is not a valid under the C++ ABI mangling rules."
);
81
ret = mangled;
82
}
83
else
if
(status == -3) {
84
NS_LOG_UNCOND
(
"Callback demangling failed: One of the arguments is invalid."
);
85
ret = mangled;
86
}
87
else
{
88
NS_LOG_UNCOND
(
"Callback demangling failed: status "
<< status);
89
ret = mangled;
90
}
91
92
if
(demangled) {
93
std::free (demangled);
94
}
95
return
ret;
96
}
97
98
}
// namespace ns3
99
100
#else
101
102
std::string
103
ns3::CallbackBase::Demangle
(
const
std::string& mangled)
104
{
105
NS_LOG_FUNCTION
(
this
<< mangled);
106
return
mangled;
107
}
108
109
#endif
110
src
core
model
callback.cc
Generated on Tue May 14 2013 11:08:17 for ns-3 by
1.8.1.2