|
A11 (C++ runtime)
Native C++ implementation of the A11 streaming action runtime
|
Type-and-mimetype indexed serialization of values to/from Chunks. More...
#include <any>#include <cstddef>#include <functional>#include <string>#include <string_view>#include <typeindex>#include <typeinfo>#include <utility>#include <vector>#include <absl/base/nullability.h>#include <absl/status/status.h>#include <absl/status/status_macros.h>#include <absl/status/statusor.h>#include <absl/strings/str_cat.h>#include "a11/data/types.h"#include "a11/exception_guard.h"Go to the source code of this file.
Classes | |
| class | a11::data::TypedChunkObject< T > |
| The local fast path: a value in a chunk, encoded only if needed. More... | |
| class | a11::data::SerializationRegistry |
Namespaces | |
| namespace | a11 |
| namespace | a11::data |
Functions | |
| template<typename T > | |
| std::optional< T > | a11::data::TryTakeObject (const Chunk &chunk, std::string_view tag) |
Takes the value out of chunk, if it is carrying one of type T. | |
| SerializationRegistry & | a11::data::GlobalSerializationRegistry () |
| Returns the process-wide registry (defaults pre-installed). | |
| template<typename T > | |
| Chunk | a11::data::MakeChunkObject (T value, std::string tag, std::string mimetype, std::shared_ptr< const SerializationRegistry > registry) |
Builds a chunk carrying value, with no bytes produced. | |
Variables | |
| constexpr std::string_view | a11::data::kJsonMimetype = "application/json" |
| Media type of the built-in JSON codec. | |
| constexpr std::string_view | a11::data::kMsgpackMimetype = "application/x-msgpack" |
| Media type of the built-in MessagePack codec. | |
| constexpr std::string_view | a11::data::kTextMimetype = "text/plain" |
| Media type of UTF-8 text carried as itself. | |
| constexpr std::string_view | a11::data::kBytesMimetype = "application/octet-stream" |
| Media type of opaque bytes carried as themselves. | |
Type-and-mimetype indexed serialization of values to/from Chunks.
SerializationRegistry maps a C++ type and media type to codecs. Chunk metadata names the representation and, for non-native shapes, a type parameter such as "application/json;type=a11.sdk.Interaction". Payloads carry no type name. Bare JSON decodes to nlohmann::json; FromChunk<T>() attempts the requested type and returns codec errors. JSON and MessagePack codecs are registered by default.