From 083bad3e286e419a42d5cd48e6454b6816e7f057 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 19 Nov 2019 09:28:15 -0800 Subject: [PATCH] redo namespaces --- src/evhelper.cpp | 4 ++-- src/evhelper.h | 4 ++-- src/log.cpp | 4 ++-- src/pvaproto.h | 4 ++-- src/pvxs/server.h | 5 +++++ src/server.cpp | 2 +- src/serverchan.cpp | 4 ++-- src/serverconn.cpp | 4 ++-- src/serverconn.h | 7 +++---- src/udp_collector.cpp | 4 ++-- src/udp_collector.h | 4 ++-- src/util.cpp | 8 ++++---- src/utilpvt.h | 4 ++-- test/testev.cpp | 2 +- test/testsock.cpp | 2 +- test/testudp.cpp | 2 +- tools/pvxvct.cpp | 2 +- 17 files changed, 35 insertions(+), 31 deletions(-) diff --git a/src/evhelper.cpp b/src/evhelper.cpp index d3f89d8..335a9e9 100644 --- a/src/evhelper.cpp +++ b/src/evhelper.cpp @@ -24,7 +24,7 @@ #include "utilpvt.h" #include -namespace pvxsimpl { +namespace pvxs {namespace impl { DEFINE_LOGGER(logerr, "evloop"); @@ -365,4 +365,4 @@ void to_evbuf(evbuffer *buf, const Header& H, bool be) throw std::bad_alloc(); } -} // namespace pvxsimpl +}} // namespace pvxs::impl diff --git a/src/evhelper.h b/src/evhelper.h index 17b2992..3004cfe 100644 --- a/src/evhelper.h +++ b/src/evhelper.h @@ -42,7 +42,7 @@ struct default_delete { }; } -namespace pvxsimpl { +namespace pvxs {namespace impl { using namespace pvxs; //! unique_ptr which is never constructed with NULL @@ -175,6 +175,6 @@ struct PVXS_API evsocket void mcast_iface(const SockAddr& iface) const; }; -} // namespace pvxsimpl +}} // namespace pvxs::impl #endif /* EVHELPER_H */ diff --git a/src/log.cpp b/src/log.cpp index bb3de87..f00a37b 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -228,7 +228,7 @@ void logger_config_env() } // namespace pvxs -namespace pvxsimpl { +namespace pvxs {namespace impl { void logger_shutdown() { @@ -241,4 +241,4 @@ void logger_shutdown() // no resetting logger_once } -} // namespace pvxsimpl +}} // namespace pvxs::impl diff --git a/src/pvaproto.h b/src/pvaproto.h index 23e6bb1..3762a26 100644 --- a/src/pvaproto.h +++ b/src/pvaproto.h @@ -22,7 +22,7 @@ #include #include -namespace pvxsimpl { +namespace pvxs {namespace impl { //! view of a slice of a buffer. //! Don't use directly. cf. FixedBuf @@ -464,6 +464,6 @@ void to_wire(Buf& buf, const Header& H) void to_evbuf(evbuffer *buf, const Header& H, bool be); -} // namespace pvxsimpl +}} // namespace pvxs::impl #endif // PVAPROTO_H diff --git a/src/pvxs/server.h b/src/pvxs/server.h index 341dae7..af5d093 100644 --- a/src/pvxs/server.h +++ b/src/pvxs/server.h @@ -19,6 +19,9 @@ #include namespace pvxs { +namespace impl { +struct ServerConn; +} namespace server { /* struct Search @@ -218,12 +221,14 @@ struct PVXS_API Source { inline const char* name() const { return _name; } //! The caller claims to be able to respond to an onCreate() inline void claim() { _claim = true; } + // TODO claim w/ redirect }; private: typedef std::vector _names_t; _names_t _names; SockAddr _src; friend struct Server::Pvt; + friend struct impl::ServerConn; public: _names_t::iterator begin() { return _names.begin(); } diff --git a/src/server.cpp b/src/server.cpp index 4148ba0..de14e89 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -29,7 +29,7 @@ namespace pvxs { namespace server { -using namespace pvxsimpl; +using namespace impl; DEFINE_LOGGER(serversetup, "server.setup"); DEFINE_LOGGER(serverio, "server.io"); diff --git a/src/serverchan.cpp b/src/serverchan.cpp index 6d839fb..40322f9 100644 --- a/src/serverchan.cpp +++ b/src/serverchan.cpp @@ -10,7 +10,7 @@ #include "pvxs/log.h" #include "serverconn.h" -namespace pvxsimpl { +namespace pvxs {namespace impl { // message related to client state and errors DEFINE_LOGGER(connsetup, "tcp.setup"); @@ -233,4 +233,4 @@ void ServerConn::handle_DestroyChan() bev.reset(); } -} // namespace pvxsimpl +}} // namespace pvxs::impl diff --git a/src/serverconn.cpp b/src/serverconn.cpp index f6cea15..5cef626 100644 --- a/src/serverconn.cpp +++ b/src/serverconn.cpp @@ -20,7 +20,7 @@ // at the price of maybe extra copying. static const size_t tcp_readahead = 0x1000; -namespace pvxsimpl { +namespace pvxs {namespace impl { // message related to client state and errors DEFINE_LOGGER(connsetup, "tcp.setup"); @@ -462,4 +462,4 @@ void ServIface::onConnS(struct evconnlistener *listener, evutil_socket_t sock, s ServerOp::~ServerOp() {} -} // namespace pvxsimpl +}} // namespace pvxs::impl diff --git a/src/serverconn.h b/src/serverconn.h index 77ff551..ff9866d 100644 --- a/src/serverconn.h +++ b/src/serverconn.h @@ -18,7 +18,7 @@ #include "utilpvt.h" #include "udp_collector.h" -namespace pvxsimpl { +namespace pvxs {namespace impl { struct ServIface; struct ServerConn; @@ -145,11 +145,10 @@ struct ServIface static void onConnS(struct evconnlistener *listener, evutil_socket_t sock, struct sockaddr *peer, int socklen, void *raw); }; -} // namespace pvxsimpl +} // namespace impl -namespace pvxs { namespace server { -using namespace pvxsimpl; +using namespace impl; struct Server::Pvt { diff --git a/src/udp_collector.cpp b/src/udp_collector.cpp index 4b87318..401850e 100644 --- a/src/udp_collector.cpp +++ b/src/udp_collector.cpp @@ -26,7 +26,7 @@ typedef epicsGuard Guard; -namespace pvxsimpl { +namespace pvxs {namespace impl { DEFINE_LOGGER(logio, "udp.io"); DEFINE_LOGGER(logsetup, "udp.setup"); @@ -433,4 +433,4 @@ bool UDPCollector::reply(const void *msg, size_t msglen) const UDPManager::Search::~Search() {} -} // namespace pvxsimpl +}} // namespace pvxs::impl diff --git a/src/udp_collector.h b/src/udp_collector.h index 0fcfb83..1d85d7c 100644 --- a/src/udp_collector.h +++ b/src/udp_collector.h @@ -16,7 +16,7 @@ #include #include "evhelper.h" -namespace pvxsimpl { +namespace pvxs {namespace impl { struct UDPListener; struct UDPCollector; struct UDPManager; @@ -95,6 +95,6 @@ public: inline void stop() { start(false); } }; -} // namespace pvxsimpl +}} // namespace pvxs::impl #endif // UDP_COLLECTOR_H diff --git a/src/util.cpp b/src/util.cpp index 9f741c4..0d289da 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -33,8 +33,8 @@ unsigned long version_int() void cleanup_for_valgrind() { - pvxsimpl::logger_shutdown(); - pvxsimpl::UDPManager::cleanup(); + impl::logger_shutdown(); + impl::UDPManager::cleanup(); } namespace detail { @@ -251,7 +251,7 @@ std::ostream& operator<<(std::ostream& strm, const SockAddr& addr) } -namespace pvxsimpl { +namespace pvxs {namespace impl { namespace detail { template<> @@ -264,5 +264,5 @@ unsigned short as_str::op(const char *s) } return ret; } - +} }} diff --git a/src/utilpvt.h b/src/utilpvt.h index c58feba..27ab794 100644 --- a/src/utilpvt.h +++ b/src/utilpvt.h @@ -22,7 +22,7 @@ #include #include -namespace pvxsimpl { +namespace pvxs {namespace impl { using namespace pvxs; //! in-line string builder (eg. for exception messages) @@ -144,6 +144,6 @@ public: void logger_shutdown(); -} // namespace pvxsimpl +}} // namespace pvxs::impl #endif // UTILPVT_H diff --git a/test/testev.cpp b/test/testev.cpp index 95bcf4b..4e8a3cc 100644 --- a/test/testev.cpp +++ b/test/testev.cpp @@ -12,7 +12,7 @@ #include #include -using namespace pvxsimpl; +using namespace pvxs::impl; namespace { struct my_special_error : public std::runtime_error diff --git a/test/testsock.cpp b/test/testsock.cpp index d1bbf01..1ab2136 100644 --- a/test/testsock.cpp +++ b/test/testsock.cpp @@ -16,7 +16,7 @@ #include namespace { -using namespace pvxsimpl; +using namespace pvxs::impl; void test_udp() { diff --git a/test/testudp.cpp b/test/testudp.cpp index 5edaba9..835f912 100644 --- a/test/testudp.cpp +++ b/test/testudp.cpp @@ -20,7 +20,7 @@ #include namespace { -using namespace pvxsimpl; +using namespace pvxs::impl; void testBeacon(bool be) { diff --git a/tools/pvxvct.cpp b/tools/pvxvct.cpp index 23bdb83..552b6da 100644 --- a/tools/pvxvct.cpp +++ b/tools/pvxvct.cpp @@ -30,7 +30,7 @@ #include #include -namespace pva = pvxsimpl; +namespace pva = pvxs::impl; namespace { DEFINE_LOGGER(out, "pvxvct");