aws-crt-cpp
Bootstrap.h
Go to the documentation of this file.
1 #pragma once
2 /*
3  * Copyright 2010-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License").
6  * You may not use this file except in compliance with the License.
7  * A copy of the License is located at
8  *
9  * http://aws.amazon.com/apache2.0
10  *
11  * or in the "license" file accompanying this file. This file is distributed
12  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13  * express or implied. See the License for the specific language governing
14  * permissions and limitations under the License.
15  */
16 
17 #include <aws/crt/Exports.h>
18 #include <aws/crt/Types.h>
21 
22 #include <aws/io/channel_bootstrap.h>
23 #include <aws/io/host_resolver.h>
24 
25 #include <future>
26 
27 namespace Aws
28 {
29  namespace Crt
30  {
31  namespace Io
32  {
33  using OnClientBootstrapShutdownComplete = std::function<void()>;
34 
45  {
46  public:
52  EventLoopGroup &elGroup,
53  HostResolver &resolver,
54  Allocator *allocator = g_allocator) noexcept;
55  ~ClientBootstrap();
56  ClientBootstrap(const ClientBootstrap &) = delete;
60 
64  operator bool() const noexcept;
65 
69  int LastError() const noexcept;
70 
77  void SetShutdownCompleteCallback(OnClientBootstrapShutdownComplete callback);
78 
91  void EnableBlockingShutdown() noexcept;
93  aws_client_bootstrap *GetUnderlyingHandle() const noexcept;
94 
95  private:
96  aws_client_bootstrap *m_bootstrap;
97  int m_lastError;
98  std::unique_ptr<struct ClientBootstrapCallbackData> m_callbackData;
99  std::future<void> m_shutdownFuture;
100  bool m_enableBlockingShutdown;
101  };
102  } // namespace Io
103  } // namespace Crt
104 } // namespace Aws
Aws::Crt::Allocator
aws_allocator Allocator
Definition: StlAllocator.h:25
EventLoopGroup.h
Types.h
AWS_CRT_CPP_API
#define AWS_CRT_CPP_API
Definition: Exports.h:34
Aws::Crt::Io::HostResolver
Definition: HostResolver.h:42
Aws::Crt::Io::OnClientBootstrapShutdownComplete
std::function< void()> OnClientBootstrapShutdownComplete
Definition: Bootstrap.h:33
Aws::Crt::g_allocator
Allocator * g_allocator
Definition: Api.cpp:28
Aws::Crt::LastError
AWS_CRT_CPP_API int LastError() noexcept
Definition: Api.cpp:116
Aws::Crt::Io::ClientBootstrap::operator=
ClientBootstrap & operator=(const ClientBootstrap &)=delete
Aws::Crt::Io::EventLoopGroup
Definition: EventLoopGroup.h:43
Aws::Crt::Io::ClientBootstrap::operator=
ClientBootstrap & operator=(ClientBootstrap &&)=delete
Aws::Crt::Io::ClientBootstrap::ClientBootstrap
ClientBootstrap(const ClientBootstrap &)=delete
Aws
Definition: Api.h:25
Exports.h
Aws::Crt::Io::ClientBootstrap::ClientBootstrap
ClientBootstrap(ClientBootstrap &&)=delete
Aws::Crt::Io::ClientBootstrap
Definition: Bootstrap.h:45
HostResolver.h