FuelModelDatabase.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 #ifndef GAZEBO_COMMON_FUELMODELDATABASE_HH_
18 #define GAZEBO_COMMON_FUELMODELDATABASE_HH_
19 
20 #include <functional>
21 #include <memory>
22 #include <string>
23 #include <vector>
24 #include <ignition/fuel_tools/ClientConfig.hh>
25 #include <ignition/fuel_tools/ModelIdentifier.hh>
26 
28 #include "gazebo/util/system.hh"
29 
31 #define GZ_MODEL_MANIFEST_FILENAME "model.config"
32 
34 #define GZ_MODEL_DB_MANIFEST_FILENAME "database.config"
35 
37 GZ_SINGLETON_DECLARE(GZ_COMMON_VISIBLE, gazebo, common, FuelModelDatabase)
38 
39 namespace gazebo
40 {
41  namespace common
42  {
44  class FuelModelDatabasePrivate;
45 
48 
52  class GZ_COMMON_VISIBLE FuelModelDatabase
53  : public SingletonT<FuelModelDatabase>
54  {
56  private: FuelModelDatabase();
57 
59  private: virtual ~FuelModelDatabase();
60 
63  public: std::vector<ignition::fuel_tools::ServerConfig> Servers() const;
64 
73  public: virtual void Models(
74  const ignition::fuel_tools::ServerConfig &_server,
75  std::function <void (
76  const std::vector<ignition::fuel_tools::ModelIdentifier> &)>
77  &_func);
78 
85  public: virtual std::vector<ignition::fuel_tools::ModelIdentifier>
86  Models(const ignition::fuel_tools::ServerConfig &_server) const;
87 
94  public: std::string ModelFile(const std::string &_uri);
95 
103  public: std::string ModelPath(const std::string &_uri,
104  const bool _forceDownload = false);
105 
109  public: std::string CachedFilePath(const std::string &_uri);
110 
112  private: std::unique_ptr<FuelModelDatabasePrivate> dataPtr;
113 
115  private: friend class SingletonT<FuelModelDatabase>;
116 
118  private: static FuelModelDatabase *myself;
119  };
120  }
121 }
122 #endif
Connects to an Igniiton Fuel model database, and has utility functions to find models.
Definition: FuelModelDatabase.hh:52
Forward declarations for the common classes.
Definition: Animation.hh:26
Singleton template class.
Definition: SingletonT.hh:33
common
Definition: FuelModelDatabase.hh:37
#define GZ_SINGLETON_DECLARE(visibility, n1, n2, singletonType)
Helper to declare typed SingletonT.
Definition: SingletonT.hh:61