src/core/boolean.h
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Thu, 17 Apr 2008 13:42:25 -0700
changeset 2965 4b28e9740e3b
parent 2928 554e10cdc747
child 3182 61fe7fe81ebd
permissions -rw-r--r--
get rid of Attribute class. Use AttributeValue subclasses directly.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2581
31d4960dc31b add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2453
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: 2453
diff changeset
     2
/*
31d4960dc31b add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2453
diff changeset
     3
 * Copyright (c) 2008 INRIA
31d4960dc31b add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2453
diff changeset
     4
 *
31d4960dc31b add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2453
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: 2453
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: 2453
diff changeset
     7
 * published by the Free Software Foundation;
31d4960dc31b add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2453
diff changeset
     8
 *
31d4960dc31b add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2453
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: 2453
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: 2453
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: 2453
diff changeset
    12
 * GNU General Public License for more details.
31d4960dc31b add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2453
diff changeset
    13
 *
31d4960dc31b add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2453
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: 2453
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: 2453
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: 2453
diff changeset
    17
 *
31d4960dc31b add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2453
diff changeset
    18
 * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
31d4960dc31b add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2453
diff changeset
    19
 */
2453
57fe34e08d8d small typo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2452
diff changeset
    20
#ifndef BOOLEAN_H
57fe34e08d8d small typo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2452
diff changeset
    21
#define BOOLEAN_H
2371
2118204a86e6 initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    22
2438
e2ac9f9aeeb9 value.h -> attribute.h
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2437
diff changeset
    23
#include "attribute.h"
2451
8979f07befd5 value-helper.h -> attribute-helper.h
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2441
diff changeset
    24
#include "attribute-helper.h"
2371
2118204a86e6 initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    25
2118204a86e6 initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    26
namespace ns3 {
2118204a86e6 initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    27
2584
5011c132ed6c doxygen doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2581
diff changeset
    28
/**
5011c132ed6c doxygen doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2581
diff changeset
    29
 * \brief Hold a bool native type
5011c132ed6c doxygen doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2581
diff changeset
    30
 *
2928
554e10cdc747 add doxygen anchors to avoid warnings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2584
diff changeset
    31
 * \anchor bool
554e10cdc747 add doxygen anchors to avoid warnings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2584
diff changeset
    32
 *
2584
5011c132ed6c doxygen doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2581
diff changeset
    33
 * This class can be used to hold bool variables
5011c132ed6c doxygen doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2581
diff changeset
    34
 * which must go through the Attribute system.
5011c132ed6c doxygen doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2581
diff changeset
    35
 */
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2928
diff changeset
    36
class BooleanValue : public AttributeValue
2371
2118204a86e6 initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    37
{
2118204a86e6 initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    38
public:
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2928
diff changeset
    39
  BooleanValue ();
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2928
diff changeset
    40
  BooleanValue (bool value);
2371
2118204a86e6 initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    41
  void Set (bool value);
2118204a86e6 initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    42
  bool Get (void) const;
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2928
diff changeset
    43
  
2441
d4a91f8bb374 BooleanValue -> Boolean
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2438
diff changeset
    44
  operator bool () const;
2372
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2371
diff changeset
    45
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2928
diff changeset
    46
  virtual Ptr<AttributeValue> Copy (void) const;
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2928
diff changeset
    47
  virtual std::string SerializeToString (Ptr<const AttributeChecker> checker) const;
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2928
diff changeset
    48
  virtual bool DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker);
2371
2118204a86e6 initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    49
private:
2118204a86e6 initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    50
  bool m_value;
2118204a86e6 initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    51
};
2118204a86e6 initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    52
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2928
diff changeset
    53
std::ostream & operator << (std::ostream &os, const BooleanValue &value);
2371
2118204a86e6 initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    54
2441
d4a91f8bb374 BooleanValue -> Boolean
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2438
diff changeset
    55
ATTRIBUTE_CHECKER_DEFINE (Boolean);
d4a91f8bb374 BooleanValue -> Boolean
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2438
diff changeset
    56
ATTRIBUTE_ACCESSOR_DEFINE (Boolean);
2371
2118204a86e6 initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    57
2118204a86e6 initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    58
} // namespace ns3
2118204a86e6 initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    59
2453
57fe34e08d8d small typo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2452
diff changeset
    60
#endif /* BOOLEAN_H */