26 #include <boost/foreach.hpp> 27 #include <boost/property_tree/ptree.hpp> 28 #include <boost/property_tree/ini_parser.hpp> 31 namespace canopen_schunk{
37 << std::hex << std::setw(2) << std::setfill(
'0')
38 <<
static_cast<int>( num );
45 for (
size_t i=0; i < length; ++i)
55 std::bitset<64> bs(num);
64 std::ostringstream ss;
65 for (std::string::const_iterator it = text.begin(); it != text.end(); ++it)
67 if (std::isgraph(*it) && *it !=
'\r' && *it !=
'\n')
76 const std::string& category)
78 std::map< uint32_t, std::string > ret_map;
82 boost::property_tree::ptree
tree;
83 boost::property_tree::read_ini(filename, tree);
85 BOOST_FOREACH(boost::property_tree::ptree::value_type &v,
86 tree.get_child(category))
92 ss << std::hex << v.first.data();
94 ret_map[key] = v.second.data();
97 catch (
const boost::property_tree::ptree_error& e )
99 LOGGING_ERROR(CanOpen,
"Error parsing error codes " << filename <<
": " 101 <<
". These error codes will not be available." <<
endl);
std::string hexArrayToString(const unsigned char *msg, const uint8_t length)
Transforms an array of unsigned chars into a string of Hex representations of those chars...
#define LOGGING_ERROR(streamname, arg)
unsigned __int64 uint64_t
ThreadStream & endl(ThreadStream &stream)
std::string binaryString(const uint64_t num)
std::map< uint32_t, std::string > getErrorMapFromConfigFile(const std::string &filename, const std::string &category)
Creates an error map from a given INI file.
std::string sanitizeString(const std::string &text)
This function removes all non-graphical characters from the given string.
std::string hexToString(const uint64_t num)
Converts a hexadecimal number into its string representation 0xXX.