LEFT | RIGHT |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright 2013. Lawrence Livermore National Security, LLC. | 3 * Copyright 2013. Lawrence Livermore National Security, LLC. |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 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 | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include <ns3/nstime.h> | 25 #include <ns3/nstime.h> |
26 #include <ns3/ptr.h> | 26 #include <ns3/ptr.h> |
27 #include <map> | 27 #include <map> |
28 | 28 |
29 namespace ns3 { | 29 namespace ns3 { |
30 | 30 |
31 class RemoteChannelBundle; | 31 class RemoteChannelBundle; |
32 | 32 |
33 /** | 33 /** |
34 * \ingroup mpi | 34 * \ingroup mpi |
35 * | 35 * |
36 * \brief Singleton for managing the RemoteChannelBundles for each process. | 36 * \brief Singleton for managing the RemoteChannelBundles for each process. |
37 * | 37 * |
38 * Manages collective tasks associated with the bundle collection. | 38 * Manages collective tasks associated with the bundle collection. |
39 */ | 39 */ |
40 class RemoteChannelBundleManager | 40 class RemoteChannelBundleManager |
41 { | 41 { |
42 | 42 |
43 public: | 43 public: |
44 /** | 44 /** |
45 * \param systemId system ID | 45 * \param systemId system ID |
46 * \return remote channel bundle for specified SystemId. | 46 * \return remote channel bundle for specified SystemId. |
47 */ | 47 */ |
48 static Ptr<RemoteChannelBundle> Find (uint32_t systemId); | 48 static Ptr<RemoteChannelBundle> Find (uint32_t systemId); |
49 | 49 |
50 /** | 50 /** |
51 * Add RemoteChannelBundle from this task to MPI task on other side of the lin
k. | 51 * Add RemoteChannelBundle from this task to MPI task on other side of the lin
k. |
52 * Can not be invoked after InitializeNullMessageEvents has been invoked. | 52 * Can not be invoked after InitializeNullMessageEvents has been invoked. |
53 * | 53 * |
54 * \param systemId system ID | 54 * \param systemId system ID |
55 * \return Ptr<RemoteChannelBundle> | 55 * \return Ptr<RemoteChannelBundle> |
56 */ | 56 */ |
57 static Ptr<RemoteChannelBundle> Add (uint32_t systemId); | 57 static Ptr<RemoteChannelBundle> Add (uint32_t systemId); |
58 | 58 |
59 /** | 59 /** |
60 * \return number of remote channel bundles | 60 * \return number of remote channel bundles |
61 * | 61 * |
62 */ | 62 */ |
63 static uint32_t Size (void); | 63 static uint32_t Size (void); |
64 | 64 |
65 /** | 65 /** |
66 * Setup initial Null Message events for every RemoteChannelBundle. | 66 * Setup initial Null Message events for every RemoteChannelBundle. |
67 * All RemoteChannelBundles should be added before this method is invoked. | 67 * All RemoteChannelBundles should be added before this method is invoked. |
68 */ | 68 */ |
69 static void InitializeNullMessageEvents (void); | 69 static void InitializeNullMessageEvents (void); |
70 | 70 |
71 /** | 71 /** |
72 * \return safe time across all remote channels. | 72 * \return safe time across all remote channels. |
73 */ | 73 */ |
74 static Time GetSafeTime (void); | 74 static Time GetSafeTime (void); |
75 | 75 |
76 /** | 76 /** |
77 * Destroy the singleton. | 77 * Destroy the singleton. |
78 */ | 78 */ |
79 static void Destroy (void); | 79 static void Destroy (void); |
80 | 80 |
81 private: | 81 private: |
82 | |
83 /** | 82 /** |
84 * Private ctor to prevent creation outside of singleton pattern. | 83 * Private ctor to prevent creation outside of singleton pattern. |
85 */ | 84 */ |
86 RemoteChannelBundleManager () | 85 RemoteChannelBundleManager () |
87 { | 86 { |
88 } | 87 } |
89 | 88 |
90 ~RemoteChannelBundleManager () | 89 ~RemoteChannelBundleManager () |
91 { | 90 { |
92 } | 91 } |
93 | 92 |
94 /** | 93 /** |
95 * Container for all remote channel bundles for this task. | 94 * Container for all remote channel bundles for this task. |
96 * | 95 * |
97 * Would be more efficient to use unordered_map when C++11 is adopted for NS3. | 96 * Would be more efficient to use unordered_map when C++11 is adopted for NS3. |
98 */ | 97 */ |
99 typedef std::map<uint32_t, Ptr<RemoteChannelBundle> > RemoteChannelMap; | 98 typedef std::map<uint32_t, Ptr<RemoteChannelBundle> > RemoteChannelMap; |
100 static RemoteChannelMap g_remoteChannelBundles; ///< remote channel bundles | 99 static RemoteChannelMap g_remoteChannelBundles; ///< remote channel bundles |
101 | 100 |
102 /** | 101 /** |
103 * Protect manager class from being initialized twice or incorrect | 102 * Protect manager class from being initialized twice or incorrect |
104 * ordering of method calls. | 103 * ordering of method calls. |
105 */ | 104 */ |
106 static bool g_initialized; | 105 static bool g_initialized; |
107 }; | 106 }; |
108 | 107 |
109 } // namespace ns3 | 108 } // namespace ns3 |
110 | 109 |
111 #endif | 110 #endif |
LEFT | RIGHT |