|
25 | 25 | #include <gz/common/URI.hh>
|
26 | 26 |
|
27 | 27 | #include "gz/fuel_tools/Export.hh"
|
| 28 | +#include "gz/fuel_tools/ServerConfig.hh" |
28 | 29 |
|
29 | 30 | #ifdef _WIN32
|
30 | 31 | // Disable warning C4251 which is triggered by
|
|
33 | 34 | #pragma warning(disable: 4251)
|
34 | 35 | #endif
|
35 | 36 |
|
36 |
| -namespace gz |
| 37 | +namespace gz::fuel_tools |
37 | 38 | {
|
38 |
| - namespace fuel_tools |
| 39 | + /// \brief Forward Declaration |
| 40 | + class ClientConfigPrivate; |
| 41 | + |
| 42 | + /// \brief High level interface to Gazebo Fuel. |
| 43 | + /// |
| 44 | + class GZ_FUEL_TOOLS_VISIBLE ClientConfig |
39 | 45 | {
|
40 |
| - /// \brief forward declaration |
41 |
| - class ServerConfigPrivate; |
42 |
| - |
43 |
| - /// \brief Forward Declaration |
44 |
| - class ClientConfigPrivate; |
45 |
| - |
46 |
| - /// \brief Describes options needed for a server. |
47 |
| - class GZ_FUEL_TOOLS_VISIBLE ServerConfig |
48 |
| - { |
49 |
| - /// \brief Constructor. |
50 |
| - public: ServerConfig(); |
51 |
| - |
52 |
| - /// \brief Copy constructor. |
53 |
| - /// \param[in] _orig The server config to copy. |
54 |
| - public: ServerConfig(const ServerConfig &_orig); |
55 |
| - |
56 |
| - /// \brief Assignment operator overload. |
57 |
| - /// \param[in] _orig The server config to copy. |
58 |
| - public: ServerConfig &operator=(const ServerConfig &_orig); |
59 |
| - |
60 |
| - /// \brief Destructor. |
61 |
| - public: ~ServerConfig(); |
62 |
| - |
63 |
| - /// \brief Clear the server config. This will set all values to empty |
64 |
| - /// strings, except the version string which will be set to its default |
65 |
| - /// value. |
66 |
| - public: void Clear(); |
67 |
| - |
68 |
| - /// \brief Get the URL to access the server. |
69 |
| - /// \return The URL of this server. |
70 |
| - public: common::URI Url() const; |
71 |
| - |
72 |
| - /// \brief Set the URL of this server. |
73 |
| - /// \param[in] _url URL of this server. |
74 |
| - public: void SetUrl(const common::URI &_url); |
75 |
| - |
76 |
| - /// \brief Get the API key to auth with the server. |
77 |
| - /// \return The API key. |
78 |
| - public: std::string ApiKey() const; |
79 |
| - |
80 |
| - /// \brief Set the API key to auth with the server. |
81 |
| - /// \param[in] _key The API key. |
82 |
| - public: void SetApiKey(const std::string &_key); |
83 |
| - |
84 |
| - /// \brief Get the protocol version used with this server. |
85 |
| - /// \return The version. E.g.: "1.0". |
86 |
| - public: std::string Version() const; |
87 |
| - |
88 |
| - /// \brief Set the protocol version used with this server. |
89 |
| - /// \param[in] _version The version. E.g.: "1.0". |
90 |
| - public: void SetVersion(const std::string &_version); |
91 |
| - |
92 |
| - /// \brief Returns all the server information as a string. |
93 |
| - /// \param[in] _prefix Optional prefix for every line of the string. |
94 |
| - /// \return Server information string |
95 |
| - public: std::string AsString(const std::string &_prefix = "") const; |
96 |
| - |
97 |
| - /// \brief Returns all the available model information as a string using |
98 |
| - /// colors for better human parsing. |
99 |
| - /// \param[in] _prefix Optional prefix for every line of the string. |
100 |
| - /// \return Model information string |
101 |
| - public: std::string AsPrettyString(const std::string &_prefix = "") const; |
102 |
| - |
103 |
| - /// \brief PIMPL |
104 |
| - private: std::unique_ptr<ServerConfigPrivate> dataPtr; |
105 |
| - }; |
106 |
| - |
107 |
| - /// \brief High level interface to Gazebo Fuel. |
108 |
| - /// |
109 |
| - class GZ_FUEL_TOOLS_VISIBLE ClientConfig |
110 |
| - { |
111 |
| - /// \brief Constructor. |
112 |
| - public: ClientConfig(); |
113 |
| - |
114 |
| - /// \brief Copy constructor. |
115 |
| - /// \param[in] _copy ClientConfig to copy. |
116 |
| - public: ClientConfig(const ClientConfig &_copy); |
117 |
| - |
118 |
| - /// \brief Assignment operator overload. |
119 |
| - /// \param[in] _copy ClientConfig to copy. |
120 |
| - public: ClientConfig &operator=(const ClientConfig &_copy); |
121 |
| - |
122 |
| - /// \brief Destructor. |
123 |
| - public: ~ClientConfig(); |
124 |
| - |
125 |
| - /// \brief Clear the client config. This will set all values to empty |
126 |
| - /// strings, except the user agent which will be set to its default |
127 |
| - /// value. |
128 |
| - public: void Clear(); |
129 |
| - |
130 |
| - /// \brief Set the user agent name. |
131 |
| - /// \param[in] _agent User agent name. |
132 |
| - public: void SetUserAgent(const std::string &_agent); |
133 |
| - |
134 |
| - /// \brief Get the user agent name. |
135 |
| - /// \return Name of the user agent. |
136 |
| - public: const std::string &UserAgent() const; |
137 |
| - |
138 |
| - /// \brief Load a YAML configuration file. |
139 |
| - /// \param[in] _file Config file to load. |
140 |
| - /// \return True if the configuration was loaded correctly. |
141 |
| - /// \sa ConfigPath |
142 |
| - public: bool LoadConfig(const std::string &_file); |
143 |
| - |
144 |
| - /// \brief Get the location of the configuration file. |
145 |
| - /// \return Path to the configuration file, which is set via |
146 |
| - /// LoadConfig. The default return value is an empty string. |
147 |
| - /// \sa LoadConfig |
148 |
| - public: std::string ConfigPath() const; |
149 |
| - |
150 |
| - /// \brief List of servers the client will connect to. |
151 |
| - /// \return The list of servers. |
152 |
| - public: std::vector<ServerConfig> Servers() const; |
153 |
| - |
154 |
| - /// \brief List of servers the client will connect to. |
155 |
| - /// \return The list of servers. |
156 |
| - public: std::vector<ServerConfig> & MutableServers() const; |
157 |
| - |
158 |
| - /// \brief Add a server to the list. |
159 |
| - /// \param[in] _srv The server config. |
160 |
| - public: void AddServer(const ServerConfig &_srv); |
161 |
| - |
162 |
| - /// \brief Where are models and stuff stored locally? |
163 |
| - /// \return The location where assets are stored locally. |
164 |
| - public: std::string CacheLocation() const; |
165 |
| - |
166 |
| - /// \brief Set where models and stuff are saved. |
167 |
| - /// \param[in] _path path on disk where models are saved. |
168 |
| - public: void SetCacheLocation(const std::string &_path); |
169 |
| - |
170 |
| - /// \brief Returns all the client information as a string. |
171 |
| - /// \param[in] _prefix Optional prefix for every line of the string. |
172 |
| - /// \return Client information string |
173 |
| - public: std::string AsString(const std::string &_prefix = "") const; |
174 |
| - |
175 |
| - /// \brief PIMPL |
176 |
| - private: std::unique_ptr<ClientConfigPrivate> dataPtr; |
177 |
| - }; |
178 |
| - } |
179 |
| -} |
| 46 | + /// \brief Constructor. |
| 47 | + public: ClientConfig(); |
| 48 | + |
| 49 | + /// \brief Copy constructor. |
| 50 | + /// \param[in] _copy ClientConfig to copy. |
| 51 | + public: ClientConfig(const ClientConfig &_copy); |
| 52 | + |
| 53 | + /// \brief Assignment operator overload. |
| 54 | + /// \param[in] _copy ClientConfig to copy. |
| 55 | + public: ClientConfig &operator=(const ClientConfig &_copy); |
| 56 | + |
| 57 | + /// \brief Destructor. |
| 58 | + public: ~ClientConfig(); |
| 59 | + |
| 60 | + /// \brief Clear the client config. This will set all values to empty |
| 61 | + /// strings, except the user agent which will be set to its default |
| 62 | + /// value. |
| 63 | + public: void Clear(); |
| 64 | + |
| 65 | + /// \brief Set the user agent name. |
| 66 | + /// \param[in] _agent User agent name. |
| 67 | + public: void SetUserAgent(const std::string &_agent); |
| 68 | + |
| 69 | + /// \brief Get the user agent name. |
| 70 | + /// \return Name of the user agent. |
| 71 | + public: const std::string &UserAgent() const; |
| 72 | + |
| 73 | + /// \brief Load a YAML configuration file. |
| 74 | + /// \param[in] _file Config file to load. |
| 75 | + /// \return True if the configuration was loaded correctly. |
| 76 | + /// \sa ConfigPath |
| 77 | + public: bool LoadConfig(const std::string &_file); |
| 78 | + |
| 79 | + /// \brief Get the location of the configuration file. |
| 80 | + /// \return Path to the configuration file, which is set via |
| 81 | + /// LoadConfig. The default return value is an empty string. |
| 82 | + /// \sa LoadConfig |
| 83 | + public: std::string ConfigPath() const; |
| 84 | + |
| 85 | + /// \brief List of servers the client will connect to. |
| 86 | + /// \return The list of servers. |
| 87 | + public: std::vector<ServerConfig> Servers() const; |
| 88 | + |
| 89 | + /// \brief List of servers the client will connect to. |
| 90 | + /// \return The list of servers. |
| 91 | + public: std::vector<ServerConfig> & MutableServers() const; |
| 92 | + |
| 93 | + /// \brief Add a server to the list. |
| 94 | + /// \param[in] _srv The server config. |
| 95 | + public: void AddServer(const ServerConfig &_srv); |
| 96 | + |
| 97 | + /// \brief Where are models and stuff stored locally? |
| 98 | + /// \return The location where assets are stored locally. |
| 99 | + public: std::string CacheLocation() const; |
| 100 | + |
| 101 | + /// \brief Set where models and stuff are saved. |
| 102 | + /// \param[in] _path path on disk where models are saved. |
| 103 | + public: void SetCacheLocation(const std::string &_path); |
| 104 | + |
| 105 | + /// \brief Returns all the client information as a string. |
| 106 | + /// \param[in] _prefix Optional prefix for every line of the string. |
| 107 | + /// \return Client information string |
| 108 | + public: std::string AsString(const std::string &_prefix = "") const; |
| 109 | + |
| 110 | + /// \brief PIMPL |
| 111 | + private: std::unique_ptr<ClientConfigPrivate> dataPtr; |
| 112 | + }; |
| 113 | +} // namespace gz::fuel_tools |
180 | 114 |
|
181 | 115 | #ifdef _MSC_VER
|
182 | 116 | #pragma warning(pop)
|
183 | 117 | #endif
|
184 | 118 |
|
185 |
| -#endif |
| 119 | +#endif // GZ_FUEL_TOOLS_CLIENTCONFIG_HH_ |
0 commit comments