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
attribute.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2008 INRIA
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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19
*/
20
#ifndef ATTRIBUTE_H
21
#define ATTRIBUTE_H
22
23
#include <string>
24
#include <stdint.h>
25
#include "
ptr.h
"
26
#include "
simple-ref-count.h
"
27
35
namespace
ns3 {
36
37
class
AttributeAccessor;
38
class
AttributeChecker;
39
class
Attribute;
40
class
ObjectBase;
41
68
class
AttributeValue
:
public
SimpleRefCount
<AttributeValue>
69
{
70
public
:
71
AttributeValue
();
72
virtual
~AttributeValue
();
73
77
virtual
Ptr<AttributeValue>
Copy
(
void
)
const
= 0;
87
virtual
std::string
SerializeToString
(
Ptr<const AttributeChecker>
checker)
const
= 0;
101
virtual
bool
DeserializeFromString
(std::string value,
Ptr<const AttributeChecker>
checker) = 0;
102
};
103
114
class
AttributeAccessor
:
public
SimpleRefCount
<AttributeAccessor>
115
{
116
public
:
117
AttributeAccessor
();
118
virtual
~AttributeAccessor
();
119
128
virtual
bool
Set
(
ObjectBase
*
object
,
const
AttributeValue
&value)
const
= 0;
138
virtual
bool
Get
(
const
ObjectBase
*
object
,
AttributeValue
&attribute)
const
= 0;
139
144
virtual
bool
HasGetter
(
void
)
const
= 0;
149
virtual
bool
HasSetter
(
void
)
const
= 0;
150
};
151
166
class
AttributeChecker
:
public
SimpleRefCount
<AttributeChecker>
167
{
168
public
:
169
AttributeChecker
();
170
virtual
~AttributeChecker
();
171
179
Ptr<AttributeValue>
CreateValidValue
(
const
AttributeValue
&value)
const
;
186
virtual
bool
Check
(
const
AttributeValue
&value)
const
= 0;
195
virtual
std::string
GetValueTypeName
(
void
)
const
= 0;
203
virtual
bool
HasUnderlyingTypeInformation
(
void
)
const
= 0;
208
virtual
std::string
GetUnderlyingTypeInformation
(
void
)
const
= 0;
216
virtual
Ptr<AttributeValue>
Create
(
void
)
const
= 0;
224
virtual
bool
Copy
(
const
AttributeValue
&source,
AttributeValue
&destination)
const
= 0;
225
226
227
};
228
234
class
EmptyAttributeValue
:
public
AttributeValue
235
{
236
public
:
238
EmptyAttributeValue
();
239
private
:
243
virtual
Ptr<AttributeValue>
Copy
(
void
)
const
;
250
virtual
std::string
SerializeToString
(
Ptr<const AttributeChecker>
checker)
const
;
259
virtual
bool
DeserializeFromString
(std::string value,
Ptr<const AttributeChecker>
checker);
260
};
261
262
}
// namespace ns3
263
264
#endif
/* ATTRIBUTE_H */
ns3::AttributeChecker::Copy
virtual bool Copy(const AttributeValue &source, AttributeValue &destination) const =0
Copy the source to the destination.
ns3::AttributeChecker
Represent the type of an attribute.
Definition:
attribute.h:166
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:73
ns3::AttributeAccessor::AttributeAccessor
AttributeAccessor()
Definition:
attribute.cc:45
ptr.h
Smart pointer implementation.
ns3::AttributeValue
Hold a value for an Attribute.
Definition:
attribute.h:68
ns3::AttributeAccessor::Get
virtual bool Get(const ObjectBase *object, AttributeValue &attribute) const =0
ns3::EmptyAttributeValue::DeserializeFromString
virtual bool DeserializeFromString(std::string value, Ptr< const AttributeChecker > checker)
Definition:
attribute.cc:105
ns3::AttributeAccessor::HasGetter
virtual bool HasGetter(void) const =0
ns3::ObjectBase
Anchor the ns-3 type and attribute system.
Definition:
object-base.h:68
ns3::AttributeChecker::HasUnderlyingTypeInformation
virtual bool HasUnderlyingTypeInformation(void) const =0
ns3::AttributeAccessor::HasSetter
virtual bool HasSetter(void) const =0
ns3::EmptyAttributeValue::EmptyAttributeValue
EmptyAttributeValue()
Default constructor.
Definition:
attribute.cc:88
ns3::AttributeValue::AttributeValue
AttributeValue()
Definition:
attribute.cc:37
ns3::AttributeValue::SerializeToString
virtual std::string SerializeToString(Ptr< const AttributeChecker > checker) const =0
ns3::EmptyAttributeValue
A class for an empty attribute value.
Definition:
attribute.h:234
ns3::AttributeAccessor::~AttributeAccessor
virtual ~AttributeAccessor()
Definition:
attribute.cc:48
ns3::AttributeChecker::AttributeChecker
AttributeChecker()
Definition:
attribute.cc:52
ns3::AttributeChecker::GetValueTypeName
virtual std::string GetValueTypeName(void) const =0
ns3::AttributeChecker::CreateValidValue
Ptr< AttributeValue > CreateValidValue(const AttributeValue &value) const
Create a valid value from the argument value, or reinterpret the argument as a string.
Definition:
attribute.cc:60
ns3::EmptyAttributeValue::SerializeToString
virtual std::string SerializeToString(Ptr< const AttributeChecker > checker) const
Definition:
attribute.cc:99
ns3::AttributeAccessor
allow setting and getting the value of an attribute.
Definition:
attribute.h:114
ns3::AttributeValue::~AttributeValue
virtual ~AttributeValue()
Definition:
attribute.cc:40
ns3::AttributeValue::Copy
virtual Ptr< AttributeValue > Copy(void) const =0
ns3::AttributeAccessor::Set
virtual bool Set(ObjectBase *object, const AttributeValue &value) const =0
ns3::AttributeChecker::Create
virtual Ptr< AttributeValue > Create(void) const =0
ns3::AttributeChecker::~AttributeChecker
virtual ~AttributeChecker()
Definition:
attribute.cc:55
ns3::AttributeValue::DeserializeFromString
virtual bool DeserializeFromString(std::string value, Ptr< const AttributeChecker > checker)=0
ns3::AttributeChecker::Check
virtual bool Check(const AttributeValue &value) const =0
ns3::AttributeChecker::GetUnderlyingTypeInformation
virtual std::string GetUnderlyingTypeInformation(void) const =0
ns3::SimpleRefCount
A template-based reference counting class.
Definition:
simple-ref-count.h:72
simple-ref-count.h
Reference counting for smart pointers.
ns3::EmptyAttributeValue::Copy
virtual Ptr< AttributeValue > Copy(void) const
Definition:
attribute.cc:93
src
core
model
attribute.h
Generated on Wed Jul 6 2016 17:11:25 for ns-3 by
1.8.6