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
3
namespace
ns3 {
4
5
CallbackValue::CallbackValue
()
6
: m_value ()
7
{
8
}
9
CallbackValue::CallbackValue
(
const
CallbackBase
&base)
10
: m_value (base)
11
{
12
}
13
CallbackValue::~CallbackValue
()
14
{
15
}
16
void
17
CallbackValue::Set
(
CallbackBase
base)
18
{
19
m_value
= base;
20
}
21
Ptr<AttributeValue>
22
CallbackValue::Copy
(
void
)
const
23
{
24
return
Create<CallbackValue> (
m_value
);
25
}
26
std::string
27
CallbackValue::SerializeToString
(
Ptr<const AttributeChecker>
checker)
const
28
{
29
std::ostringstream oss;
30
oss <<
PeekPointer
(
m_value
.
GetImpl
());
31
return
oss.str ();
32
}
33
bool
34
CallbackValue::DeserializeFromString
(std::string value,
Ptr<const AttributeChecker>
checker)
35
{
36
return
false
;
37
}
38
39
ATTRIBUTE_CHECKER_IMPLEMENT
(
Callback
);
40
41
}
// namespace ns3
42
43
#if (__GNUC__ >= 3)
44
45
#include <stdlib.h>
46
#include <cxxabi.h>
47
#include "
log.h
"
48
49
namespace
ns3 {
50
51
std::string
52
CallbackBase::Demangle
(
const
std::string& mangled)
53
{
54
int
status;
55
char
* demangled = abi::__cxa_demangle (mangled.c_str (),
56
NULL, NULL, &status);
57
58
std::string ret;
59
if
(status == 0) {
60
NS_ASSERT
(demangled);
61
ret = demangled;
62
}
63
else
if
(status == -1) {
64
NS_LOG_UNCOND
(
"Callback demangling failed: Memory allocation failure occured."
);
65
ret = mangled;
66
}
67
else
if
(status == -2) {
68
NS_LOG_UNCOND
(
"Callback demangling failed: Mangled name is not a valid under the C++ ABI mangling rules."
);
69
ret = mangled;
70
}
71
else
if
(status == -3) {
72
NS_LOG_UNCOND
(
"Callback demangling failed: One of the arguments is invalid."
);
73
ret = mangled;
74
}
75
else
{
76
NS_LOG_UNCOND
(
"Callback demangling failed: status "
<< status);
77
ret = mangled;
78
}
79
80
if
(demangled) {
81
free (demangled);
82
}
83
return
ret;
84
}
85
86
}
// namespace ns3
87
88
#else
89
90
std::string
91
ns3::CallbackBase::Demangle
(
const
std::string& mangled)
92
{
93
return
mangled;
94
}
95
96
#endif
97
src
core
model
callback.cc
Generated on Tue Oct 9 2012 16:45:34 for ns-3 by
1.8.1.2