Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions parameters/src/Client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@

#include "Utils.hh"

using namespace gz;
using namespace transport;
using namespace parameters;

struct transport::parameters::ParametersClientPrivate
namespace gz::transport::parameters
{
// Inline bracket to help doxygen filtering.
inline namespace GZ_TRANSPORT_VERSION_NAMESPACE {
struct ParametersClientPrivate
{
ParametersClientPrivate(
const std::string & _serverNamespace,
Expand All @@ -47,6 +47,7 @@ struct transport::parameters::ParametersClientPrivate
mutable transport::Node node;
unsigned int timeoutMs;
};
} // namespace GZ_TRANSPORT_VERSION_NAMESPACE

//////////////////////////////////////////////////
ParametersClient::~ParametersClient() = default;
Expand Down Expand Up @@ -243,3 +244,4 @@ ParametersClient::ListParameters() const
}
return res;
}
} // namespace gz::transport::parameters
12 changes: 7 additions & 5 deletions parameters/src/Registry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@

#include "Utils.hh"

using namespace gz;
using namespace transport;
using namespace parameters;

struct transport::parameters::ParametersRegistryPrivate
namespace gz::transport::parameters
{
// Inline bracket to help doxygen filtering.
inline namespace GZ_TRANSPORT_VERSION_NAMESPACE {
struct ParametersRegistryPrivate
{
using ParametersMapT = std::unordered_map<
std::string, std::unique_ptr<google::protobuf::Message>>;
Expand Down Expand Up @@ -78,6 +78,7 @@ struct transport::parameters::ParametersRegistryPrivate
std::mutex parametersMapMutex;
ParametersMapT parametersMap;
};
} // namespace GZ_TRANSPORT_VERSION_NAMESPACE

//////////////////////////////////////////////////
ParametersRegistry::ParametersRegistry(
Expand Down Expand Up @@ -360,3 +361,4 @@ ParametersRegistry::ListParameters() const
dataPtr->ListParameters(unused, ret);
return ret;
}
} // namespace gz::transport::parameters
15 changes: 9 additions & 6 deletions parameters/src/Utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,21 @@
#include <ios>
#include <sstream>
#include <string>
using namespace gz;

namespace gz::transport::parameters
{
// Inline bracket to help doxygen filtering.
inline namespace GZ_TRANSPORT_VERSION_NAMESPACE {
//////////////////////////////////////////////////
std::string
transport::parameters::addGzMsgsPrefix(
const std::string &_gzType)
std::string addGzMsgsPrefix(const std::string &_gzType)
{
std::ostringstream oss{"gz_msgs.", std::ios_base::ate};
oss << _gzType;
return oss.str();
}

//////////////////////////////////////////////////
std::optional<std::string>
transport::parameters::getGzTypeFromAnyProto(
std::optional<std::string> getGzTypeFromAnyProto(
const google::protobuf::Any &_any)
{
auto typeUrl = _any.type_url();
Expand All @@ -48,3 +49,5 @@ transport::parameters::getGzTypeFromAnyProto(
}
return ret.substr(sizeof(prefix) - 1);
}
} // namespace GZ_TRANSPORT_VERSION_NAMESPACE
} // namespace gz::transport::parameters
48 changes: 21 additions & 27 deletions parameters/src/Utils.hh
Original file line number Diff line number Diff line change
Expand Up @@ -33,31 +33,25 @@
#pragma warning(pop)
#endif // defined(_MSC_VER)

namespace gz
namespace gz::transport::parameters
{
namespace transport
{
namespace parameters
{
// Inline bracket to help doxygen filtering.
inline namespace GZ_TRANSPORT_VERSION_NAMESPACE {

/// \brief Return the protobuf type prefixed with "gz_msgs."
/// \param[in] _gzType Type name to be prefixed.
/// \return The protobuf type with the prefix added.
GZ_TRANSPORT_PARAMETERS_VISIBLE
std::string addGzMsgsPrefix(const std::string &_gzType);

/// \brief Get the gz message type from a protobuf message.
/// \param[in] _any Message to get the type.
/// \return A string with the gazebo protobuf type,
/// or nullopt if it fails.
GZ_TRANSPORT_PARAMETERS_VISIBLE
std::optional<std::string> getGzTypeFromAnyProto(
const google::protobuf::Any &_any);
}
}
}
}

#endif
// Inline bracket to help doxygen filtering.
inline namespace GZ_TRANSPORT_VERSION_NAMESPACE {

/// \brief Return the protobuf type prefixed with "gz_msgs."
/// \param[in] _gzType Type name to be prefixed.
/// \return The protobuf type with the prefix added.
GZ_TRANSPORT_PARAMETERS_VISIBLE
std::string addGzMsgsPrefix(const std::string &_gzType);

/// \brief Get the gz message type from a protobuf message.
/// \param[in] _any Message to get the type.
/// \return A string with the gazebo protobuf type,
/// or nullopt if it fails.
GZ_TRANSPORT_PARAMETERS_VISIBLE
std::optional<std::string> getGzTypeFromAnyProto(
const google::protobuf::Any &_any);
} // namespace GZ_TRANSPORT_VERSION_NAMESPACE
} // namespace gz::transport::parameters

#endif // GZ_TRANSPORT_PARAMETERS_UTILS_HH_
13 changes: 7 additions & 6 deletions parameters/src/result.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@

#include "gz/transport/parameters/result.hh"

using namespace gz;
using namespace transport;
using namespace parameters;

