Skip to content

Commit

Permalink
style: Rename ipp file to hpp for better intellisense in vscode
Browse files Browse the repository at this point in the history
  • Loading branch information
Tradias committed Jul 13, 2024
1 parent eba6846 commit 0b45a48
Show file tree
Hide file tree
Showing 11 changed files with 107 additions and 83 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
paths:
- '**.cpp'
- '**.hpp'
- '**.ipp'
- '**.cmake'
- '**.cmake.in'
- '**/CMakeLists.txt'
Expand Down
3 changes: 1 addition & 2 deletions cmake/AsioGrpcInstallation.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,4 @@ install(
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/agrpc"
TYPE INCLUDE
FILES_MATCHING
PATTERN "*.hpp"
PATTERN "*.ipp")
PATTERN "*.hpp")
3 changes: 1 addition & 2 deletions cmake/hooks/AsioGrpcPreCommit.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ endforeach()

# process cpp files
foreach(_git_out IN LISTS _git_output_list)
string(REGEX MATCHALL ".*\\.tpp\$|.*\\.hpp\$|.*\\.ipp\$|.*\\.cpp\$|.*\\.proto\$|.*\\.h\$|.*\\.c\$" _file
"${_git_out}")
string(REGEX MATCHALL ".*\\.tpp\$|.*\\.hpp\$|.*\\.cpp\$|.*\\.proto\$|.*\\.h\$|.*\\.c\$" _file "${_git_out}")

if(NOT "${_file}" STREQUAL "")
execute_process(COMMAND "@ASIO_GRPC_CLANG_FORMAT_PROGRAM@" "-i" "-style=file" "${_file}"
Expand Down
2 changes: 1 addition & 1 deletion doc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if(TARGET Doxygen::doxygen)
set(DOXYGEN_HIDE_UNDOC_CLASSES "YES")
set(DOXYGEN_WARN_IF_UNDOCUMENTED "NO")
set(DOXYGEN_WARN_IF_INCOMPLETE_DOC "NO")
set(DOXYGEN_FILE_PATTERNS "*.cpp" "*.ixx" "*.ipp" "*.hpp" "*.md" "cmake/AsioGrpcProtobufGenerator.cmake")
set(DOXYGEN_FILE_PATTERNS "*.cpp" "*.hpp" "*.md" "cmake/AsioGrpcProtobufGenerator.cmake")
set(DOXYGEN_EXCLUDE_PATTERNS "*/build*" "*/example/*" "*/deps/*" "*/test/*" "README.md" "CONTRIBUTING.md")
set(DOXYGEN_EXAMPLE_PATH "example/proto" "example/snippets" "example" "test/cmake/superbuild/src" "cmake")
set(DOXYGEN_USE_MDFILE_AS_MAINPAGE "doc/index.md")
Expand Down
9 changes: 9 additions & 0 deletions src/agrpc/detail/forward.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,15 @@ class NotifyWhenDoneEvent;

template <class ServerRPC, class RPCHandler, class CompletionHandler>
struct RegisterCallbackRPCHandlerOperation;

template <class Signature>
class ManualResetEvent;

template <class Signature>
struct ManualResetEventOperationBase;

template <class Signature, class Receiver>
struct ManualResetEventOperation;
}

AGRPC_NAMESPACE_END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,18 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef AGRPC_DETAIL_GRPC_CONTEXT_IPP
#define AGRPC_DETAIL_GRPC_CONTEXT_IPP
#ifndef AGRPC_DETAIL_GRPC_CONTEXT_DEFINITION_HPP
#define AGRPC_DETAIL_GRPC_CONTEXT_DEFINITION_HPP

#include <agrpc/detail/asio_forward.hpp>
#include <agrpc/detail/grpc_completion_queue_event.hpp>
#include <agrpc/detail/grpc_executor_options.hpp>
#include <agrpc/detail/intrusive_queue.hpp>
#include <agrpc/grpc_context.hpp>
#include <agrpc/grpc_executor.hpp>
#include <grpcpp/alarm.h>
#include <grpcpp/completion_queue.h>

#include <atomic>
#include <utility>

#include <agrpc/detail/config.hpp>

