##

SystemPaths.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_SYSTEMPATHS_HH_
#define _GAZEBO_SYSTEMPATHS_HH_
#include <stdio.h>
#define LINUX
#ifdef _WIN32
#include <direct.h>
#define GetCurrentDir _getcwd
#else
#include <unistd.h>
#define GetCurrentDir getcwd
#endif
#include <boost/filesystem.hpp>
#include <list>
#include <string>
#include "gazebo/common/CommonTypes.hh"
#include "gazebo/common/Event.hh"
#include "gazebo/common/SingletonT.hh"
#include "gazebo/util/system.hh"
GZ_SINGLETON_DECLARE(GZ_COMMON_VISIBLE, gazebo, common, SystemPaths)
namespace gazebo
{
namespace common
{
class GZ_COMMON_VISIBLE SystemPaths : public SingletonT<SystemPaths>
{
private: SystemPaths();
public: std::string GetLogPath() const;
public: const std::list<std::string> &GetGazeboPaths();
public: const std::list<std::string> &GetOgrePaths();
public: const std::list<std::string> &GetPluginPaths();
public: const std::list<std::string> &GetModelPaths();
public: std::string GetWorldPathExtension();
public: const std::string &TmpPath() const;
public: const std::string &TmpInstancePath() const;
public: std::string DefaultTestPath() const;
public: std::string FindFileURI(const std::string &_uri);
public: std::string FindFile(const std::string &_filename,
bool _searchLocalPath = true);
public: void AddFindFileCallback(
std::function<std::string (const std::string &)> _cb);
public: void AddGazeboPaths(const std::string &_path);
public: void AddModelPaths(const std::string &_path);
public: void AddModelPathsUpdate(const std::string &_path);
public: void AddOgrePaths(const std::string &_path);
public: void AddPluginPaths(const std::string &_path);
public: void ClearGazeboPaths();
public: void ClearModelPaths();
public: void ClearOgrePaths();
public: void ClearPluginPaths();
public: void AddSearchPathSuffix(const std::string &_suffix);
private: void UpdateModelPaths();
private: void UpdateGazeboPaths();
private: void UpdatePluginPaths();
private: void UpdateOgrePaths();
private: void InsertUnique(const std::string &_path,
std::list<std::string> &_list);
private: std::list<std::string> gazeboPaths;
private: std::list<std::string> ogrePaths;
private: std::list<std::string> pluginPaths;
private: std::list<std::string> suffixPaths;
private: std::list<std::string> modelPaths;
private: std::string logPath;
public: event::EventT<void (std::string)> updateModelRequest;
public: bool modelPathsFromEnv;
public: bool gazeboPathsFromEnv;
public: bool pluginPathsFromEnv;
public: bool ogrePathsFromEnv;
private: friend class SingletonT<SystemPaths>;
private: boost::filesystem::path tmpPath;
private: boost::filesystem::path tmpInstancePath;
};
}
}
#endif
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
SingletonT
Singleton template class.
Definition: SingletonT.hh:33
gazebo::common::SystemPaths::modelPathsFromEnv
bool modelPathsFromEnv
if true, call UpdateGazeboPaths() within GetGazeboPaths()
Definition: SystemPaths.hh:204
system.hh
CommonTypes.hh
gazebo
gazebo
Definition: SystemPaths.hh:41
gazebo::common::SystemPaths::updateModelRequest
event::EventT< void(std::string)> updateModelRequest
Event to notify InsertModelWidget that the model paths were changed.
Definition: SystemPaths.hh:201
common
common
Definition: SystemPaths.hh:41
gazebo::event::EventT
A class for event processing.
Definition: Event.hh:97
gazebo::common::SystemPaths::gazeboPathsFromEnv
bool gazeboPathsFromEnv
if true, call UpdateGazeboPaths() within GetGazeboPaths()
Definition: SystemPaths.hh:207
Event.hh
gazebo::common::SystemPaths::ogrePathsFromEnv
bool ogrePathsFromEnv
if true, call UpdateOgrePaths() within GetOgrePaths()
Definition: SystemPaths.hh:213
gazebo::common::SystemPaths::pluginPathsFromEnv
bool pluginPathsFromEnv
if true, call UpdatePluginPaths() within GetPluginPaths()
Definition: SystemPaths.hh:210
GZ_SINGLETON_DECLARE
#define GZ_SINGLETON_DECLARE(visibility, n1, n2, singletonType)
Helper to declare typed SingletonT.
Definition: SingletonT.hh:61
gazebo::common::SystemPaths
Functions to handle getting system paths, keeps track of:
Definition: SystemPaths.hh:59
SingletonT.hh