Gazebo Fuel_tools

API Reference

9.1.0
ModelIdentifier.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_MODELIDENTIFIER_HH_
19 #define GZ_FUEL_TOOLS_MODELIDENTIFIER_HH_
20 
21 #include <cstdint>
22 #include <ctime>
23 #include <memory>
24 #include <string>
25 #include <vector>
26 
27 #include "gz/fuel_tools/Helpers.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 gz::fuel_tools
37 {
39  class ModelIdentifierPrivate;
40  class ServerConfig;
41 
43  class GZ_FUEL_TOOLS_VISIBLE ModelIdentifier
44  {
46  public: ModelIdentifier();
47 
50  public: ModelIdentifier(const ModelIdentifier &_orig);
51 
53  public: ~ModelIdentifier();
54 
58  public: ModelIdentifier &operator=(const ModelIdentifier &_orig);
59 
63  public: bool operator==(const ModelIdentifier &_rhs) const;
64 
68  public: bool operator!=(const ModelIdentifier &_rhs) const;
69 
72  public: std::string Name() const;
73 
76  public: std::string Owner() const;
77 
80  public: ServerConfig &Server() const;
81 
85  public: std::string UniqueName() const;
86 
89  public: gz::common::URI Url() const;
90 
94  public: bool SetName(const std::string &_name);
95 
99  public: bool SetOwner(const std::string &_name);
100 
104  public: bool SetServer(const ServerConfig &_server);
105 
108  public: std::string Description() const;
109 
112  public: unsigned int FileSize() const;
113 
116  public: std::time_t UploadDate() const;
117 
120  public: std::time_t ModifyDate() const;
121 
124  public: uint32_t LikeCount() const;
125 
128  public: uint32_t DownloadCount() const;
129 
132  public: std::string LicenseName() const;
133 
136  public: std::string LicenseUrl() const;
137 
140  public: std::string LicenseImageUrl() const;
141 
145 
149  public: bool Private() const;
150 
154  public: void SetPrivate(bool _private) const;
155 
159  public: bool SetDescription(const std::string &_desc);
160 
164  public: bool SetFileSize(const unsigned int _filesize);
165 
169  public: bool SetUploadDate(const std::time_t &_date);
170 
173  public: bool SetModifyDate(const std::time_t &_date);
174 
178  public: bool SetLikeCount(const uint32_t _likes);
179 
183  public: bool SetDownloadCount(const uint32_t _downloads);
184 
188  public: bool SetLicenseName(const std::string &_name);
189 
193  public: bool SetLicenseUrl(const std::string &_url);
194 
198  public: bool SetLicenseImageUrl(const std::string &_url);
199 
203  public: bool SetTags(const std::vector<std::string> &_tags);
204 
210  public: unsigned int Version() const;
211 
217  public: std::string VersionStr() const;
218 
225  public: bool SetVersion(const unsigned int _version);
226 
233  public: bool SetVersionStr(const std::string &_version);
234 
235  // /// \brief returns a SHA 2 256 hash of the model
236  // /// \remarks fulfills versioning requirement
237  // public: std::array<std::uint8_t, 32> SHA_256() const;
238 
239  // /// \brief Sets the SHA 2 256 hash of the model
240  // /// \param[in] _hash a 256 bit SHA 2 hash
241  // /// \returns true if successful
242  // public: bool SHA_256(const std::array<std::uint8_t, 32> &_hash);
243 
248  public: std::string AsString(const std::string &_prefix = "") const;
249 
254  public: std::string AsPrettyString(const std::string &_prefix = "") const;
255 
258  };
259 } // namespace gz::fuel_tools
260 
261 #ifdef _MSC_VER
262 #pragma warning(pop)
263 #endif
264 
265 #endif // GZ_FUEL_TOOLS_MODELIDENTIFIER_HH_