mathieu@2371: #ifndef BOOLEAN_VALUE_H mathieu@2371: #define BOOLEAN_VALUE_H mathieu@2371: mathieu@2371: #include "value.h" mathieu@2371: #include "param-spec.h" mathieu@2371: #include "param-spec-helper.h" mathieu@2371: #include "ptr.h" mathieu@2371: mathieu@2371: namespace ns3 { mathieu@2371: mathieu@2371: class BooleanValue : public Value mathieu@2371: { mathieu@2371: public: mathieu@2371: BooleanValue (bool value); mathieu@2371: void Set (bool value); mathieu@2371: bool Get (void) const; mathieu@2371: mathieu@2371: virtual Ptr Copy (void) const; mathieu@2371: virtual std::string SerializeToString (Ptr spec) const; mathieu@2371: virtual bool DeserializeFromString (std::string value, Ptr spec); mathieu@2372: mathieu@2372: BooleanValue (Ptr value); mathieu@2372: operator Ptr () const; mathieu@2372: operator Ptr () const; mathieu@2371: private: mathieu@2371: bool m_value; mathieu@2371: }; mathieu@2371: mathieu@2371: mathieu@2371: template mathieu@2371: Ptr MakeBooleanParamSpec (bool T::*v, bool initialValue); mathieu@2371: mathieu@2371: template mathieu@2371: Ptr MakeBooleanParamSpec (bool (T::*getter) (void) const, mathieu@2371: bool initialValue); mathieu@2371: mathieu@2371: template mathieu@2371: Ptr MakeBooleanParamSpec (bool (T::*getter) (void) const, mathieu@2371: void (T::*setter) (bool), mathieu@2371: bool initialValue); mathieu@2371: template mathieu@2371: Ptr MakeBooleanParamSpec (void (T::*setter) (bool), mathieu@2371: bool initialValue); mathieu@2371: mathieu@2371: } // namespace ns3 mathieu@2371: mathieu@2371: mathieu@2371: // Implementation of template functions below. mathieu@2371: namespace ns3 { mathieu@2371: mathieu@2371: template mathieu@2371: Ptr MakeBooleanParamSpec (bool T::*v, bool initialValue) mathieu@2371: { mathieu@2371: return Create > (v, initialValue); mathieu@2371: } mathieu@2371: mathieu@2371: template mathieu@2371: Ptr MakeBooleanParamSpec (void (T::*setter) (bool), mathieu@2371: bool (T::*getter) (void) const, mathieu@2371: bool initialValue) mathieu@2371: { mathieu@2371: return Create > (setter, getter, initialValue); mathieu@2371: } mathieu@2371: mathieu@2371: template mathieu@2371: Ptr MakeBooleanParamSpec (bool (T::*getter) (void) const, mathieu@2371: bool initialValue) mathieu@2371: { mathieu@2371: return Create > (getter, initialValue); mathieu@2371: } mathieu@2371: mathieu@2371: template mathieu@2371: Ptr MakeBooleanParamSpec (void (T::*setter) (bool), mathieu@2371: bool initialValue) mathieu@2371: { mathieu@2371: return Create > (setter, initialValue); mathieu@2371: } mathieu@2371: mathieu@2371: } // namespace ns3 mathieu@2371: mathieu@2371: #endif /* BOOLEAN_PARAMETER_H */