Gazebo Fuel_tools

API Reference

7.3.1
gz/fuel_tools/ClientConfig.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 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_CLIENTCONFIG_HH_
19 #define GZ_FUEL_TOOLS_CLIENTCONFIG_HH_
20 
21 #include <memory>
22 #include <string>
23 #include <vector>
24 
25 #include <gz/common/URI.hh>
26 
27 #include "gz/fuel_tools/Export.hh"
28 
29 #ifdef _WIN32
30 // Disable warning C4251 which is triggered by
31 // std::unique_ptr
32 #pragma warning(push)
33 #pragma warning(disable: 4251)
34 #endif
35 
36 namespace ignition
37 {
38  namespace fuel_tools
39  {
41  class ServerConfigPrivate;
42 
44  class ClientConfigPrivate;
45 
47  class IGNITION_FUEL_TOOLS_VISIBLE ServerConfig
48  {
50  public: ServerConfig();
51 
54  public: ServerConfig(const ServerConfig &_orig);
55 
58  public: ServerConfig &operator=(const ServerConfig &_orig);
59 
61  public: ~ServerConfig();
62 
66  public: void Clear();
67 
70  public: common::URI Url() const;
71 
74  public: void SetUrl(const common::URI &_url);
75 
78  public: std::string ApiKey() const;
79 
82  public: void SetApiKey(const std::string &_key);
83 
86  public: std::string Version() const;
87 
90  public: void SetVersion(const std::string &_version);
91 
95  public: std::string AsString(const std::string &_prefix = "") const;
96 
101  public: std::string AsPrettyString(const std::string &_prefix = "") const;
102 
104  private: std::unique_ptr<ServerConfigPrivate> dataPtr;
105  };
106 
109  class IGNITION_FUEL_TOOLS_VISIBLE ClientConfig
110  {
112  public: ClientConfig();
113 
116  public: ClientConfig(const ClientConfig &_copy);
117 
120  public: ClientConfig &operator=(const ClientConfig &_copy);
121 
123  public: ~ClientConfig();
124 
128  public: void Clear();
129 
132  public: void SetUserAgent(const std::string &_agent);
133 
136  public: const std::string &UserAgent() const;
137 
142  public: bool LoadConfig(const std::string &_file);
143 
148  public: std::string ConfigPath() const;
149 
152  public: std::vector<ServerConfig> Servers() const;
153 
156  public: std::vector<ServerConfig> & MutableServers() const;
157 
160  public: void AddServer(const ServerConfig &_srv);
161 
164  public: std::string CacheLocation() const;
165 
168  public: void SetCacheLocation(const std::string &_path);
169 
173  public: std::string AsString(const std::string &_prefix = "") const;
174 
176  private: std::unique_ptr<ClientConfigPrivate> dataPtr;
177  };
178  }
179 }
180 
181 #ifdef _MSC_VER
182 #pragma warning(pop)
183 #endif
184 
185 #endif
High level interface to ignition fuel.
Definition: gz/fuel_tools/ClientConfig.hh:109
std::vector< ServerConfig > & MutableServers() const
List of servers the client will connect to.
std::vector< ServerConfig > Servers() const
List of servers the client will connect to.
STL class.
std::string AsString(const std::string &_prefix="") const
Returns all the client information as a string.
const std::string & UserAgent() const
Get the user agent name.
std::string AsPrettyString(const std::string &_prefix="") const
Returns all the available model information as a string using colors for better human parsing.
bool LoadConfig(const std::string &_file)
Load a YAML configuration file.
STL class.
void SetUrl(const common::URI &_url)
Set the URL of this server.
ClientConfig & operator=(const ClientConfig &_copy)
Assignment operator overload.
void SetUserAgent(const std::string &_agent)
Set the user agent name.
void AddServer(const ServerConfig &_srv)
Add a server to the list.
std::string ConfigPath() const
Get the location of the configuration file.
void SetApiKey(const std::string &_key)
Set the API key to auth with the server.
std::string AsString(const std::string &_prefix="") const
Returns all the server information as a string.
std::string Version() const
Get the protocol version used with this server.
void Clear()
Clear the server config. This will set all values to empty strings, except the version string which w...
Describes options needed for a server.
Definition: gz/fuel_tools/ClientConfig.hh:47
common::URI Url() const
Get the URL to access the server.
void SetCacheLocation(const std::string &_path)
Set where models and stuff are saved.
std::string ApiKey() const
Get the API key to auth with the server.
void SetVersion(const std::string &_version)
Set the protocol version used with this server.
void Clear()
Clear the client config. This will set all values to empty strings, except the user agent which will ...
ServerConfig & operator=(const ServerConfig &_orig)
Assignment operator overload.
std::string CacheLocation() const
Where are models and stuff stored locally?