Gazebo Fuel_tools

API Reference

9.0.2
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
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
36namespace 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
54
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
90 public: bool SetName(const std::string &_name);
91
95 public: bool SetOwner(const std::string &_name);
96
100 public: bool SetServer(const ServerConfig &_server);
101
104 public: std::string Description() const;
105
108 public: unsigned int FileSize() const;
109
112 public: std::time_t UploadDate() const;
113
116 public: std::time_t ModifyDate() const;
117
120 public: uint32_t LikeCount() const;
121
124 public: uint32_t DownloadCount() const;
125
128 public: std::string LicenseName() const;
129
132 public: std::string LicenseUrl() const;
133
137
141
145 public: bool Private() const;
146
150 public: void SetPrivate(bool _private) const;
151
155 public: bool SetDescription(const std::string &_desc);
156
160 public: bool SetFileSize(const unsigned int _filesize);
161
165 public: bool SetUploadDate(const std::time_t &_date);
166
169 public: bool SetModifyDate(const std::time_t &_date);
170
174 public: bool SetLikeCount(const uint32_t _likes);
175
179 public: bool SetDownloadCount(const uint32_t _downloads);
180
184 public: bool SetLicenseName(const std::string &_name);
185
189 public: bool SetLicenseUrl(const std::string &_url);
190
194 public: bool SetLicenseImageUrl(const std::string &_url);
195
199 public: bool SetTags(const std::vector<std::string> &_tags);
200
206 public: unsigned int Version() const;
207
213 public: std::string VersionStr() const;
214
221 public: bool SetVersion(const unsigned int _version);
222
229 public: bool SetVersionStr(const std::string &_version);
230
231 // /// \brief returns a SHA 2 256 hash of the model
232 // /// \remarks fulfills versioning requirement
233 // public: std::array<std::uint8_t, 32> SHA_256() const;
234
235 // /// \brief Sets the SHA 2 256 hash of the model
236 // /// \param[in] _hash a 256 bit SHA 2 hash
237 // /// \returns true if successful
238 // public: bool SHA_256(const std::array<std::uint8_t, 32> &_hash);
239
244 public: std::string AsString(const std::string &_prefix = "") const;
245
250 public: std::string AsPrettyString(const std::string &_prefix = "") const;
251
254 };
255} // namespace gz::fuel_tools
256
257#ifdef _MSC_VER
258#pragma warning(pop)
259#endif
260
261#endif // GZ_FUEL_TOOLS_MODELIDENTIFIER_HH_