| 4 |
|
#include "ConstraintPair.hpp" |
| 5 |
|
|
| 6 |
|
CallbackFunctor:: CallbackFunctor(SimInfo* rhs) : info(rhs){ |
| 7 |
< |
registerFunction(KeyType(typeid(ConstraintElement), typeid(ConstraintElement)), &CallbackFunctor::constrainAtomAtom); |
| 8 |
< |
registerFunction(KeyType(typeid(ConstraintElement), typeid(ConstraintRigidBody)), &CallbackFunctor::constrainAtomRigidBody); |
| 9 |
< |
registerFunction(KeyType(typeid(ConstraintRigidBody), typeid(ConstraintElement)), &CallbackFunctor::constrainRigidBodyAtom); |
| 7 |
> |
registerFunction(KeyType(typeid(ConstraintAtom), typeid(ConstraintAtom)), &CallbackFunctor::constrainAtomAtom); |
| 8 |
> |
registerFunction(KeyType(typeid(ConstraintAtom), typeid(ConstraintRigidBody)), &CallbackFunctor::constrainAtomRigidBody); |
| 9 |
> |
registerFunction(KeyType(typeid(ConstraintRigidBody), typeid(ConstraintAtom)), &CallbackFunctor::constrainRigidBodyAtom); |
| 10 |
|
registerFunction(KeyType(typeid(ConstraintRigidBody), typeid(ConstraintRigidBody)), &CallbackFunctor::constrainRigidBodyRigidBody); |
| 11 |
|
} |
| 12 |
|
void CallbackFunctor::registerFunction(const KeyType& key, MappedType f){ |
| 17 |
|
DoubleDispatchMap::iterator foundResult; |
| 18 |
|
curPair = consPair; |
| 19 |
|
|
| 20 |
< |
foundResult = ddMap.find(KeyType(typeid(consPair->firstElem), typeid(consPair->secondElem))); |
| 20 |
> |
//typeid must operate on reference, otherwise it return the type_info of base class |
| 21 |
> |
foundResult = ddMap.find(KeyType(typeid(*(consPair->firstElem)), typeid(*(consPair->secondElem)))); |
| 22 |
|
|
| 23 |
|
if(foundResult != ddMap.end()){ |
| 24 |
|
return (this->*(foundResult->second))(consPair->firstElem, consPair->secondElem); |