##

ModelDatabase.hh
Go to the documentation of this file.
/*
* Copyright (C) 2012 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef _GAZEBO_MODELDATABSE_HH_
#define _GAZEBO_MODELDATABSE_HH_
#include <string>
#include <map>
#include <utility>
#include <boost/function.hpp>
#include "gazebo/common/Event.hh"
#include "gazebo/common/SingletonT.hh"
#include "gazebo/common/CommonTypes.hh"
#include "gazebo/util/system.hh"
#define GZ_MODEL_MANIFEST_FILENAME "model.config"
#define GZ_MODEL_DB_MANIFEST_FILENAME "database.config"
GZ_SINGLETON_DECLARE(GZ_COMMON_VISIBLE, gazebo, common, ModelDatabase)
namespace gazebo
{
namespace common
{
class ModelDatabasePrivate;
class GZ_COMMON_VISIBLE ModelDatabase : public SingletonT<ModelDatabase>
{
private: ModelDatabase();
private: virtual ~ModelDatabase();
public: void Start(bool _fetchImmediately = false);
public: void Fini();
public: std::string GetURI();
public: std::map<std::string, std::string> GetModels();
public: event::ConnectionPtr GetModels(boost::function<
void (const std::map<std::string, std::string> &)> _func);
public: std::string GetModelName(const std::string &_uri);
public: std::string GetModelConfig(const std::string &_uri);
public: std::string GetDBConfig(const std::string &_uri);
public: std::string GetModelPath(const std::string &_uri,
bool _forceDownload = false);
public: std::string GetModelFile(const std::string &_uri);
public: void DownloadDependencies(const std::string &_path);
public: bool HasModel(const std::string &_modelName);
private: std::string GetManifestImpl(const std::string &_uri);
private: void UpdateModelCache(bool _fetchImmediately);
private: bool UpdateModelCacheImpl();
private: ModelDatabasePrivate *dataPtr;
private: friend class SingletonT<ModelDatabase>;
private: static ModelDatabase *myself;
};
}
}
#endif
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
SingletonT
Singleton template class.
Definition: SingletonT.hh:33
system.hh
CommonTypes.hh
common
common
Definition: ModelDatabase.hh:37
gazebo::common::ModelDatabase
Connects to model database, and has utility functions to find models.
Definition: ModelDatabase.hh:52
gazebo::event::ConnectionPtr
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:134
gazebo
gazebo
Definition: ModelDatabase.hh:37
Event.hh
GZ_SINGLETON_DECLARE
#define GZ_SINGLETON_DECLARE(visibility, n1, n2, singletonType)
Helper to declare typed SingletonT.
Definition: SingletonT.hh:61
SingletonT.hh