A Discrete-Event Network Simulator
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
10
11#include "ns3/boolean.h"
12#include "ns3/log.h"
13#include "ns3/string.h"
14
15namespace ns3
16{
17
18NS_LOG_COMPONENT_DEFINE("DataCollectionObject");
19
20NS_OBJECT_ENSURE_REGISTERED(DataCollectionObject);
21
22TypeId
24{
25 static TypeId tid = TypeId("ns3::DataCollectionObject")
27 .SetGroupName("Stats")
28 .AddConstructor<DataCollectionObject>()
29 .AddAttribute("Name",
30 "Object's name",
31 StringValue("unnamed"),
35 .AddAttribute("Enabled",
36 "Object's enabled status",
37 BooleanValue(true),
40 return tid;
41}
42
46
51
52bool
54{
55 return m_enabled;
56}
57
58std::string
60{
61 return m_name;
62}
63
64void
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
76void
82
83void
89
90} // namespace ns3
Base class for data collection framework objects.
std::string m_name
Name of the object within the data collection framework.
virtual bool IsEnabled() const
Check the status of an individual object.
std::string GetName() const
Get the object's name.
bool m_enabled
Object's activation state.
void Disable()
Unset the status of an individual object.
void SetName(std::string name)
Set the object's name.
void Enable()
Set the status of an individual object.
static TypeId GetTypeId()
Get the type ID.
A base class which provides memory management and object aggregation.
Definition object.h:78
Hold variables of type string.
Definition string.h:45
a unique identifier for an interface.
Definition type-id.h:48
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition object-base.h:35
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeBooleanChecker()
Definition boolean.cc:113
Ptr< const AttributeChecker > MakeStringChecker()
Definition string.cc:19
Ptr< const AttributeAccessor > MakeStringAccessor(T1 a1)
Definition string.h:46
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Definition boolean.h:70