| 1 | /*++ |
| 2 | |
| 3 | Copyright (c) Microsoft. All rights reserved. |
| 4 | |
| 5 | Module Name: |
| 6 | |
| 7 | ExecutionContextData.h |
| 8 | |
| 9 | Abstract: |
| 10 | |
| 11 | Header file for defining execution context data mappings. |
| 12 | |
| 13 | --*/ |
| 14 | #pragma once |
| 15 | #include "EnumVariantMap.h" |
| 16 | #include "ContainerModel.h" |
| 17 | #include "ImageModel.h" |
| 18 | #include "NetworkModel.h" |
| 19 | #include "SessionModel.h" |
| 20 | #include "wslc.h" |
| 21 | #include <wslc_schema.h> |
| 22 | |
| 23 | #include <string> |
| 24 | |
| 25 | #define DEFINE_DATA_MAPPING(_typeName_, _valueType_) \ |
| 26 | template <> \ |
| 27 | struct DataMapping<Data::_typeName_> \ |
| 28 | { \ |
| 29 | using value_t = _valueType_; \ |
| 30 | }; |
| 31 | |
| 32 | namespace wsl::windows::wslc::execution { |
| 33 | // Names a piece of data stored in the context by a task step. |
| 34 | // Must start at 0 to enable direct access to variant in Context. |
| 35 | // Max must be last and unused. |
| 36 | enum class Data : size_t |
| 37 | { |
| 38 | Session, |
| 39 | Containers, |
| 40 | ContainerOptions, |
| 41 | Images, |
| 42 | Volumes, |
| 43 | Networks, |
| 44 | NetworkEndpointOptions, |
| 45 | |
| 46 | Max |
| 47 | }; |
| 48 | |
| 49 | namespace details { |
| 50 | template <Data D> |
| 51 | struct DataMapping |
| 52 | { |
| 53 | }; |
| 54 | |
| 55 | DEFINE_DATA_MAPPING(Session, wsl::windows::wslc::models::Session); |
| 56 | DEFINE_DATA_MAPPING(Containers, std::vector<wsl::windows::wslc::models::ContainerInformation>); |
| 57 | DEFINE_DATA_MAPPING(ContainerOptions, wsl::windows::wslc::models::ContainerOptions); |
| 58 | DEFINE_DATA_MAPPING(Images, std::vector<wsl::windows::wslc::models::ImageInformation>); |
| 59 | DEFINE_DATA_MAPPING(Volumes, std::vector<wsl::windows::common::wslc_schema::VolumeListEntry>); |
| 60 | DEFINE_DATA_MAPPING(Networks, std::vector<wsl::windows::common::wslc_schema::NetworkListEntry>); |
| 61 | DEFINE_DATA_MAPPING(NetworkEndpointOptions, wsl::windows::wslc::models::NetworkEndpointOptions); |
| 62 | } // namespace details |
| 63 | |
| 64 | struct DataMap : wsl::windows::wslc::EnumBasedVariantMap<Data, wsl::windows::wslc::execution::details::DataMapping> |
| 65 | { |
| 66 | }; |
| 67 | } // namespace wsl::windows::wslc::execution |