Callback template class. More...
#include "callback.h"
Inherits ns3::CallbackBase.
Public Member Functions | |
Callback () | |
template<typename FUNCTOR > | |
Callback (FUNCTOR const &functor, bool, bool) | |
Construct a functor call back, supporting operator() calls. More... | |
template<typename OBJ_PTR , typename MEM_PTR > | |
Callback (OBJ_PTR const &objPtr, MEM_PTR memPtr) | |
Construct a member function pointer call back. More... | |
Callback (Ptr< CallbackImpl< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 > > const &impl) | |
Construct from a CallbackImpl pointer. More... | |
bool | Assign (const CallbackBase &other) |
Adopt the other's implementation, if type compatible. More... | |
template<typename T > | |
Callback< R, T2, T3, T4, T5, T6, T7, T8, T9 > | Bind (T a) |
Bind the first arguments. More... | |
bool | CheckType (const CallbackBase &other) const |
Check for compatible types. More... | |
bool | IsEqual (const CallbackBase &other) const |
Equality test. More... | |
bool | IsNull (void) const |
Check for null implementation. More... | |
void | Nullify (void) |
Discard the implementation, set it to null. More... | |
template<typename TX1 , typename TX2 , typename TX3 > | |
Callback< R, T4, T5, T6, T7, T8, T9 > | ThreeBind (TX1 a1, TX2 a2, TX3 a3) |
Bind the first three arguments. More... | |
template<typename TX1 , typename TX2 > | |
Callback< R, T3, T4, T5, T6, T7, T8, T9 > | TwoBind (TX1 a1, TX2 a2) |
Bind the first two arguments. More... | |
R | operator() (void) const |
Functor with varying numbers of arguments. More... | |
R | operator() (T1 a1) const |
R | operator() (T1 a1, T2 a2) const |
R | operator() (T1 a1, T2 a2, T3 a3) const |
R | operator() (T1 a1, T2 a2, T3 a3, T4 a4) const |
R | operator() (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) const |
R | operator() (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) const |
R | operator() (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) const |
R | operator() (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) const |
R | operator() (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) const |
![]() | |
CallbackBase () | |
Ptr< CallbackImplBase > | GetImpl (void) const |
Private Member Functions | |
bool | DoAssign (Ptr< const CallbackImplBase > other) |
Adopt the other's implementation, if type compatible. More... | |
bool | DoCheckType (Ptr< const CallbackImplBase > other) const |
Check for compatible types. More... | |
CallbackImpl< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 > * | DoPeekImpl (void) const |
Additional Inherited Members | |
![]() | |
CallbackBase (Ptr< CallbackImplBase > impl) | |
Construct from a pimpl. More... | |
![]() | |
Ptr< CallbackImplBase > | m_impl |
the pimpl More... | |
Callback template class.
This class template implements the Functor Design Pattern. It is used to declare the type of a Callback:
Callback instances are built with the MakeCallback template functions. Callback instances have POD semantics: the memory they allocate is managed automatically, without user intervention which allows you to pass around Callback instances by value.
Sample code which shows how to use this class template as well as the function templates MakeCallback :
This code uses:
This code most notably departs from the alexandrescu implementation in that it does not use type lists to specify and pass around the types of the callback arguments. Of course, it also does not use copy-destruction semantics and relies on a reference list rather than autoPtr to hold the pointer.
R | [explicit] The return type of the Callback. The remaining template arguments are the types of any arguments to the Callback. |
Definition at line 1278 of file callback.h.
|
inline |
Definition at line 1281 of file callback.h.
|
inline |
Construct a functor call back, supporting operator() calls.
[in] | functor | The functor to run on this callback |
FUNCTOR | [deduced] The actual type of the functor. |
Definition at line 1295 of file callback.h.
|
inline |
Construct a member function pointer call back.
OBJ_PTR | [deduced] Type of the target object, as a pointer. |
MEM_PTR | [deduced] Type of the class member function. |
[in] | objPtr | Pointer to the object |
[in] | memPtr | Pointer to the member function |
Definition at line 1308 of file callback.h.
|
inline |
Construct from a CallbackImpl pointer.
[in] | impl | The CallbackImpl Ptr |
Definition at line 1317 of file callback.h.
|
inline |
Adopt the other's implementation, if type compatible.
[in] | other | Callback |
true
if other was type-compatible and could be adopted. Definition at line 1542 of file callback.h.
References ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::DoAssign(), and ns3::CallbackBase::GetImpl().
|
inline |
Bind the first arguments.
T | [deduced] The type of the bound argument. |
[in] | a | Argument to bind |
Definition at line 1329 of file callback.h.
Referenced by ns3::TracedCallback< Ts >::Connect(), ns3::TracedCallback< Ts >::Disconnect(), ns3::Txop::SetDroppedMpduCallback(), and ns3::QosTxop::SetDroppedMpduCallback().
|
inline |
Check for compatible types.
true
if other can be dynamic_cast to my type Definition at line 1532 of file callback.h.
References ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::DoCheckType(), and ns3::CallbackBase::GetImpl().
|
inlineprivate |
Adopt the other's implementation, if type compatible.
[in] | other | Callback |
true
if other was type-compatible and could be adopted. Definition at line 1582 of file callback.h.
References ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::DoCheckType(), ns3::CallbackImpl< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::DoGetTypeid(), ns3::CallbackBase::m_impl, NS_FATAL_ERROR_CONT, and ns3::PeekPointer().
Referenced by ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::Assign().
|
inlineprivate |
Check for compatible types.
true
if other can be dynamic_cast to my type Definition at line 1559 of file callback.h.
References ns3::PeekPointer().
Referenced by ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::CheckType(), and ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::DoAssign().
|
inlineprivate |
Definition at line 1549 of file callback.h.
References ns3::CallbackBase::m_impl, and ns3::PeekPointer().
Referenced by ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), and ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::operator()().
|
inline |
Equality test.
[in] | other | Callback |
true
if we are equal Definition at line 1521 of file callback.h.
References ns3::CallbackBase::GetImpl(), and ns3::CallbackBase::m_impl.
Referenced by ns3::aodv::QueueEntryTest::DoRun(), and ns3::operator!=().
|
inline |
Check for null implementation.
true
if I don't have an implementation Definition at line 1386 of file callback.h.
References ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::DoPeekImpl().
Referenced by ns3::TcpSocketBase::TcpSocketBase(), ns3::Ipv4EndPoint::~Ipv4EndPoint(), ns3::Ipv6EndPoint::~Ipv6EndPoint(), ns3::LrWpanPhy::CancelEd(), ns3::LrWpanCsmaCa::CanProceed(), ns3::WifiPhyStateHelper::ContinueRxNextMpdu(), ns3::TcpTxBuffer::DiscardUpTo(), ns3::WifiRadioEnergyModelHelper::DoInstall(), NullifyCallbackTestCase::DoRun(), ns3::LrWpanPhy::EndCca(), ns3::LrWpanPhy::EndEd(), ns3::HalfDuplexIdealPhy::EndRx(), ns3::LrWpanPhy::EndRx(), ns3::LteSpectrumPhy::EndRxData(), ns3::LteSpectrumPhy::EndRxDlCtrl(), ns3::LrWpanPhy::EndSetTRXState(), ns3::HalfDuplexIdealPhy::EndTx(), ns3::LrWpanPhy::EndTx(), ns3::WifiTxTimer::FeedTraceSource(), ns3::dsr::DsrRouting::ForwardErrPacket(), ns3::dsr::DsrRouting::ForwardPacket(), ns3::WaveNetDevice::ForwardUp(), ns3::WifiNetDevice::ForwardUp(), ns3::FdNetDevice::ForwardUp(), ns3::WifiMode::GetNonHtReferenceRate(), ns3::AcousticModemEnergyModel::HandleEnergyDepletion(), ns3::WifiRadioEnergyModel::HandleEnergyDepletion(), ns3::AcousticModemEnergyModel::HandleEnergyRecharged(), ns3::WifiRadioEnergyModel::HandleEnergyRecharged(), ns3::BlockAckManager::HandleInFlightMpdu(), RandomVariableStreamAttributeTestCase::InvokeCbValue(), CallbackValueTestCase::InvokeCbValue(), ns3::WimaxNetDevice::IsPromisc(), ns3::LrWpanMac::McpsDataRequest(), ns3::LrWpanMac::MlmeStartRequest(), ns3::BlockAckManager::NotifyDiscardedMpdu(), ns3::HePhy::NotifyEndOfHeSigA(), ns3::BlockAckManager::NotifyGotBlockAck(), ns3::WifiRadioEnergyModelPhyListener::NotifyMaybeCcaBusyStart(), ns3::Icmpv4L4Protocol::NotifyNewAggregate(), ns3::Icmpv6L4Protocol::NotifyNewAggregate(), ns3::TcpL4Protocol::NotifyNewAggregate(), ns3::UdpL4Protocol::NotifyNewAggregate(), ns3::WifiRadioEnergyModelPhyListener::NotifyOff(), ns3::WifiRadioEnergyModelPhyListener::NotifyOn(), ns3::FrameExchangeManager::NotifyPacketDiscarded(), ns3::FrameExchangeManager::NotifyReceivedNormalAck(), ns3::AlohaNoackNetDevice::NotifyReceptionEndOk(), ns3::WifiRadioEnergyModelPhyListener::NotifyRxEndError(), ns3::WifiRadioEnergyModelPhyListener::NotifyRxEndOk(), ns3::WifiRadioEnergyModelPhyListener::NotifyRxStart(), ns3::WifiRadioEnergyModelPhyListener::NotifySleep(), ns3::WifiRadioEnergyModelPhyListener::NotifySwitchingStart(), ns3::NetDeviceQueue::NotifyTransmittedBytes(), ns3::WifiRadioEnergyModelPhyListener::NotifyTxStart(), ns3::WifiRadioEnergyModelPhyListener::NotifyWakeup(), ns3::LrWpanMac::PdDataConfirm(), ns3::LrWpanMac::PdDataIndication(), ns3::LrWpanPhy::PdDataRequest(), ns3::QosTxop::PeekNextMpdu(), ns3::LrWpanCsmaCa::PlmeCcaConfirm(), ns3::LrWpanPhy::PlmeCcaRequest(), ns3::LrWpanPhy::PlmeEdRequest(), ns3::LrWpanPhy::PlmeGetAttributeRequest(), ns3::LrWpanPhy::PlmeSetAttributeRequest(), ns3::LrWpanPhy::PlmeSetTRXStateRequest(), ns3::LrWpanMac::PrepareRetransmission(), ns3::Packet::Print(), ns3::Packet::PrintByteTags(), ns3::Packet::PrintPacketTags(), ns3::MpiReceiver::Receive(), ns3::PointToPointNetDevice::Receive(), ns3::dsr::DsrRouting::Receive(), ns3::CsmaNetDevice::Receive(), ns3::MockNetDevice::Receive(), ns3::VirtualNetDevice::Receive(), ns3::LoopbackNetDevice::Receive(), ns3::SimpleNetDevice::Receive(), ns3::OcbWifiMac::Receive(), ns3::StaWifiMac::Receive(), ns3::TcpSocketMsgBase::ReceivedAck(), ns3::BridgeNetDevice::ReceiveFromDevice(), ns3::MeshPointDevice::ReceiveFromDevice(), ns3::SixLowPanNetDevice::ReceiveFromDevice(), ns3::NixVectorRouting< T >::RouteInput(), ns3::aodv::RoutingProtocol::RouteInput(), ns3::dsdv::RoutingProtocol::RouteInput(), ns3::Ipv4GlobalRouting::RouteInput(), ns3::Ipv4StaticRouting::RouteInput(), ns3::Rip::RouteInput(), ns3::olsr::RoutingProtocol::RouteInput(), ns3::Ipv6StaticRouting::RouteInput(), ns3::RipNg::RouteInput(), ns3::UanPhyGen::RxEndEvent(), ns3::dsr::DsrRouting::Send(), ns3::dsr::DsrRouting::SendErrorRequest(), ns3::MockNetDevice::SendFrom(), ns3::dsr::DsrRouting::SendInitialRequest(), ns3::dsr::DsrRouting::SendPacketFromBuffer(), ns3::dsr::DsrRouting::SendReply(), ns3::dsr::DsrRouting::SendRequest(), ns3::TcpSocketMsgBase::SetAfterRetransmitCb(), ns3::SubscriberStationNetDevice::SetBasicConnection(), ns3::TcpSocketMsgBase::SetBeforeRetransmitCb(), ns3::WifiRadioEnergyModelPhyListener::SetChangeStateCallback(), ns3::AcousticModemEnergyModel::SetEnergyDepletionCallback(), ns3::WifiRadioEnergyModel::SetEnergyDepletionCallback(), ns3::AcousticModemEnergyModel::SetEnergyRechargeCallback(), ns3::WifiRadioEnergyModel::SetEnergyRechargedCallback(), TcpSocketAdvertisedWindowProxy::SetInvalidAwndCb(), ns3::LrWpanMac::SetLrWpanMacState(), ns3::WifiPhy::SetMaxSupportedRxSpatialStreams(), ns3::WifiPhy::SetMaxSupportedTxSpatialStreams(), ns3::SubscriberStationNetDevice::SetPrimaryConnection(), ns3::TcpSocketMsgBase::SetProcessedAckCb(), ns3::TcpSocketMsgBase::SetRcvAckCb(), ns3::UanPhyGen::SetSleepMode(), ns3::TcpSocketMsgBase::SetUpdateRttHistoryCb(), ns3::WifiRadioEnergyModelPhyListener::SetUpdateTxCurrentCallback(), ns3::HalfDuplexIdealPhy::StartRx(), ns3::LteSpectrumPhy::StartRxDlCtrl(), ns3::WifiPhyStateHelper::SwitchFromRxEndError(), ns3::WifiPhyStateHelper::SwitchFromRxEndOk(), ns3::WifiRadioEnergyModelPhyListener::SwitchToIdle(), ns3::TcpTxBuffer::Update(), ns3::UanPhyGen::UpdatePowerConsumption(), ns3::TcpSocketMsgBase::UpdateRttHistory(), and ns3::NetDeviceQueue::Wake().
|
inline |
Discard the implementation, set it to null.
Definition at line 1391 of file callback.h.
References ns3::CallbackBase::m_impl.
Referenced by ns3::AcousticModemEnergyModel::AcousticModemEnergyModel(), ns3::AcousticModemEnergyModelHelper::AcousticModemEnergyModelHelper(), ns3::UanPhyGen::UanPhyGen(), ns3::WifiRadioEnergyModel::WifiRadioEnergyModel(), ns3::WifiRadioEnergyModelHelper::WifiRadioEnergyModelHelper(), ns3::WifiRadioEnergyModelPhyListener::WifiRadioEnergyModelPhyListener(), ns3::Ipv4EndPoint::~Ipv4EndPoint(), ns3::Ipv6EndPoint::~Ipv6EndPoint(), ns3::NetDeviceQueue::~NetDeviceQueue(), ns3::Icmpv6L4Protocol::DoDispose(), ns3::UanPhyGen::DoDispose(), ns3::Icmpv4L4Protocol::DoDispose(), ns3::TcpL4Protocol::DoDispose(), ns3::UdpL4Protocol::DoDispose(), ns3::MockNetDevice::DoDispose(), ns3::AcousticModemEnergyModel::DoDispose(), ns3::WifiRadioEnergyModel::DoDispose(), ns3::SubscriberStationNetDevice::DoDispose(), NullifyCallbackTestCase::DoRun(), and ns3::FdReader::Stop().
|
inline |
[in] | a1 | First argument |
Definition at line 1409 of file callback.h.
References ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::DoPeekImpl().
|
inline |
[in] | a1 | First argument |
[in] | a2 | Second argument |
Definition at line 1418 of file callback.h.
References ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::DoPeekImpl().
|
inline |
[in] | a1 | First argument |
[in] | a2 | Second argument |
[in] | a3 | Third argument |
Definition at line 1428 of file callback.h.
References ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::DoPeekImpl().
|
inline |
[in] | a1 | First argument |
[in] | a2 | Second argument |
[in] | a3 | Third argument |
[in] | a4 | Fourth argument |
Definition at line 1439 of file callback.h.
References ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::DoPeekImpl().
|
inline |
[in] | a1 | First argument |
[in] | a2 | Second argument |
[in] | a3 | Third argument |
[in] | a4 | Fourth argument |
[in] | a5 | Fifth argument |
Definition at line 1451 of file callback.h.
References ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::DoPeekImpl().
|
inline |
[in] | a1 | First argument |
[in] | a2 | Second argument |
[in] | a3 | Third argument |
[in] | a4 | Fourth argument |
[in] | a5 | Fifth argument |
[in] | a6 | Sixth argument |
Definition at line 1464 of file callback.h.
References ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::DoPeekImpl().
|
inline |
[in] | a1 | First argument |
[in] | a2 | Second argument |
[in] | a3 | Third argument |
[in] | a4 | Fourth argument |
[in] | a5 | Fifth argument |
[in] | a6 | Sixth argument |
[in] | a7 | Seventh argument |
Definition at line 1478 of file callback.h.
References ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::DoPeekImpl().
|
inline |
[in] | a1 | First argument |
[in] | a2 | Second argument |
[in] | a3 | Third argument |
[in] | a4 | Fourth argument |
[in] | a5 | Fifth argument |
[in] | a6 | Sixth argument |
[in] | a7 | Seventh argument |
[in] | a8 | Eighth argument |
Definition at line 1493 of file callback.h.
References ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::DoPeekImpl().
|
inline |
[in] | a1 | First argument |
[in] | a2 | Second argument |
[in] | a3 | Third argument |
[in] | a4 | Fourth argument |
[in] | a5 | Fifth argument |
[in] | a6 | Sixth argument |
[in] | a7 | Seventh argument |
[in] | a8 | Eighth argument |
[in] | a9 | Ninth argument |
Definition at line 1509 of file callback.h.
References ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::DoPeekImpl().
|
inline |
Functor with varying numbers of arguments.
Definition at line 1401 of file callback.h.
References ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::DoPeekImpl().
|
inline |
Bind the first three arguments.
TX1 | [deduced] The actual type of the first bound argument. |
TX2 | [deduced] The actual type of the second bound argument. |
TX3 | [deduced] The actual type of the third bound argument. |
[in] | a1 | First argument to bind |
[in] | a2 | Second argument to bind |
[in] | a3 | Third argument to bind |
Definition at line 1371 of file callback.h.
|
inline |
Bind the first two arguments.
TX1 | [deduced] Type of the first bound argument. |
TX2 | [deduced] Type of the second bound argument. |
[in] | a1 | First argument to bind |
[in] | a2 | Second argument to bind |
Definition at line 1349 of file callback.h.