src/core/param-spec-helper.h
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Sun, 17 Feb 2008 00:46:24 +0100
changeset 2423 5609a96df2f6
parent 2410 88dc7d4a6731
child 2424 217a447122a6
permissions -rw-r--r--
get rid of ParamSpec::CreateValue.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2371
2118204a86e6 initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     1
#ifndef PARAM_SPEC_HELPER_H
2118204a86e6 initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     2
#define PARAM_SPEC_HELPER_H
2118204a86e6 initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     3
2118204a86e6 initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     4
namespace ns3 {
2118204a86e6 initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     5
2410
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
     6
template <typename BASE, typename T1, typename V>
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
     7
Ptr<ParamSpec>
2408
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
     8
MakeParamSpecHelper (T1 a1, V initialValue);
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
     9
2410
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    10
template <typename BASE, typename T1, typename T2, typename V>
2408
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
    11
Ptr<ParamSpec>
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
    12
MakeParamSpecHelper (T1 a1, T2 a2, V initialValue);
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
    13
2410
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    14
template <typename BASE, typename T1, typename V, typename CHECKER>
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
    15
Ptr<ParamSpec>
2408
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
    16
MakeParamSpecHelperWithChecker (T1 a1, V initialValue, CHECKER checker);
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
    17
2410
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    18
template <typename BASE, typename T1, typename T2, typename V, typename CHECKER>
2408
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
    19
Ptr<ParamSpec>
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
    20
MakeParamSpecHelperWithChecker (T1 a1, T2 a2, V initialValue, CHECKER checker);
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
    21
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
    22
} // namespace ns3
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
    23
2408
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
    24
/***************************************************************
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
    25
 *        The implementation of the above functions.
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
    26
 ***************************************************************/
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
    27
2408
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
    28
#include "type-traits.h"
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
    29
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
    30
