Gazebo Transport

API Reference

11.4.1
gz/transport/Uuid.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 #ifndef GZ_TRANSPORT_UUID_HH_
19 #define GZ_TRANSPORT_UUID_HH_
20 
21 #include <iostream>
22 #include <string>
23 
24 #include "gz/transport/config.hh"
25 #include "gz/transport/Export.hh"
26 
27 #ifdef _WIN32
28  #include <Rpc.h>
29  #pragma comment(lib, "Rpcrt4.lib")
30  using portable_uuid_t = UUID;
31 #else /* UNIX */
32  #include <uuid/uuid.h>
33  using portable_uuid_t = uuid_t;
34 #endif
35 
36 namespace ignition::transport
37 {
38  // Inline bracket to help doxygen filtering.
39  inline namespace IGNITION_TRANSPORT_VERSION_NAMESPACE {
40  //
43  class IGNITION_TRANSPORT_VISIBLE Uuid
44  {
46  public: Uuid();
47 
49  public: virtual ~Uuid();
50 
53  public: std::string ToString() const;
54 
58  public: friend std::ostream &operator<<(std::ostream &_out,
59  const gz::transport::Uuid &_uuid)
60  {
61  _out << _uuid.ToString();
62  return _out;
63  }
64 
71  private: static const int UuidStrLen = 37;
72 
74  private: portable_uuid_t data;
75  };
76  }
77 }
78 #endif
STL class.
A portable class for representing a Universally Unique Identifier.
Definition: gz/transport/Uuid.hh:43
uuid_t portable_uuid_t
Definition: gz/transport/Uuid.hh:33
STL class.
virtual ~Uuid()
Destructor.
friend std::ostream & operator<<(std::ostream &_out, const Uuid &_uuid)
Stream insertion operator.
Definition: gz/transport/Uuid.hh:58
Definition: gz/transport/AdvertiseOptions.hh:28
std::string ToString() const
Return the string representation of the Uuid.