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
data-collection-object.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2011 Bucknell University
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
* Authors: Tiago G. Rodrigues (tgr002@bucknell.edu)
19
*/
20
21
#include "ns3/log.h"
22
#include "ns3/string.h"
23
#include "ns3/boolean.h"
24
25
#include "
data-collection-object.h
"
26
27
NS_LOG_COMPONENT_DEFINE
(
"DataCollectionObject"
);
28
29
namespace
ns3 {
30
31
NS_OBJECT_ENSURE_REGISTERED
(DataCollectionObject)
32
;
33
34
TypeId
35
DataCollectionObject::GetTypeId
(
void
)
36
{
37
static
TypeId
tid =
TypeId
(
"ns3::DataCollectionObject"
)
38
.
SetParent
<
Object
> ()
39
.AddConstructor<DataCollectionObject> ()
40
.AddAttribute (
"Name"
,
41
"Object's name"
,
42
StringValue
(
"unnamed"
), MakeStringAccessor (&
DataCollectionObject::GetName
, &
DataCollectionObject::SetName
), MakeStringChecker ())
43
.AddAttribute (
"Enabled"
,
44
"Object's enabled status"
,
45
BooleanValue
(
true
), MakeBooleanAccessor (&
DataCollectionObject::m_enabled
), MakeBooleanChecker ())
46
;
47
return
tid;
48
}
49
50
DataCollectionObject::DataCollectionObject
()
51
{
52
}
53
54
DataCollectionObject::~DataCollectionObject
()
55
{
56
NS_LOG_FUNCTION
(
this
);
57
}
58
59
bool
60
DataCollectionObject::IsEnabled
(
void
)
const
61
{
62
return
m_enabled
;
63
}
64
65
std::string
66
DataCollectionObject::GetName
(
void
)
const
67
{
68
return
m_name
;
69
}
70
71
void
72
DataCollectionObject::SetName
(std::string name)
73
{
74
NS_LOG_FUNCTION
(
this
<< name);
75
for
(
size_t
pos = name.find (
" "
); pos != std::string::npos; pos = name.find (
" "
, pos + 1, 1))
76
{
77
name[pos] =
'_'
;
78
}
79
80
m_name
= name;
81
}
82
83
void
84
DataCollectionObject::Enable
(
void
)
85
{
86
NS_LOG_FUNCTION
(
this
);
87
m_enabled
=
true
;
88
}
89
90
void
91
DataCollectionObject::Disable
(
void
)
92
{
93
NS_LOG_FUNCTION
(
this
);
94
m_enabled
=
false
;
95
}
96
97
}
// namespace ns3
ns3::DataCollectionObject::Enable
void Enable(void)
Set the status of an individual object.
Definition:
data-collection-object.cc:84
ns3::DataCollectionObject::IsEnabled
virtual bool IsEnabled(void) const
Check the status of an individual object.
Definition:
data-collection-object.cc:60
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
Definition:
log.h:345
ns3::BooleanValue
Hold a bool native type.
Definition:
boolean.h:38
ns3::DataCollectionObject::GetName
std::string GetName(void) const
Get the object's name.
Definition:
data-collection-object.cc:66
ns3::StringValue
hold variables of type string
Definition:
string.h:19
ns3::NS_OBJECT_ENSURE_REGISTERED
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
ns3::DataCollectionObject::m_name
std::string m_name
Name of the object within the data collection framework.
Definition:
data-collection-object.h:68
NS_LOG_COMPONENT_DEFINE
NS_LOG_COMPONENT_DEFINE("DataCollectionObject")
ns3::DataCollectionObject::~DataCollectionObject
virtual ~DataCollectionObject()
Definition:
data-collection-object.cc:54
ns3::DataCollectionObject::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition:
data-collection-object.cc:35
ns3::DataCollectionObject::m_enabled
bool m_enabled
Object's activation state.
Definition:
data-collection-object.h:65
ns3::DataCollectionObject::Disable
void Disable(void)
Unset the status of an individual object.
Definition:
data-collection-object.cc:91
ns3::DataCollectionObject::SetName
void SetName(std::string name)
Set the object's name. All spaces are replaced by underscores.
Definition:
data-collection-object.cc:72
ns3::Object
a base class which provides memory management and object aggregation
Definition:
object.h:63
data-collection-object.h
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::DataCollectionObject::DataCollectionObject
DataCollectionObject()
Definition:
data-collection-object.cc:50
src
stats
model
data-collection-object.cc
Generated on Sat Apr 19 2014 14:07:08 for ns-3 by
1.8.6