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
names.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2009 University of Washington
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
19
#ifndef OBJECT_NAMES_H
20
#define OBJECT_NAMES_H
21
22
#include "
ptr.h
"
23
#include "
object.h
"
24
25
namespace
ns3 {
26
31
class
Names
32
{
33
public
:
34
68
static
void
Add
(std::string name,
Ptr<Object>
object
);
69
101
static
void
Add
(std::string path, std::string name,
Ptr<Object>
object
);
102
150
static
void
Add
(
Ptr<Object>
context, std::string name,
Ptr<Object>
object
);
151
179
static
void
Rename
(std::string oldpath, std::string newname);
180
201
static
void
Rename
(std::string path, std::string oldname, std::string newname);
202
240
static
void
Rename
(
Ptr<Object>
context, std::string oldname, std::string newname);
241
259
static
std::string
FindName
(
Ptr<Object>
object
);
260
278
static
std::string
FindPath
(
Ptr<Object>
object
);
279
284
static
void
Clear
(
void
);
285
303
template
<
typename
T>
304
static
Ptr<T>
Find
(std::string path);
305
327
template
<
typename
T>
328
static
Ptr<T>
Find
(std::string path, std::string name);
329
364
template
<
typename
T>
365
static
Ptr<T>
Find
(
Ptr<Object>
context, std::string name);
366
367
private
:
377
static
Ptr<Object>
FindInternal
(std::string path);
378
389
static
Ptr<Object>
FindInternal
(std::string path, std::string name);
390
402
static
Ptr<Object>
FindInternal
(
Ptr<Object>
context, std::string name);
403
};
404
408
template
<
typename
T>
409
Ptr<T>
410
Names::Find
(std::string name)
411
{
412
Ptr<Object>
obj =
FindInternal
(name);
413
if
(obj)
414
{
415
return
obj->
GetObject
<T> ();
416
}
417
else
418
{
419
return
0;
420
}
421
}
422
426
template
<
typename
T>
427
Ptr<T>
428
Names::Find
(std::string path, std::string name)
429
{
430
Ptr<Object>
obj =
FindInternal
(path, name);
431
if
(obj)
432
{
433
return
obj->
GetObject
<T> ();
434
}
435
else
436
{
437
return
0;
438
}
439
}
440
444
template
<
typename
T>
445
Ptr<T>
446
Names::Find
(
Ptr<Object>
context, std::string name)
447
{
448
Ptr<Object>
obj =
FindInternal
(context, name);
449
if
(obj)
450
{
451
return
obj->
GetObject
<T> ();
452
}
453
else
454
{
455
return
0;
456
}
457
}
458
459
}
// namespace ns3
460
461
#endif
/* OBJECT_NAMES_H */
src
core
model
names.h
Generated on Tue Oct 9 2012 16:45:34 for ns-3 by
1.8.1.2