cesium-native 0.43.0
Loading...
Searching...
No Matches
IAssetAccessor.h
1#pragma once
2
3#include "Future.h"
4#include "IAssetRequest.h"
5#include "Library.h"
6
7#include <cstddef>
8#include <memory>
9#include <span>
10#include <string>
11#include <vector>
12
13namespace CesiumAsync {
14
15class AsyncSystem;
16
21class CESIUMASYNC_API IAssetAccessor {
22public:
26 typedef std::pair<std::string, std::string> THeader;
27
28 virtual ~IAssetAccessor() = default;
29
40 get(const AsyncSystem& asyncSystem,
41 const std::string& url,
42 const std::vector<THeader>& headers = {}) = 0;
43
58 const AsyncSystem& asyncSystem,
59 const std::string& verb,
60 const std::string& url,
61 const std::vector<THeader>& headers = std::vector<THeader>(),
62 const std::span<const std::byte>& contentPayload = {}) = 0;
63
70 virtual void tick() noexcept = 0;
71};
72
73} // 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 Promise.h:11
Provides asynchronous access to assets, usually files downloaded via HTTP.
virtual void tick() noexcept=0
Ticks the asset accessor system while the main thread is blocked.
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 std::span< const std::byte > &contentPayload={})=0
Starts a new request to the given URL, using the provided HTTP verb and the provided content payload.
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.