waservicefactoryt.h 815 B

12345678910111213141516171819202122232425262728
  1. #ifndef __WASERVICEFACTORYT_IMPL_H
  2. #define __WASERVICEFACTORYT_IMPL_H
  3. /*<?<autoheader/>*/
  4. /*?>*/
  5. #include "waservicefactorybase.h"
  6. // this is a service factory template that will manufacture any number
  7. // of a given class SERVICE, which is derived from service class SERVICETYPE
  8. template <class SERVICETYPE, class SERVICE>
  9. class waServiceFactoryT : public waServiceFactoryBase<SERVICETYPE, SERVICE> {
  10. public:
  11. waServiceFactoryT(GUID myGuid = INVALID_GUID) :
  12. waServiceFactoryBase<SERVICETYPE, SERVICE>(myGuid) {}
  13. virtual SERVICETYPE *newService() {
  14. SERVICE *ret = new SERVICE;
  15. ASSERT(ret != NULL);
  16. return ret;
  17. }
  18. virtual int delService(SERVICETYPE *service) {
  19. ASSERT(service != NULL);
  20. delete static_cast<SERVICE*>(service);
  21. return 1;
  22. }
  23. };
  24. #endif // __WASERVICEFACTORYT_IMPL_H