NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: 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 
31 {
32 }
33 
34 Connection::Connection(weak_ptr<function<void()>> disconnect)
35  : m_disconnect(disconnect)
36 {
37 }
38 
39 void
41 {
42  shared_ptr<function<void()>> f = m_disconnect.lock();
43  if (f != nullptr) {
44  (*f)();
45  }
46 }
47 
48 bool
50 {
51  return !m_disconnect.expired();
52 }
53 
54 bool
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
64 {
65  return !(this->operator==(other));
66 }
67 
68 } // namespace signal
69 } // namespace util
70 } // namespace ndn
Copyright (c) 2011-2015 Regents of the University of California.
represents a connection to a signal
void disconnect()
disconnects from the signal
bool operator!=(const Connection &other) const
bool operator==(const Connection &other) const
compare for equality
bool isConnected() const
check if connected to the signal