A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
data-collection-object.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2011 Bucknell University
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Authors: Tiago G. Rodrigues (tgr002@bucknell.edu)
7
*/
8
9
#include "
data-collection-object.h
"
10
11
#include "ns3/boolean.h"
12
#include "ns3/log.h"
13
#include "ns3/string.h"
14
15
namespace
ns3
16
{
17
18
NS_LOG_COMPONENT_DEFINE
(
"DataCollectionObject"
);
19
20
NS_OBJECT_ENSURE_REGISTERED
(DataCollectionObject);
21
22
TypeId
23
DataCollectionObject::GetTypeId
()
24
{
25
static
TypeId
tid =
TypeId
(
"ns3::DataCollectionObject"
)
26
.
SetParent
<
Object
>()
27
.SetGroupName(
"Stats"
)
28
.AddConstructor<
DataCollectionObject
>()
29
.AddAttribute(
"Name"
,
30
"Object's name"
,
31
StringValue
(
"unnamed"
),
32
MakeStringAccessor
(&
DataCollectionObject::GetName
,
33
&
DataCollectionObject::SetName
),
34
MakeStringChecker
())
35
.AddAttribute(
"Enabled"
,
36
"Object's enabled status"
,
37
BooleanValue
(
true
),
38
MakeBooleanAccessor
(&
DataCollectionObject::m_enabled
),
39
MakeBooleanChecker
());
40
return
tid;
41
}
42
43
DataCollectionObject::DataCollectionObject
()
44
{
45
}
46
47
DataCollectionObject::~DataCollectionObject
()
48
{
49
NS_LOG_FUNCTION
(
this
);
50
}
51
52
bool
53
DataCollectionObject::IsEnabled
()
const
54
{
55
return
m_enabled
;
56
}
57
58
std::string
59
DataCollectionObject::GetName
()
const
60
{
61
return
m_name
;
62
}
63
64
void
65
DataCollectionObject::SetName
(std::string name)
66
{
67
NS_LOG_FUNCTION
(
this
<< name);
68
for
(
size_t
pos = name.find(
' '
); pos != std::string::npos; pos = name.find(
" "
, pos + 1, 1))
69
{
70
name[pos] =
'_'
;
71
}
72
73
m_name
= name;
74
}
75
76
void
77
DataCollectionObject::Enable
()
78
{
79
NS_LOG_FUNCTION
(
this
);
80
m_enabled
=
true
;
81
}
82
83
void
84
DataCollectionObject::Disable
()
85
{
86
NS_LOG_FUNCTION
(
this
);
87
m_enabled
=
false
;
88
}
89
90
}
// namespace ns3
ns3::BooleanValue
Definition
boolean.h:26
ns3::DataCollectionObject
Base class for data collection framework objects.
Definition
data-collection-object.h:28
ns3::DataCollectionObject::m_name
std::string m_name
Name of the object within the data collection framework.
Definition
data-collection-object.h:67
ns3::DataCollectionObject::DataCollectionObject
DataCollectionObject()
Definition
data-collection-object.cc:43
ns3::DataCollectionObject::IsEnabled
virtual bool IsEnabled() const
Check the status of an individual object.
Definition
data-collection-object.cc:53
ns3::DataCollectionObject::GetName
std::string GetName() const
Get the object's name.
Definition
data-collection-object.cc:59
ns3::DataCollectionObject::m_enabled
bool m_enabled
Object's activation state.
Definition
data-collection-object.h:64
ns3::DataCollectionObject::Disable
void Disable()
Unset the status of an individual object.
Definition
data-collection-object.cc:84
ns3::DataCollectionObject::SetName
void SetName(std::string name)
Set the object's name.
Definition
data-collection-object.cc:65
ns3::DataCollectionObject::Enable
void Enable()
Set the status of an individual object.
Definition
data-collection-object.cc:77
ns3::DataCollectionObject::~DataCollectionObject
~DataCollectionObject() override
Definition
data-collection-object.cc:47
ns3::DataCollectionObject::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
data-collection-object.cc:23
ns3::Object
A base class which provides memory management and object aggregation.
Definition
object.h:78
ns3::StringValue
Hold variables of type string.
Definition
string.h:45
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition
type-id.cc:1001
data-collection-object.h
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition
log.h:191
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:229
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition
object-base.h:35
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::MakeBooleanChecker
Ptr< const AttributeChecker > MakeBooleanChecker()
Definition
boolean.cc:113
ns3::MakeStringChecker
Ptr< const AttributeChecker > MakeStringChecker()
Definition
string.cc:19
ns3::MakeStringAccessor
Ptr< const AttributeAccessor > MakeStringAccessor(T1 a1)
Definition
string.h:46
ns3::MakeBooleanAccessor
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Definition
boolean.h:70
src
stats
model
data-collection-object.cc
Generated on Fri Nov 8 2024 13:59:06 for ns-3 by
1.11.0