Gazebo Fuel_tools

API Reference

4.9.1
gz/fuel_tools/WorldIdentifier.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 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_FUEL_TOOLS_WORLDIDENTIFIER_HH_
19 #define GZ_FUEL_TOOLS_WORLDIDENTIFIER_HH_
20 
21 #include <memory>
22 #include <string>
23 
24 #include "gz/fuel_tools/Helpers.hh"
25 
26 #ifdef _WIN32
27 // Disable warning C4251 which is triggered by
28 // std::unique_ptr
29 #pragma warning(push)
30 #pragma warning(disable: 4251)
31 #endif
32 
33 namespace ignition
34 {
35  namespace fuel_tools
36  {
38  class WorldIdentifierPrivate;
39  class ServerConfig;
40 
42  class IGNITION_FUEL_TOOLS_VISIBLE WorldIdentifier
43  {
45  public: WorldIdentifier();
46 
49  public: WorldIdentifier(const WorldIdentifier &_orig);
50 
52  public: ~WorldIdentifier();
53 
57  public: WorldIdentifier &operator=(const WorldIdentifier &_orig);
58 
62  public: bool operator==(const WorldIdentifier &_rhs) const;
63 
66  public: std::string Name() const;
67 
71  public: bool SetName(const std::string &_name);
72 
75  public: std::string Owner() const;
76 
80  public: bool SetOwner(const std::string &_name);
81 
84  public: ServerConfig &Server() const;
85 
89  public: bool SetServer(const ServerConfig &_server);
90 
96  public: unsigned int Version() const;
97 
103  public: std::string VersionStr() const;
104 
111  public: bool SetVersion(const unsigned int _version);
112 
119  public: bool SetVersionStr(const std::string &_version);
120 
124  public: std::string LocalPath() const;
125 
129  public: bool SetLocalPath(const std::string &_path);
130 
134  public: std::string UniqueName() const;
135 
136  // /// \brief Sets the SHA 2 256 hash of the world
137  // /// \param[in] _hash a 256 bit SHA 2 hash
138  // /// \returns true if successful
139  // public: bool SHA_256(const std::array<std::uint8_t, 32> &_hash);
140 
145  public: std::string AsString(const std::string &_prefix = "") const;
146 
151  public: std::string AsPrettyString(const std::string &_prefix = "") const;
152 
155  };
156  }
157 }
158 
159 #ifdef _MSC_VER
160 #pragma warning(pop)
161 #endif
162 
163 #endif
std::string AsString(const std::string &_prefix="") const
Returns all the world information as a string. Convenient for debugging.
bool operator==(const WorldIdentifier &_rhs) const
Equality operator.
STL class.
std::string UniqueName() const
Returns a unique name for the world.
std::string LocalPath() const
Returns a path to the world on disk if it is already cached.
std::string VersionStr() const
Returns the world's version as a string. Versions are integers counting from 1. The strings "tip" or ...
WorldIdentifier & operator=(const WorldIdentifier &_orig)
Assignment operator.
std::string Owner() const
Returns owner to attribute world to.
bool SetOwner(const std::string &_name)
Set the owner of the world.
bool SetVersion(const unsigned int _version)
Set the world's version. Versions are integers counting from 1.
bool SetName(const std::string &_name)
Set the name of the world.
std::string AsPrettyString(const std::string &_prefix="") const
Returns all the available world information as a string using colors for better human parsing.
Describes options needed for a server.
Definition: gz/fuel_tools/ClientConfig.hh:47
bool SetVersionStr(const std::string &_version)
Set the world's version. Versions are integers counting from 1 or "tip" for the latest version.
bool SetServer(const ServerConfig &_server)
Set the server from which this world comes.
ServerConfig & Server() const
Returns server information to retrieve world from.
unsigned int Version() const
Returns the world's version as a number. Versions are integers counting from 1. Version zero means th...
Defines how to identify a world.
Definition: gz/fuel_tools/WorldIdentifier.hh:42
std::string Name() const
Returns the world name.
bool SetLocalPath(const std::string &_path)
Sets the path of the world in the local cache.