namespace ns3 {
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
    31
2410
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    32
template <typename BASE, typename T, typename U, typename CHECKER>
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    33
class ParamSpecHelper : public BASE
2371
2118204a86e6 initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    34
{
2118204a86e6 initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    35
public:
2410
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    36
  ParamSpecHelper (PValue initialValue, CHECKER checker)
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    37
  : m_initialValue (initialValue),
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    38
    m_checker (checker) {}
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    39
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    40
  virtual bool Set (ObjectBase * object, PValue val) const {
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    41
    const U *value = val.DynCast<const U*> ();
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    42
    if (value == 0)
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    43
      {
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    44
	return false;
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    45
      }
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    46
    T *obj = dynamic_cast<T *> (object);
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    47
    if (obj == 0)
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    48
      {
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    49
	return false;
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    50
      }
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    51
    return DoSet (obj, value);
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    52
  }
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    53
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    54
  virtual bool Get (const ObjectBase * object, PValue val) const {
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    55
    U *value = val.DynCast<U*> ();
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    56
    if (value == 0)
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    57
      {
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    58
	return false;
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    59
      }
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    60
    const T *obj = dynamic_cast<const T *> (object);
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    61
    if (obj == 0)
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    62
      {
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    63
	return false;
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    64
      }
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    65
    return DoGet (obj, value);
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    66
  }
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    67
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    68
  virtual bool Check (PValue value) const {
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    69
    const U *val = value.DynCast<const U*> ();
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    70
    if (val == 0)
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    71
      {
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    72
	return false;
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    73
      }
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    74
    return m_checker.Check (val->Get ());
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    75
  }
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    76
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    77
  virtual PValue GetInitialValue (void) const {
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    78
    return m_initialValue;
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    79
  }
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    80
2371
2118204a86e6 initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    81
private:
2403
759adf2fdf98 report more get/set errors
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2398
diff changeset
    82
  virtual bool DoSet (T *object, const U *v) const = 0;
759adf2fdf98 report more get/set errors
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2398
diff changeset
    83
  virtual bool DoGet (const T *object, U *v) const = 0;
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
    84
  PValue m_initialValue;
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
    85
  CHECKER m_checker;
2371
2118204a86e6 initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    86
};
2118204a86e6 initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    87
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
    88
template <typename T>
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
    89
class ParamSpecHelperSimpleChecker
2371
2118204a86e6 initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    90
{
2118204a86e6 initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    91
public:
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
    92
  bool Check (const T &value) const {return true;}
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
    93
};
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
    94
2410
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    95
template <typename BASE, typename T, typename U, typename V, typename CHECKER>
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
    96
Ptr<ParamSpec>
2408
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
    97
DoMakeParamSpecHelperOne (U T::*memberVariable, V initialValue, CHECKER checker)
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
    98
{
2410
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
    99
  class MemberVariable : public ParamSpecHelper<BASE,T,V,CHECKER>
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   100
    {
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   101
    public:
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   102
      MemberVariable (U T::*memberVariable, V initialValue, CHECKER checker)
2410
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
   103
	: ParamSpecHelper<BASE,T,V,CHECKER> (initialValue, checker),
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   104
	m_memberVariable (memberVariable)
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   105
	{}
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   106
    private:
2403
759adf2fdf98 report more get/set errors
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2398
diff changeset
   107
      virtual bool DoSet (T *object, const V *v) const {
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   108
	(object->*m_memberVariable) = v->Get ();
2403
759adf2fdf98 report more get/set errors
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2398
diff changeset
   109
	return true;
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   110
      }
2403
759adf2fdf98 report more get/set errors
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2398
diff changeset
   111
      virtual bool DoGet (const T *object, V *v) const {
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   112
	v->Set (object->*m_memberVariable);
2403
759adf2fdf98 report more get/set errors
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2398
diff changeset
   113
	return true;
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   114
      }
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   115
      
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   116
      U T::*m_memberVariable;
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   117
    };
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   118
  return Ptr<ParamSpec> (new MemberVariable (memberVariable, initialValue, checker), false);
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   119
}
2410
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
   120
template <typename BASE, typename T, typename U, typename V>
2408
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   121
Ptr<ParamSpec>
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   122
DoMakeParamSpecHelperOne (U T::*memberVariable, V initialValue)
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   123
{
2410
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
   124
  return DoMakeParamSpecHelperOne<BASE> (memberVariable, initialValue, ParamSpecHelperSimpleChecker<U> ());
2408
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   125
}
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   126
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   127
2410
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
   128
template <typename BASE, typename T, typename U, typename V, typename CHECKER>
2408
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   129
Ptr<ParamSpec>
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   130
DoMakeParamSpecHelperOne (U (T::*getter) (void) const, 
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   131
			  V initialValue, CHECKER checker)
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   132
{
2410
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
   133
  class MemberMethod : public ParamSpecHelper<BASE,T,V,CHECKER>
2408
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   134
    {
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   135
    public:
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   136
      MemberMethod (U (T::*getter) (void) const,
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   137
		    V initialValue, CHECKER checker)
2410
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
   138
	: ParamSpecHelper<BASE,T,V,CHECKER> (initialValue, checker),
2408
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   139
	m_getter (getter)
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   140
	{}
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   141
    private:
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   142
      virtual bool DoSet (T *object, const V *v) const {
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   143
	return false;
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   144
      }
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   145
      virtual bool DoGet (const T *object, V *v) const {
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   146
	v->Set ((object->*m_getter) ());
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   147
	return true;
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   148
      }
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   149
      U (T::*m_getter) (void) const;
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   150
    };
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   151
  return Ptr<ParamSpec> (new MemberMethod (getter, initialValue, checker), false);
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   152
}
2371
2118204a86e6 initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   153
2410
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
   154
template <typename BASE, typename T, typename U, typename V>
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   155
Ptr<ParamSpec>
2408
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   156
DoMakeParamSpecHelperOne (U (T::*getter) (void) const, 
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   157
			  V initialValue)
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   158
{
2410
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
   159
  return DoMakeParamSpecHelperOne<BASE> (getter, initialValue, ParamSpecHelperSimpleChecker<U> ());
2408
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   160
}
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   161
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   162
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   163
2410
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
   164
template <typename BASE, typename T, typename U, typename V, typename CHECKER>
2408
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   165
Ptr<ParamSpec>
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   166
DoMakeParamSpecHelperOne (void (T::*setter) (U), 
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   167
			  V initialValue, CHECKER checker)
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   168
{
2410
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
   169
  class MemberMethod : public ParamSpecHelper<BASE,T,V,CHECKER>
2408
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   170
    {
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   171
    public:
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   172
      MemberMethod (void (T::*setter) (U), 
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   173
		    V initialValue, CHECKER checker)
2410
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
   174
	: ParamSpecHelper<BASE,T,V,CHECKER> (initialValue, checker),
2408
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   175
	m_setter (setter)
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   176
	{}
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   177
    private:
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   178
      virtual bool DoSet (T *object, const V *v) const {
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   179
	(object->*m_setter) (v->Get ());
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   180
	return true;
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   181
      }
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   182
      virtual void DoGet (const T *object, V *v) const {
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   183
	return false;
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   184
      }
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   185
      void (T::*m_setter) (U);
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   186
    };
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   187
  return Ptr<ParamSpec> (new MemberMethod (setter, initialValue, checker), false);
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   188
}
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   189
2410
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
   190
template <typename BASE, typename T, typename U, typename V>
2408
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   191
Ptr<ParamSpec>
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   192
DoMakeParamSpecHelperOne (void (T::*setter) (U), 
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   193
			  V initialValue)
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   194
{
2410
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
   195
  return DoMakeParamSpecHelperOne<BASE> (setter, initialValue, 
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
   196
					 ParamSpecHelperSimpleChecker<typename TypeTraits<U>::ReferencedType> ());
2408
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   197
}
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   198
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   199
2410
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
   200
template <typename BASE, typename T, typename U, typename V, typename W, typename CHECKER>
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   201
Ptr<ParamSpec>
2408
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   202
DoMakeParamSpecHelperTwo (void (T::*setter) (U), 
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   203
			  V (T::*getter) (void) const, 
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   204
			  W initialValue, 
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   205
			  CHECKER checker = ParamSpecHelperSimpleChecker<V> ())
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   206
{
2410
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
   207
  class MemberMethod : public ParamSpecHelper<BASE,T,W,CHECKER>
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   208
    {
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   209
    public:
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   210
      MemberMethod (void (T::*setter) (U), 
2393
025986c8b400 untested templates rarely work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2380
diff changeset
   211
		    V (T::*getter) (void) const,
025986c8b400 untested templates rarely work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2380
diff changeset
   212
		    W initialValue, CHECKER checker)
2410
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
   213
	: ParamSpecHelper<BASE,T,W,CHECKER> (initialValue, checker),
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   214
	m_setter (setter),
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   215
	m_getter (getter)
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   216
	{}
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   217
    private:
2403
759adf2fdf98 report more get/set errors
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2398
diff changeset
   218
      virtual bool DoSet (T *object, const W *v) const {
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   219
	(object->*m_setter) (v->Get ());
2403
759adf2fdf98 report more get/set errors
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2398
diff changeset
   220
	return true;
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   221
      }
2403
759adf2fdf98 report more get/set errors
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2398
diff changeset
   222
      virtual bool DoGet (const T *object, W *v) const {
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   223
	v->Set ((object->*m_getter) ());
2403
759adf2fdf98 report more get/set errors
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2398
diff changeset
   224
	return true;
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   225
      }
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   226
      void (T::*m_setter) (U);
2393
025986c8b400 untested templates rarely work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2380
diff changeset
   227
      V (T::*m_getter) (void) const;
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   228
    };
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   229
  return Ptr<ParamSpec> (new MemberMethod (setter, getter, initialValue, checker), false);
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   230
}
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   231
2410
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
   232
template <typename BASE, typename T, typename U, typename V, typename W>
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   233
Ptr<ParamSpec>
2408
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   234
DoMakeParamSpecHelperTwo (void (T::*setter) (U), 
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   235
		      V (T::*getter) (void) const, 
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   236
		      W initialValue)
2371
2118204a86e6 initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   237
{
2410
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
   238
  return DoMakeParamSpecHelperTwo<BASE> (setter, getter, initialValue, ParamSpecHelperSimpleChecker<V> ());
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   239
}
2371
2118204a86e6 initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   240
2410
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
   241
template <typename BASE, typename T, typename U, typename V, typename W, typename CHECKER>
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   242
Ptr<ParamSpec>
2408
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   243
DoMakeParamSpecHelperTwo (V (T::*getter) (void) const, 
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   244
			  void (T::*setter) (U), 
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   245
			  W initialValue, 
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   246
			  CHECKER checker)
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   247
{
2410
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
   248
  return DoMakeParamSpecHelperTwo<BASE> (setter, getter, initialValue, checker);
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   249
}
2371
2118204a86e6 initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   250
2410
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
   251
template <typename BASE, typename T, typename U, typename V, typename W, typename CHECKER>
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   252
Ptr<ParamSpec>
2408
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   253
DoMakeParamSpecHelperTwo (V (T::*getter) (void) const, 
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   254
			  void (T::*setter) (U), 
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   255
			  W initialValue)
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   256
{
2410
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
   257
  return DoMakeParamSpecHelperTwo<BASE> (setter, getter, initialValue);
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   258
}
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2374
diff changeset
   259
2410
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
   260
template <typename BASE, typename T1, typename V>
2408
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   261
Ptr<ParamSpec>
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   262
MakeParamSpecHelper (T1 a1, V initialValue)
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   263
{
2410
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
   264
  return DoMakeParamSpecHelperOne<BASE> (a1, initialValue);
2408
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   265
}
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   266
2410
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
   267
template <typename BASE, typename T1, typename T2, typename V>
2408
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   268
Ptr<ParamSpec>
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   269
MakeParamSpecHelper (T1 a1, T2 a2, V initialValue)
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   270
{
2410
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
   271
  return DoMakeParamSpecHelperTwo<BASE> (a1, a2, initialValue);
2408
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   272
}
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   273
2410
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
   274
template <typename BASE, typename T1, typename V, typename CHECKER>
2408
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   275
Ptr<ParamSpec>
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   276
MakeParamSpecHelperWithChecker (T1 a1, V initialValue, CHECKER checker)
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   277
{
2410
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
   278
  return DoMakeParamSpecHelperOne<BASE> (a1, initialValue, checker);
2408
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   279
}
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   280
2410
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
   281
template <typename BASE, typename T1, typename T2, typename V, typename CHECKER>
2408
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   282
Ptr<ParamSpec>
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   283
MakeParamSpecHelperWithChecker (T1 a1, T2 a2, V initialValue, CHECKER checker)
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   284
{
2410
88dc7d4a6731 introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2408
diff changeset
   285
  return DoMakeParamSpecHelperTwo<BASE> (a1, a2, initialValue, checker);
2408
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   286
}
04fe819b3ad1 rework param-spec-helper code to avoid having to deal with pointers to member functions et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2403
diff changeset
   287
2371
2118204a86e6 initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   288
} // namespace ns3
2118204a86e6 initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   289
2118204a86e6 initial work on Value code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   290
#endif /* PARAM_SPEC_HELPER_H */