| 1 |
|
|
1 |
|
|
| 2 |
|
// Copyright (c) 2025 Vinnie Falco (vinnie.falco@gmail.com)
|
2 |
|
// Copyright (c) 2025 Vinnie Falco (vinnie.falco@gmail.com)
|
| 3 |
|
|
3 |
|
|
| 4 |
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
4 |
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
| 5 |
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
5 |
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
| 6 |
|
|
6 |
|
|
| 7 |
|
// Official repository: https://github.com/cppalliance/http
|
7 |
|
// Official repository: https://github.com/cppalliance/http
|
| 8 |
|
|
8 |
|
|
| 9 |
|
|
9 |
|
|
| 10 |
|
#ifndef BOOST_HTTP_DATASTORE_HPP
|
10 |
|
#ifndef BOOST_HTTP_DATASTORE_HPP
|
| 11 |
|
#define BOOST_HTTP_DATASTORE_HPP
|
11 |
|
#define BOOST_HTTP_DATASTORE_HPP
|
| 12 |
|
|
12 |
|
|
| 13 |
|
#include <boost/http/detail/config.hpp>
|
13 |
|
#include <boost/http/detail/config.hpp>
|
| 14 |
|
#include <boost/http/core/polystore.hpp>
|
14 |
|
#include <boost/http/core/polystore.hpp>
|
| 15 |
|
|
15 |
|
|
| 16 |
|
|
16 |
|
|
| 17 |
|
|
17 |
|
|
| 18 |
|
|
18 |
|
|
| 19 |
|
/** A polymorphic data container with clear functionality.
|
19 |
|
/** A polymorphic data container with clear functionality.
|
| 20 |
|
|
20 |
|
|
| 21 |
|
This class extends @ref polystore to provide a container
|
21 |
|
This class extends @ref polystore to provide a container
|
| 22 |
|
for type-erased objects with an explicit clear operation.
|
22 |
|
for type-erased objects with an explicit clear operation.
|
| 23 |
|
It is commonly used as a service container.
|
23 |
|
It is commonly used as a service container.
|
| 24 |
|
|
24 |
|
|
| 25 |
|
|
25 |
|
|
| 26 |
|
// Example: Using datastore with services
|
26 |
|
// Example: Using datastore with services
|
| 27 |
|
boost::http::datastore ctx;
|
27 |
|
boost::http::datastore ctx;
|
| 28 |
|
|
28 |
|
|
| 29 |
|
|
29 |
|
|
| 30 |
|
|
30 |
|
|
| 31 |
|
// Clean up all services when done
|
31 |
|
// Clean up all services when done
|
| 32 |
|
|
32 |
|
|
| 33 |
|
|
33 |
|
|
| 34 |
|
|
34 |
|
|
| 35 |
|
class datastore : public polystore
|
35 |
|
class datastore : public polystore
|
| 36 |
|
|
36 |
|
|
| 37 |
|
|
37 |
|
|
| 38 |
|
|
38 |
|
|
| 39 |
|
|
39 |
|
|
| 40 |
|
Constructs an empty datastore.
|
40 |
|
Constructs an empty datastore.
|
| 41 |
|
|
41 |
|
|
| 42 |
|
|
42 |
|
|
| 43 |
|
|
43 |
|
|
| 44 |
|
/** Remove and destroy all stored objects.
|
44 |
|
/** Remove and destroy all stored objects.
|
| 45 |
|
|
45 |
|
|
| 46 |
|
All stored objects are destroyed in the reverse order
|
46 |
|
All stored objects are destroyed in the reverse order
|
| 47 |
|
of construction. The container is left empty.
|
47 |
|
of construction. The container is left empty.
|
| 48 |
|
|
48 |
|
|
| 49 |
|
|
49 |
|
|
| 50 |
|
|
50 |
|
|
| 51 |
|
|
51 |
|
|
| 52 |
|
|
52 |
|
|
| 53 |
|
|
53 |
|
|
| 54 |
|
|
54 |
|
|
| 55 |
|
|
55 |
|
|
| 56 |
|
|
56 |
|
|
| 57 |
|
|
57 |
|
|
| 58 |
|
|
58 |
|
|