Skip to content

Commit 1ad0e41

Browse files
committed
Update Entry class documentation
1 parent 5cec1c2 commit 1ad0e41

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

include/caliper/common/Entry.h

+13-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class CaliperMetadataAccessInterface;
2525
/// a _reference entry_ (reference into the context tree) or an
2626
/// _immediate entry_ (explicit key:value pair). Reference entries are
2727
/// stored as context tree node pointer, immediate entries are stored as
28-
/// (attribute, value) pair.
28+
/// (attribute node pointer, value) pair.
2929

3030
class Entry
3131
{
@@ -34,12 +34,16 @@ class Entry
3434

3535
public:
3636

37+
/// @brief Maximum size in bytes of a packed entry
3738
constexpr static size_t MAX_PACKED_SIZE = 30;
3839

40+
/// @brief Construct an empty Entry
3941
constexpr Entry() : m_node(nullptr) {}
4042

43+
/// @brief Construct a reference entry from \a node
4144
Entry(Node* node) : m_node(node), m_value(node->data()) {}
4245

46+
/// @brief Construct an immediate entry from \a attr, \a val
4347
Entry(const Attribute& attr, const Variant& val) : m_node(attr.node()), m_value(val) {}
4448

4549
/// \brief Return context tree node pointer for reference entries.
@@ -79,8 +83,16 @@ class Entry
7983

8084
bool is_reference() const { return !empty() && !is_immediate(); }
8185

86+
/// @brief Write a compact binary serialization of the entry into \a buffer
87+
/// @param buffer The target buffer. Must have at least \ref MAX_PACKED_SIZE bytes of free space.
88+
/// @return The actual number of bytes written into \a buffer
8289
size_t pack(unsigned char* buffer) const;
8390

91+
/// @brief Deserialize a packed entry from \a buffer
92+
/// @param db The %Caliper metadata (context tree nodes, attributes) associated with this entry.
93+
/// @param buffer The source buffer. Must point to a packed entry.
94+
/// @param inc Returns the number of bytes read from the source buffer.
95+
/// @return The deserialized entry.
8496
static Entry unpack(const CaliperMetadataAccessInterface& db, const unsigned char* buffer, size_t* inc);
8597

8698
friend bool operator== (const Entry&, const Entry&);

0 commit comments

Comments
 (0)