Ignition Transport

API Reference

4.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 IGN_TRANSPORT_UUID_HH_
19#define IGN_TRANSPORT_UUID_HH_
20
21#include <iostream>
22#include <string>
23
24#include "ignition/transport/Export.hh"
25
26#ifdef _WIN32
27 #include <Rpc.h>
28 #pragma comment(lib, "Rpcrt4.lib")
29 using portable_uuid_t = UUID;
30#else /* UNIX */
31 #include <uuid/uuid.h>
32 using portable_uuid_t = uuid_t;
33#endif
34
35namespace ignition
36{
37 namespace transport
38 {
41 class IGNITION_TRANSPORT_VISIBLE Uuid
42 {
44 public: Uuid();
45
47 public: virtual ~Uuid();
48
51 public: std::string ToString() const;
52
56 public: friend std::ostream &operator<<(std::ostream &_out,
57 const ignition::transport::Uuid &_uuid)
58 {
59 _out << _uuid.ToString();
60 return _out;
61 }
62
69 private: static const int UuidStrLen = 37;
70
72 private: portable_uuid_t data;
73 };
74 }
75}
76#endif
uuid_t portable_uuid_t
Definition Uuid.hh:32
A portable class for representing a Universally Unique Identifier.
Definition Uuid.hh:42
std::string ToString() const
Return the string representation of the Uuid.
friend std::ostream & operator<<(std::ostream &_out, const Uuid &_uuid)
Stream insertion operator.
Definition Uuid.hh:56
virtual ~Uuid()
Destructor.
*brief Subscribe to a topic registering a callback The callback must *accept a std::string to represent the message data
Definition Node.hh:1245
Definition AdvertiseOptions.hh:28