From 098d93689749e31dc56b6337ff8705d7ff08b29c Mon Sep 17 00:00:00 2001 From: Kevin Matz Date: Tue, 25 Apr 2023 12:14:03 -0400 Subject: [PATCH] documentation and namespace cleanup --- protocol/citp/citp.h | 2 +- protocol/citp/finf.h | 7 ++----- protocol/citp/fptc.h | 7 ++----- protocol/citp/fsel.h | 6 ++---- protocol/citp/msex.h | 7 ++----- protocol/citp/pinf.h | 6 ++---- protocol/citp/sdmx.h | 7 ++----- protocol/osc/argument.h | 38 +++++++++++++++++++++++--------------- protocol/osc/message.cpp | 16 ++++++++-------- 9 files changed, 44 insertions(+), 52 deletions(-) diff --git a/protocol/citp/citp.h b/protocol/citp/citp.h index 4d9b455..5308096 100644 --- a/protocol/citp/citp.h +++ b/protocol/citp/citp.h @@ -26,7 +26,7 @@ #include /** - * @namespace \cite CITP 3. CITP, base layer + * \cite CITP 3 CITP base layer * * The base layer as such does not define any packages, it merely adds a header that * encapsulate all messages. diff --git a/protocol/citp/finf.h b/protocol/citp/finf.h index bd4a201..618775f 100644 --- a/protocol/citp/finf.h +++ b/protocol/citp/finf.h @@ -25,17 +25,14 @@ #include -namespace CITP { - /** - * @namespace \cite CITP 8. CITP/FINF, Fixture Information layer + * \cite CITP 8 CITP/FINF, Fixture Information layer * * The Fixture Information layer is used to carry additional fixture information. */ -namespace FINF { +namespace CITP::FINF { } // namespace FINF -} // namespace CITP diff --git a/protocol/citp/fptc.h b/protocol/citp/fptc.h index ce11e00..20f7e5a 100644 --- a/protocol/citp/fptc.h +++ b/protocol/citp/fptc.h @@ -25,17 +25,14 @@ #include -namespace CITP { - /** - * @namespace \cite CITP 6. CITP/FPTC, Fixture patch layer + * \cite CITP 6 CITP/FPTC, Fixture patch layer * * The Fixture Patch layer is used to communicate fixture existence and patch information. */ -namespace FPTC { +namespace CITP::FPTC { } // namespace FPTC -} // namespace CITP diff --git a/protocol/citp/fsel.h b/protocol/citp/fsel.h index 7605e3e..67d60e3 100644 --- a/protocol/citp/fsel.h +++ b/protocol/citp/fsel.h @@ -25,17 +25,15 @@ #include -namespace CITP { /** - * @namespace \cite CITP 7. CITP/FSEL, Fixture Selection layer + * \cite CITP 7 CITP/FSEL, Fixture Selection layer * * The Fixture Selection layer is used to carry fixture selection information. */ -namespace FSEL { +namespace CITP::FSEL { } // namespace FSEL -} // namespace CITP diff --git a/protocol/citp/msex.h b/protocol/citp/msex.h index d361f4b..9df3936 100644 --- a/protocol/citp/msex.h +++ b/protocol/citp/msex.h @@ -25,15 +25,12 @@ #include -namespace CITP { - /** - * @namespace \cite CITP 9. CITP/MSEX, Media Server Extensions layer + * \cite CITP 9 CITP/MSEX, Media Server Extensions layer * * The Media Server EXtensions layer is used for communication with Media Servers. */ -namespace MSEX { +namespace CITP::MSEX { } // namespace MSEX -} // namespace CITP diff --git a/protocol/citp/pinf.h b/protocol/citp/pinf.h index d910447..cdf11fe 100644 --- a/protocol/citp/pinf.h +++ b/protocol/citp/pinf.h @@ -25,16 +25,14 @@ #include -namespace CITP { /** - * @namespace \cite CITP 4. CITP/PINF, Peer Information layer + * \cite CITP 4 CITP/PINF, Peer Information layer * * The Peer Information layer is used to exchange peer information, both when * connected and during discovery. */ -namespace PINF { +namespace CITP::PINF { } // namespace PINF -} // namespace CITP diff --git a/protocol/citp/sdmx.h b/protocol/citp/sdmx.h index a0c7265..20cd850 100644 --- a/protocol/citp/sdmx.h +++ b/protocol/citp/sdmx.h @@ -25,16 +25,13 @@ #include -namespace CITP { - /** - * @namespace \cite CITP 5. CITP/SDMX, Send DMX layer + * \cite CITP 5 CITP/SDMX, Send DMX layer * * The SDMX layer is used to transmit DMX information. It also supports designating * an alternative DMX source. */ -namespace SDMX { +namespace CITP::SDMX { } // namespace SDMX -} // namespace CITP diff --git a/protocol/osc/argument.h b/protocol/osc/argument.h index 591149e..1c79938 100644 --- a/protocol/osc/argument.h +++ b/protocol/osc/argument.h @@ -27,6 +27,14 @@ #include #include + +/** + * @brief The Open Sound Control message format. + * + * \cite Spec10 Open Sound Control (OSC) is an open, transport-independent, message-based + * protocol developed for communication among computers, sound synthesizers, and other + * multimedia devices. + */ namespace OSC { @@ -50,7 +58,7 @@ private: /** - * @brief The int32 class + * @brief The int32 Argument type */ struct int32 : Argument @@ -66,7 +74,7 @@ struct int32 /** - * @brief The float32 class + * @brief The float32 Argument type */ struct float32 : Argument @@ -82,7 +90,7 @@ struct float32 /** - * @brief The string class + * @brief The string Argument type */ struct string : Argument @@ -98,7 +106,7 @@ struct string /** - * @brief The blob class + * @brief The blob Argument type */ struct blob : Argument @@ -114,7 +122,7 @@ struct blob /** - * @brief The int64 class + * @brief The int64 Argument type */ struct int64 : Argument @@ -130,7 +138,7 @@ struct int64 /** - * @brief The timetag class + * @brief The timetag Argument type */ struct timetag : Argument @@ -155,7 +163,7 @@ struct timetag /** - * @brief The float64 class + * @brief The float64 Argument type */ struct float64 : Argument @@ -171,7 +179,7 @@ struct float64 /** - * @brief The character class + * @brief The character Argument type */ struct character : Argument @@ -187,7 +195,7 @@ struct character /** - * @brief The rgba class + * @brief The rgba Argument type */ struct rgba : Argument @@ -211,7 +219,7 @@ struct rgba /** - * @brief The midi class + * @brief The midi Argument type */ struct midi : Argument @@ -235,7 +243,7 @@ struct midi /** - * @brief The True class + * @brief The True Argument type */ struct True : Argument @@ -251,7 +259,7 @@ struct True /** - * @brief The False class + * @brief The False Argument type */ struct False : Argument @@ -267,7 +275,7 @@ struct False /** - * @brief The Null class + * @brief The Null Argument type */ struct Null : Argument @@ -281,7 +289,7 @@ struct Null /** - * @brief The impulse class + * @brief The impulse Argument type */ struct impulse : Argument @@ -295,7 +303,7 @@ struct impulse /** - * @brief The array class + * @brief The array Argument type */ struct array : Argument diff --git a/protocol/osc/message.cpp b/protocol/osc/message.cpp index 7cd15e7..4f493a7 100644 --- a/protocol/osc/message.cpp +++ b/protocol/osc/message.cpp @@ -99,8 +99,8 @@ std::vector> Message::createArguments(std::string type args.emplace_back(std::make_shared()); auto arg = std::static_pointer_cast(args.back()); std::string::size_type close = pos; - int nests = 1; - while (nests > 0) + int depth = 1; + while (depth > 0) { close = types.find_first_of("[]", close); if (close == std::string::npos) // no closing brace, use all the remaining types @@ -110,12 +110,12 @@ std::vector> Message::createArguments(std::string type } if (types.at(close) == '[') // nested braces, keep going { - nests++; + depth++; continue; } if (types.at(close) == ']') // closed this level of nesting { - nests--; + depth--; } } arg->setTypes(types.substr(pos+1, close-(pos+1))); @@ -157,14 +157,14 @@ void Message::iStream(std::shared_ptr stream) if (address_pattern.front() != '/') return stream->setstate(std::ios::failbit); for (uint i = 0; i < (address_pattern.size() + 1) % 4; i++) - stream->readType(); + stream->readType(); // 32 bit aligned padding std::string type_string; stream->readString(type_string); if (type_string.front() != ',') return stream->setstate(std::ios::failbit); for (uint i = 0; i < (type_string.size() + 1) % 4; i++) - stream->readType(); + stream->readType(); // 32 bit aligned padding arguments = createArguments(type_string); for (auto &argument: arguments) @@ -178,14 +178,14 @@ void Message::oStream(std::shared_ptr stream) const auto address_pad = (address_pattern.size() + 1) % 4; address_pad = address_pad ? 4 - address_pad : 0; for (uint i = 0; i < address_pad; i++) - stream->writeType(0x00); + stream->writeType(0x00); // 32 bit aligned padding std::string type_string = type_tag(); stream->writeString(type_string); auto type_pad = (type_string.size() + 1) % 4; type_pad = type_pad ? 4 - type_pad : 0; for (uint i = 0; i < type_pad; i++) - stream->writeType(0x00); + stream->writeType(0x00); // 32 bit aligned padding for (const auto &argument: arguments) argument->oStream(stream);