1
0
Fork 0

documentation and namespace cleanup

This commit is contained in:
Kevin Matz 2023-04-25 12:14:03 -04:00
parent 9442b6a7ff
commit 098d936897
9 changed files with 44 additions and 52 deletions

View File

@ -26,7 +26,7 @@
#include <cstdint> #include <cstdint>
/** /**
* @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 * The base layer as such does not define any packages, it merely adds a header that
* encapsulate all messages. * encapsulate all messages.

View File

@ -25,17 +25,14 @@
#include <cstdint> #include <cstdint>
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. * The Fixture Information layer is used to carry additional fixture information.
*/ */
namespace FINF { namespace CITP::FINF {
} // namespace FINF } // namespace FINF
} // namespace CITP

View File

@ -25,17 +25,14 @@
#include <cstdint> #include <cstdint>
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. * The Fixture Patch layer is used to communicate fixture existence and patch information.
*/ */
namespace FPTC { namespace CITP::FPTC {
} // namespace FPTC } // namespace FPTC
} // namespace CITP

View File

@ -25,17 +25,15 @@
#include <cstdint> #include <cstdint>
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. * The Fixture Selection layer is used to carry fixture selection information.
*/ */
namespace FSEL { namespace CITP::FSEL {
} // namespace FSEL } // namespace FSEL
} // namespace CITP

View File

@ -25,15 +25,12 @@
#include <cstdint> #include <cstdint>
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. * The Media Server EXtensions layer is used for communication with Media Servers.
*/ */
namespace MSEX { namespace CITP::MSEX {
} // namespace MSEX } // namespace MSEX
} // namespace CITP

View File

@ -25,16 +25,14 @@
#include <cstdint> #include <cstdint>
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 * The Peer Information layer is used to exchange peer information, both when
* connected and during discovery. * connected and during discovery.
*/ */
namespace PINF { namespace CITP::PINF {
} // namespace PINF } // namespace PINF
} // namespace CITP

View File

@ -25,16 +25,13 @@
#include <cstdint> #include <cstdint>
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 * The SDMX layer is used to transmit DMX information. It also supports designating
* an alternative DMX source. * an alternative DMX source.
*/ */
namespace SDMX { namespace CITP::SDMX {
} // namespace SDMX } // namespace SDMX
} // namespace CITP

View File

@ -27,6 +27,14 @@
#include <chrono> #include <chrono>
#include <vector> #include <vector>
/**
* @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 { namespace OSC {
@ -50,7 +58,7 @@ private:
/** /**
* @brief The int32 class * @brief The int32 Argument type
*/ */
struct int32 struct int32
: Argument : Argument
@ -66,7 +74,7 @@ struct int32
/** /**
* @brief The float32 class * @brief The float32 Argument type
*/ */
struct float32 struct float32
: Argument : Argument
@ -82,7 +90,7 @@ struct float32
/** /**
* @brief The string class * @brief The string Argument type
*/ */
struct string struct string
: Argument : Argument
@ -98,7 +106,7 @@ struct string
/** /**
* @brief The blob class * @brief The blob Argument type
*/ */
struct blob struct blob
: Argument : Argument
@ -114,7 +122,7 @@ struct blob
/** /**
* @brief The int64 class * @brief The int64 Argument type
*/ */
struct int64 struct int64
: Argument : Argument
@ -130,7 +138,7 @@ struct int64
/** /**
* @brief The timetag class * @brief The timetag Argument type
*/ */
struct timetag struct timetag
: Argument : Argument
@ -155,7 +163,7 @@ struct timetag
/** /**
* @brief The float64 class * @brief The float64 Argument type
*/ */
struct float64 struct float64
: Argument : Argument
@ -171,7 +179,7 @@ struct float64
/** /**
* @brief The character class * @brief The character Argument type
*/ */
struct character struct character
: Argument : Argument
@ -187,7 +195,7 @@ struct character
/** /**
* @brief The rgba class * @brief The rgba Argument type
*/ */
struct rgba struct rgba
: Argument : Argument
@ -211,7 +219,7 @@ struct rgba
/** /**
* @brief The midi class * @brief The midi Argument type
*/ */
struct midi struct midi
: Argument : Argument
@ -235,7 +243,7 @@ struct midi
/** /**
* @brief The True class * @brief The True Argument type
*/ */
struct True struct True
: Argument : Argument
@ -251,7 +259,7 @@ struct True
/** /**
* @brief The False class * @brief The False Argument type
*/ */
struct False struct False
: Argument : Argument
@ -267,7 +275,7 @@ struct False
/** /**
* @brief The Null class * @brief The Null Argument type
*/ */
struct Null struct Null
: Argument : Argument
@ -281,7 +289,7 @@ struct Null
/** /**
* @brief The impulse class * @brief The impulse Argument type
*/ */
struct impulse struct impulse
: Argument : Argument
@ -295,7 +303,7 @@ struct impulse
/** /**
* @brief The array class * @brief The array Argument type
*/ */
struct array struct array
: Argument : Argument

