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
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
callback.cc
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
ns3::Ptr
smart pointer class similar to boost::intrusive_ptr
Definition:
ptr.h:59
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
Definition:
log.h:311
ns3::Callback
Callback template class.
Definition:
callback.h:369
NS_ASSERT
#define NS_ASSERT(condition)
Definition:
assert.h:64
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Definition:
log.h:122
NS_LOG_UNCOND
#define NS_LOG_UNCOND(msg)
Definition:
log.h:343
ns3::CallbackValue::DeserializeFromString
virtual bool DeserializeFromString(std::string value, Ptr< const AttributeChecker > checker)
Definition:
callback.cc:43
ns3::CallbackValue::SerializeToString
virtual std::string SerializeToString(Ptr< const AttributeChecker > checker) const
Definition:
callback.cc:35
ns3::CallbackValue::Copy
virtual Ptr< AttributeValue > Copy(void) const
Definition:
callback.cc:29
ATTRIBUTE_CHECKER_IMPLEMENT
#define ATTRIBUTE_CHECKER_IMPLEMENT(type)
Definition:
attribute-helper.h:216
src
core
model
callback.cc
Generated on Sun Mar 16 2014 11:25:02 for ns-3 by
1.8.6