DownloaderFactory.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * TI Voxel Lib component.
  3. *
  4. * Copyright (c) 2014 Texas Instruments Inc.
  5. */
  6. #ifndef VOXEL_DOWNLOADER_FACTORY_H
  7. #define VOXEL_DOWNLOADER_FACTORY_H
  8. #include "Downloader.h"
  9. #include "Common.h"
  10. #include "Device.h"
  11. namespace Voxel
  12. {
  13. /**
  14. * \addtogroup CamSys
  15. * @{
  16. */
  17. class VOXEL_EXPORT DownloaderFactory
  18. {
  19. protected:
  20. Vector<DevicePtr> _supportedDevices;
  21. inline void _addSupportedDevices(const Vector<DevicePtr> &devices);
  22. String _name;
  23. public:
  24. DownloaderFactory(const String &name): _name(name) {}
  25. inline const String &name() const { return _name; }
  26. inline const Vector<DevicePtr> &getSupportedDevices() const { return _supportedDevices; }
  27. // Instantiate a depth camera for the specified device
  28. virtual DownloaderPtr getDownloader(DevicePtr device) = 0;
  29. virtual ~DownloaderFactory() {}
  30. };
  31. void DownloaderFactory::_addSupportedDevices(const Vector<DevicePtr> &devices)
  32. {
  33. _supportedDevices.reserve(_supportedDevices.size() + devices.size());
  34. _supportedDevices.insert(_supportedDevices.end(), devices.begin(), devices.end());
  35. }
  36. // Implement this function in every device-specific voxel library
  37. typedef Ptr<DownloaderFactory> DownloaderFactoryPtr;
  38. #ifndef SWIG
  39. extern "C" void getDownloaderFactory(DownloaderFactoryPtr &downloaderFactory);
  40. #endif
  41. typedef void (*GetDownloaderFactory)(DownloaderFactoryPtr &downloaderFactory); // Function type to return DownloaderFactory
  42. /**
  43. * @}
  44. */
  45. }
  46. #endif // DEPTHCAMERA_FACTORY_H