cesium-native  0.41.0
IAssetAccessor.h
1 #pragma once
2 
3 #include "Future.h"
4 #include "IAssetRequest.h"
5 #include "Library.h"
6 
7 #include <gsl/span>
8 
9 #include <cstddef>
10 #include <memory>
11 #include <string>
12 #include <vector>
13 
14 namespace CesiumAsync {
15 
16 class AsyncSystem;
17 
22 class CESIUMASYNC_API IAssetAccessor {
23 public:
27  typedef std::pair<std::string, std::string> THeader;
28 
29  virtual ~IAssetAccessor() = default;
30 
41  get(const AsyncSystem& asyncSystem,
42  const std::string& url,
43  const std::vector<THeader>& headers = {}) = 0;
44 
59  const AsyncSystem& asyncSystem,
60  const std::string& verb,
61  const std::string& url,
62  const std::vector<THeader>& headers = std::vector<THeader>(),
63  const gsl::span<const std::byte>& contentPayload = {}) = 0;
64 
71  virtual void tick() noexcept = 0;
72 };
73 
74 } // namespace CesiumAsync
A system for managing asynchronous requests and tasks.
Definition: AsyncSystem.h:36
A value that will be available in the future, as produced by AsyncSystem.
Definition: Future.h:29
Provides asynchronous access to assets, usually files downloaded via HTTP.
virtual CesiumAsync::Future< std::shared_ptr< IAssetRequest > > request(const AsyncSystem &asyncSystem, const std::string &verb, const std::string &url, const std::vector< THeader > &headers=std::vector< THeader >(), const gsl::span< const std::byte > &contentPayload={})=0
Starts a new request to the given URL, using the provided HTTP verb and the provided content payload.
virtual void tick() noexcept=0
Ticks the asset accessor system while the main thread is blocked.
std::pair< std::string, std::string > THeader
An HTTP header represented as a key/value pair.
virtual CesiumAsync::Future< std::shared_ptr< IAssetRequest > > get(const AsyncSystem &asyncSystem, const std::string &url, const std::vector< THeader > &headers={})=0
Starts a new request for the asset with the given URL. The request proceeds asynchronously without bl...
Classes that support asynchronous operations.