@@ -57,6 +57,8 @@ Status ConnectionGenerator::GenerateHeader() {
5757 {vars (" idempotency_policy_header_path" ), vars (" retry_traits_header_path" ),
5858 HasLongrunningMethod () ? " google/cloud/no_await_tag.h" : " " ,
5959 IsExperimental () ? " google/cloud/experimental_tag.h" : " " ,
60+ HasEmitCompletionQueueAccessor () ? " google/cloud/completion_queue.h"
61+ : " " ,
6062 " google/cloud/backoff_policy.h" ,
6163 HasLongrunningMethod () || HasAsyncMethod () ? " google/cloud/future.h"
6264 : " " ,
@@ -91,7 +93,21 @@ Status ConnectionGenerator::GenerateHeader() {
9193 }
9294 }
9395
94- auto result = HeaderOpenNamespaces ();
96+ Status result;
97+ if (HasEmitCompletionQueueAccessor ()) {
98+ result = HeaderOpenNamespaces ();
99+ if (!result.ok ()) return result;
100+ HeaderPrint (R"""( class $connection_class_name$;)""" );
101+ HeaderCloseNamespaces ();
102+
103+ result = HeaderOpenNamespaces (NamespaceType::kInternal );
104+ if (!result.ok ()) return result;
105+ HeaderPrint (
106+ R"""( StatusOr<CompletionQueue> completion_queue($product_namespace$::$connection_class_name$ const& conn);)""" );
107+ HeaderCloseNamespaces ();
108+ }
109+
110+ result = HeaderOpenNamespaces ();
95111 if (!result.ok ()) return result;
96112
97113 HeaderPrint (R"""(
@@ -315,6 +331,13 @@ class $connection_class_name$ {
315331 __FILE__, __LINE__);
316332 }
317333
334+ if (HasEmitCompletionQueueAccessor ()) {
335+ HeaderPrint (R"""( protected:
336+ friend StatusOr<CompletionQueue> $product_internal_namespace$::completion_queue(
337+ $connection_class_name$ const& conn);
338+ virtual StatusOr<CompletionQueue> completion_queue() const;
339+ )""" );
340+ }
318341 // close abstract interface Connection base class
319342 HeaderPrint (" };\n " );
320343
@@ -490,6 +513,15 @@ future<StatusOr<$response_type$>>
490513 __FILE__, __LINE__);
491514 }
492515
516+ if (HasEmitCompletionQueueAccessor ()) {
517+ CcPrint (
518+ R"""(
519+ StatusOr<CompletionQueue> $connection_class_name$::completion_queue() const {
520+ return Status(StatusCode::kUnimplemented, "not implemented");
521+ }
522+ )""" );
523+ }
524+
493525 if (HasGenerateGrpcTransport ()) {
494526 EmitFactoryFunctionDefinition (EndpointLocationStyle ());
495527 }
0 commit comments