#pragma once #include #include #include #include #include "secsgem/secs2/item.hpp" namespace secsgem::secs2 { class CodecError : public std::runtime_error { public: using std::runtime_error::runtime_error; }; // Encode a single item (with all nested children) to its SECS-II byte form. std::vector encode(const Item& item); void encode_into(const Item& item, std::vector& out); // Decode exactly one item starting at `pos`, advancing `pos` past it. Item decode_at(const uint8_t* data, std::size_t len, std::size_t& pos); // Decode one item that occupies the entire buffer; throws on trailing bytes. Item decode(const std::vector& bytes); // Human-readable SML (SECS Message Language) rendering, single line. std::string to_sml(const Item& item); } // namespace secsgem::secs2