NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
signal-connection.cpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22
#include "
signal-connection.hpp
"
23
24
namespace
ndn
{
25
namespace
util {
26
namespace
signal
{
27
28
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Connection>));
29
30
Connection::Connection
()
31
{
32
}
33
34
Connection::Connection
(weak_ptr<
function
<
void
()>>
disconnect
)
35
: m_disconnect(
disconnect
)
36
{
37
}
38
39
void
40
Connection::disconnect
()
41
{
42
shared_ptr<function<void()>> f = m_disconnect.lock();
43
if
(f !=
nullptr
) {
44
(*f)();
45
}
46
}
47
48
bool
49
Connection::isConnected
()
const
50
{
51
return
!m_disconnect.expired();
52
}
53
54
bool
55
Connection::operator==
(
const
Connection
& other)
const
56
{
57
shared_ptr<function<void()>> f1 = m_disconnect.lock();
58
shared_ptr<function<void()>> f2 = other.m_disconnect.lock();
59
return
f1 == f2;
60
}
61
62
bool
63
Connection::operator!=
(
const
Connection
& other)
const
64
{
65
return
!(this->
operator==
(other));
66
}
67
68
}
// namespace signal
69
}
// namespace util
70
}
// namespace ndn
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::util::signal::Connection
represents a connection to a signal
Definition:
signal-connection.hpp:34
ndn::util::signal::Connection::disconnect
void disconnect()
disconnects from the signal
Definition:
signal-connection.cpp:40
ndn::util::signal::Connection::operator!=
bool operator!=(const Connection &other) const
Definition:
signal-connection.cpp:63
ndn::util::signal::Connection::operator==
bool operator==(const Connection &other) const
compare for equality
Definition:
signal-connection.cpp:55
signal-connection.hpp
ndn::util::signal::Connection::isConnected
bool isConnected() const
check if connected to the signal
Definition:
signal-connection.cpp:49
ndn::util::signal::Connection::Connection
Connection()
Definition:
signal-connection.cpp:30
ndn::util::signal
Definition:
signal-connection.cpp:26
ndnSIM
ndn-cxx
src
util
signal-connection.cpp
Generated on Wed Jan 11 2017 18:17:15 for ndnSIM by
1.8.13