A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
attribute.cc
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 #include "attribute.h"
21 #include "log.h"
22 #include "fatal-error.h"
23 #include "string.h"
24 #include <sstream>
25 
26 NS_LOG_COMPONENT_DEFINE ("AttributeValue");
27 
28 namespace ns3 {
29 
31 {
32 }
34 {
35 }
36 
37 
39 {
40 }
42 {
43 }
44 
46 {
47 }
49 {
50 }
51 
54 {
55  if (Check (value))
56  {
57  return value.Copy ();
58  }
59  // attempt to convert to string.
60  const StringValue *str = dynamic_cast<const StringValue *> (&value);
61  if (str == 0)
62  {
63  return 0;
64  }
65  // attempt to convert back to value.
67  bool ok = v->DeserializeFromString (str->Get (), this);
68  if (!ok)
69  {
70  return 0;
71  }
72  ok = Check (*v);
73  if (!ok)
74  {
75  return 0;
76  }
77  return v;
78 }
79 
81 {
82 }
85 {
86  return Create<EmptyAttributeValue> ();
87 }
88 std::string
90 {
91  return "";
92 }
93 bool
95 {
96  return true;
97 }
98 
99 
100 } // namespace ns3