Gazebo Fuel_tools

API Reference

4.9.1
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 ignition
37 {
38  namespace fuel_tools
39  {
41  class ModelIdentifierPrivate;
42  class ServerConfig;
43 
45  class IGNITION_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
std::string Name() const
Returns just the last part of the model name.
ModelIdentifier & operator=(const ModelIdentifier &_orig)
Assignment operator.
bool SetDownloadCount(const uint32_t _downloads)
Set the number of downloads of the model.
STL class.
bool SetName(const std::string &_name)
set the name of the model.
std::time_t UploadDate() const
Returns the upload date of the model.
std::string LicenseName() const
Returns the license name.
STL class.
bool SetModifyDate(const std::time_t &_date)
Set the modify date.
Defines how to identify a model.
Definition: gz/fuel_tools/ModelIdentifier.hh:45
bool SetUploadDate(const std::time_t &_date)
Set the upload date.
std::time_t ModifyDate() const
Returns the modify date of the model.
std::string AsPrettyString(const std::string &_prefix="") const
Returns all the available model information as a string using colors for better human parsing.
std::string UniqueName() const
Returns a unique name for the model.
bool SetLicenseUrl(const std::string &_url)
Set the license URL of the model.
bool operator==(const ModelIdentifier &_rhs) const
Equality operator.
bool SetTags(const std::vector< std::string > &_tags)
Set the list of tags of the model.
std::string VersionStr() const
Returns the model's version as a string. Versions are integers counting from 1. The strings "tip" or ...
uint32_t DownloadCount() const
Returns the number of downloads for the model.
bool SetLicenseImageUrl(const std::string &_url)
Set the license image URL of the model.
std::vector< std::string > Tags() const
Returns the collection of tags.
std::string Description() const
Returns the description of the model.
std::string AsString(const std::string &_prefix="") const
Returns all the model information as a string. Convenient for debugging.
uint32_t LikeCount() const
Returns the number of "likes" for the model.
bool SetServer(const ServerConfig &_server)
Set the server from which this model comes.
Describes options needed for a server.
Definition: gz/fuel_tools/ClientConfig.hh:47
bool Private() const
Returns the privacy setting of the model.
unsigned int Version() const
Returns the model's version as a number. Versions are integers counting from 1. Version zero means th...
unsigned int FileSize() const
Returns the file size of the model in bytes.
bool SetLikeCount(const uint32_t _likes)
Set the number of "likes" of the model.
std::string LicenseImageUrl() const
Returns the license image URL.
ServerConfig & Server() const
Returns server information to retrieve model from.
bool SetLicenseName(const std::string &_name)
Set the license name of the model.
void SetPrivate(bool _private) const
Set the privacy setting of the model.
bool SetVersionStr(const std::string &_version)
Set the model's version. Versions are integers counting from 1 or "tip" for the latest version.
std::string LicenseUrl() const
Returns the license URL.
bool SetOwner(const std::string &_name)
Set the owner of the model.
bool SetDescription(const std::string &_desc)
Set the description of the model.
bool SetVersion(const unsigned int _version)
Set the model's version. Versions are integers counting from 1.
bool SetFileSize(const unsigned int _filesize)
Set the file size of the model in bytes.
bool operator!=(const ModelIdentifier &_rhs) const
Inequality operator.
std::string Owner() const
Returns owner to attribute model to.