fields.h#
-
namespace ONNX_LIGHT_NAMESPACE
-
namespace utils#
-
template<typename T>
class _OptionalField# - #include <fields.h>
Optional field wrapper for scalar values.
Subclassed by ONNX_LIGHT_NAMESPACE::utils::OptionalField< float >, ONNX_LIGHT_NAMESPACE::utils::OptionalField< int32_t >, ONNX_LIGHT_NAMESPACE::utils::OptionalField< int64_t >
Public Functions
-
inline explicit _OptionalField()#
Constructs an empty optional field.
-
inline bool has_value() const#
Returns true if the field holds a value.
-
inline void reset()#
Releases the held value, leaving the field empty.
-
inline bool operator==(const _OptionalField<T> &v) const#
Returns true if the held value equals another optional field’s value.
-
inline _OptionalField<T> &operator=(const T &other)#
Assigns a scalar value to the field.
-
inline void set_empty_value()#
Initializes the field with zero-cast value.
-
inline explicit _OptionalField()#
-
template<typename T>
class OptionalEnumField# - #include <fields.h>
Optional field wrapper for enum values.
Public Functions
-
inline explicit OptionalEnumField()#
Constructs an empty optional enum field.
-
inline bool has_value() const#
Returns true if the field holds a value.
-
inline void reset()#
Releases the held value, leaving the field empty.
-
inline bool operator==(const OptionalEnumField<T> &v) const#
Returns true if the held value equals another optional enum field’s value.
-
inline OptionalEnumField<T> &operator=(const T &other)#
Assigns an enum value to the field.
-
inline void set_empty_value()#
Initializes the field with zero-cast enum value.
-
inline explicit OptionalEnumField()#
-
template<typename T>
class OptionalField# - #include <fields.h>
Optional field wrapper for message-like values.
Public Functions
-
inline explicit OptionalField()#
Constructs an empty optional field.
-
inline explicit OptionalField(const OptionalField<T> ©)#
Constructs by copying another optional field.
-
inline OptionalField(OptionalField<T> &&move) noexcept#
Constructs by moving from another optional field.
-
inline bool has_value() const#
Returns true if the field holds a value.
-
inline void reset()#
Releases the held value, leaving the field empty.
-
OptionalField<T> &operator=(const T &other)#
Assigns a copy of the given value.
-
OptionalField<T> &operator=(const OptionalField<T> &other)#
Assigns from another optional field.
-
inline OptionalField<T> &operator=(OptionalField<T> &&other) noexcept#
Moves from another optional field.
-
void set_empty_value()#
Initializes the field with a default-constructed value.
Private Members
-
simple_unique_ptr<T> value_#
-
inline explicit OptionalField()#
-
template<>
class OptionalField<float> : public ONNX_LIGHT_NAMESPACE::utils::_OptionalField<float># - #include <fields.h>
Optional field specialization for float.
Public Functions
-
inline explicit OptionalField()#
Constructs an empty optional float field.
-
inline OptionalField<float> &operator=(const float &other)#
Assigns a float value to the field.
-
inline explicit OptionalField()#
-
template<>
class OptionalField<int32_t> : public ONNX_LIGHT_NAMESPACE::utils::_OptionalField<int32_t># - #include <fields.h>
Optional field specialization for int32_t.
Public Functions
-
inline explicit OptionalField()#
Constructs an empty optional int32_t field.
-
inline OptionalField<int32_t> &operator=(const int32_t &other)#
Assigns an int32_t value to the field.
-
inline explicit OptionalField()#
-
template<>
class OptionalField<int64_t> : public ONNX_LIGHT_NAMESPACE::utils::_OptionalField<int64_t># - #include <fields.h>
Optional field specialization for int64_t.
Public Functions
-
inline explicit OptionalField()#
Constructs an empty optional int64_t field.
-
inline OptionalField<int64_t> &operator=(const int64_t &other)#
Assigns an int64_t value to the field.
-
inline explicit OptionalField()#
-
struct PrintOptions#
- #include <fields.h>
Options that control how a proto message is printed.
-
template<typename T>
class RepeatedField# - #include <fields.h>
Repeated primitive field storage.
Public Functions
-
inline explicit RepeatedField()#
Constructs an empty field.
-
inline void reserve(size_t n)#
Reserves storage for at least n elements.
-
inline void clear()#
Removes all elements.
-
inline void Clear()#
Removes all elements.
-
inline bool empty() const#
Returns true if the field contains no elements.
-
inline size_t size() const#
Returns the number of elements.
-
inline const T &Get(size_t index) const#
Returns a const reference to the element at the given index.
-
inline T *Mutable(size_t index)#
Returns a mutable reference to the owning pointer at the given index.
-
inline const T &operator[](size_t index) const#
Returns a const reference to the element at the given index.
-
inline void remove_range(size_t start, size_t stop, size_t step)#
Removes a contiguous range; currently only start=0, step=1, and stop=size() are supported.
-
inline void extend(const RepeatedField<T> &v)#
Appends all elements from another RepeatedField.
-
template<class ...Args>
inline void emplace_back(Args&&... args)# Constructs a new element in-place at the end.
-
std::vector<std::string> PrintToVectorString(PrintOptions &options) const#
Returns a vector of string representations of the contained values.
-
inline explicit RepeatedField()#
-
template<typename T>
class RepeatedProtoField# - #include <fields.h>
Repeated message field storage with owning pointers.
Public Functions
-
inline explicit RepeatedProtoField()#
Constructs an empty field.
-
inline void reserve(size_t n)#
Reserves storage for at least n elements.
-
inline bool empty() const#
Returns true if the field contains no elements.
-
inline size_t size() const#
Returns the number of elements.
-
inline const T &operator[](size_t index) const#
Returns a const reference to the element at the given index.
-
inline simple_unique_ptr<T> &get(size_t index)#
Returns a mutable reference to the owning pointer at the given index.
-
inline const T &Get(size_t index)#
Returns a mutable reference to the owning pointer at the given index.
-
inline T *Mutable(size_t index)#
Returns a mutable reference to the owning pointer at the given index.
-
inline void remove_range(size_t start, size_t stop, size_t step)#
Removes a contiguous range; currently only start=0, step=1, and stop=size() are supported.
-
void clear()#
Removes all elements.
-
inline void Clear()#
Removes all elements.
-
void extend(const RepeatedProtoField<T> &v)#
Appends all elements from another RepeatedProtoField by copy.
-
void extend(RepeatedProtoField<T> &&v)#
Appends all elements from another RepeatedProtoField by move (steals ownership).
-
template<class ...Args>
inline void emplace_back(Args&&... args)# Constructs a new element in-place at the end.
-
std::vector<std::string> PrintToVectorString(PrintOptions &options) const#
Returns a vector of string representations of the contained values.
-
inline iterator erase(iterator it)#
Removes the element at the given iterator position and returns an iterator to the next element.
-
inline const_iterator begin() const#
Returns a const iterator to the first element.
-
inline const_iterator end() const#
Returns a const iterator past the last element.
Private Members
-
std::vector<simple_unique_ptr<T>> values_#
-
class const_iterator#
- #include <fields.h>
Const iterator for repeated proto fields.
Public Functions
-
inline explicit const_iterator(const RepeatedProtoField<T> *parent, size_t pos = 0)#
Constructs a const iterator for parent starting at pos.
-
inline const_iterator &operator++()#
Advances the iterator to the next element.
-
inline bool operator==(const const_iterator &other) const#
Returns true if both iterators point to the same position in the same field.
-
inline bool operator!=(const const_iterator &other) const#
Returns true if the iterators differ.
-
inline explicit const_iterator(const RepeatedProtoField<T> *parent, size_t pos = 0)#
-
class iterator#
- #include <fields.h>
Mutable iterator for repeated proto fields.
Public Functions
-
inline iterator(RepeatedProtoField<T> *parent, size_t pos = 0)#
Constructs an iterator for parent starting at pos.
-
inline bool operator==(const iterator &other) const#
Returns true if both iterators point to the same position in the same field.
-
inline size_t pos() const#
Returns the current position index.
-
inline iterator(RepeatedProtoField<T> *parent, size_t pos = 0)#
-
inline explicit RepeatedProtoField()#
-
template<typename T>
class simple_unique_ptr# - #include <fields.h>
Minimal unique_ptr-like holder used by generated proto containers.
Public Functions
-
inline explicit simple_unique_ptr(T *ptr = nullptr)#
Constructs from a raw pointer (defaults to null); takes ownership if non-null.
-
inline ~simple_unique_ptr()#
Releases owned memory.
-
inline simple_unique_ptr(simple_unique_ptr &&other) noexcept#
Constructs by taking ownership from another instance.
-
inline simple_unique_ptr &operator=(simple_unique_ptr &&other) noexcept#
Transfers ownership from another instance.
-
inline bool isnull() const#
Returns true if the held pointer is null.
-
inline bool operator==(const simple_unique_ptr &other) const#
Returns true if both instances hold the same pointer.
-
inline bool operator!=(const simple_unique_ptr &other) const#
Returns true if the instances hold different pointers.
-
inline simple_unique_ptr(const simple_unique_ptr&)#
Deleted copy constructor; use move semantics instead.
-
inline simple_unique_ptr &operator=(const simple_unique_ptr&)#
Deleted copy assignment; use move semantics instead.
-
inline explicit simple_unique_ptr(T *ptr = nullptr)#
-
template<typename T>
-
namespace utils#