namespace X3DTK {

template<class T, class V>
MemberFunctor<T, V>::MemberFunctor(V T:: *member)
: _member(member)
{
}

template<class T, class V>
X3DField MemberFunctor<T, V>::getValueOf(X3DAbstractNode const *N) const
{
  return X3DField(typeid(V), const_cast<unsigned char *>(reinterpret_cast<const unsigned char *>(&(static_cast<T const *>(N)->*_member))));
}
template<class T, class V>
void MemberFunctor<T, V>::setValueOf(X3DAbstractNode *N, const X3DField &field)
{
  (static_cast<T *>(N)->*_member) = *reinterpret_cast<V *>(field.data());
}

}
