Skip to content

Commit 99820c8

Browse files
committed
Merge #279: doc: Add comments to FIELD_* constants in proxy.h
e863c6c doc: Add comments to FIELD_* constants in proxy.h (ViniciusCestarii) Pull request description: Add documentation comments to the five `FIELD_*` bit flag constants in `proxy.h`, which were previously undocumented ACKs for top commit: ryanofsky: Code review ACK e863c6c. Thanks for the comments! Tree-SHA512: 98ac5ee308c103f04ba3b72f03498241a8164a8da53f59ae52458e4f0b14a744be025d681e6802fae2d5cff5f87607bff00a2aaec9eff2016c5b989bd6449bb3
2 parents 73b9855 + e863c6c commit 99820c8

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

include/mp/proxy.h

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,20 +304,31 @@ struct ProxyServerMethodTraits : public ProxyMethodTraits<MethodParams>
304304
{
305305
};
306306

307-
static constexpr int FIELD_IN = 1;
308-
static constexpr int FIELD_OUT = 2;
309-
static constexpr int FIELD_OPTIONAL = 4;
310-
static constexpr int FIELD_REQUESTED = 8;
311-
static constexpr int FIELD_BOXED = 16;
307+
static constexpr int FIELD_IN = 1; //!< See Accessor::in.
308+
static constexpr int FIELD_OUT = 2; //!< See Accessor::out.
309+
static constexpr int FIELD_OPTIONAL = 4; //!< See Accessor::optional.
310+
static constexpr int FIELD_REQUESTED = 8; //!< See Accessor::requested.
311+
static constexpr int FIELD_BOXED = 16; //!< See Accessor::boxed.
312312

313313
//! Accessor type holding flags that determine how to access a message field.
314314
template <typename Field, int flags>
315315
struct Accessor : public Field
316316
{
317+
//! Field is present from the Cap'n Proto Params struct (client -> server).
317318
static const bool in = flags & FIELD_IN;
319+
//! Field is present from the Cap'n Proto Results struct (server -> client).
318320
static const bool out = flags & FIELD_OUT;
321+
//! Field has a companion has{Name} boolean field in the Cap'n Proto struct.
322+
//! This is used to represent optional primitive values (e.g. C++
323+
//! std::optional<int>) because Cap'n Proto doesn't allow primitive fields to
324+
//! be unset.
319325
static const bool optional = flags & FIELD_OPTIONAL;
326+
//! Results field has a companion want{Name} boolean field in the Params
327+
//! struct. Used for optional output parameters (e.g. C++ int*) and set to
328+
//! true if the caller passed a non-null pointer and wants the result.
320329
static const bool requested = flags & FIELD_REQUESTED;
330+
//! Field is a Cap'n Proto pointer type (struct, list, text, data,
331+
//! interface) as opposed to a primitive type (bool, int, float, enum).
321332
static const bool boxed = flags & FIELD_BOXED;
322333
};
323334

0 commit comments

Comments
 (0)