All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
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 
35 namespace ignition
36 {
37  namespace transport
38  {
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:41
std::string ToString() const
Return the string representation of the Uuid.
friend std::ostream & operator<<(std::ostream &_out, const ignition::transport::Uuid &_uuid)
Stream insertion operator.
Definition: Uuid.hh:56
#define IGNITION_TRANSPORT_VISIBLE
Use to represent "symbol visible" if supported.
Definition: Helpers.hh:57