52 template <
typename R,
class TList,
unsigned int size = 4 * sizeof(
void*)>
133 template <
typename F>
explicit Functor(F
const& fun)
135 using StoredType = FunctorImpl<F>;
136 vptr_ = _init<StoredType>(fun);
149 template <
class P,
typename MF>
explicit Functor(P
const& pobj, MF memfun)
151 using StoredType = MemberFnImpl<P, MF>;
152 vptr_ = _init<StoredType>(std::pair<P, MF>(pobj, memfun));
162 #define DoCall(parms) return vptr_->call_(*this, parms); 170 inline R
operator()(
Parm1 p1,
Parm2 p2,
Parm3 p3,
Parm4 p4,
Parm5 p5,
Parm6 p6)
const {
DoCall(
CallParms<TList>::Make(p1, p2, p3, p4, p5, p6)) }
171 inline R
operator()(
Parm1 p1,
Parm2 p2,
Parm3 p3,
Parm4 p4,
Parm5 p5,
Parm6 p6,
Parm7 p7)
const {
DoCall(
CallParms<TList>::Make(p1, p2, p3, p4, p5, p6, p7)) }
185 template <
typename V,
class Derived>
193 Derived
const& this_ = src.
val_.template get<Derived const>();
194 return dest.
_init<Derived>(this_.val_);
197 template <
typename T>
207 template <
class P,
typename T>
218 template <
class T,
class V>
219 typename FunImplBase::VTable*
_init(V
const& v)
221 val_.template init<T>(v);
222 static typename FunImplBase::VTable vtbl =
233 template <
typename T>
inline T*
init1(T* v) {
return new(getbuf()) T(v); }
234 template <
typename T,
typename V>
inline T*
init(V
const& v) {
return new(getbuf()) T(v); }
235 template <
typename T>
inline void destroy()
const { (*
reinterpret_cast<T const*
>(getbuf())).~T(); }
236 template <
typename T>
inline T
const&
get()
const {
return *
reinterpret_cast<T const*
>(getbuf()); }
237 template <
typename T>
inline T&
get() {
return *
reinterpret_cast<T*
>(getbuf()); }
239 void const*
getbuf()
const {
return &buffer_[0]; }
240 unsigned char buffer_[size];
242 template <
typename T>
245 template <
typename V>
inline static T*
init(
Typeless& val, V
const& v) {
return val.template init<T>(v); }
247 inline static T
const&
get(
Typeless const& val) {
return val.template get<T>(); }
248 inline static T&
get(
Typeless& val) {
return val.template get<T>(); }
250 template <
typename T>
253 template <
typename V>
inline static T*
init(
Typeless& val, V
const& v) {
return *val.template init<T*>(
new T(v)); }
255 inline static T
const&
get(
Typeless const& val) {
return *val.template get<T const*>(); }
256 inline static T&
get(
Typeless& val) {
return *val.template get<T*>(); }
258 template <
typename T>
273 typename FunImplBase::VTable*
vptr_;
286 template <
typename CallType>
inline 301 template <
typename CallType,
class PObj>
inline 315 template <
typename CallType,
class Fun>
inline 330 template <
typename CallType,
class PObj>
inline
typename trUtil::TypeAtNonStrict< TYPELIST_1(const Message_T &), 6, trUtil::NullType >::Result Parm7
Functor(Functor const &src)
Copy constructor.
R operator()(ParmsListType const &parms) const
Functor(F const &fun)
ctor for static fns and arbitrary functors.
typename trUtil::TypeAtNonStrict< TYPELIST_1(const Message_T &), 3, trUtil::NullType >::Result Parm4
void(* destroy_)(Functor const &)
typename CallParms< TYPELIST_1(const Message_T &) >::ParmsListType ParmsListType
FunStorageImpl(V const &val)
R operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5) const
typename trUtil::TypeAtNonStrict< TYPELIST_1(const Message_T &), 0, trUtil::NullType >::Result Parm1
Functor< typename trUtil::FunTraits< CallType >::ResultType, typename trUtil::FunTraits< CallType >::TypeListType > MakeFunctor(CallType fun)
Constructor.
R operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4) const
R operator()(Parm1 p1, Parm2 p2) const
FunctorImpl(T const &val)
static void destroy(Typeless const &val)
R(* call_)(Functor const &, ParmsListType)
bool operator!() const
is-empty selector.
R operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, Parm6 p6) const
R operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, Parm6 p6, Parm7 p7) const
static void destroy(Typeless const &val)
FunImplBase::VTable * _init(V const &v)
static void Destroy(Functor const &src)
typename trUtil::TypeAtNonStrict< TYPELIST_1(const Message_T &), 2, trUtil::NullType >::Result Parm3
Namespace that holds various utility classes for the engine.
static FunImplBase::VTable * Clone(Functor const &src, Functor &dest)
FunImplBase::VTable * vptr_
typename trUtil::TypeAtNonStrict< TYPELIST_1(const Message_T &), 4, trUtil::NullType >::Result Parm5
static T * init(Typeless &val, V const &v)
MemberFnImpl(std::pair< P, T > const &val)
bool valid() const
Valids this object.
static T * init(Typeless &val, V const &v)
VTable *(* clone_)(Functor const &, Functor &)
typename trUtil::TypeAtNonStrict< TYPELIST_1(const Message_T &), 5, trUtil::NullType >::Result Parm6
Functor()
default construction, assignment and destruction.
R operator()(Parm1 p1, Parm2 p2, Parm3 p3) const
typename trUtil::TypeAtNonStrict< TYPELIST_1(const Message_T &), 1, trUtil::NullType >::Result Parm2
void const * getbuf() const
typename trUtil::Select< sizeof(T)<=sizeof(Typeless), ByValue< T >, NewAlloc< T > >::Result Type
TYPELIST_1(const Message_T &) TypeListType
static R Call(Functor const &src, ParmsListType parms)
R operator()(Parm1 p1) const
Functor(P const &pobj, MF memfun)
ctor for member fns (note: raw ptrs and smart ptrs are equally welcome in pobj)
Functor & operator=(Functor const &src)
Assignment operator.
static R Call(Functor const &src, ParmsListType parms)