roo_io
API Documentation for roo_io
Loading...
Searching...
No Matches
iterable.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4
5#include "roo_io/status.h"
6
7// Iterable defines a template contract that allows clients to read their
8// content as a stream of bytes, by creating input iterators. They are intended
9// for performance-critical applications where it is desirable that byte reads
10// are inlined. An example application is to read byte-by-byte from an in-memory
11// resource.
12
13// The baseline 'iterable' contract is as follows:
14//
15// class MyIterable {
16// public:
17// // Iterable must be movable.
18// //
19// // MyIterable(MyIterable&& other);
20//
21// // Returns a new input iterator over the iterable's content.
22// //
23// MyInputIterator iterator() const;
24// };
25
26// The more advanced 'multipass iterable' contract is as follows:
27//
28// class MyMultipassIterable {
29// public:
30// // Iterable must be movable.
31// //
32// MyMultipassIterable(MyMultipassIterable&& other);
33//
34// // Returns a new multipass input iterator over the iterable's content.
35// //
36// MyMultipassInputIterator iterator() const;
37// };