Gazebo Common

API Reference

6.0.0
Uuid.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016 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#ifndef GZ_COMMON_UUID_HH_INCLUDED_
18#define GZ_COMMON_UUID_HH_INCLUDED_
19
20#include <iostream>
21#include <string>
22
23#include <gz/common/Export.hh>
24
25#ifdef _WIN32
26 #include <Rpc.h>
27 #pragma comment(lib, "Rpcrt4.lib")
28 using portable_uuid_t = UUID;
29// else unix
30#else
31 #include <uuid/uuid.h>
32 using portable_uuid_t = uuid_t;
33#endif
34
35namespace gz
36{
37 namespace common
38 {
40 class GZ_COMMON_VISIBLE Uuid
41 {
43 public: Uuid();
44
46 public: virtual ~Uuid();
47
50 public: std::string String() const;
51
55 public: friend std::ostream &operator<<(std::ostream &_out,
56 const gz::common::Uuid &_uuid)
57 {
58 _out << _uuid.String();
59 return _out;
60 }
61
68 private: static const int UuidStrLen = 37;
69
71 private: portable_uuid_t data;
72 };
73 }
74}
75#endif