A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
remote-channel-bundle.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright 2013. Lawrence Livermore National Security, LLC.
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Author: Steven Smith <smith84@llnl.gov>
19
*
20
*/
21
22
#include "
remote-channel-bundle.h
"
23
24
#include "
null-message-mpi-interface.h
"
25
#include "
null-message-simulator-impl.h
"
26
27
#include <ns3/simulator.h>
28
29
namespace
ns3 {
30
31
#define NS_TIME_INFINITY ns3::Time (0x7fffffffffffffffLL)
32
33
TypeId
RemoteChannelBundle::GetTypeId
(
void
)
34
{
35
static
TypeId
tid =
TypeId
(
"ns3::RemoteChannelBundle"
)
36
.
SetParent
<
Object
> ()
37
.AddConstructor <RemoteChannelBundle> ();
38
return
tid;
39
}
40
41
RemoteChannelBundle::RemoteChannelBundle
()
42
: m_remoteSystemId (-1),
43
m_guaranteeTime (0),
44
m_delay (
NS_TIME_INFINITY
)
45
{
46
}
47
48
RemoteChannelBundle::RemoteChannelBundle
(
const
uint32_t remoteSystemId)
49
: m_remoteSystemId (remoteSystemId),
50
m_guaranteeTime (0),
51
m_delay (
NS_TIME_INFINITY
)
52
{
53
}
54
55
void
56
RemoteChannelBundle::AddChannel
(
Ptr<Channel>
channel,
Time
delay)
57
{
58
m_channels
[channel->GetId ()] = channel;
59
m_delay
=
ns3::Min
(
m_delay
, delay);
60
}
61
62
uint32_t
63
RemoteChannelBundle::GetSystemId
()
const
64
{
65
return
m_remoteSystemId
;
66
}
67
68
Time
69
RemoteChannelBundle::GetGuaranteeTime
(
void
)
const
70
{
71
return
m_guaranteeTime
;
72
}
73
74
void
75
RemoteChannelBundle::SetGuaranteeTime
(
Time
time)
76
{
77
NS_ASSERT
(time >=
Simulator::Now
());
78
79
m_guaranteeTime
= time;
80
}
81
82
Time
83
RemoteChannelBundle::GetDelay
(
void
)
const
84
{
85
return
m_delay
;
86
}
87
88
void
89
RemoteChannelBundle::SetEventId
(
EventId
id
)
90
{
91
m_nullEventId
= id;
92
}
93
94
EventId
95
RemoteChannelBundle::GetEventId
(
void
)
const
96
{
97
return
m_nullEventId
;
98
}
99
100
int
101
RemoteChannelBundle::GetSize
(
void
)
const
102
{
103
return
m_channels
.size ();
104
}
105
106
void
107
RemoteChannelBundle::Send
(
Time
time)
108
{
109
NullMessageMpiInterface::SendNullMessage
(time,
this
);
110
}
111
112
std::ostream&
operator<<
(std::ostream& out,
ns3::RemoteChannelBundle
& bundle )
113
{
114
out <<
"RemoteChannelBundle Rank = "
<< bundle.
m_remoteSystemId
115
<<
", GuaranteeTime = "
<< bundle.
m_guaranteeTime
116
<<
", Delay = "
<< bundle.
m_delay
<< std::endl;
117
118
for
(std::map < uint32_t,
Ptr < Channel >
> ::const_iterator pair = bundle.
m_channels
.begin ();
119
pair != bundle.
m_channels
.end ();
120
++pair)
121
{
122
out <<
"\t"
<< (*pair).second << std::endl;
123
}
124
125
return
out;
126
}
127
128
129
}
// namespace ns3
130
ns3::RemoteChannelBundle::RemoteChannelBundle
RemoteChannelBundle()
Definition:
remote-channel-bundle.cc:41
ns3::Time
keep track of time values and allow control of global simulation resolution
Definition:
nstime.h:81
ns3::Ptr
smart pointer class similar to boost::intrusive_ptr
Definition:
ptr.h:59
ns3::RemoteChannelBundle::GetEventId
EventId GetEventId(void) const
Definition:
remote-channel-bundle.cc:95
null-message-simulator-impl.h
ns3::RemoteChannelBundle::SetGuaranteeTime
void SetGuaranteeTime(Time time)
Definition:
remote-channel-bundle.cc:75
NS_ASSERT
#define NS_ASSERT(condition)
Definition:
assert.h:64
ns3::RemoteChannelBundle
Collection of NS3 channels between local and remote nodes.
Definition:
remote-channel-bundle.h:45
ns3::RemoteChannelBundle::GetSize
int GetSize(void) const
Definition:
remote-channel-bundle.cc:101
ns3::RemoteChannelBundle::m_nullEventId
EventId m_nullEventId
Definition:
remote-channel-bundle.h:145
ns3::RemoteChannelBundle::Send
void Send(Time time)
Definition:
remote-channel-bundle.cc:107
ns3::RemoteChannelBundle::GetSystemId
uint32_t GetSystemId() const
Definition:
remote-channel-bundle.cc:63
ns3::RemoteChannelBundle::GetGuaranteeTime
Time GetGuaranteeTime(void) const
Definition:
remote-channel-bundle.cc:69
ns3::RemoteChannelBundle::GetDelay
Time GetDelay(void) const
Definition:
remote-channel-bundle.cc:83
ns3::RemoteChannelBundle::AddChannel
void AddChannel(Ptr< Channel > channel, Time delay)
Definition:
remote-channel-bundle.cc:56
ns3::NullMessageMpiInterface::SendNullMessage
static void SendNullMessage(const Time &guaranteeUpdate, Ptr< RemoteChannelBundle > bundle)
Send a Null Message to across the specified bundle.
Definition:
null-message-mpi-interface.cc:239
ns3::Min
int64x64_t Min(const int64x64_t &a, const int64x64_t &b)
Definition:
int64x64.h:90
ns3::RemoteChannelBundle::m_channels
std::map< uint32_t, Ptr< Channel > > m_channels
Definition:
remote-channel-bundle.h:128
ns3::operator<<
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
Definition:
angles.cc:43
NS_TIME_INFINITY
#define NS_TIME_INFINITY
Definition:
remote-channel-bundle.cc:31
ns3::Simulator::Now
static Time Now(void)
Return the "current simulation time".
Definition:
simulator.cc:180
remote-channel-bundle.h
null-message-mpi-interface.h
ns3::EventId
an identifier for simulation events.
Definition:
event-id.h:46
ns3::RemoteChannelBundle::SetEventId
void SetEventId(EventId id)
Set the event ID of the Null Message send event current scheduled for this channel.
Definition:
remote-channel-bundle.cc:89
ns3::RemoteChannelBundle::m_remoteSystemId
uint32_t m_remoteSystemId
Definition:
remote-channel-bundle.h:121
ns3::Object
a base class which provides memory management and object aggregation
Definition:
object.h:63
ns3::RemoteChannelBundle::GetTypeId
static TypeId GetTypeId(void)
Definition:
remote-channel-bundle.cc:33
ns3::RemoteChannelBundle::m_delay
Time m_delay
Definition:
remote-channel-bundle.h:140
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:49
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Definition:
type-id.cc:611
ns3::RemoteChannelBundle::m_guaranteeTime
Time m_guaranteeTime
Definition:
remote-channel-bundle.h:135
src
mpi
model
remote-channel-bundle.cc
Generated on Sat Apr 19 2014 14:07:04 for ns-3 by
1.8.6