Gazebo Fuel_tools

API Reference

8.1.0
gz/fuel_tools/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
37 {
38  namespace fuel_tools
39  {
41  class ModelIdentifierPrivate;
42  class ServerConfig;
43 
45  class GZ_FUEL_TOOLS_VISIBLE ModelIdentifier
46  {
48  public: ModelIdentifier();
49 
52  public: ModelIdentifier(const ModelIdentifier &_orig);
53 
55  public: ~ModelIdentifier();
56 
60  public: ModelIdentifier &operator=(const ModelIdentifier &_orig);
61 
65  public: bool operator==(const ModelIdentifier &_rhs) const;
66 
70  public: bool operator!=(const ModelIdentifier &_rhs) const;
71 
74  public: std::string Name() const;
75 
78  public: std::string Owner() const;
79 
82  public: ServerConfig &Server() const;
83 
87  public: std::string UniqueName() const;
88 
92  public: bool SetName(const std::string &_name);
93 
97  public: bool SetOwner(const std::string &_name);
98 
102  public: bool SetServer(const ServerConfig &_server);
103 
106  public: std::string Description() const;
107 
110  public: unsigned int FileSize() const;
111 
114  public: std::time_t UploadDate() const;
115 
118  public: std::time_t ModifyDate() const;
119 
122  public: uint32_t LikeCount() const;
123 
126  public: uint32_t DownloadCount() const;
127 
130  public: std::string LicenseName() const;
131 
134  public: std::string LicenseUrl() const;
135 
138  public: std::string LicenseImageUrl() const;
139 
142  public: std::vector<std::string> Tags() const;
143 
147  public: bool Private() const;
148 
152  public: void SetPrivate(bool _private) const;
153 
157  public: bool SetDescription(const std::string &_desc);
158 
162  public: bool SetFileSize(const unsigned int _filesize);
163 
167  public: bool SetUploadDate(const std::time_t &_date);
168 
171  public: bool SetModifyDate(const std::time_t &_date);
172 
176  public: bool SetLikeCount(const uint32_t _likes);
177 
181  public: bool SetDownloadCount(const uint32_t _downloads);
182 
186  public: bool SetLicenseName(const std::string &_name);
187 
191  public: bool SetLicenseUrl(const std::string &_url);
192 
196  public: bool SetLicenseImageUrl(const std::string &_url);
197 
201  public: bool SetTags(const std::vector<std::string> &_tags);
202 
208  public: unsigned int Version() const;
209 
215  public: std::string VersionStr() const;
216 
223  public: bool SetVersion(const unsigned int _version);
224 
231  public: bool SetVersionStr(const std::string &_version);
232 
233  // /// \brief returns a SHA 2 256 hash of the model
234  // /// \remarks fulfills versioning requirement
235  // public: std::array<std::uint8_t, 32> SHA_256() const;
236 
237  // /// \brief Sets the SHA 2 256 hash of the model
238  // /// \param[in] _hash a 256 bit SHA 2 hash
239  // /// \returns true if successful
240  // public: bool SHA_256(const std::array<std::uint8_t, 32> &_hash);
241 
246  public: std::string AsString(const std::string &_prefix = "") const;
247 
252  public: std::string AsPrettyString(const std::string &_prefix = "") const;
253 
256  };
257  }
258 }
259 
260 #ifdef _MSC_VER
261 #pragma warning(pop)
262 #endif
263 
264 #endif