5 #include "../../include/librealsense2/h/rs_types.h" 10 #define MAP_EXTENSION(E, T) \ 11 template<> struct ExtensionToType<E> { \ 13 static constexpr const char* to_string() { return #T; }; \ 15 template<> struct TypeToExtension<T> { \ 16 static constexpr rs2_extension value = E; \ 17 static constexpr const char* to_string() { return #T; }; \ 36 virtual void update(std::shared_ptr<extension_snapshot> ext) = 0;
53 virtual void create_snapshot(std::shared_ptr<T>& snapshot)
const = 0;
59 virtual void enable_recording(std::function<
void(
const T&)> recording_function) = 0;
70 template <
typename To>
71 inline bool try_extend(std::shared_ptr<extension_snapshot> from,
void** ext)
78 auto casted = std::dynamic_pointer_cast<To>(from);
79 if (casted ==
nullptr)
87 template<
typename T,
typename P>
88 inline std::shared_ptr<T>
As(std::shared_ptr<P> ptr)
90 return std::dynamic_pointer_cast<
T>(ptr);
93 template<
typename T,
typename P>
96 return dynamic_cast<T*
>(ptr);
99 template<
typename T,
typename P>
100 inline bool Is(std::shared_ptr<P> ptr)
102 return As<T>(ptr) !=
nullptr;
105 template<
typename T,
typename P>
106 inline bool Is(P* ptr)
108 return As<T>(ptr) !=
nullptr;
bool try_extend(std::shared_ptr< extension_snapshot > from, void **ext)
std::shared_ptr< T > As(std::shared_ptr< P > ptr)
bool Is(std::shared_ptr< P > ptr)
virtual ~extendable_interface()=default
void update(rs2::update_device fwu_dev, std::vector< uint8_t > fw_image)
virtual bool extend_to(rs2_extension extension_type, void **ptr)=0
rs2_extension
Specifies advanced interfaces (capabilities) objects may implement.