A Discrete-Event Network Simulator
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
19namespace ns3
20{
21
22NS_LOG_COMPONENT_DEFINE("Callback");
23
25 : m_value()
26{
27 NS_LOG_FUNCTION(this);
28}
29
31 : m_value(value)
32{
33}
34
39
40void
42{
43 NS_LOG_FUNCTION(&value);
44 m_value = value;
45}
46
49{
50 NS_LOG_FUNCTION(this);
51 return m_value;
52}
53
60
61std::string
63{
64 NS_LOG_FUNCTION(this << checker);
65 std::ostringstream oss;
66 oss << PeekPointer(m_value.GetImpl());
67 return oss.str();
68}
69
70bool
72{
73 NS_LOG_FUNCTION(this << value << checker);
74 return false;
75}
76
78
79} // namespace ns3
Declaration of the various callback functions.
Base class for Callback class.
Definition callback.h:344
Ptr< CallbackImplBase > GetImpl() const
Definition callback.h:352
Callback template class.
Definition callback.h:422
bool DeserializeFromString(std::string value, Ptr< const AttributeChecker > checker) override
Deserialize from string (not implemented)
Definition callback.cc:71
CallbackBase Get()
Definition callback.cc:48
std::string SerializeToString(Ptr< const AttributeChecker > checker) const override
Serialize to string.
Definition callback.cc:62
void Set(const CallbackBase &value)
Set the value.
Definition callback.cc:41
CallbackBase m_value
The stored Callback instance.
Definition callback.h:815
Ptr< AttributeValue > Copy() const override
Definition callback.cc:55
~CallbackValue() override
Definition callback.cc:35
Smart pointer class similar to boost::intrusive_ptr.
#define ATTRIBUTE_CHECKER_IMPLEMENT(type)
Define the MaketypeChecker function for class type .
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:436
Debug message logging.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
U * PeekPointer(const Ptr< U > &p)
Definition ptr.h:443