| IOLink 1.11.0

Loading...
Searching...
No Matches
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
iolink::StreamAccess
Mother interface for all stream-like data accessors.
Definition StreamAccess.h:60
iolink::StreamAccessProvider
Utility class to check and convert a DataAccess into a StreamAccess.
Definition StreamAccessProvider.h:15
iolink::StreamAccessProvider::toStream
static std::shared_ptr< StreamAccess > toStream(std::shared_ptr< DataAccess > storage) noexcept
Definition StreamAccessProvider.h:30
iolink::StreamAccessProvider::isStreamAccess
static bool isStreamAccess(std::shared_ptr< DataAccess > accessor) noexcept
Checks if DataAccess is a StreamAccess.
Definition StreamAccessProvider.h:20
iolink
All IOLink symbols are enclosed in this namespace.
Definition ArrayX.h:8