src/core/attribute-helper.h File Reference

#include "attribute.h"
#include "attribute-accessor-helper.h"
#include "type-traits.h"
#include <sstream>
#include "fatal-error.h"
Include dependency graph for attribute-helper.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  ns3
 

Every class exported by the ns3 library is enclosed in the ns3 namespace.


Defines

#define ATTRIBUTE_ACCESSOR_DEFINE(type)
#define ATTRIBUTE_VALUE_DEFINE_WITH_NAME(type, name)
#define ATTRIBUTE_VALUE_DEFINE(type)   ATTRIBUTE_VALUE_DEFINE_WITH_NAME (type,type)
#define ATTRIBUTE_CONVERTER_DEFINE(type)
#define ATTRIBUTE_CHECKER_DEFINE(type)
#define ATTRIBUTE_VALUE_IMPLEMENT_WITH_NAME(type, name)
#define ATTRIBUTE_VALUE_IMPLEMENT(type)   ATTRIBUTE_VALUE_IMPLEMENT_WITH_NAME(type,type)
#define ATTRIBUTE_CHECKER_IMPLEMENT(type)
#define ATTRIBUTE_CHECKER_IMPLEMENT_WITH_NAME(type, name)
#define ATTRIBUTE_HELPER_HEADER(type)
#define ATTRIBUTE_HELPER_CPP(type)

Functions

template<typename T , typename BASE >
Ptr< AttributeChecker > ns3::MakeSimpleAttributeChecker (std::string name, std::string underlying)

Define Documentation

#define ATTRIBUTE_CHECKER_IMPLEMENT_WITH_NAME ( type,
name   ) 
Value:
Ptr<const AttributeChecker> Make##type##Checker (void)      \
  {                                 \
    return MakeSimpleAttributeChecker<type##Value,type##Checker> (#type "Value", name); \
  }                                 \

Definition at line 222 of file attribute-helper.h.

#define ATTRIBUTE_VALUE_DEFINE_WITH_NAME ( type,
name   ) 
Value:
class name##Value : public AttributeValue               \
  {                                 \
  public:                               \
    name##Value ();                         \
    name##Value (const type &value);                    \
    void Set (const type &value);                   \
    type Get (void) const;                      \
    template <typename T>                                               \
    bool GetAccessor (T &value) const {                                 \
      value = T (m_value);                                              \
      return true;                                                      \
    }                                                                   \
    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); \
  private:                              \
    type m_value;                           \
  };

Definition at line 112 of file attribute-helper.h.

#define ATTRIBUTE_VALUE_IMPLEMENT_WITH_NAME ( type,
name   ) 
Value:
name##Value::name##Value ()                     \
    : m_value () {}                         \
  name##Value::name##Value (const type &value)              \
  : m_value (value) {}                          \
  void name##Value::Set (const type &v) {               \
    m_value = v;                            \
  }                                 \
  type name##Value::Get (void) const {                  \
    return m_value;                         \
  }                                 \
  Ptr<AttributeValue>                                                   \
  name##Value::Copy (void) const {                  \
    return ns3::Create<name##Value> (*this);                            \
  }                                                                     \
  std::string                               \
  name##Value::SerializeToString (Ptr<const AttributeChecker> checker) const { \
    std::ostringstream oss;                     \
    oss << m_value;                         \
    return oss.str ();                          \
  }                                 \
  bool                                  \
  name##Value::DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker) { \
    std::istringstream iss;                     \
    iss.str (value);                            \
    iss >> m_value;                         \
    return !iss.bad () && !iss.fail ();                 \
  }

Definition at line 167 of file attribute-helper.h.

Generated on Thu Dec 3 14:06:18 2009 for NS-3 by  doxygen 1.6.3