A Discrete-Event Network Simulator
API
boolean.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 BOOLEAN_H
21 #define BOOLEAN_H
22 
23 #include "attribute.h"
24 #include "attribute-helper.h"
25 
32 namespace ns3 {
33 
34 // Doxygen for this class is auto-generated by
35 // utils/print-introspected-doxygen.h
37 {
38 public:
39  BooleanValue ();
45  BooleanValue (bool value);
46  void Set (bool value);
47  bool Get (void) const;
48  template <typename T>
49  bool GetAccessor (T &v) const;
50 
55  operator bool () const;
56 
57  virtual Ptr<AttributeValue> Copy (void) const;
58  virtual std::string SerializeToString (Ptr<const AttributeChecker> checker) const;
59  virtual bool DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker);
60 private:
61  bool m_value;
62 };
63 
64 template <typename T>
65 bool BooleanValue::GetAccessor (T &v) const
66 {
67  v = T (m_value);
68  return true;
69 }
70 
81 std::ostream & operator << (std::ostream &os, const BooleanValue &value);
82 
85 
86 } // namespace ns3
87 
88 #endif /* BOOLEAN_H */
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
AttributeValue implementation for Boolean.
Definition: boolean.h:36
Hold a value for an Attribute.
Definition: attribute.h:68
virtual bool DeserializeFromString(std::string value, Ptr< const AttributeChecker > checker)
Definition: boolean.cc:96
virtual std::string SerializeToString(Ptr< const AttributeChecker > checker) const
Definition: boolean.cc:82
bool GetAccessor(T &v) const
Access the Boolean value as type T.
Definition: boolean.h:65
#define ATTRIBUTE_CHECKER_DEFINE(type)
Declare the AttributeChecker class typeChecker and the MaketypeChecker function for class type...
void Set(bool value)
Set the value.
Definition: boolean.cc:45
ns3::AttributeValue, ns3::AttributeAccessor and ns3::AttributeChecker declarations.
bool Get(void) const
Definition: boolean.cc:51
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
Definition: angles.cc:42
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Attribute helper (ATTRIBUTE_ )macros definition.
#define ATTRIBUTE_ACCESSOR_DEFINE(type)
Define the attribute accessor functions MakeTypeAccessor for class type.
bool m_value
The stored Boolean instance.
Definition: boolean.h:61
virtual Ptr< AttributeValue > Copy(void) const
Definition: boolean.cc:75