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
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
namespace
ns3
{
28
29
NS_LOG_COMPONENT_DEFINE
(
"DataCollectionObject"
);
30
31
NS_OBJECT_ENSURE_REGISTERED
(DataCollectionObject);
32
33
TypeId
34
DataCollectionObject::GetTypeId
(
void
)
35
{
36
static
TypeId
tid =
TypeId
(
"ns3::DataCollectionObject"
)
37
.
SetParent
<
Object
> ()
38
.AddConstructor<DataCollectionObject> ()
39
.AddAttribute (
"Name"
,
40
"Object's name"
,
41
StringValue
(
"unnamed"
),
MakeStringAccessor
(&
DataCollectionObject::GetName
, &
DataCollectionObject::SetName
),
MakeStringChecker
())
42
.AddAttribute (
"Enabled"
,
43
"Object's enabled status"
,
44
BooleanValue
(
true
),
MakeBooleanAccessor
(&
DataCollectionObject::m_enabled
),
MakeBooleanChecker
())
45
;
46
return
tid;
47
}
48
49
DataCollectionObject::DataCollectionObject
()
50
{
51
}
52
53
DataCollectionObject::~DataCollectionObject
()
54
{
55
NS_LOG_FUNCTION
(
this
);
56
}
57
58
bool
59
DataCollectionObject::IsEnabled
(
void
)
const
60
{
61
return
m_enabled
;
62
}
63
64
std::string
65
DataCollectionObject::GetName
(
void
)
const
66
{
67
return
m_name
;
68
}
69
70
void
71
DataCollectionObject::SetName
(std::string name)
72
{
73
NS_LOG_FUNCTION
(
this
<< name);
74
for
(
size_t
pos = name.find (
" "
); pos != std::string::npos; pos = name.find (
" "
, pos + 1, 1))
75
{
76
name[pos] =
'_'
;
77
}
78
79
m_name
= name;
80
}
81
82
void
83
DataCollectionObject::Enable
(
void
)
84
{
85
NS_LOG_FUNCTION
(
this
);
86
m_enabled
=
true
;
87
}
88
89
void
90
DataCollectionObject::Disable
(
void
)
91
{
92
NS_LOG_FUNCTION
(
this
);
93
m_enabled
=
false
;
94
}
95
96
}
// namespace ns3
ns3::DataCollectionObject::Enable
void Enable(void)
Set the status of an individual object.
Definition:
data-collection-object.cc:83
ns3::MakeStringChecker
Ptr< const AttributeChecker > MakeStringChecker(void)
Definition:
string.cc:30
ns3::DataCollectionObject::IsEnabled
virtual bool IsEnabled(void) const
Check the status of an individual object.
Definition:
data-collection-object.cc:59
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
Definition:
log-macros-enabled.h:207
ns3::BooleanValue
AttributeValue implementation for Boolean.
Definition:
boolean.h:34
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition:
object-base.h:44
ns3::DataCollectionObject::GetName
std::string GetName(void) const
Get the object's name.
Definition:
data-collection-object.cc:65
ns3::StringValue
Hold variables of type string.
Definition:
string.h:41
ns3::MakeBooleanAccessor
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition:
boolean.h:81
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:201
ns3::DataCollectionObject::m_name
std::string m_name
Name of the object within the data collection framework.
Definition:
data-collection-object.h:68
ns3::DataCollectionObject::~DataCollectionObject
virtual ~DataCollectionObject()
Definition:
data-collection-object.cc:53
ns3::DataCollectionObject::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition:
data-collection-object.cc:34
ns3::DataCollectionObject::m_enabled
bool m_enabled
Object's activation state.
Definition:
data-collection-object.h:65
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::DataCollectionObject::Disable
void Disable(void)
Unset the status of an individual object.
Definition:
data-collection-object.cc:90
ns3::MakeBooleanChecker
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Definition:
boolean.cc:121
ns3::DataCollectionObject::SetName
void SetName(std::string name)
Set the object's name. All spaces are replaced by underscores.
Definition:
data-collection-object.cc:71
ns3::Object
A base class which provides memory management and object aggregation.
Definition:
object.h:87
ns3::MakeStringAccessor
Ptr< const AttributeAccessor > MakeStringAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition:
string.h:42
data-collection-object.h
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:51
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Definition:
type-id.cc:631
ns3::DataCollectionObject::DataCollectionObject
DataCollectionObject()
Definition:
data-collection-object.cc:49
src
stats
model
data-collection-object.cc
Generated on Thu Feb 5 2015 18:33:53 for ns-3 by
1.8.9.1