2008-03-10 00:38:48 +01:00
|
|
|
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
|
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2008 INRIA
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
|
* published by the Free Software Foundation;
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
*
|
|
|
|
|
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
|
|
|
|
|
*/
|
2008-02-21 18:58:08 +01:00
|
|
|
#ifndef BOOLEAN_H
|
|
|
|
|
#define BOOLEAN_H
|
2008-01-30 17:28:18 +01:00
|
|
|
|
2008-02-20 21:45:42 +01:00
|
|
|
#include "attribute.h"
|
2008-02-21 18:54:02 +01:00
|
|
|
#include "attribute-helper.h"
|
2008-01-30 17:28:18 +01:00
|
|
|
|
|
|
|
|
namespace ns3 {
|
|
|
|
|
|
2008-03-10 14:05:26 -07:00
|
|
|
/**
|
2008-05-29 23:24:10 -07:00
|
|
|
* \ingroup attribute
|
|
|
|
|
*
|
2008-03-10 14:05:26 -07:00
|
|
|
* \brief Hold a bool native type
|
|
|
|
|
*
|
2008-04-09 13:03:58 -07:00
|
|
|
* \anchor bool
|
|
|
|
|
*
|
2008-03-10 14:05:26 -07:00
|
|
|
* This class can be used to hold bool variables
|
|
|
|
|
* which must go through the Attribute system.
|
|
|
|
|
*/
|
2008-04-17 13:42:25 -07:00
|
|
|
class BooleanValue : public AttributeValue
|
2008-01-30 17:28:18 +01:00
|
|
|
{
|
|
|
|
|
public:
|
2008-04-17 13:42:25 -07:00
|
|
|
BooleanValue ();
|
|
|
|
|
BooleanValue (bool value);
|
2008-01-30 17:28:18 +01:00
|
|
|
void Set (bool value);
|
|
|
|
|
bool Get (void) const;
|
2008-04-17 13:42:25 -07:00
|
|
|
|
2008-02-21 00:19:31 +01:00
|
|
|
operator bool () const;
|
2008-01-30 19:13:06 +01:00
|
|
|
|
2008-04-17 13:42:25 -07:00
|
|
|
virtual Ptr<AttributeValue> Copy (void) const;
|
|
|
|
|
virtual std::string SerializeToString (Ptr<const AttributeChecker> checker) const;
|
|
|
|
|
virtual bool DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker);
|
2008-01-30 17:28:18 +01:00
|
|
|
private:
|
|
|
|
|
bool m_value;
|
|
|
|
|
};
|
|
|
|
|
|
2008-04-17 13:42:25 -07:00
|
|
|
std::ostream & operator << (std::ostream &os, const BooleanValue &value);
|
2008-02-13 23:37:46 +01:00
|
|
|
|
2008-02-21 00:19:31 +01:00
|
|
|
ATTRIBUTE_CHECKER_DEFINE (Boolean);
|
|
|
|
|
ATTRIBUTE_ACCESSOR_DEFINE (Boolean);
|
2008-01-30 17:28:18 +01:00
|
|
|
|
|
|
|
|
} // namespace ns3
|
|
|
|
|
|
2008-02-21 18:58:08 +01:00
|
|
|
#endif /* BOOLEAN_H */
|