src/core/boolean-value.h
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Wed, 20 Feb 2008 21:45:42 +0100
changeset 2438 e2ac9f9aeeb9
parent 2437 44e34ffee8e3
child 2441 d4a91f8bb374
permissions -rw-r--r--
value.h -> attribute.h
mathieu@2371
     1
#ifndef BOOLEAN_VALUE_H
mathieu@2371
     2
#define BOOLEAN_VALUE_H
mathieu@2371
     3
mathieu@2438
     4
#include "attribute.h"
mathieu@2371
     5
#include "param-spec-helper.h"
mathieu@2371
     6
#include "ptr.h"
mathieu@2371
     7
mathieu@2371
     8
namespace ns3 {
mathieu@2371
     9
mathieu@2437
    10
class BooleanValue : public AttributeValue
mathieu@2371
    11
{
mathieu@2371
    12
public:
mathieu@2371
    13
  BooleanValue (bool value);
mathieu@2371
    14
  void Set (bool value);
mathieu@2371
    15
  bool Get (void) const;
mathieu@2371
    16
mathieu@2433
    17
  virtual Attribute Copy (void) const;
mathieu@2427
    18
  virtual std::string SerializeToString (Ptr<const AttributeChecker> checker) const;
mathieu@2427
    19
  virtual bool DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker);
mathieu@2372
    20
mathieu@2433
    21
  BooleanValue (Attribute value);
mathieu@2433
    22
  operator Attribute () const;
mathieu@2371
    23
private:
mathieu@2371
    24
  bool m_value;
mathieu@2371
    25
};
mathieu@2371
    26
mathieu@2436
    27
class BooleanAccessor : public AttributeAccessor {};
mathieu@2410
    28
mathieu@2371
    29
mathieu@2408
    30
template <typename T1>
mathieu@2436
    31
Ptr<const AttributeAccessor> MakeBooleanAccessor (T1 a1);
mathieu@2371
    32
mathieu@2408
    33
template <typename T1, typename T2>
mathieu@2436
    34
Ptr<const AttributeAccessor> MakeBooleanAccessor (T1 a1, T2 a2);
mathieu@2371
    35
mathieu@2436
    36
Ptr<const AttributeChecker> MakeBooleanChecker (void);
mathieu@2427
    37
mathieu@2371
    38
} // namespace ns3
mathieu@2371
    39
mathieu@2371
    40
mathieu@2371
    41
// Implementation of template functions below.
mathieu@2371
    42
namespace ns3 {
mathieu@2371
    43
mathieu@2408
    44
template <typename T1>
mathieu@2436
    45
Ptr<const AttributeAccessor> MakeBooleanAccessor (T1 a1)
mathieu@2371
    46
{
mathieu@2435
    47
  return MakeAccessorHelper<BooleanAccessor,BooleanValue> (a1);
mathieu@2371
    48
}
mathieu@2371
    49
mathieu@2408
    50
template <typename T1, typename T2>
mathieu@2436
    51
Ptr<const AttributeAccessor> MakeBooleanAccessor (T1 a1, T2 a2)
mathieu@2371
    52
{
mathieu@2435
    53
  return MakeAccessorHelper<BooleanAccessor,BooleanValue> (a1, a2);
mathieu@2371
    54
}
mathieu@2371
    55
mathieu@2371
    56
} // namespace ns3
mathieu@2371
    57
mathieu@2371
    58
#endif /* BOOLEAN_PARAMETER_H */