IOLink  IOL_v1.6.1_release
StreamAccessProvider.h
1 #pragma once
2 
3 #include <iolink/IOLinkAPI.h>
4 #include <iolink/storage/StreamAccess.h>
5 
6 #include <memory>
7 
8 namespace iolink
9 {
10 
14 class IOLINK_INTERFACE_API StreamAccessProvider
15 {
16 public:
20  inline static bool isStreamAccess(std::shared_ptr<DataAccess> accessor) noexcept
21  {
22  return (dynamic_cast<const StreamAccess*>(accessor.get()) != nullptr);
23  }
24 
30  inline static std::shared_ptr<StreamAccess> toStream(std::shared_ptr<DataAccess> storage) noexcept
31  {
32  return std::dynamic_pointer_cast<StreamAccess>(storage);
33  }
34 };
35 
36 } // end namespace iolink