A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
remote-channel-bundle-manager.h
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 #ifndef NS3_REMOTE_CHANNEL_BUNDLE_MANAGER
23 #define NS3_REMOTE_CHANNEL_BUNDLE_MANAGER
24 
25 #include <ns3/nstime.h>
26 #include <ns3/ptr.h>
27 #include <map>
28 
29 namespace ns3 {
30 
31 class RemoteChannelBundle;
32 
33 /*
34  * \ingroup mpi
35  *
36  * \brief Singleton for managing the RemoteChannelBundles for each process.
37  *
38  * Manages collective tasks associated with the bundle collection.
39  */
41 {
42 
43 public:
47  static Ptr<RemoteChannelBundle> Find (uint32_t systemId);
48 
53  static Ptr<RemoteChannelBundle> Add (uint32_t systemId);
54 
59  static uint32_t Size (void);
60 
65  static void InitializeNullMessageEvents (void);
66 
70  static Time GetSafeTime (void);
71 
75  static void Destroy (void);
76 
77 private:
78 
83  {
84  }
85 
87  {
88  }
89 
90  /*
91  * Container for all remote channel bundles for this task.
92  *
93  * Would be more efficient to use unordered_map when C++11 is adopted for NS3.
94  */
95  typedef std::map<uint32_t, Ptr<RemoteChannelBundle> > RemoteChannelMap;
97 
98  /*
99  * Protect manager class from being initialized twice or incorrect
100  * ordering of method calls.
101  */
102  static bool g_initialized;
103 };
104 
105 } // namespace ns3
106 
107 #endif
std::map< uint32_t, Ptr< RemoteChannelBundle > > RemoteChannelMap
keep track of time values and allow control of global simulation resolution
Definition: nstime.h:81
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:59
static void InitializeNullMessageEvents(void)
Setup initial Null Message events for every RemoteChannelBundle.
static void Destroy(void)
Destroy the singleton.
static Ptr< RemoteChannelBundle > Find(uint32_t systemId)
static Ptr< RemoteChannelBundle > Add(uint32_t systemId)
Add RemoteChannelBundle from this task to MPI task on other side of the link.
RemoteChannelBundleManager()
Private ctor to prevent creation outside of singleton pattern.