17 #ifndef _GAZEBO_MODELDATABSE_HH_
18 #define _GAZEBO_MODELDATABSE_HH_
23 #include <boost/thread.hpp>
24 #include <boost/thread/mutex.hpp>
30 #define GZ_MODEL_MANIFEST_FILENAME "model.config"
33 #define GZ_MODEL_DB_MANIFEST_FILENAME "database.config"
56 public:
void Start(
bool _fetchImmediately =
false);
63 public: std::string
GetURI();
70 public: std::map<std::string, std::string>
GetModels();
78 void (
const std::map<std::string, std::string> &)> _func);
87 public: std::string
GetModelName(
const std::string &_uri);
95 public: std::string
GetDBConfig(
const std::string &_uri);
104 public: std::string
GetModelPath(
const std::string &_uri,
105 bool _forceDownload =
false);
113 public: std::string
GetModelFile(
const std::string &_uri);
128 public:
bool HasModel(
const std::string &_modelName);
133 private: std::string GetManifestImpl(
const std::string &_uri);
138 private:
void UpdateModelCache(
bool _fetchImmediately);
142 private:
bool UpdateModelCacheImpl();
145 private: boost::thread *updateCacheThread;
148 private: std::map<std::string, std::string> modelCache;
154 private: boost::mutex updateMutex;
157 private: boost::recursive_mutex startCacheMutex;
160 private: boost::condition_variable updateCacheCondition;
163 private: boost::condition_variable updateCacheCompleteCondition;
167 private:
typedef boost::function<
168 void (
const std::map<std::string, std::string> &)> CallbackFunc;
172 private: std::list<CallbackFunc> callbacks;