Robowflex  v0.1
Making MoveIt Easy
robowflex_library/include/robowflex_library/io.h File Reference
#include <string>
#include <utility>
#include <fstream>
#include <boost/date_time.hpp>
#include <ros/message_traits.h>
#include <yaml-cpp/yaml.h>

Go to the source code of this file.

Namespaces

 robowflex
 Main namespace. Contains all library classes and functions.
 
 robowflex::IO
 File and ROS Input / Output operations.
 

Functions

std::string robowflex::IO::generateUUID ()
 Generates a UUID. More...
 
std::string robowflex::IO::resolvePackage (const std::string &path)
 Resolves package:// URLs to their canonical form. The path does not need to exist, but the package does. Can be used to write new files in packages. More...
 
std::set< std::stringrobowflex::IO::findPackageURIs (const std::string &string)
 Finds all package URIs within a string. More...
 
std::string robowflex::IO::resolvePath (const std::string &path)
 Resolves package:// URLs and relative file paths to their canonical form. More...
 
std::string robowflex::IO::resolveParent (const std::string &path)
 Resolves package:// URLs to get the directory this path is in. More...
 
std::string robowflex::IO::makeFilepath (const std::string &directory, const std::string &filename)
 Concatenates two elements of a path, a directory and a filename. More...
 
std::string robowflex::IO::loadXMLToString (const std::string &path)
 Loads an XML or .xacro file to a string. More...
 
std::string robowflex::IO::loadXacroToString (const std::string &path)
 Loads a .xacro file to a string. More...
 
std::string robowflex::IO::loadFileToString (const std::string &path)
 Loads a file to a string. More...
 
std::string robowflex::IO::runCommand (const std::string &cmd)
 Runs a command cmd and returns stdout as a string. More...
 
std::pair< bool, YAML::Node > robowflex::IO::loadFileToYAML (const std::string &path)
 Loads a file to a YAML node. More...
 
std::pair< bool, std::vector< YAML::Node > > robowflex::IO::loadAllFromFileToYAML (const std::string &path)
 Loads a file with multiple documents to a vector of YAML nodes. More...
 
void robowflex::IO::createFile (std::ofstream &out, const std::string &file)
 Creates a file and opens an output stream. Creates directories if they do not exist. More...
 
std::string robowflex::IO::createTempFile (std::ofstream &out)
 Creates a temporary file and opens an output stream. More...
 
void robowflex::IO::deleteFile (const std::string &file)
 Deletes a file. More...
 
std::pair< bool, std::vector< std::string > > robowflex::IO::listDirectory (const std::string &directory)
 Lists of the contents of a directory. More...
 
std::string robowflex::IO::getHostname ()
 Get the hostname of the system. More...
 
std::size_t robowflex::IO::getProcessID ()
 Get the process ID of this process. More...
 
std::size_t robowflex::IO::getThreadID ()
 Get the thread ID of the current thread. More...
 
boost::posix_time::ptime robowflex::IO::getDate ()
 Get the current time (up to milliseconds) More...
 
double robowflex::IO::getSeconds (boost::posix_time::ptime start, boost::posix_time::ptime finish)
 Get a duration in seconds from two times. More...
 
void robowflex::IO::threadSleep (double seconds)
 Put the current thread to sleep for a desired amount of seconds. More...
 
template<typename T >
std::vector< T > robowflex::IO::tokenize (const std::string &string, const std::string &separators=" ")
 Separates a string into casted tokens, based upon separators. More...
 
bool robowflex::IO::YAMLToFile (const YAML::Node &node, const std::string &file)
 Write the contents of a YAML node out to a potentially new file. More...
 
template<typename T >
bool robowflex::IO::messageToYAMLFile (T &msg, const std::string &file)
 Dump a message (or YAML convertable object) to a file. More...
 
template<typename T >
bool robowflex::IO::YAMLFileToMessage (T &msg, const std::string &file)
 Load a message (or YAML convertable object) from a file. More...
 
template<typename T >
std::string robowflex::IO::getMessageMD5 (T &msg)
 Compute MD5 hash of message. More...