Skip to content

Commit

Permalink
Split off internal::poll
Browse files Browse the repository at this point in the history
  • Loading branch information
d-frey committed Nov 19, 2023
1 parent 72af86d commit 2a71f80
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 21 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ set(taopq_INCLUDE_FILES
${taopq_INCLUDE_DIRS}/tao/pq/internal/from_chars.hpp
${taopq_INCLUDE_DIRS}/tao/pq/internal/gen.hpp
${taopq_INCLUDE_DIRS}/tao/pq/internal/parameter_traits_helper.hpp
${taopq_INCLUDE_DIRS}/tao/pq/internal/poll.hpp
${taopq_INCLUDE_DIRS}/tao/pq/internal/pool.hpp
${taopq_INCLUDE_DIRS}/tao/pq/internal/printf.hpp
${taopq_INCLUDE_DIRS}/tao/pq/internal/resize_uninitialized.hpp
Expand Down Expand Up @@ -74,11 +75,11 @@ set(taopq_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/src/lib/pq/exception.cpp
${CMAKE_CURRENT_LIST_DIR}/src/lib/pq/field.cpp
${CMAKE_CURRENT_LIST_DIR}/src/lib/pq/internal/demangle.cpp
${CMAKE_CURRENT_LIST_DIR}/src/lib/pq/internal/poll.cpp
${CMAKE_CURRENT_LIST_DIR}/src/lib/pq/internal/printf.cpp
${CMAKE_CURRENT_LIST_DIR}/src/lib/pq/internal/strtox.cpp
${CMAKE_CURRENT_LIST_DIR}/src/lib/pq/large_object.cpp
${CMAKE_CURRENT_LIST_DIR}/src/lib/pq/parameter_traits.cpp
${CMAKE_CURRENT_LIST_DIR}/src/lib/pq/poll.cpp
${CMAKE_CURRENT_LIST_DIR}/src/lib/pq/result.cpp
${CMAKE_CURRENT_LIST_DIR}/src/lib/pq/result_traits.cpp
${CMAKE_CURRENT_LIST_DIR}/src/lib/pq/row.cpp
Expand Down
1 change: 1 addition & 0 deletions include/tao/pq/connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include <tao/pq/access_mode.hpp>
#include <tao/pq/connection_status.hpp>
#include <tao/pq/internal/poll.hpp>
#include <tao/pq/internal/zsv.hpp>
#include <tao/pq/isolation_level.hpp>
#include <tao/pq/notification.hpp>
Expand Down
1 change: 1 addition & 0 deletions include/tao/pq/connection_pool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <utility>

#include <tao/pq/connection.hpp>
#include <tao/pq/internal/poll.hpp>
#include <tao/pq/internal/pool.hpp>
#include <tao/pq/internal/zsv.hpp>
#include <tao/pq/poll.hpp>
Expand Down
16 changes: 16 additions & 0 deletions include/tao/pq/internal/poll.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright (c) 2023 Daniel Frey and Dr. Colin Hirsch
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)

#ifndef TAO_PQ_INTERNAL_POLL_HPP
#define TAO_PQ_INTERNAL_POLL_HPP

#include <tao/pq/poll.hpp>

namespace tao::pq::internal
{
[[nodiscard]] auto poll( const int socket, const bool wait_for_write, const int timeout ) -> pq::poll::status;

} // namespace tao::pq::internal

#endif
28 changes: 9 additions & 19 deletions include/tao/pq/poll.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,18 @@
#ifndef TAO_PQ_POLL_HPP
#define TAO_PQ_POLL_HPP

namespace tao::pq
namespace tao::pq::poll
{
namespace poll
enum class status
{
enum class status
{
timeout,
readable,
writable,
again
};
timeout,
readable,
writable,
again
};

using callback = status( const int socket, const bool wait_for_write, const int timeout );
using callback = status( const int socket, const bool wait_for_write, const int timeout );

} // namespace poll

namespace internal
{
[[nodiscard]] auto poll( const int socket, const bool wait_for_write, const int timeout ) -> pq::poll::status;

} // namespace internal

} // namespace tao::pq
} // namespace tao::pq::poll

#endif
2 changes: 1 addition & 1 deletion src/lib/pq/poll.cpp → src/lib/pq/internal/poll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)

#include <tao/pq/poll.hpp>
#include <tao/pq/internal/poll.hpp>

#include <cctype>
#include <cerrno>
Expand Down

0 comments on commit 2a71f80

Please sign in to comment.