NS-3 based Named Data Networking (NDN) simulator
ndnSIM: NDN, CCN, CCNx, content centric networks
API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Groups
Pages
callback-based-app.cc
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2
/*
3
* Copyright (c) 2013, Regents of the University of California
4
* Alexander Afanasyev
5
* Zhenkai Zhu
6
*
7
* GNU v3.0 license, See the LICENSE file for more information
8
*
9
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
10
*/
11
12
#include "callback-based-app.h"
13
14
#include <ns3/log.h>
15
16
NS_LOG_COMPONENT_DEFINE (
"CallbackBasedApp"
);
17
18
namespace
ns3 {
19
20
NS_OBJECT_ENSURE_REGISTERED (CallbackBasedApp);
21
22
TypeId
23
CallbackBasedApp::GetTypeId (
void
)
24
{
25
static
TypeId tid = TypeId (
"ns3::CallbackBasedApp"
)
26
.SetGroupName (
"Ndn"
)
27
.SetParent<Application> ()
28
.AddConstructor<CallbackBasedApp> ()
29
30
.AddAttribute (
"OnStart"
,
"OnStart callback"
,
31
CallbackValue (),
32
MakeCallbackAccessor (&CallbackBasedApp::m_onStart),
33
MakeCallbackChecker ())
34
35
.AddAttribute (
"OnStop"
,
"OnStop callback"
,
36
CallbackValue (),
37
MakeCallbackAccessor (&CallbackBasedApp::m_onStop),
38
MakeCallbackChecker ())
39
;
40
return
tid;
41
}
42
43
CallbackBasedApp::CallbackBasedApp
()
44
{
45
}
46
47
CallbackBasedApp::~CallbackBasedApp
()
48
{
49
}
50
51
void
52
CallbackBasedApp::SetOnStartCallback
(Callback<
void
, Ptr<Application> > onStart)
53
{
54
m_onStart = onStart;
55
}
56
57
void
58
CallbackBasedApp::SetOnStopCallback
(Callback<
void
, Ptr<Application> > onStop)
59
{
60
m_onStop = onStop;
61
}
62
63
void
64
CallbackBasedApp::StartApplication
()
65
{
66
NS_LOG_FUNCTION (
this
);
67
if
(!m_onStart.IsNull ())
68
m_onStart (
this
);
69
}
70
71
void
72
CallbackBasedApp::StopApplication
()
73
{
74
NS_LOG_FUNCTION (
this
);
75
if
(!m_onStop.IsNull ())
76
m_onStop (
this
);
77
}
78
79
}
ns3::CallbackBasedApp::StartApplication
virtual void StartApplication()
Called at time specified by Start.
Definition:
callback-based-app.cc:64
ns3::CallbackBasedApp::CallbackBasedApp
CallbackBasedApp()
Default constructor.
Definition:
callback-based-app.cc:43
ns3::CallbackBasedApp::SetOnStopCallback
void SetOnStopCallback(Callback< void, Ptr< Application > > onStart)
Define callback that will be fired when application need to stop its work.
Definition:
callback-based-app.cc:58
ns3::CallbackBasedApp::~CallbackBasedApp
virtual ~CallbackBasedApp()
Virtual destructor.
Definition:
callback-based-app.cc:47
ns3::CallbackBasedApp::StopApplication
virtual void StopApplication()
Called at time specified by Stop.
Definition:
callback-based-app.cc:72
ns3::CallbackBasedApp::SetOnStartCallback
void SetOnStartCallback(Callback< void, Ptr< Application > > onStart)
Define callback that will be fired when application need to start its work.
Definition:
callback-based-app.cc:52
ndnSIM
apps
callback-based-app.cc
Generated on Mon Jan 19 2015 11:27:03 for ndnSIM by
1.8.7