A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
callback.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2005,2006 INRIA
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7
*/
8
9
#include "
callback.h
"
10
11
#include "
log.h
"
12
13
/**
14
* \file
15
* \ingroup callback
16
* ns3::CallbackValue implementation.
17
*/
18
19
namespace
ns3
20
{
21
22
NS_LOG_COMPONENT_DEFINE
(
"Callback"
);
23
24
CallbackValue::CallbackValue
()
25
: m_value()
26
{
27
NS_LOG_FUNCTION
(
this
);
28
}
29
30
CallbackValue::CallbackValue
(
const
CallbackBase
& value)
31
: m_value(value)
32
{
33
}
34
35
CallbackValue::~CallbackValue
()
36
{
37
NS_LOG_FUNCTION
(
this
);
38
}
39
40
void
41
CallbackValue::Set
(
const
CallbackBase
& value)
42
{
43
NS_LOG_FUNCTION
(&value);
44
m_value
= value;
45
}
46
47
CallbackBase
48
CallbackValue::Get
()
49
{
50
NS_LOG_FUNCTION
(
this
);
51
return
m_value
;
52
}
53
54
Ptr<AttributeValue>
55
CallbackValue::Copy
()
const
56
{
57
NS_LOG_FUNCTION
(
this
);
58
return
Create<CallbackValue>
(
m_value
);
59
}
60
61
std::string
62
CallbackValue::SerializeToString
(
Ptr<const AttributeChecker>
checker)
const
63
{
64
NS_LOG_FUNCTION
(
this
<< checker);
65
std::ostringstream oss;
66
oss <<
PeekPointer
(
m_value
.
GetImpl
());
67
return
oss.str();
68
}
69
70
bool
71
CallbackValue::DeserializeFromString
(std::string value,
Ptr<const AttributeChecker>
checker)
72
{
73
NS_LOG_FUNCTION
(
this
<< value << checker);
74
return
false
;
75
}
76
77
ATTRIBUTE_CHECKER_IMPLEMENT
(
Callback
);
78
79
}
// namespace ns3
callback.h
Declaration of the various callback functions.
ns3::CallbackBase
Base class for Callback class.
Definition
callback.h:344
ns3::CallbackBase::GetImpl
Ptr< CallbackImplBase > GetImpl() const
Definition
callback.h:352
ns3::Callback
Callback template class.
Definition
callback.h:422
ns3::CallbackValue::DeserializeFromString
bool DeserializeFromString(std::string value, Ptr< const AttributeChecker > checker) override
Deserialize from string (not implemented)
Definition
callback.cc:71
ns3::CallbackValue::Get
CallbackBase Get()
Definition
callback.cc:48
ns3::CallbackValue::SerializeToString
std::string SerializeToString(Ptr< const AttributeChecker > checker) const override
Serialize to string.
Definition
callback.cc:62
ns3::CallbackValue::Set
void Set(const CallbackBase &value)
Set the value.
Definition
callback.cc:41
ns3::CallbackValue::CallbackValue
CallbackValue()
Definition
callback.cc:24
ns3::CallbackValue::m_value
CallbackBase m_value
The stored Callback instance.
Definition
callback.h:815
ns3::CallbackValue::Copy
Ptr< AttributeValue > Copy() const override
Definition
callback.cc:55
ns3::CallbackValue::~CallbackValue
~CallbackValue() override
Definition
callback.cc:35
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ATTRIBUTE_CHECKER_IMPLEMENT
#define ATTRIBUTE_CHECKER_IMPLEMENT(type)
Define the MaketypeChecker function for class type .
Definition
attribute-helper.h:351
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition
log.h:191
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition
log-macros-enabled.h:229
ns3::Create
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition
ptr.h:436
log.h
Debug message logging.
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::PeekPointer
U * PeekPointer(const Ptr< U > &p)
Definition
ptr.h:443
src
core
model
callback.cc
Generated on Wed Oct 9 2024 01:03:22 for ns-3 by
1.11.0