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
50
ATTRIBUTE_CHECKER_IMPLEMENT
(
Callback
);
51
52
}
// namespace ns3
53
54
#if (__GNUC__ >= 3)
55
56
#include <cstdlib>
57
#include <cxxabi.h>
58
#include "
log.h
"
59
60
namespace
ns3 {
61
62
std::string
63
CallbackBase::Demangle
(
const
std::string& mangled)
64
{
65
NS_LOG_FUNCTION
(mangled);
66
67
int
status;
68
char
* demangled = abi::__cxa_demangle (mangled.c_str (),
69
NULL, NULL, &status);
70
71
std::string ret;
72
if
(status == 0) {
73
NS_ASSERT
(demangled);
74
ret = demangled;
75
}
76
else
if
(status == -1) {
77
NS_LOG_UNCOND
(
"Callback demangling failed: Memory allocation failure occured."
);
78
ret = mangled;
79
}
80
else
if
(status == -2) {
81
NS_LOG_UNCOND
(
"Callback demangling failed: Mangled name is not a valid under the C++ ABI mangling rules."
);
82
ret = mangled;
83
}
84
else
if
(status == -3) {
85
NS_LOG_UNCOND
(
"Callback demangling failed: One of the arguments is invalid."
);
86
ret = mangled;
87
}
88
else
{
89
NS_LOG_UNCOND
(
"Callback demangling failed: status "
<< status);
90
ret = mangled;
91
}
92
93
if
(demangled) {
94
std::free (demangled);
95
}
96
return
ret;
97
}
98
99
}
// namespace ns3
100
101
#else
102
103
std::string
104
ns3::CallbackBase::Demangle
(
const
std::string& mangled)
105
{
106
NS_LOG_FUNCTION
(
this
<< mangled);
107
return
mangled;
108
}
109
110
#endif
111
src
core
model
callback.cc
Generated on Fri Aug 30 2013 01:42:46 for ns-3 by
1.8.1.2