stream_class.h#

Defines

FIELD_VARINT#
FIELD_FIXED64#
FIELD_FIXED_SIZE#
FIELD_FIXED32#
SERIALIZATION_METHOD()#

Serialization/parsing core declaration macro for generated proto classes.

BEGIN_PROTO(cls, doc)#

Macro for beginning a generated proto class with a default constructor.

BEGIN_PROTO_NOINIT(cls, doc)#

Macro for beginning a generated proto class without adding a default constructor.

END_PROTO()#

Macro for ending a generated proto class and injecting the serialization/parsing API.

FIELD(type, name, order, doc)#
FIELD_BYTES(name, order, doc)#

Like FIELD but for ByteSpan (protobuf bytes) fields. \ Bytes are exposed as a utils::ByteSpan (breaking change). The old protobuf-style \ name()/mutable_##name() accessors returned const std::string&/std::string*, \ which is unsafe here: a ByteSpan may hold borrowed (zero-copy) or aligned-owned bytes that \ are not backed by a std::string, so exposing them as a std::string would require a hidden copy \ and could not preserve alignment or borrowed semantics. name()/mutable_##name() are \ kept but now return utils::ByteSpan, equivalent to ref_##name(); use the ByteSpan API \ (data()/size()/assign()/…) to read or mutate bytes.

FIELD_DEFAULT(type, name, order, default_value, doc)#
FIELD_STR(name, order, doc)#
FIELD_REPEATED_BASE(type, repeated_type, name, order, doc)#
FIELD_REPEATED(type, name, order, doc)#
FIELD_REPEATED_STR(type, name, order, doc)#
FIELD_REPEATED_PROTO(type, name, order, doc)#
FIELD_REPEATED_PACKED(type, name, order, doc)#
_FIELD_OPTIONAL(type, name, order, doc)#
FIELD_OPTIONAL(type, name, order, doc)#
FIELD_OPTIONAL_ONEOF(type, name, order, oneof, doc)#
FIELD_OPTIONAL_ENUM(type, name, order, doc)#
namespace onnx_light

Alias that makes onnx-light headers compatible with code that references ONNX_LIGHT_NAMESPACE (the macro used in the standard onnx package).

Set to ONNX_LIGHT_NAMESPACE so both names resolve to the same namespace.

Symbol-visibility attribute for the public onnx-light C++ API.

Maps the upstream compatibility macro to onnx-light’s explicit proto ABI annotation. This keeps declarations from vendored ONNX headers visible when lib_onnx_proto uses hidden visibility by default.

Namespace alias so that ONNX C++ code (and consumers such as onnxruntime) that refers to the literal onnx namespace — rather than the ONNX_NAMESPACE macro — resolves to the onnx-light namespace. The standard onnx package lives in namespace onnx; onnx-light uses onnx_light (via ONNX_LIGHT_NAMESPACE), so this alias keeps onnx-light a true drop-in. It is only introduced when the onnx-light namespace differs from onnx.

Functions

template<typename T>
inline bool _has_field_(const T&)#

Returns true if the field holds a non-default value (always true for scalar types other than String and raw-bytes vectors, which have their own specializations).

template<>
inline bool _has_field_(const utils::String &field)#

Returns true if the string field is non-empty.

template<>
inline bool _has_field_(const utils::OptionalString &field)#

Returns true if the optional string field is present (proto2 optional-string presence).

template<>
inline bool _has_field_(const std::vector<uint8_t> &field)#

Returns true if the raw-bytes field is non-empty.

template<>
inline bool _has_field_(const utils::ByteSpan &field)#

Returns true if the ByteSpan field is non-empty (owned or borrowed).

template<typename T>
void CopyProtoFrom(T &dest, const T &src)#

Copies all fields from src into dest. Generated for every proto class.

template<typename T, typename = std::enable_if_t<std::is_base_of<Message, T>::value>>
inline void swap(T &a, T &b) noexcept#

ADL-visible swap for generated proto messages so that unqualified swap(a, b) calls in consuming code (e.g. onnxruntime) resolve, mirroring the friend swap that protobuf generates for every message class.

class Message#
#include <stream_class.h>

Base class for generated ONNX proto messages.

Subclassed by onnx_light::AttributeProto, onnx_light::DeviceConfigurationProto, onnx_light::FunctionProto, onnx_light::GraphProto, onnx_light::IntIntListEntryProto, onnx_light::MapProto, onnx_light::ModelProto, onnx_light::NodeDeviceConfigurationProto, onnx_light::NodeProto, onnx_light::OperatorSetIdProto, onnx_light::OptionalProto, onnx_light::ProtoMessageAdapter< Derived >, onnx_light::SequenceProto, onnx_light::ShardedDimProto, onnx_light::ShardingSpecProto, onnx_light::SimpleShardedDimProto, onnx_light::SparseTensorProto, onnx_light::StringStringEntryProto, onnx_light::TensorAnnotation, onnx_light::TensorProto, onnx_light::TensorProto::Segment, onnx_light::TensorShapeProto, onnx_light::TensorShapeProto::Dimension, onnx_light::TypeProto, onnx_light::TypeProto::Map, onnx_light::TypeProto::Opaque, onnx_light::TypeProto::Optional, onnx_light::TypeProto::Sequence, onnx_light::TypeProto::SparseTensor, onnx_light::TypeProto::Tensor, onnx_light::ValueInfoProto

Public Functions

inline explicit Message()#

Constructs an empty message base object.

inline bool operator==(const Message&) const#

Throws an exception as a placeholder; generated classes provide their own operator==.

template<typename Derived>
class ProtoMessageAdapter : public onnx_light::Message#
#include <stream_class.h>

Supplies protobuf-compatible convenience methods without emitting one exported copy per generated message. The wire-format core declared by SERIALIZATION_METHOD and the small CopyFrom entry point remain type-specific and out of line.

Public Functions

SerializeSizeResult SerializeSize() const#
size_t ByteSizeLong() const#
bool ParseFromString(const std::string &raw)#
bool ParseFromString(const std::string &raw, ParseOptions &opts)#
bool ParseFromArray(const void *data, int size)#
bool ParseFromZeroCopyStream(utils::BinaryStream *stream)#
bool ParseFromZeroCopyStream(utils::BinaryStream *stream, ParseOptions &opts)#
bool ParseFromIstream(std::istream *input)#
bool ParseFromFileDescriptor(int fd)#
std::string SerializeAsString() const#
bool SerializeToArray(void *data, int size) const#
bool SerializeToOstream(std::ostream *output) const#
bool SerializeToOStream(std::ostream *output) const#
bool SerializeToZeroCopyStream(utils::BinaryWriteStream *output) const#
bool SerializeToString(std::string &out) const#
bool SerializeToString(std::string *out) const#
bool SerializeToString(std::string &out, SerializeOptions &opts) const#
bool SerializeToFileDescriptor(int fd) const#
bool SerializeToFileDescriptor(int fd, SerializeOptions &opts) const#
bool SaveToFileDescriptor(int fd) const#
bool SaveToFileDescriptor(int fd, SerializeOptions &opts) const#
bool ParseFromStream(utils::BinaryStream &stream)#
void SerializeToStream(utils::BinaryWriteStream &stream) const#

Private Functions

inline Derived &derived()#
inline const Derived &derived() const#
namespace proto_default_detail#

Functions

template<typename T>
inline const T &default_proto_instance()#

Returns a const reference to a default-constructed instance of T. Uses a template to defer instantiation until the type is complete.