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 <map>
22 #include <memory>
23 #include <string>
24 #include <vector>
25 #include <ignition/fuel_tools/ClientConfig.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 
36 namespace gazebo
37 {
38  namespace common
39  {
41  class FuelModelDatabasePrivate;
42 
45 
49  class GZ_COMMON_VISIBLE FuelModelDatabase
50  : public SingletonT<FuelModelDatabase>
51  {
53  private: FuelModelDatabase();
54 
56  private: virtual ~FuelModelDatabase();
57 
60  public: std::vector<ignition::fuel_tools::ServerConfig> Servers() const;
61 
72  public: virtual void Models(
73  const ignition::fuel_tools::ServerConfig &_server,
74  std::function<void(const std::map<std::string, std::string> &)> &_func);
75 
85  public: virtual std::map<std::string, std::string> Models(
86  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 
107  private: std::unique_ptr<FuelModelDatabasePrivate> dataPtr;
108 
110  private: friend class SingletonT<FuelModelDatabase>;
111 
113  private: static FuelModelDatabase *myself;
114  };
115  }
116 }
117 #endif
Connects to an Igniiton Fuel model database, and has utility functions to find models.
Definition: FuelModelDatabase.hh:49
Singleton template class.
Definition: SingletonT.hh:33