17#ifndef GAZEBO_COMMON_COMMONIFACE_HH_
18#define GAZEBO_COMMON_COMMONIFACE_HH_
23#include <boost/version.hpp>
24#if BOOST_VERSION < 106600
25#include <boost/uuid/sha1.hpp>
27#include <boost/uuid/detail/sha1.hpp>
30#include <boost/filesystem.hpp>
65 bool _searchLocalPath);
78 std::string
get_sha1(
const T &_buffer);
84 const char *
getEnv(
const char *_name);
95 bool exists(
const std::string &_path);
113 std::string
absPath(
const std::string &_path);
120 bool copyFile(
const std::string &_existingFilename,
121 const std::string &_newFilename);
128 bool copyDir(
const boost::filesystem::path &_source,
129 const boost::filesystem::path &_destination);
136 bool moveFile(
const std::string &_existingFilename,
137 const std::string &_newFilename);
149 const std::string &_orig,
150 const std::string &_key,
151 const std::string &_replacement);
163 const std::string &_key,
164 const std::string &_replacement);
171 std::vector<std::string>
split(
const std::string &_str,
172 const std::string &_delim);
183 const std::string &_extension);
192 boost::uuids::detail::sha1 sha1;
193 unsigned int hash[5];
194 std::stringstream stream;
196 if (_buffer.size() == 0)
198 sha1.process_bytes(
nullptr, 0);
202 sha1.process_bytes(&(_buffer[0]), _buffer.size() *
sizeof(_buffer[0]));
205 sha1.get_digest(hash);
207 for (std::size_t i = 0; i <
sizeof(hash) /
sizeof(hash[0]); ++i)
209 stream << std::setfill(
'0')
210 << std::setw(
sizeof(hash[0]) * 2)
common
Definition FuelModelDatabase.hh:37
bool isFile(const std::string &_path)
Check if the given path is a file.
bool copyFile(const std::string &_existingFilename, const std::string &_newFilename)
Copy a file.
void replaceAll(std::string &_result, const std::string &_orig, const std::string &_key, const std::string &_replacement)
Replace all occurances of _key with _replacement.
std::string cwd()
Get the current working directory.
void add_search_path_suffix(const std::string &_suffix)
add path sufix to common::SystemPaths
const char * getEnv(const char *_name)
Cross platform retrieval of an environment variable.
std::vector< std::string > split(const std::string &_str, const std::string &_delim)
Splits a string into tokens.
void load()
Load the common library.
std::string unique_file_path(const std::string &_pathAndName, const std::string &_extension)
Generates a path for a file which doesn't collide with existing files, by appending numbers to it (i....
std::string get_sha1(const T &_buffer)
Compute the SHA1 hash of an array of bytes.
Definition CommonIface.hh:190
std::string absPath(const std::string &_path)
Get the absolute path of a provided path.
std::string find_file(const std::string &_file)
search for file in common::SystemPaths
std::string find_file_path(const std::string &_file)
search for a file in common::SystemPaths
bool moveFile(const std::string &_existingFilename, const std::string &_newFilename)
Move a file.
bool isDirectory(const std::string &_path)
Check if the given path is a directory.
bool copyDir(const boost::filesystem::path &_source, const boost::filesystem::path &_destination)
Copy a directory, overwrite the destination directory if exists.
bool exists(const std::string &_path)
Returns true if _path is a file or directory.
Forward declarations for the common classes.
Definition Animation.hh:27