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 @@ -359,3 +360,4 @@ ParametersRegistry::ListParameters() const
dataPtr->ListParameters(unused, ret);
return ret;
}
} // namespace gz::transport::parameters
11 changes: 8 additions & 3 deletions parameters/src/Utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@
#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::optional<std::string>
transport::parameters::getGzTypeFromAnyProto(
std::optional<std::string> getGzTypeFromAnyProto(
const google::protobuf::Any &_any)
{
auto typeUrl = _any.type_url();
Expand All @@ -38,3 +41,5 @@ transport::parameters::getGzTypeFromAnyProto(
}
return ret;
}
} // namespace GZ_TRANSPORT_VERSION_NAMESPACE
} // namespace gz::transport::parameters
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
72 changes: 34 additions & 38 deletions src/Helpers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,55 +26,51 @@

#include "gz/transport/Helpers.hh"

namespace gz
namespace gz::transport
{
namespace transport
inline namespace GZ_TRANSPORT_VERSION_NAMESPACE {
//////////////////////////////////////////////////
bool env(const std::string &_name, std::string &_value)
{
inline namespace GZ_TRANSPORT_VERSION_NAMESPACE
{
//////////////////////////////////////////////////
bool env(const std::string &_name, std::string &_value)
{
char *v;
char *v;
#ifdef _MSC_VER
size_t sz = 0;
_dupenv_s(&v, &sz, _name.c_str());
size_t sz = 0;
_dupenv_s(&v, &sz, _name.c_str());
#else
v = std::getenv(_name.c_str());
v = std::getenv(_name.c_str());
#endif
if (v)
{
_value = v;
return true;
}
return false;
if (v)
{
_value = v;
return true;
}
return false;
}

//////////////////////////////////////////////////
std::vector<std::string> split(const std::string &_orig, char _delim)
//////////////////////////////////////////////////
std::vector<std::string> split(const std::string &_orig, char _delim)
{
std::vector<std::string> pieces;
size_t pos1 = 0;
size_t pos2 = _orig.find(_delim);
while (pos2 != std::string::npos)
{
std::vector<std::string> pieces;
size_t pos1 = 0;
size_t pos2 = _orig.find(_delim);
while (pos2 != std::string::npos)
{
pieces.push_back(_orig.substr(pos1, pos2-pos1));
pos1 = pos2 + 1;
pos2 = _orig.find(_delim, pos2 + 1);
}
pieces.push_back(_orig.substr(pos1, _orig.size()-pos1));
return pieces;
pieces.push_back(_orig.substr(pos1, pos2-pos1));
pos1 = pos2 + 1;
pos2 = _orig.find(_delim, pos2 + 1);
}
pieces.push_back(_orig.substr(pos1, _orig.size()-pos1));
return pieces;
}

//////////////////////////////////////////////////
unsigned int getProcessId()
{
//////////////////////////////////////////////////
unsigned int getProcessId()
{
#ifdef _WIN32
return ::GetCurrentProcessId();
return ::GetCurrentProcessId();
#else
return ::getpid();
return ::getpid();
#endif
}
}
}
}
} // namespace GZ_TRANSPORT_VERSION_NAMESPACE
} // namespace gz::transport
Loading
Loading