Gazebo Transport

API Reference

14.0.0
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
36namespace gz
37{
38 namespace transport
39 {
40 // Inline bracket to help doxygen filtering.
41 inline namespace GZ_TRANSPORT_VERSION_NAMESPACE {
42 //
45 class GZ_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