IOLink IOL_v1.8.0_release
Loading...
Searching...
No Matches
RandomAccessFactory.h
1#pragma once
2
3#include <map>
4#include <memory>
5
6#include <iolink/IOLinkAPI.h>
7#include <iolink/Uri.h>
8#include <iolink/storage/HTTPHeaders.h>
9#include <iolink/storage/RandomAccess.h>
10#include <iolink/storage/StreamAccess.h>
11
12namespace iolink
13{
14
18class IOLINK_API RandomAccessFactory
19{
20public:
21 RandomAccessFactory() = delete;
22 RandomAccessFactory(const RandomAccessFactory& other) = delete; // copy constructor
23 RandomAccessFactory(RandomAccessFactory&& other) = delete; // move constructor
24 RandomAccessFactory& operator=(const RandomAccessFactory& other) = delete; // copy assignment
25 RandomAccessFactory& operator=(RandomAccessFactory&& other) = delete; // move assignment
26
30 static std::shared_ptr<RandomAccess> allocate(size_t size);
31
37 static std::shared_ptr<RandomAccess> copyInMemory(std::shared_ptr<RandomAccess> randomAccess);
38
47 static std::shared_ptr<RandomAccess> mapFile(const std::string& filePath);
48
55 static std::shared_ptr<RandomAccess> fromBuffer(void* buffer, size_t size);
56
63 static std::shared_ptr<RandomAccess> openURIRead(const Uri& uri);
64
73 static std::shared_ptr<RandomAccess> openHTTPRead(const Uri& uri,
74 const std::string& method,
75 const HTTPHeaders& headers);
76
86 static std::shared_ptr<RandomAccess> extractRegion(std::shared_ptr<RandomAccess> src, size_t offset);
87
98 static std::shared_ptr<RandomAccess> extractRegion(std::shared_ptr<RandomAccess> src, size_t offset, size_t size);
99
104 static std::shared_ptr<RandomAccess> fromStream(std::shared_ptr<StreamAccess> stream);
105};
106
107} // end namespace iolink