author | Craig Dowell <craigdo@ee.washington.edu> |
Fri, 30 Jan 2009 17:34:41 -0800 | |
changeset 4153 | 93bb91eae5cd |
parent 4147 | 5d8530130930 |
child 4157 | 40e3876f8090 |
permissions | -rw-r--r-- |
4139
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
2 |
/* |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
3 |
* Copyright (c) 2009 University of Washington |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
4 |
* |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
8 |
* |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
13 |
* |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
17 |
*/ |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
18 |
|
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
19 |
#ifndef OBJECT_NAMES_H |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
20 |
#define OBJECT_NAMES_H |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
21 |
|
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
22 |
#include "ns3/ptr.h" |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
23 |
#include "ns3/object.h" |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
24 |
|
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
25 |
namespace ns3 { |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
26 |
|
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
27 |
/** |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
28 |
* \brief A directory of name and Ptr<Object> associations that allows us to |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
29 |
* give any ns3 Object a name. |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
30 |
*/ |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
31 |
class Names |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
32 |
{ |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
33 |
public: |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
34 |
|
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
35 |
/** |
4153
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
36 |
* \brief Add the association between the string "name" and the Ptr<Object> obj. |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
37 |
* |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
38 |
* The name may begin either with "/Names" to explicitly call out the fact |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
39 |
* that the name provided is installed under the root of the name space, |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
40 |
* or it may begin with the short name of the first obejct in the path. |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
41 |
* For example, Add ("/Names/client", obj) and Add ("client", obj) accomplish |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
42 |
* exactly the same thing. Names at a given level in the name space must be |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
43 |
* unique. It would be illegal to try and associate a different object with |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
44 |
* the same name: "client." |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
45 |
* |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
46 |
* As well as providing a single shortname, the name parameter can contain a |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
47 |
* path that qualifies the shortname. For example, you could make the call |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
48 |
* Add ("/Names/client/eth0", obj) if you had previously associated a name |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
49 |
* "client" in the root of the name space. Note that Add ("client/eth0", obj) |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
50 |
* would accomplish exactly the same thing. |
4139
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
51 |
* |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
52 |
* \param name The name of the object you want to associate. |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
53 |
* \param obj A smart pointer to the object itself. |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
54 |
*/ |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
55 |
static bool Add (std::string name, Ptr<Object> obj); |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
56 |
|
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
57 |
/** |
4153
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
58 |
* \brief Rename a previously associated name. |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
59 |
* |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
60 |
* The name may begin either with "/Names" to explicitly call out the fact |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
61 |
* that the name provided is installed under the root of the name space, |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
62 |
* or it may begin with the short name of the first obejct in the path. |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
63 |
* For example, Rename ("/Names/client", "newname") and |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
64 |
* Rename ("client", "newname") will accomplish exactly the same thing -- |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
65 |
* to find an object at the root of the name space called "client" and change |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
66 |
* its name to "newname". Names at a given level in the name space must be |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
67 |
* unique. It would be illegal to try and rename the association to another |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
68 |
* name that already exists at the namespace level indicated by the path. |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
69 |
* |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
70 |
* As well as providing a single shortname, the name parameter can contain a |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
71 |
* path that qualifies the shortname you want to change. For example, you |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
72 |
* could make the call Rename ("/Names/client/eth0", "ath0") if "ath0" has |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
73 |
* not been previously used at this level (under "client"). Note that |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
74 |
* Rename ("client/eth0", "ath0") would accomplish exactly the same thing. |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
75 |
* |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
76 |
* \param oldname The current name of the object you want to change. |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
77 |
* \param newname The new name of the object you want to change. |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
78 |
* |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
79 |
* \returns true if the name change was successfully completed, false otherwise |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
80 |
*/ |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
81 |
static bool Rename (std::string oldname, std::string newname); |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
82 |
|
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
83 |
/** |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
84 |
* \brief An intermediate form of Add allowing you to provide a context in the |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
85 |
* form of a name string. |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
86 |
* |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
87 |
* \see Add (Ptr<Object> context, std::string name, Ptr<Object> object); |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
88 |
* |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
89 |
* \param context A fully qualified name describing a previously named object. |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
90 |
* under which you want this name to be defined. |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
91 |
* \param name The name of the object you want to associate. |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
92 |
* \param obj A smart pointer to the object itself. |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
93 |
* |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
94 |
* \returns true if the association was successfully completed, false otherwise |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
95 |
*/ |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
96 |
static bool Add (std::string context, std::string name, Ptr<Object> object); |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
97 |
|
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
98 |
/** |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
99 |
* \brief An intermediate form of Rename allowing you to provide a context in |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
100 |
* the form of a name string. |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
101 |
* |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
102 |
* \see Rename (Ptr<Object> context, std::string oldname, std::string newname); |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
103 |
* |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
104 |
* \param context A fully qualified name describing a previously named object. |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
105 |
* under which you want this name to be changed. |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
106 |
* \param oldname The current shortname of the object you want to change. |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
107 |
* \param newname The new shortname of the object you want to change. |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
108 |
* |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
109 |
* \returns true if the name change was successfully completed, false otherwise |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
110 |
*/ |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
111 |
static bool Rename (std::string context, std::string oldname, std::string newname); |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
112 |
|
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
113 |
/** |
4139
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
114 |
* Add the association between the string "name" and the Ptr<Object> obj |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
115 |
* in the object context given by the Ptr<Object> context. This can be |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
116 |
* seen as equivalent to adding a Pointer Attribute called "name" to the |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
117 |
* object given by "context" and then assigning the value obj to that |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
118 |
* attribute. The config facility will see it that way. |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
119 |
* |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
120 |
* \param context A spart pointer to an object under which you want this |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
121 |
* name to be defined. |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
122 |
* \param name The name of the object you want to associate. |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
123 |
* \param obj A smart pointer to the object itself. |
4146
805af0f9ddd9
a little more doxygen for object-names.h
Craig Dowell <craigdo@ee.washington.edu>
parents:
4145
diff
changeset
|
124 |
* |
805af0f9ddd9
a little more doxygen for object-names.h
Craig Dowell <craigdo@ee.washington.edu>
parents:
4145
diff
changeset
|
125 |
* \returns true if the association was successfully completed, false otherwise |
4139
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
126 |
*/ |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
127 |
static bool Add (Ptr<Object> context, std::string name, Ptr<Object> object); |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
128 |
|
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
129 |
/** |
4153
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
130 |
* \brief Rename a previously associated shortname. |
4139
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
131 |
* |
4153
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
132 |
* The context for the name -- the namespace level must be provided by passing |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
133 |
* a context object. The oldname is then interpreted as a shortname which is |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
134 |
* defined "under" this context. For example, if you have previously done an |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
135 |
* Add ("/Names/client", obj), you have associated the object obj with the |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
136 |
* name "client." If you create an "eth0" under "client", then the obj that |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
137 |
* you associated with "client" becomes the context for "eth0" object. If |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
138 |
* you want to rename "eth0", you would provide that obj as the context for |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
139 |
* the Rename. This would look like Rename (obj, "eth0", "ath0"). |
4146
805af0f9ddd9
a little more doxygen for object-names.h
Craig Dowell <craigdo@ee.washington.edu>
parents:
4145
diff
changeset
|
140 |
* |
4153
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
141 |
* \param context A spart pointer to an object under which to look for the |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
142 |
* oldname. |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
143 |
* \param oldname The current shortname of the object you want to change. |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
144 |
* \param newname The new shortname of the object you want to change. |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
145 |
* |
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
146 |
* \returns true if the name change was successfully completed, false otherwise |
4139
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
147 |
*/ |
4153
93bb91eae5cd
add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
148 |
static bool Rename (Ptr<Object> context, std::string oldname, std::string newname); |
4139
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
149 |
|
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
150 |
/** |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
151 |
* Given a pointer to an object, look to see if that object has a name |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
152 |
* associated with it and return the shortname for the object. |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
153 |
* |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
154 |
* The fullname of an object is a fully qualified namespace name, for example |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
155 |
* if you have a device that you have previously named "eth0" under a node |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
156 |
* you have named "client", the fullname of the device will then be |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
157 |
* "/Names/client/eth0". |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
158 |
* |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
159 |
* The shortname of an object is the name of the object in its parent name |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
160 |
* space. Using the example above, asking for the shortname of the device |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
161 |
* will result in "eth0" being returned. |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
162 |
* |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
163 |
* \param object A spart pointer to an object for which you want to find |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
164 |
* its shortname. |
4146
805af0f9ddd9
a little more doxygen for object-names.h
Craig Dowell <craigdo@ee.washington.edu>
parents:
4145
diff
changeset
|
165 |
* |
805af0f9ddd9
a little more doxygen for object-names.h
Craig Dowell <craigdo@ee.washington.edu>
parents:
4145
diff
changeset
|
166 |
* \returns a string containing the shortname of the object. |
4139
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
167 |
*/ |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
168 |
static std::string FindShortName (Ptr<Object> object); |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
169 |
|
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
170 |
/** |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
171 |
* Given a pointer to an object, look to see if that object has a name |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
172 |
* associated with it and return the fully qualified namespace name |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
173 |
* for the object. |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
174 |
* |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
175 |
* The fullname of an object is a fully qualified namespace name, for example |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
176 |
* if you have a device that you have previously named "eth0" under a node |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
177 |
* you have named "client", the fullname of the device will then be |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
178 |
* "/Names/client/eth0". |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
179 |
* |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
180 |
* The shortname of an object is the name of the object in its parent name |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
181 |
* space. Using the example above, asking for the shortname of the device |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
182 |
* will result in "eth0" being returned. |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
183 |
* |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
184 |
* \param object A spart pointer to an object for which you want to find |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
185 |
* its fullname. |
4146
805af0f9ddd9
a little more doxygen for object-names.h
Craig Dowell <craigdo@ee.washington.edu>
parents:
4145
diff
changeset
|
186 |
* |
805af0f9ddd9
a little more doxygen for object-names.h
Craig Dowell <craigdo@ee.washington.edu>
parents:
4145
diff
changeset
|
187 |
* \returns a string containing the fullname of the object. |
4139
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
188 |
*/ |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
189 |
static std::string FindFullName (Ptr<Object> object); |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
190 |
|
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
191 |
/** |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
192 |
* Given a fullname string, look to see if there's an object in the system |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
193 |
* with a that associated with it. If there is, do a QueryObject on the |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
194 |
* resulting object to convert it to the requested typename. |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
195 |
* |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
196 |
* The fullname of an object is a fully qualified namespace name, for example |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
197 |
* if you have a device that you have previously named "eth0" under a node |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
198 |
* you have named "client", the fullname of the device will then be |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
199 |
* "/Names/client/eth0". |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
200 |
* |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
201 |
* \param name A string containing a fully qualified name space name |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
202 |
* used to locate the object. |
4146
805af0f9ddd9
a little more doxygen for object-names.h
Craig Dowell <craigdo@ee.washington.edu>
parents:
4145
diff
changeset
|
203 |
* |
805af0f9ddd9
a little more doxygen for object-names.h
Craig Dowell <craigdo@ee.washington.edu>
parents:
4145
diff
changeset
|
204 |
* \returns a smart pointer to the named object converted to the requested |
805af0f9ddd9
a little more doxygen for object-names.h
Craig Dowell <craigdo@ee.washington.edu>
parents:
4145
diff
changeset
|
205 |
* type. |
4139
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
206 |
*/ |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
207 |
template <typename T> |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
208 |
static Ptr<T> FindObjectFromFullName (std::string name); |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
209 |
|
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
210 |
/** |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
211 |
* Given a fullname string, look to see if there's an object in the system |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
212 |
* with a that associated with it. If there is, do a QueryObject on the |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
213 |
* resulting object to convert it to the requested typename. |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
214 |
* |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
215 |
* The fullname of an object is a fully qualified namespace name, for example |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
216 |
* if you have a device that you have previously named "eth0" under a node |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
217 |
* you have named "client", the fullname of the device will then be |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
218 |
* "/Names/client/eth0". |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
219 |
* |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
220 |
* \param name A string containing a fully qualified name space name |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
221 |
* used to locate the object. |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
222 |
* |
4146
805af0f9ddd9
a little more doxygen for object-names.h
Craig Dowell <craigdo@ee.washington.edu>
parents:
4145
diff
changeset
|
223 |
* |
805af0f9ddd9
a little more doxygen for object-names.h
Craig Dowell <craigdo@ee.washington.edu>
parents:
4145
diff
changeset
|
224 |
* \returns a smart pointer to the named object converted to the requested |
805af0f9ddd9
a little more doxygen for object-names.h
Craig Dowell <craigdo@ee.washington.edu>
parents:
4145
diff
changeset
|
225 |
* type. |
805af0f9ddd9
a little more doxygen for object-names.h
Craig Dowell <craigdo@ee.washington.edu>
parents:
4145
diff
changeset
|
226 |
* |
4139
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
227 |
* @comment This method is identical to FindObjectFromFullName, but has a |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
228 |
* short signature since it is a common use and we want it to be easy to |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
229 |
* type. |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
230 |
*/ |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
231 |
template <typename T> |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
232 |
static Ptr<T> Find (std::string name); |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
233 |
|
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
234 |
/** |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
235 |
* Given an object context and a shortname string, look through the names |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
236 |
* associated with the namespace defined by the context object to see if |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
237 |
* there's an object there with the given shortname. |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
238 |
* |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
239 |
* The fullname of an object is a fully qualified namespace name, for example |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
240 |
* if you have a device that you have previously named "eth0" under a node |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
241 |
* you have named "client", the fullname of the device will then be |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
242 |
* "/Names/client/eth0". |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
243 |
* |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
244 |
* The shortname of an object is the name of the object in its parent name |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
245 |
* space. Using the example above, asking for the shortname of the device |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
246 |
* will result in "eth0" being returned. |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
247 |
* |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
248 |
* The context object provides a namespace context, in the case of the example |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
249 |
* it would be the "client" object under which we look for the short name. |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
250 |
* In the example above, the context pointer would be the Ptr<Object> to the |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
251 |
* client node, and the name would be the shortname "eth0" |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
252 |
* |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
253 |
* \param context A spart pointer to an object under which you want to look |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
254 |
* for the provided name. |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
255 |
* \param name A string containing a shortname to look for. |
4146
805af0f9ddd9
a little more doxygen for object-names.h
Craig Dowell <craigdo@ee.washington.edu>
parents:
4145
diff
changeset
|
256 |
* |
805af0f9ddd9
a little more doxygen for object-names.h
Craig Dowell <craigdo@ee.washington.edu>
parents:
4145
diff
changeset
|
257 |
* \returns a smart pointer to the named object converted to the requested |
805af0f9ddd9
a little more doxygen for object-names.h
Craig Dowell <craigdo@ee.washington.edu>
parents:
4145
diff
changeset
|
258 |
* type. |
4139
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
259 |
*/ |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
260 |
template <typename T> |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
261 |
static Ptr<T> FindObjectFromShortName (Ptr<Object> context, std::string name); |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
262 |
|
4145
bb930262e55c
add NamesPriv cleanup for code that doesn't use simulator -- for valgrind-clean runs
Craig Dowell <craigdo@ee.washington.edu>
parents:
4139
diff
changeset
|
263 |
/** |
bb930262e55c
add NamesPriv cleanup for code that doesn't use simulator -- for valgrind-clean runs
Craig Dowell <craigdo@ee.washington.edu>
parents:
4139
diff
changeset
|
264 |
* Clean up all of the data structures of the implementation and delete the |
bb930262e55c
add NamesPriv cleanup for code that doesn't use simulator -- for valgrind-clean runs
Craig Dowell <craigdo@ee.washington.edu>
parents:
4139
diff
changeset
|
265 |
* underlying singleton. Used to get valgrind-clean runs if the simulator |
bb930262e55c
add NamesPriv cleanup for code that doesn't use simulator -- for valgrind-clean runs
Craig Dowell <craigdo@ee.washington.edu>
parents:
4139
diff
changeset
|
266 |
* is not run. Normally singleton cleanup is scheduled on Simulator::Destroy. |
bb930262e55c
add NamesPriv cleanup for code that doesn't use simulator -- for valgrind-clean runs
Craig Dowell <craigdo@ee.washington.edu>
parents:
4139
diff
changeset
|
267 |
*/ |
bb930262e55c
add NamesPriv cleanup for code that doesn't use simulator -- for valgrind-clean runs
Craig Dowell <craigdo@ee.washington.edu>
parents:
4139
diff
changeset
|
268 |
static void Delete (void); |
bb930262e55c
add NamesPriv cleanup for code that doesn't use simulator -- for valgrind-clean runs
Craig Dowell <craigdo@ee.washington.edu>
parents:
4139
diff
changeset
|
269 |
|
4139
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
270 |
private: |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
271 |
/** |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
272 |
* \internal |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
273 |
* |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
274 |
* \brief Non-templated internal version of FindObjectFromLongName |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
275 |
* |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
276 |
* \param name A string containing a longname to look for. |
4146
805af0f9ddd9
a little more doxygen for object-names.h
Craig Dowell <craigdo@ee.washington.edu>
parents:
4145
diff
changeset
|
277 |
* |
805af0f9ddd9
a little more doxygen for object-names.h
Craig Dowell <craigdo@ee.washington.edu>
parents:
4145
diff
changeset
|
278 |
* \returns a smart pointer to the named object. |
4139
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
279 |
*/ |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
280 |
static Ptr<Object> FindObjectFromFullNameInternal (std::string name); |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
281 |
|
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
282 |
/** |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
283 |
* \internal |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
284 |
* |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
285 |
* \brief Non-templated internal version of FindObjectFromShortName |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
286 |
* |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
287 |
* \param context A spart pointer to an object under which you want to look |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
288 |
* for the provided name. |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
289 |
* \param name A string containing a shortname to look for. |
4146
805af0f9ddd9
a little more doxygen for object-names.h
Craig Dowell <craigdo@ee.washington.edu>
parents:
4145
diff
changeset
|
290 |
* |
805af0f9ddd9
a little more doxygen for object-names.h
Craig Dowell <craigdo@ee.washington.edu>
parents:
4145
diff
changeset
|
291 |
* \returns a smart pointer to the named object. |
4139
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
292 |
*/ |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
293 |
static Ptr<Object> FindObjectFromShortNameInternal (Ptr<Object> context, std::string name); |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
294 |
}; |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
295 |
|
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
296 |
/** |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
297 |
* \brief Template definition of corresponding template declaration found in class Names. |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
298 |
*/ |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
299 |
template <typename T> |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
300 |
Ptr<T> |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
301 |
Names::Find (std::string name) |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
302 |
{ |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
303 |
return FindObjectFromFullName<T> (name); |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
304 |
} |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
305 |
|
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
306 |
/** |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
307 |
* \brief Template definition of corresponding template declaration found in class Names. |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
308 |
*/ |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
309 |
template <typename T> |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
310 |
Ptr<T> |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
311 |
Names::FindObjectFromFullName (std::string name) |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
312 |
{ |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
313 |
Ptr<Object> obj = FindObjectFromFullNameInternal (name); |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
314 |
if (obj) |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
315 |
{ |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
316 |
return obj->GetObject<T> (); |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
317 |
} |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
318 |
else |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
319 |
{ |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
320 |
return 0; |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
321 |
} |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
322 |
} |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
323 |
|
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
324 |
/** |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
325 |
* \brief Template definition of corresponding template declaration found in class Names. |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
326 |
*/ |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
327 |
template <typename T> |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
328 |
Ptr<T> |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
329 |
Names::FindObjectFromShortName (Ptr<Object> context, std::string name) |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
330 |
{ |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
331 |
Ptr<Object> obj = FindObjectFromShortNameInternal (context, name); |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
332 |
if (obj) |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
333 |
{ |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
334 |
return obj->GetObject<T> (); |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
335 |
} |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
336 |
else |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
337 |
{ |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
338 |
return 0; |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
339 |
} |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
340 |
} |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
341 |
|
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
342 |
}//namespace ns3 |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
343 |
|
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
344 |
#endif /* OBJECT_NAMES_H */ |