View File

@ -99,8 +99,8 @@ std::vector<std::shared_ptr<Argument>> Message::createArguments(std::string type
args.emplace_back(std::make_shared<array>()); args.emplace_back(std::make_shared<array>());
auto arg = std::static_pointer_cast<array>(args.back()); auto arg = std::static_pointer_cast<array>(args.back());
std::string::size_type close = pos; std::string::size_type close = pos;
int nests = 1; int depth = 1;
while (nests > 0) while (depth > 0)
{ {
close = types.find_first_of("[]", close); close = types.find_first_of("[]", close);
if (close == std::string::npos) // no closing brace, use all the remaining types if (close == std::string::npos) // no closing brace, use all the remaining types
@ -110,12 +110,12 @@ std::vector<std::shared_ptr<Argument>> Message::createArguments(std::string type
} }
if (types.at(close) == '[') // nested braces, keep going if (types.at(close) == '[') // nested braces, keep going
{ {
nests++; depth++;
continue; continue;
} }
if (types.at(close) == ']') // closed this level of nesting if (types.at(close) == ']') // closed this level of nesting
{ {
nests--; depth--;
} }
} }
arg->setTypes(types.substr(pos+1, close-(pos+1))); arg->setTypes(types.substr(pos+1, close-(pos+1)));
@ -157,14 +157,14 @@ void Message::iStream(std::shared_ptr<bufferstream> stream)
if (address_pattern.front() != '/') if (address_pattern.front() != '/')
return stream->setstate(std::ios::failbit); return stream->setstate(std::ios::failbit);
for (uint i = 0; i < (address_pattern.size() + 1) % 4; i++) for (uint i = 0; i < (address_pattern.size() + 1) % 4; i++)
stream->readType<uint8_t>(); stream->readType<uint8_t>(); // 32 bit aligned padding
std::string type_string; std::string type_string;
stream->readString(type_string); stream->readString(type_string);
if (type_string.front() != ',') if (type_string.front() != ',')
return stream->setstate(std::ios::failbit); return stream->setstate(std::ios::failbit);
for (uint i = 0; i < (type_string.size() + 1) % 4; i++) for (uint i = 0; i < (type_string.size() + 1) % 4; i++)
stream->readType<uint8_t>(); stream->readType<uint8_t>(); // 32 bit aligned padding
arguments = createArguments(type_string); arguments = createArguments(type_string);
for (auto &argument: arguments) for (auto &argument: arguments)
@ -178,14 +178,14 @@ void Message::oStream(std::shared_ptr<bufferstream> stream) const
auto address_pad = (address_pattern.size() + 1) % 4; auto address_pad = (address_pattern.size() + 1) % 4;
address_pad = address_pad ? 4 - address_pad : 0; address_pad = address_pad ? 4 - address_pad : 0;
for (uint i = 0; i < address_pad; i++) for (uint i = 0; i < address_pad; i++)
stream->writeType<uint8_t>(0x00); stream->writeType<uint8_t>(0x00); // 32 bit aligned padding
std::string type_string = type_tag(); std::string type_string = type_tag();
stream->writeString(type_string); stream->writeString(type_string);
auto type_pad = (type_string.size() + 1) % 4; auto type_pad = (type_string.size() + 1) % 4;
type_pad = type_pad ? 4 - type_pad : 0; type_pad = type_pad ? 4 - type_pad : 0;
for (uint i = 0; i < type_pad; i++) for (uint i = 0; i < type_pad; i++)
stream->writeType<uint8_t>(0x00); stream->writeType<uint8_t>(0x00); // 32 bit aligned padding
for (const auto &argument: arguments) for (const auto &argument: arguments)
argument->oStream(stream); argument->oStream(stream);