Gazebo Transport

API Reference

8.5.0
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
37 {
38  namespace transport
39  {
40  // Inline bracket to help doxygen filtering.
41  inline namespace IGNITION_TRANSPORT_VERSION_NAMESPACE {
42  //
45  class IGNITION_TRANSPORT_VISIBLE Uuid
46  {
48  public: Uuid();
49 
51  public: virtual ~Uuid();
52 
55  public: std::string ToString() const;
56 
60  public: friend std::ostream &operator<<(std::ostream &_out,
61  const gz::transport::Uuid &_uuid)
62  {
63  _out << _uuid.ToString();
64  return _out;
65  }
66 
73  private: static const int UuidStrLen = 37;
74 
76  private: portable_uuid_t data;
77  };
78  }
79  }
80 }
81 #endif
Definition: gz/transport/AdvertiseOptions.hh:28
STL class.
A portable class for representing a Universally Unique Identifier.
Definition: gz/transport/Uuid.hh:45
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:60
std::string ToString() const
Return the string representation of the Uuid.