DepthCameraFactory.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * TI Voxel Lib component.
  3. *
  4. * Copyright (c) 2014 Texas Instruments Inc.
  5. */
  6. #ifndef VOXEL_DEPTHCAMERA_FACTORY_H
  7. #define VOXEL_DEPTHCAMERA_FACTORY_H
  8. #include "DepthCamera.h"
  9. #include "Common.h"
  10. #include "Device.h"
  11. namespace Voxel
  12. {
  13. /**
  14. * \addtogroup CamSys
  15. * @{
  16. */
  17. class VOXEL_EXPORT DepthCameraFactory
  18. {
  19. protected:
  20. Vector<DevicePtr> _supportedDevices;
  21. inline void _addSupportedDevices(const Vector<DevicePtr> &devices);
  22. String _name;
  23. public:
  24. DepthCameraFactory(const String &name): _name(name) {}
  25. inline const String &name() const { return _name; }
  26. inline const Vector<DevicePtr> &getSupportedDevices() const { return _supportedDevices; }
  27. // Get the list of channels supported by this device
  28. virtual bool getChannels(Device &device, Vector<int> &channels) = 0;
  29. // Instantiate a depth camera for the specified device
  30. virtual DepthCameraPtr getDepthCamera(DevicePtr device) = 0;
  31. virtual bool getFrameGenerator(uint8_t frameType, GeneratorIDType generatorID, FrameGeneratorPtr &frameGenerator) = 0;
  32. virtual Vector<GeneratorIDType> getSupportedGeneratorTypes() = 0;
  33. virtual ~DepthCameraFactory() {}
  34. };
  35. void DepthCameraFactory::_addSupportedDevices(const Vector<DevicePtr> &devices)
  36. {
  37. _supportedDevices.reserve(_supportedDevices.size() + devices.size());
  38. _supportedDevices.insert(_supportedDevices.end(), devices.begin(), devices.end());
  39. }
  40. // Implement this function in every device-specific voxel library
  41. typedef Ptr<DepthCameraFactory> DepthCameraFactoryPtr;
  42. #ifndef SWIG
  43. extern "C" void getDepthCameraFactory(DepthCameraFactoryPtr &depthCameraFactory);
  44. extern "C" int getABIVersion();
  45. #endif
  46. typedef void (*GetDepthCameraFactory)(DepthCameraFactoryPtr &depthCameraFactory); // Function type to return DepthCameraFactory
  47. typedef int(*GetABIVersion)(); // Function type to return ABI version
  48. /**
  49. * @}
  50. */
  51. }
  52. #endif // DEPTHCAMERA_FACTORY_H