|
From: Frank V. C. <fr...@us...> - 2000-10-30 05:01:29
|
Update of /cvsroot/corelinux/clfw/src/libs/clfw In directory slayer.i.sourceforge.net:/tmp/cvs-serv14134/src/libs/clfw Modified Files: MetaType.cpp Log Message: 119678 Completed dispatch table functionality with example Index: MetaType.cpp =================================================================== RCS file: /cvsroot/corelinux/clfw/src/libs/clfw/MetaType.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** MetaType.cpp 2000/10/29 17:09:52 1.10 --- MetaType.cpp 2000/10/30 05:01:25 1.11 *************** *** 340,344 **** // ! // Get the descriptor, getter, and subsequent value // --- 340,344 ---- // ! // Get the descriptor, setter, and subsequent value // *************** *** 379,382 **** --- 379,443 ---- } + // + // Dispatch Method + // + + void MetaType::dispatch + ( + FrameworkEntityPtr aInstanceObject, + char *aMethodName, + void **args, + void *retArg + ) + throw( NullPointerException, DescriptorNotFound ) + { + if( aMethodName == NULLPTR || aInstanceObject == NULLPTR ) + { + throw NullPointerException(LOCATION); + } + else + { + ; // do nothing + } + + // + // Get the descriptor, function, and subsequent value + // + + DispatchDescriptorCptr aDesc( NULLPTR ); + + DispatchDescriptorCptr *pMd(theDispatchFunctions); + + while( *pMd != NULLPTR ) + { + if( strcmp((*pMd)->theClassMethodName,aMethodName) == 0 ) + { + aDesc = *pMd; + if( aDesc->theFunction != NULLPTR ) + { + (*(aDesc->theFunction))(aInstanceObject,args,retArg); + } + else + { + throw NullPointerException(LOCATION); + } + break; + } + else + { + ; // do nothing + } + ++pMd; + } + + if( aDesc == NULLPTR ) + { + throw DescriptorNotFound(aMethodName, LOCATION); + } + else + { + ; // do nothing + } + } } |