Google Cloud Pub/Sub C++ Client
2.1.0
A C++ Client Library for Google Cloud Pub/Sub
topic.h
Go to the documentation of this file.
1
// Copyright 2020 Google LLC
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// https://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
#
ifndef
GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_PUBSUB_TOPIC_H
16
#
define
GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_PUBSUB_TOPIC_H
17
18
#
include
"google/cloud/pubsub/version.h"
19
#
include
<
grpcpp
/
grpcpp
.
h
>
20
#
include
<
string
>
21
22
namespace
google
{
23
namespace
cloud
{
24
namespace
pubsub
{
25
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
26
27
/**
28
* Objects of this class identify a Cloud Pub/Sub topic.
29
*
30
* @note
31
* This class makes no effort to validate the ids provided. The application
32
* should verify that any ids passed to this application conform to the
33
* Cloud Pub/Sub [resource name][name-link] restrictions.
34
*
35
* [name-link]: https://cloud.google.com/pubsub/docs/admin#resource_names
36
*/
37
class
Topic
{
38
public
:
39
Topic
(std::string project_id, std::string topic_id)
40
: project_id_(std::move(project_id)), topic_id_(std::move(topic_id)) {}
41
42
/// @name Copy and move
43
//@{
44
Topic
(
Topic
const
&) =
default
;
45
Topic
&
operator
=(
Topic
const
&) =
default
;
46
Topic
(
Topic
&&) =
default
;
47
Topic
&
operator
=(
Topic
&&) =
default
;
48
//@}
49
50
/// Returns the Project ID
51
std::string
const
&
project_id
()
const
{
return
project_id_; }
52
53
/// Returns the Topic ID
54
std::string
const
&
topic_id
()
const
{
return
topic_id_; }
55
56
/**
57
* Returns the fully qualified topic name as a string of the form:
58
* "projects/<project-id>/topics/<topic-id>"
59
*/
60
std::string
FullName
()
const
;
61
62
/// @name Equality operators
63
//@{
64
friend
bool
operator
==(
Topic
const
& a,
Topic
const
& b);
65
friend
bool
operator
!=(
Topic
const
& a,
Topic
const
& b) {
return
!(a
==
b); }
66
//@}
67
68
/// Output the `FullName()` format.
69
friend
std::ostream& operator<<(std::ostream& os,
Topic
const
& rhs);
70
71
private
:
72
std::string project_id_;
73
std::string topic_id_;
74
};
75
76
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
77
}
// namespace pubsub
78
}
// namespace cloud
79
}
// namespace google
80
81
#
endif
// GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_PUBSUB_TOPIC_H
Generated on Mon Aug 1 2022 21:41:46 for Google Cloud Pub/Sub C++ Client by
1.9.1