author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Thu, 10 Apr 2008 13:01:53 -0700 | |
changeset 2948 | 858fc65447a5 |
parent 2947 | b0fec3381418 |
child 2965 | 4b28e9740e3b |
permissions | -rw-r--r-- |
2581
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2502
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2502
diff
changeset
|
2 |
/* |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2502
diff
changeset
|
3 |
* Copyright (c) 2008 INRIA |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2502
diff
changeset
|
4 |
* |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2502
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2502
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2502
diff
changeset
|
7 |
* published by the Free Software Foundation; |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2502
diff
changeset
|
8 |
* |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2502
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2502
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2502
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2502
diff
changeset
|
12 |
* GNU General Public License for more details. |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2502
diff
changeset
|
13 |
* |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2502
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2502
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2502
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2502
diff
changeset
|
17 |
* |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2502
diff
changeset
|
18 |
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2502
diff
changeset
|
19 |
*/ |
2438
e2ac9f9aeeb9
value.h -> attribute.h
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2437
diff
changeset
|
20 |
#include "attribute.h" |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2371
diff
changeset
|
21 |
#include "log.h" |
2397
45cd59c6ddf8
add automatic conversion from string to PValue.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2374
diff
changeset
|
22 |
#include "fatal-error.h" |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2371
diff
changeset
|
23 |
#include <sstream> |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2371
diff
changeset
|
24 |
|
2437
44e34ffee8e3
Value -> AttributeValue
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2436
diff
changeset
|
25 |
NS_LOG_COMPONENT_DEFINE ("AttributeValue"); |
2371
2118204a86e6
initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
26 |
|
2118204a86e6
initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
27 |
namespace ns3 { |
2118204a86e6
initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
28 |
|
2437
44e34ffee8e3
Value -> AttributeValue
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2436
diff
changeset
|
29 |
AttributeValue::AttributeValue () |
2371
2118204a86e6
initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
30 |
{} |
2437
44e34ffee8e3
Value -> AttributeValue
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2436
diff
changeset
|
31 |
AttributeValue::~AttributeValue () |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2371
diff
changeset
|
32 |
{} |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2371
diff
changeset
|
33 |
|
2433
3a98e1db7f80
PValue -> Attribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2427
diff
changeset
|
34 |
Attribute::Attribute () |
2947
b0fec3381418
get rid of scary implementation details of Attribute.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
35 |
: m_value () |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2371
diff
changeset
|
36 |
{} |
2947
b0fec3381418
get rid of scary implementation details of Attribute.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
37 |
Attribute::Attribute (Ptr<AttributeValue> value) |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2371
diff
changeset
|
38 |
: m_value (value) |
2947
b0fec3381418
get rid of scary implementation details of Attribute.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
39 |
{} |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2371
diff
changeset
|
40 |
|
2433
3a98e1db7f80
PValue -> Attribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2427
diff
changeset
|
41 |
Attribute |
3a98e1db7f80
PValue -> Attribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2427
diff
changeset
|
42 |
Attribute::Copy (void) const |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2371
diff
changeset
|
43 |
{ |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2371
diff
changeset
|
44 |
return m_value->Copy (); |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2371
diff
changeset
|
45 |
} |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2371
diff
changeset
|
46 |
std::string |
2433
3a98e1db7f80
PValue -> Attribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2427
diff
changeset
|
47 |
Attribute::SerializeToString (Ptr<const AttributeChecker> checker) const |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2371
diff
changeset
|
48 |
{ |
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2421
diff
changeset
|
49 |
return m_value->SerializeToString (checker); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2371
diff
changeset
|
50 |
} |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2371
diff
changeset
|
51 |
bool |
2433
3a98e1db7f80
PValue -> Attribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2427
diff
changeset
|
52 |
Attribute::DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker) |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2371
diff
changeset
|
53 |
{ |
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2421
diff
changeset
|
54 |
return m_value->DeserializeFromString (value, checker); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2371
diff
changeset
|
55 |
} |
2397
45cd59c6ddf8
add automatic conversion from string to PValue.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2374
diff
changeset
|
56 |
|
2436
23415bac7eaf
Accessor -> AttributeAccessor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2435
diff
changeset
|
57 |
AttributeAccessor::AttributeAccessor () |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2371
diff
changeset
|
58 |
{} |
2436
23415bac7eaf
Accessor -> AttributeAccessor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2435
diff
changeset
|
59 |
AttributeAccessor::~AttributeAccessor () |
2371
2118204a86e6
initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
60 |
{} |
2118204a86e6
initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
61 |
|
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2421
diff
changeset
|
62 |
AttributeChecker::AttributeChecker () |
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2421
diff
changeset
|
63 |
{} |
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2421
diff
changeset
|
64 |
AttributeChecker::~AttributeChecker () |
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2421
diff
changeset
|
65 |
{} |
2397
45cd59c6ddf8
add automatic conversion from string to PValue.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2374
diff
changeset
|
66 |
|
2371
2118204a86e6
initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
67 |
} // namespace ns3 |