Ignition Fuel_tools

API Reference

8.0.0~pre1
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 IGNITION_FUEL_TOOLS_MODELIDENTIFIER_HH_
19 #define IGNITION_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 
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 
69  public: std::string Name() const;
70 
73  public: std::string Owner() const;
74 
77  public: ServerConfig &Server() const;
78 
82  public: std::string UniqueName() const;
83 
87  public: bool SetName(const std::string &_name);
88 
92  public: bool SetOwner(const std::string &_name);
93 
97  public: bool SetServer(const ServerConfig &_server);
98 
101  public: std::string Description() const;
102 
105  public: unsigned int FileSize() const;
106 
109  public: std::time_t UploadDate() const;
110 
113  public: std::time_t ModifyDate() const;
114 
117  public: uint32_t LikeCount() const;
118 
121  public: uint32_t DownloadCount() const;
122 
125  public: std::string LicenseName() const;
126 
129  public: std::string LicenseUrl() const;
130 
133  public: std::string LicenseImageUrl() const;
134 
137  public: std::vector<std::string> Tags() const;
138 
142  public: bool Private() const;
143 
147  public: void SetPrivate(bool _private) const;
148 
152  public: bool SetDescription(const std::string &_desc);
153 
157  public: bool SetFileSize(const unsigned int _filesize);
158 
162  public: bool SetUploadDate(const std::time_t &_date);
163 
166  public: bool SetModifyDate(const std::time_t &_date);
167 
171  public: bool SetLikeCount(const uint32_t _likes);
172 
176  public: bool SetDownloadCount(const uint32_t _downloads);
177 
181  public: bool SetLicenseName(const std::string &_name);
182 
186  public: bool SetLicenseUrl(const std::string &_url);
187 
191  public: bool SetLicenseImageUrl(const std::string &_url);
192 
196  public: bool SetTags(const std::vector<std::string> &_tags);
197 
203  public: unsigned int Version() const;
204 
210  public: std::string VersionStr() const;
211 
218  public: bool SetVersion(const unsigned int _version);
219 
226  public: bool SetVersionStr(const std::string &_version);
227 
228  // /// \brief returns a SHA 2 256 hash of the model
229  // /// \remarks fulfills versioning requirement
230  // public: std::array<std::uint8_t, 32> SHA_256() const;
231 
232  // /// \brief Sets the SHA 2 256 hash of the model
233  // /// \param[in] _hash a 256 bit SHA 2 hash
234  // /// \returns true if successful
235  // public: bool SHA_256(const std::array<std::uint8_t, 32> &_hash);
236 
241  public: std::string AsString(const std::string &_prefix = "") const;
242 
247  public: std::string AsPrettyString(const std::string &_prefix = "") const;
248 
251  };
252  }
253 }
254 
255 #ifdef _MSC_VER
256 #pragma warning(pop)
257 #endif
258 
259 #endif
Defines how to identify a model.
Definition: ModelIdentifier.hh:45
STL class.
Describes options needed for a server.
Definition: ClientConfig.hh:47
STL class.