Skip to content

Commit

Permalink
Drop ARAIPC prefix from C++ class and type names that are defined ins…
Browse files Browse the repository at this point in the history
…ide ARA::IPC namespace
  • Loading branch information
sgretscher committed Feb 11, 2024
1 parent 2b9d128 commit e0487be
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 72 deletions.
18 changes: 9 additions & 9 deletions TestHost/CompanionAPIs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ constexpr auto kIPCTerminateMethodID { ARA::IPC::MethodID::createWithNonARAMetho
_Pragma ("GCC diagnostic ignored \"-Wunused-template\"")
#endif

ARA_MAP_IPC_REF (ARA::IPC::ARAIPCMessageChannel, ARA::IPC::ARAIPCMessageChannelRef)
ARA_MAP_IPC_REF (ARA::IPC::MessageChannel, ARA::IPC::ARAIPCMessageChannelRef)

#if defined (__GNUC__)
_Pragma ("GCC diagnostic pop")
Expand Down Expand Up @@ -456,7 +456,7 @@ class CLAPPlugInEntry : public PlugInEntry
class IPCPlugInInstance : public PlugInInstance, protected ARA::IPC::RemoteCaller
{
public:
IPCPlugInInstance (ARA::IPC::ARAIPCPlugInInstanceRef remoteRef, ARA::IPC::ARAIPCMessageChannel* messageChannel)
IPCPlugInInstance (ARA::IPC::ARAIPCPlugInInstanceRef remoteRef, ARA::IPC::MessageChannel* messageChannel)
: RemoteCaller { messageChannel },
_remoteRef { remoteRef }
{}
Expand Down Expand Up @@ -521,7 +521,7 @@ struct RemoteLauncher

/*******************************************************************************/

class IPCPlugInEntry : public PlugInEntry, private RemoteLauncher, protected ARA::IPC::RemoteCaller, public ARA::IPC::ARAIPCProxyPlugInMessageHandler
class IPCPlugInEntry : public PlugInEntry, private RemoteLauncher, protected ARA::IPC::RemoteCaller, public ARA::IPC::ProxyPlugInMessageHandler
{
private:
static const ARA::ARAFactory* defaultGetFactory (ARA::IPC::ARAIPCMessageChannelRef messageChannel)
Expand Down Expand Up @@ -659,13 +659,13 @@ class IPCAUPlugInEntry : public IPCPlugInEntry
std::unique_ptr<PlugInEntry> _plugInEntry {};
bool _shutDown { false };

class ProxyMessageHandler : public ARA::IPC::ARAIPCProxyHostMessageHandler
class ProxyMessageHandler : public ARA::IPC::ProxyHostMessageHandler
{
public:
void handleReceivedMessage (ARA::IPC::ARAIPCMessageChannel* messageChannel,
const ARA::IPC::ARAIPCMessageID messageID,
const ARA::IPC::ARAIPCMessageDecoder* decoder,
ARA::IPC::ARAIPCMessageEncoder* const replyEncoder) override
void handleReceivedMessage (ARA::IPC::MessageChannel* messageChannel,
const ARA::IPC::MessageID messageID,
const ARA::IPC::MessageDecoder* decoder,
ARA::IPC::MessageEncoder* const replyEncoder) override
{
if (messageID == kIPCCreateEffectMethodID)
{
Expand Down Expand Up @@ -718,7 +718,7 @@ class ProxyMessageHandler : public ARA::IPC::ARAIPCProxyHostMessageHandler
}
else
{
ARAIPCProxyHostMessageHandler::handleReceivedMessage (messageChannel, messageID, decoder, replyEncoder);
ARA::IPC::ProxyHostMessageHandler::handleReceivedMessage (messageChannel, messageID, decoder, replyEncoder);
}
}
};
Expand Down
22 changes: 11 additions & 11 deletions TestHost/IPC/IPCMessageChannel.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//------------------------------------------------------------------------------
//! \file IPCMessageChannel.cpp
//! Proof-of-concept implementation of ARAIPCMessageChannel
//! Proof-of-concept implementation of MessageChannel
//! for the ARA SDK TestHost (error handling is limited to assertions).
//! \project ARA SDK Examples
//! \copyright Copyright (c) 2012-2023, Celemony Software GmbH, All Rights Reserved.
Expand Down Expand Up @@ -73,7 +73,7 @@ class IPCMessagePort
static constexpr DWORD maxMessageSize { 4 * 1024 * 1024L - 64};

size_t messageSize;
ARA::IPC::ARAIPCMessageID messageID;
ARA::IPC::MessageID messageID;
char messageData[maxMessageSize];
};

Expand Down Expand Up @@ -168,7 +168,7 @@ class IPCSendPort : public IPCMessagePort
ARA_INTERNAL_ASSERT (_sharedMemory != nullptr);
}

void sendMessage (ARA::IPC::ARAIPCMessageID messageID, const std::string& messageData)
void sendMessage (ARA::IPC::MessageID messageID, const std::string& messageData)
{
ARA_INTERNAL_ASSERT (messageData.size () <= SharedMemory::maxMessageSize);

Expand Down Expand Up @@ -246,7 +246,7 @@ class IPCReceivePort
{
auto channel { static_cast<IPCMessageChannel*> (info) };
#if USE_ARA_CF_ENCODING
const auto decoder { ARA::IPC::ARAIPCCFMessageDecoder::createWithMessageData (messageData) };
const auto decoder { ARA::IPC::CFMessageDecoder::createWithMessageData (messageData) };
#else
const auto decoder { IPCXMLMessageDecoder::createWithMessageData (messageData) };
#endif
Expand Down Expand Up @@ -290,7 +290,7 @@ class IPCSendPort
CFRelease (_port);
}

void sendMessage (ARA::IPC::ARAIPCMessageID messageID, CFDataRef messageData)
void sendMessage (ARA::IPC::MessageID messageID, CFDataRef messageData)
{
const auto ARA_MAYBE_UNUSED_VAR (result) { CFMessagePortSendRequest (_port, messageID, messageData, 0.001 * messageTimeout, 0.0, nullptr, nullptr) };
ARA_INTERNAL_ASSERT (result == kCFMessagePortSuccess);
Expand All @@ -306,15 +306,15 @@ class IPCSendPort
//------------------------------------------------------------------------------


IPCMessageChannel* IPCMessageChannel::createPublishingID (const std::string& channelID, ARA::IPC::ARAIPCMessageHandler* handler)
IPCMessageChannel* IPCMessageChannel::createPublishingID (const std::string& channelID, ARA::IPC::MessageHandler* handler)
{
auto channel { new IPCMessageChannel { handler } };
channel->_sendPort = new IPCSendPort { channelID + ".from_server" };
channel->_receivePort = new IPCReceivePort { channelID + ".to_server", channel };
return channel;
}

IPCMessageChannel* IPCMessageChannel::createConnectedToID (const std::string& channelID, ARA::IPC::ARAIPCMessageHandler* handler)
IPCMessageChannel* IPCMessageChannel::createConnectedToID (const std::string& channelID, ARA::IPC::MessageHandler* handler)
{
auto channel { new IPCMessageChannel { handler } };
channel->_receivePort = new IPCReceivePort { channelID + ".from_server", channel };
Expand All @@ -328,10 +328,10 @@ IPCMessageChannel::~IPCMessageChannel ()
delete _receivePort;
}

void IPCMessageChannel::_sendMessage (ARA::IPC::ARAIPCMessageID messageID, ARA::IPC::ARAIPCMessageEncoder* encoder)
void IPCMessageChannel::_sendMessage (ARA::IPC::MessageID messageID, ARA::IPC::MessageEncoder* encoder)
{
#if USE_ARA_CF_ENCODING
const auto messageData { static_cast<ARA::IPC::ARAIPCCFMessageEncoder*> (encoder)->createMessageEncoderData () };
const auto messageData { static_cast<ARA::IPC::CFMessageEncoder*> (encoder)->createMessageEncoderData () };
#else
const auto messageData { static_cast<const IPCXMLMessageEncoder*> (encoder)->createEncodedMessage () };
#endif
Expand Down Expand Up @@ -366,10 +366,10 @@ void IPCMessageChannel::loopUntilMessageReceived ()
}
#endif

ARA::IPC::ARAIPCMessageEncoder* IPCMessageChannel::createEncoder ()
ARA::IPC::MessageEncoder* IPCMessageChannel::createEncoder ()
{
#if USE_ARA_CF_ENCODING
return new ARA::IPC::ARAIPCCFMessageEncoder {};
return new ARA::IPC::CFMessageEncoder {};
#else
return new IPCXMLMessageEncoder {};
#endif
Expand Down
14 changes: 7 additions & 7 deletions TestHost/IPC/IPCMessageChannel.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//------------------------------------------------------------------------------
//! \file IPCMessageChannel.h
//! Proof-of-concept implementation of ARAIPCMessageChannel
//! Proof-of-concept implementation of MessageChannel
//! for the ARA SDK TestHost (error handling is limited to assertions).
//! \project ARA SDK Examples
//! \copyright Copyright (c) 2012-2023, Celemony Software GmbH, All Rights Reserved.
Expand Down Expand Up @@ -61,16 +61,16 @@ class IPCSendPort;
class IPCReceivePort;


class IPCMessageChannel : public ARA::IPC::ARAIPCMessageChannel
class IPCMessageChannel : public ARA::IPC::MessageChannel
{
public:
~IPCMessageChannel () override;

// factory functions for send and receive channels
static IPCMessageChannel* createPublishingID (const std::string& channelID, ARA::IPC::ARAIPCMessageHandler* handler);
static IPCMessageChannel* createConnectedToID (const std::string& channelID, ARA::IPC::ARAIPCMessageHandler* handler);
static IPCMessageChannel* createPublishingID (const std::string& channelID, ARA::IPC::MessageHandler* handler);
static IPCMessageChannel* createConnectedToID (const std::string& channelID, ARA::IPC::MessageHandler* handler);

ARA::IPC::ARAIPCMessageEncoder* createEncoder () override;
ARA::IPC::MessageEncoder* createEncoder () override;

// \todo currently not implemented, we rely on running on the same machine for now
// C++20 offers std::endian which allows for a simple implementation upon connecting...
Expand All @@ -82,9 +82,9 @@ class IPCMessageChannel : public ARA::IPC::ARAIPCMessageChannel
bool runReceiveLoop (int32_t milliseconds);

protected:
using ARA::IPC::ARAIPCMessageChannel::ARAIPCMessageChannel;
using ARA::IPC::MessageChannel::MessageChannel;

void _sendMessage (ARA::IPC::ARAIPCMessageID messageID, ARA::IPC::ARAIPCMessageEncoder* encoder) override;
void _sendMessage (ARA::IPC::MessageID messageID, ARA::IPC::MessageEncoder* encoder) override;

#if !USE_ARA_BACKGROUND_IPC
bool runsReceiveLoopOnCurrentThread () override;
Expand Down
42 changes: 21 additions & 21 deletions TestHost/IPC/IPCXMLEncoding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ IPCXMLMessage::IPCXMLMessage (std::shared_ptr<pugi::xml_document> dictionary, pu
_root { root }
{}

const char* IPCXMLMessage::_getEncodedKey (const MessageKey argKey)
const char* IPCXMLMessage::_getEncodedKey (const MessageArgumentKey argKey)
{
static std::map<MessageKey, std::string> cache;
static std::map<MessageArgumentKey, std::string> cache;
auto existingEntry { cache.find (argKey) };
if (existingEntry != cache.end ())
return existingEntry->second.c_str ();
Expand All @@ -60,48 +60,48 @@ const char* IPCXMLMessage::_getEncodedKey (const MessageKey argKey)
}


void IPCXMLMessageEncoder::appendInt32 (const MessageKey argKey, const int32_t argValue)
void IPCXMLMessageEncoder::appendInt32 (const MessageArgumentKey argKey, const int32_t argValue)
{
_appendAttribute (argKey).set_value (argValue);
}

void IPCXMLMessageEncoder::appendInt64 (const MessageKey argKey, const int64_t argValue)
void IPCXMLMessageEncoder::appendInt64 (const MessageArgumentKey argKey, const int64_t argValue)
{
_appendAttribute (argKey).set_value (argValue);
}

void IPCXMLMessageEncoder::appendSize (const MessageKey argKey, const size_t argValue)
void IPCXMLMessageEncoder::appendSize (const MessageArgumentKey argKey, const size_t argValue)
{
_appendAttribute (argKey).set_value (argValue);
}

void IPCXMLMessageEncoder::appendFloat (const MessageKey argKey, const float argValue)
void IPCXMLMessageEncoder::appendFloat (const MessageArgumentKey argKey, const float argValue)
{
_appendAttribute (argKey).set_value (argValue);
}

void IPCXMLMessageEncoder::appendDouble (const MessageKey argKey, const double argValue)
void IPCXMLMessageEncoder::appendDouble (const MessageArgumentKey argKey, const double argValue)
{
_appendAttribute (argKey).set_value (argValue);
}

void IPCXMLMessageEncoder::appendString (const MessageKey argKey, const char* const argValue)
void IPCXMLMessageEncoder::appendString (const MessageArgumentKey argKey, const char* const argValue)
{
_appendAttribute (argKey).set_value (argValue);
}

void IPCXMLMessageEncoder::appendBytes (const MessageKey argKey, const uint8_t* argValue, const size_t argSize, const bool /*copy*/)
void IPCXMLMessageEncoder::appendBytes (const MessageArgumentKey argKey, const uint8_t* argValue, const size_t argSize, const bool /*copy*/)
{
const auto encodedData { base64_encode (argValue, argSize, false) };
_appendAttribute (argKey).set_value (encodedData.c_str ());
}

pugi::xml_attribute IPCXMLMessageEncoder::_appendAttribute (const MessageKey argKey)
pugi::xml_attribute IPCXMLMessageEncoder::_appendAttribute (const MessageArgumentKey argKey)
{
return _root.append_attribute (_getEncodedKey (argKey));
}

ARA::IPC::ARAIPCMessageEncoder* IPCXMLMessageEncoder::appendSubMessage (const MessageKey argKey)
ARA::IPC::MessageEncoder* IPCXMLMessageEncoder::appendSubMessage (const MessageArgumentKey argKey)
{
return new IPCXMLMessageEncoder { _dictionary, _root.append_child (_getEncodedKey (argKey)) };
}
Expand Down Expand Up @@ -160,7 +160,7 @@ IPCXMLMessageDecoder* IPCXMLMessageDecoder::createWithMessageData (const char* d
}
#endif

bool IPCXMLMessageDecoder::readInt32 (const MessageKey argKey, int32_t* argValue) const
bool IPCXMLMessageDecoder::readInt32 (const MessageArgumentKey argKey, int32_t* argValue) const
{
ARA_INTERNAL_ASSERT (!_root.empty ());
const auto attribute { _root.attribute (_getEncodedKey (argKey)) };
Expand All @@ -174,7 +174,7 @@ bool IPCXMLMessageDecoder::readInt32 (const MessageKey argKey, int32_t* argValue
return true;
}

bool IPCXMLMessageDecoder::readInt64 (const MessageKey argKey, int64_t* argValue) const
bool IPCXMLMessageDecoder::readInt64 (const MessageArgumentKey argKey, int64_t* argValue) const
{
ARA_INTERNAL_ASSERT (!_root.empty ());
const auto attribute { _root.attribute (_getEncodedKey (argKey)) };
Expand All @@ -188,7 +188,7 @@ bool IPCXMLMessageDecoder::readInt64 (const MessageKey argKey, int64_t* argValue
return true;
}

bool IPCXMLMessageDecoder::readSize (const MessageKey argKey, size_t* argValue) const
bool IPCXMLMessageDecoder::readSize (const MessageArgumentKey argKey, size_t* argValue) const
{
ARA_INTERNAL_ASSERT (!_root.empty ());
const auto attribute { _root.attribute (_getEncodedKey (argKey)) };
Expand All @@ -202,7 +202,7 @@ bool IPCXMLMessageDecoder::readSize (const MessageKey argKey, size_t* argValue)
return true;
}

bool IPCXMLMessageDecoder::readFloat (const MessageKey argKey, float* argValue) const
bool IPCXMLMessageDecoder::readFloat (const MessageArgumentKey argKey, float* argValue) const
{
ARA_INTERNAL_ASSERT (!_root.empty ());
const auto attribute { _root.attribute (_getEncodedKey (argKey)) };
Expand All @@ -215,7 +215,7 @@ bool IPCXMLMessageDecoder::readFloat (const MessageKey argKey, float* argValue)
return true;
}

bool IPCXMLMessageDecoder::readDouble (const MessageKey argKey, double* argValue) const
bool IPCXMLMessageDecoder::readDouble (const MessageArgumentKey argKey, double* argValue) const
{
ARA_INTERNAL_ASSERT (!_root.empty ());
const auto attribute { _root.attribute (_getEncodedKey (argKey)) };
Expand All @@ -228,7 +228,7 @@ bool IPCXMLMessageDecoder::readDouble (const MessageKey argKey, double* argValue
return true;
}

bool IPCXMLMessageDecoder::readString (const MessageKey argKey, const char** argValue) const
bool IPCXMLMessageDecoder::readString (const MessageArgumentKey argKey, const char** argValue) const
{
ARA_INTERNAL_ASSERT (!_root.empty ());
const auto attribute { _root.attribute (_getEncodedKey (argKey)) };
Expand All @@ -241,7 +241,7 @@ bool IPCXMLMessageDecoder::readString (const MessageKey argKey, const char** arg
return true;
}

bool IPCXMLMessageDecoder::readBytesSize (const MessageKey argKey, size_t* argSize) const
bool IPCXMLMessageDecoder::readBytesSize (const MessageArgumentKey argKey, size_t* argSize) const
{
ARA_INTERNAL_ASSERT (!_root.empty ());
const auto attribute { _root.attribute (_getEncodedKey (argKey)) };
Expand All @@ -260,7 +260,7 @@ bool IPCXMLMessageDecoder::readBytesSize (const MessageKey argKey, size_t* argSi
return true;
}

void IPCXMLMessageDecoder::readBytes (const MessageKey argKey, uint8_t* const argValue) const
void IPCXMLMessageDecoder::readBytes (const MessageArgumentKey argKey, uint8_t* const argValue) const
{
if (argKey == _bytesCacheKey)
std::memcpy (argValue, _bytesCacheData.data (), _bytesCacheData.size ());
Expand All @@ -277,7 +277,7 @@ void IPCXMLMessageDecoder::readBytes (const MessageKey argKey, uint8_t* const ar
std::memcpy (argValue, decodedData.c_str (), decodedData.size ());
}

ARA::IPC::ARAIPCMessageDecoder* IPCXMLMessageDecoder::readSubMessage (const MessageKey argKey) const
ARA::IPC::MessageDecoder* IPCXMLMessageDecoder::readSubMessage (const MessageArgumentKey argKey) const
{
ARA_INTERNAL_ASSERT (!_root.empty ());
const auto child { _root.child (_getEncodedKey (argKey)) };
Expand All @@ -287,7 +287,7 @@ ARA::IPC::ARAIPCMessageDecoder* IPCXMLMessageDecoder::readSubMessage (const Mess
return new IPCXMLMessageDecoder { _dictionary, child };
}

bool IPCXMLMessageDecoder::hasDataForKey (const MessageKey argKey) const
bool IPCXMLMessageDecoder::hasDataForKey (const MessageArgumentKey argKey) const
{
ARA_INTERNAL_ASSERT (!_root.empty ());
const auto encodedKey { _getEncodedKey (argKey) };
Expand Down
Loading

0 comments on commit e0487be

Please sign in to comment.