Expand Down Expand Up @@ -227,6 +225,6 @@ agrpc::GrpcContext::executor_type tag_invoke(stdexec::get_completion_scheduler_t

AGRPC_NAMESPACE_END

#include <agrpc/detail/grpc_context_implementation.ipp>
#include <agrpc/detail/grpc_context_implementation_definition.hpp>

#endif // AGRPC_DETAIL_GRPC_CONTEXT_IPP
#endif // AGRPC_DETAIL_GRPC_CONTEXT_DEFINITION_HPP
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef AGRPC_DETAIL_GRPC_CONTEXT_IMPLEMENTATION_IPP
#define AGRPC_DETAIL_GRPC_CONTEXT_IMPLEMENTATION_IPP
#ifndef AGRPC_DETAIL_GRPC_CONTEXT_IMPLEMENTATION_DEFINITION_HPP
#define AGRPC_DETAIL_GRPC_CONTEXT_IMPLEMENTATION_DEFINITION_HPP

#include <agrpc/detail/asio_forward.hpp>
#include <agrpc/detail/grpc_completion_queue_event.hpp>
Expand Down Expand Up @@ -368,4 +368,4 @@ inline void PoolResourceAllocator<T>::deallocate(T* p, std::size_t n) noexcept

AGRPC_NAMESPACE_END

#endif // AGRPC_DETAIL_GRPC_CONTEXT_IMPLEMENTATION_IPP
#endif // AGRPC_DETAIL_GRPC_CONTEXT_IMPLEMENTATION_DEFINITION_HPP
66 changes: 2 additions & 64 deletions src/agrpc/detail/manual_reset_event.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <agrpc/detail/association.hpp>
#include <agrpc/detail/execution.hpp>
#include <agrpc/detail/forward.hpp>
#include <agrpc/detail/prepend_error_code.hpp>
#include <agrpc/detail/sender_of.hpp>
#include <agrpc/detail/stop_callback_lifetime.hpp>
#include <agrpc/detail/tuple.hpp>
Expand All @@ -32,51 +33,12 @@ AGRPC_NAMESPACE_BEGIN()

namespace detail
{
template <class Signature>
struct PrependErrorCodeToSignature;

template <class... Args>
struct PrependErrorCodeToSignature<void(detail::ErrorCode, Args...)>
{
using Type = void(detail::ErrorCode, Args...);

template <class Function>
static void invoke_with_default_args(Function&& function, detail::ErrorCode&& ec)
{
static_cast<Function&&>(function)(static_cast<detail::ErrorCode&&>(ec), Args{}...);
}
};

template <class... Args>
struct PrependErrorCodeToSignature<void(Args...)>
{
using Type = void(detail::ErrorCode, Args...);

template <class Function>
static void invoke_with_default_args(Function&& function, detail::ErrorCode&& ec)
{
static_cast<Function&&>(function)(static_cast<detail::ErrorCode&&>(ec), Args{}...);
}
};

template <class Signature>
using PrependErrorCodeToSignatureT = typename detail::PrependErrorCodeToSignature<Signature>::Type;

template <class Signature>
class ManualResetEvent;

template <class Signature>
class ManualResetEventSender;

template <class Signature, class Receiver>
struct ManualResetEventRunningOperationState;

template <class Signature, class Receiver>
struct ManualResetEventOperation;

template <class Signature>
struct ManualResetEventOperationBase;

template <class... Args>
struct ManualResetEventOperationBase<void(Args...)>
{
Expand All @@ -88,30 +50,6 @@ struct ManualResetEventOperationBase<void(Args...)>
Complete complete_;
};

template <class CompletionHandler, class... Args, std::size_t... I>
void prepend_error_code_and_apply_impl(CompletionHandler&& ch, detail::Tuple<Args...>&& args,
const std::index_sequence<I...>&)
{
static_cast<CompletionHandler&&>(ch)(detail::ErrorCode{},
detail::get<I>(static_cast<detail::Tuple<Args...>&&>(args))...);
}

template <class CompletionHandler, class... Args, std::size_t... I>
void prepend_error_code_and_apply_impl(CompletionHandler&& ch, detail::Tuple<detail::ErrorCode, Args...>&& args,
const std::index_sequence<I...>&)
{
static_cast<CompletionHandler&&>(ch)(
detail::get<I>(static_cast<detail::Tuple<detail::ErrorCode, Args...>&&>(args))...);
}

template <class CompletionHandler, class... Args>
void prepend_error_code_and_apply(CompletionHandler&& ch, detail::Tuple<Args...>&& args)
{
detail::prepend_error_code_and_apply_impl(static_cast<CompletionHandler&&>(ch),
static_cast<detail::Tuple<Args...>&&>(args),
std::make_index_sequence<sizeof...(Args)>{});
}

template <class... Args>
class ManualResetEvent<void(Args...)> : private detail::Tuple<Args...>
{
Expand Down Expand Up @@ -336,7 +274,7 @@ inline ManualResetEventSender<void(Args...)> ManualResetEvent<void(Args...)>::wa
AGRPC_NAMESPACE_END

#if defined(AGRPC_STANDALONE_ASIO) || defined(AGRPC_BOOST_ASIO)
#include <agrpc/detail/manual_reset_event_operation.ipp>
#include <agrpc/detail/manual_reset_event_operation.hpp>
#endif

#endif // AGRPC_DETAIL_MANUAL_RESET_EVENT_HPP
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@

#include <agrpc/detail/allocate.hpp>
#include <agrpc/detail/association.hpp>
#include <agrpc/detail/execution.hpp>
#include <agrpc/detail/forward.hpp>
#include <agrpc/detail/tuple.hpp>
#include <agrpc/detail/utility.hpp>
#include <agrpc/detail/prepend_error_code.hpp>
#include <agrpc/detail/work_tracking_completion_handler.hpp>

#include <agrpc/detail/asio_macros.hpp>
Expand Down
84 changes: 84 additions & 0 deletions src/agrpc/detail/prepend_error_code.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// Copyright 2024 Dennis Hezel
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef AGRPC_DETAIL_PREPEND_ERROR_CODE_HPP
#define AGRPC_DETAIL_PREPEND_ERROR_CODE_HPP

#include <agrpc/detail/asio_forward.hpp>
#include <agrpc/detail/tuple.hpp>

#include <agrpc/detail/config.hpp>

AGRPC_NAMESPACE_BEGIN()

namespace detail
{
template <class Signature>
struct PrependErrorCodeToSignature;

template <class... Args>
struct PrependErrorCodeToSignature<void(detail::ErrorCode, Args...)>
{
using Type = void(detail::ErrorCode, Args...);

template <class Function>
static void invoke_with_default_args(Function&& function, detail::ErrorCode&& ec)
{
static_cast<Function&&>(function)(static_cast<detail::ErrorCode&&>(ec), Args{}...);
}
};

template <class... Args>
struct PrependErrorCodeToSignature<void(Args...)>
{
using Type = void(detail::ErrorCode, Args...);

template <class Function>
static void invoke_with_default_args(Function&& function, detail::ErrorCode&& ec)
{
static_cast<Function&&>(function)(static_cast<detail::ErrorCode&&>(ec), Args{}...);
}
};

template <class Signature>
using PrependErrorCodeToSignatureT = typename detail::PrependErrorCodeToSignature<Signature>::Type;

template <class CompletionHandler, class... Args, std::size_t... I>
void prepend_error_code_and_apply_impl(CompletionHandler&& ch, detail::Tuple<Args...>&& args,
const std::index_sequence<I...>&)
{
static_cast<CompletionHandler&&>(ch)(detail::ErrorCode{},
detail::get<I>(static_cast<detail::Tuple<Args...>&&>(args))...);
}

template <class CompletionHandler, class... Args, std::size_t... I>
void prepend_error_code_and_apply_impl(CompletionHandler&& ch, detail::Tuple<detail::ErrorCode, Args...>&& args,
const std::index_sequence<I...>&)
{
static_cast<CompletionHandler&&>(ch)(
detail::get<I>(static_cast<detail::Tuple<detail::ErrorCode, Args...>&&>(args))...);
}

template <class CompletionHandler, class... Args>
void prepend_error_code_and_apply(CompletionHandler&& ch, detail::Tuple<Args...>&& args)
{
detail::prepend_error_code_and_apply_impl(static_cast<CompletionHandler&&>(ch),
static_cast<detail::Tuple<Args...>&&>(args),
std::make_index_sequence<sizeof...(Args)>{});
}
}

AGRPC_NAMESPACE_END

#endif
2 changes: 1 addition & 1 deletion src/agrpc/grpc_executor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ struct agrpc::asio::traits::query_member<agrpc::BasicGrpcExecutor<Allocator, Opt
};
#endif

#include <agrpc/detail/grpc_context.ipp>
#include <agrpc/detail/grpc_context_definition.hpp>

#include <agrpc/detail/epilogue.hpp>

Expand Down

0 comments on commit 0b45a48

Please sign in to comment.