namespace gz::transport::parameters
{
// Inline bracket to help doxygen filtering.
inline namespace GZ_TRANSPORT_VERSION_NAMESPACE {
//////////////////////////////////////////////////
ParameterResult::ParameterResult(ParameterResultType _resultType)
: resultType{_resultType}
Expand Down Expand Up @@ -70,8 +70,7 @@ ParameterResult::operator bool() const
}

//////////////////////////////////////////////////
std::ostream &
transport::parameters::operator<<(
std::ostream & operator<<(
std::ostream & os, const ParameterResult & ret)
{
std::ostringstream ss;
Expand Down Expand Up @@ -105,3 +104,5 @@ transport::parameters::operator<<(
os << ss.str();
return os;
}
} // namespace GZ_TRANSPORT_VERSION_NAMESPACE
} // namespace gz::transport::parameters
91 changes: 44 additions & 47 deletions src/AdvertiseOptions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,53 +25,48 @@
using namespace gz;
using namespace transport;

namespace gz
{
namespace transport
{
inline namespace GZ_TRANSPORT_VERSION_NAMESPACE
{
/// \internal
/// \brief Private data for AdvertiseOptions class.
class AdvertiseOptionsPrivate
{
/// \brief Constructor.
public: AdvertiseOptionsPrivate() = default;

/// \brief Destructor.
public: virtual ~AdvertiseOptionsPrivate() = default;

/// \brief Default scope value.
public: Scope_t scope = Scope_t::ALL;
};

/// \internal
/// \brief Private data for AdvertiseMessageOptions class.
class AdvertiseMessageOptionsPrivate
{
/// \brief Constructor.
public: AdvertiseMessageOptionsPrivate() = default;

/// \brief Destructor.
public: virtual ~AdvertiseMessageOptionsPrivate() = default;

/// \brief Default message publication rate.
public: uint64_t msgsPerSec = kUnthrottled;
};

/// \internal
/// \brief Private data for AdvertiseServiceOptions class.
class AdvertiseServiceOptionsPrivate
{
/// \brief Constructor.
public: AdvertiseServiceOptionsPrivate() = default;

/// \brief Destructor.
public: virtual ~AdvertiseServiceOptionsPrivate() = default;
};
}
}
}
namespace gz::transport
{
inline namespace GZ_TRANSPORT_VERSION_NAMESPACE
{
/// \internal
/// \brief Private data for AdvertiseOptions class.
class AdvertiseOptionsPrivate
{
/// \brief Constructor.
public: AdvertiseOptionsPrivate() = default;

/// \brief Destructor.
public: virtual ~AdvertiseOptionsPrivate() = default;

/// \brief Default scope value.
public: Scope_t scope = Scope_t::ALL;
};

/// \internal
/// \brief Private data for AdvertiseMessageOptions class.
class AdvertiseMessageOptionsPrivate
{
/// \brief Constructor.
public: AdvertiseMessageOptionsPrivate() = default;

/// \brief Destructor.
public: virtual ~AdvertiseMessageOptionsPrivate() = default;

/// \brief Default message publication rate.
public: uint64_t msgsPerSec = kUnthrottled;
};

/// \internal
/// \brief Private data for AdvertiseServiceOptions class.
class AdvertiseServiceOptionsPrivate
{
/// \brief Constructor.
public: AdvertiseServiceOptionsPrivate() = default;

/// \brief Destructor.
public: virtual ~AdvertiseServiceOptionsPrivate() = default;
};

//////////////////////////////////////////////////
AdvertiseOptions::AdvertiseOptions()
Expand Down Expand Up @@ -225,3 +220,5 @@ bool AdvertiseServiceOptions::operator!=(
{
return !(*this == _other);
}
} // namespace GZ_TRANSPORT_VERSION_NAMESPACE
} // namespace gz::transport
11 changes: 7 additions & 4 deletions src/Clock.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@
#include <gz/transport/Clock.hh>
#include <gz/transport/Node.hh>

using namespace gz::transport;

namespace gz::transport
{
inline namespace GZ_TRANSPORT_VERSION_NAMESPACE {
//////////////////////////////////////////////////
class gz::transport::NetworkClock::Implementation
class NetworkClock::Implementation
{
/// \brief Implementation constructor.
/// \param[in] _topicName Name of the gz::msgs::Clock type
Expand Down Expand Up @@ -207,7 +208,7 @@ bool NetworkClock::IsReady() const {
}

//////////////////////////////////////////////////
class gz::transport::WallClock::Implementation
class WallClock::Implementation
{
/// \brief Default constructor
public: Implementation();
Expand Down Expand Up @@ -272,3 +273,5 @@ bool WallClock::IsReady() const
{
return true; // Always ready.
}
} // GZ_TRANSPORT_VERSION_NAMESPACE
} // namespace gz::transport
12 changes: 4 additions & 8 deletions src/Discovery.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,9 @@
#endif
#endif

namespace gz
{
namespace transport
{
inline namespace GZ_TRANSPORT_VERSION_NAMESPACE
namespace gz::transport
{
inline namespace GZ_TRANSPORT_VERSION_NAMESPACE {
/////////////////////////////////////////////////
bool pollSockets(const std::vector<int> &_sockets, const int _timeout)
{
Expand All @@ -65,6 +62,5 @@ inline namespace GZ_TRANSPORT_VERSION_NAMESPACE
// Return if we got a reply.
return items[0].revents & ZMQ_POLLIN;
}
}
}
}
} // namespace GZ_TRANSPORT_VERSION_NAMESPACE
} // namespace gz::transport
Loading
Loading