Functions | |
unsigned int | TrailingRightBits (uint32_t aValue) |
Helper function to calculate the number of zero-bits at the righthand end of a 32-bit number. More... | |
void | ParseSemicolonDelimitedUriList (const std::string &aSemicolonDelimitedUriList, std::vector< std::pair< std::string, std::string > > &aUriList) |
Parse a semicolon delimited list of URIs into a vector of protocol/address pairs. More... | |
void | ShellExpandFilenameExpr (const std::string &aFilenameExpr, const boost::filesystem::path &aParentPath, std::vector< boost::filesystem::path > &aFiles) |
Perform shell expansion of a linux shell expression ( e.g. More... | |
template<bool DebugInfo> | |
bool | HttpGet (const std::string &aURL, HttpResponseType &aResponse) |
Retrieve a file by HTTP. More... | |
template<typename R , typename F , typename L > | |
void | OpenFileLocal (const std::string &aFilenameExpr, const boost::filesystem::path &aParentPath, boost::_bi::bind_t< R, F, L > aBinder) |
Given a linux shell expression, open all files which match it and call the callback function on each of them. More... | |
template<typename R , typename F , typename L > | |
void | OpenFileHttp (const std::string &aURL, boost::_bi::bind_t< R, F, L > aBinder) |
Given a URL, retrieve the file and call the callback function on each of them. More... | |
template<typename R , typename F , typename L > | |
void | OpenFile (const std::string &aProtocol, const std::string &aFilenameExpr, const boost::filesystem::path &aParentPath, boost::_bi::bind_t< R, F, L > aBinder) |
Given a protocol and either a URL or a linux shell expression, open the file and call the callback function on each of them. More... | |
void | PugiXMLParseResultPrettifier (const pugi::xml_parse_result &aLoadResult, const boost::filesystem::path &aPath, const std::vector< uint8_t > &aFile) |
Helper function to make debugging failures when parsing XML files easier. More... | |
template<bool DebugInfo> | |
bool | GetXMLattribute (const pugi::xml_node &aNode, const std::string &aAttrName, std::string &aTarget) |
Helper function to retrieve a named attribute from a PugiXML node and cast it to the correct type. More... | |
template<bool DebugInfo> | |
bool | GetXMLattribute (const pugi::xml_node &aNode, const std::string &aAttrName, const char *aTarget) |
Helper function to retrieve a named attribute from a PugiXML node and cast it to the correct type. More... | |
template<bool DebugInfo> | |
bool | GetXMLattribute (const pugi::xml_node &aNode, const std::string &aAttrName, int32_t &aTarget) |
Helper function to retrieve a named attribute from a PugiXML node and cast it to the correct type. More... | |
template<bool DebugInfo> | |
bool | GetXMLattribute (const pugi::xml_node &aNode, const std::string &aAttrName, uint32_t &aTarget) |
Helper function to retrieve a named attribute from a PugiXML node and cast it to the correct type. More... | |
template<bool DebugInfo> | |
bool | GetXMLattribute (const pugi::xml_node &aNode, const std::string &aAttrName, double &aTarget) |
Helper function to retrieve a named attribute from a PugiXML node and cast it to the correct type. More... | |
template<bool DebugInfo> | |
bool | GetXMLattribute (const pugi::xml_node &aNode, const std::string &aAttrName, float &aTarget) |
Helper function to retrieve a named attribute from a PugiXML node and cast it to the correct type. More... | |
template<bool DebugInfo> | |
bool | GetXMLattribute (const pugi::xml_node &aNode, const std::string &aAttrName, bool &aTarget) |
Helper function to retrieve a named attribute from a PugiXML node and cast it to the correct type. More... | |
template bool | GetXMLattribute< true > (const pugi::xml_node &aNode, const std::string &aAttrName, std::string &aTarget) |
template bool | GetXMLattribute< false > (const pugi::xml_node &aNode, const std::string &aAttrName, std::string &aTarget) |
template bool | GetXMLattribute< true > (const pugi::xml_node &aNode, const std::string &aAttrName, const char *aTarget) |
template bool | GetXMLattribute< false > (const pugi::xml_node &aNode, const std::string &aAttrName, const char *aTarget) |
template bool | GetXMLattribute< true > (const pugi::xml_node &aNode, const std::string &aAttrName, int32_t &aTarget) |
template bool | GetXMLattribute< false > (const pugi::xml_node &aNode, const std::string &aAttrName, int32_t &aTarget) |
template bool | GetXMLattribute< true > (const pugi::xml_node &aNode, const std::string &aAttrName, uint32_t &aTarget) |
template bool | GetXMLattribute< false > (const pugi::xml_node &aNode, const std::string &aAttrName, uint32_t &aTarget) |
template bool | GetXMLattribute< true > (const pugi::xml_node &aNode, const std::string &aAttrName, double &aTarget) |
template bool | GetXMLattribute< false > (const pugi::xml_node &aNode, const std::string &aAttrName, double &aTarget) |
template bool | GetXMLattribute< true > (const pugi::xml_node &aNode, const std::string &aAttrName, float &aTarget) |
template bool | GetXMLattribute< false > (const pugi::xml_node &aNode, const std::string &aAttrName, float &aTarget) |
template bool | GetXMLattribute< true > (const pugi::xml_node &aNode, const std::string &aAttrName, bool &aTarget) |
template bool | GetXMLattribute< false > (const pugi::xml_node &aNode, const std::string &aAttrName, bool &aTarget) |
bool uhal::utilities::GetXMLattribute | ( | const pugi::xml_node & | aNode, |
const std::string & | aAttrName, | ||
bool & | aTarget | ||
) |
Helper function to retrieve a named attribute from a PugiXML node and cast it to the correct type.
aNode | a node from which the attribute is to be extracted |
aAttrName | the name of the attribute to be extracted |
aTarget | a variable into which the attribute's value id to be written |
Definition at line 367 of file xml.cpp.
References pugi::xml_attribute::as_bool(), pugi::xml_node::attribute(), pugi::xml_attribute::empty(), uhal::Error, uhal::log(), and uhal::Quote().
bool uhal::utilities::GetXMLattribute | ( | const pugi::xml_node & | aNode, |
const std::string & | aAttrName, | ||
const char * | aTarget | ||
) |
Helper function to retrieve a named attribute from a PugiXML node and cast it to the correct type.
aNode | a node from which the attribute is to be extracted |
aAttrName | the name of the attribute to be extracted |
aTarget | a variable into which the attribute's value id to be written |
Definition at line 141 of file xml.cpp.
References pugi::xml_node::attribute(), pugi::xml_attribute::empty(), uhal::Error, uhal::log(), uhal::Quote(), and pugi::xml_attribute::value().
bool uhal::utilities::GetXMLattribute | ( | const pugi::xml_node & | aNode, |
const std::string & | aAttrName, | ||
double & | aTarget | ||
) |
Helper function to retrieve a named attribute from a PugiXML node and cast it to the correct type.
aNode | a node from which the attribute is to be extracted |
aAttrName | the name of the attribute to be extracted |
aTarget | a variable into which the attribute's value id to be written |
Definition at line 317 of file xml.cpp.
References pugi::xml_attribute::as_double(), pugi::xml_node::attribute(), pugi::xml_attribute::empty(), uhal::Error, uhal::log(), and uhal::Quote().
bool uhal::utilities::GetXMLattribute | ( | const pugi::xml_node & | aNode, |
const std::string & | aAttrName, | ||
float & | aTarget | ||
) |
Helper function to retrieve a named attribute from a PugiXML node and cast it to the correct type.
aNode | a node from which the attribute is to be extracted |
aAttrName | the name of the attribute to be extracted |
aTarget | a variable into which the attribute's value id to be written |
Definition at line 342 of file xml.cpp.
References pugi::xml_attribute::as_float(), pugi::xml_node::attribute(), pugi::xml_attribute::empty(), uhal::Error, uhal::log(), and uhal::Quote().
bool uhal::utilities::GetXMLattribute | ( | const pugi::xml_node & | aNode, |
const std::string & | aAttrName, | ||
int32_t & | aTarget | ||
) |
Helper function to retrieve a named attribute from a PugiXML node and cast it to the correct type.
aNode | a node from which the attribute is to be extracted |
aAttrName | the name of the attribute to be extracted |
aTarget | a variable into which the attribute's value id to be written |
Definition at line 166 of file xml.cpp.
References pugi::xml_node::attribute(), pugi::xml_attribute::empty(), uhal::Error, uhal::hex, uhal::log(), uhal::Quote(), and pugi::xml_attribute::value().
bool uhal::utilities::GetXMLattribute | ( | const pugi::xml_node & | aNode, |
const std::string & | aAttrName, | ||
std::string & | aTarget | ||
) |
Helper function to retrieve a named attribute from a PugiXML node and cast it to the correct type.
aNode | a node from which the attribute is to be extracted |
aAttrName | the name of the attribute to be extracted |
aTarget | a variable into which the attribute's value id to be written |
Definition at line 116 of file xml.cpp.
References pugi::xml_node::attribute(), pugi::xml_attribute::empty(), uhal::Error, uhal::log(), uhal::Quote(), and pugi::xml_attribute::value().
bool uhal::utilities::GetXMLattribute | ( | const pugi::xml_node & | aNode, |
const std::string & | aAttrName, | ||
uint32_t & | aTarget | ||
) |
Helper function to retrieve a named attribute from a PugiXML node and cast it to the correct type.
aNode | a node from which the attribute is to be extracted |
aAttrName | the name of the attribute to be extracted |
aTarget | a variable into which the attribute's value id to be written |
Definition at line 242 of file xml.cpp.
References pugi::xml_node::attribute(), pugi::xml_attribute::empty(), uhal::Error, uhal::hex, uhal::log(), uhal::Quote(), and pugi::xml_attribute::value().
template bool uhal::utilities::GetXMLattribute< false > | ( | const pugi::xml_node & | aNode, |
const std::string & | aAttrName, | ||
bool & | aTarget | ||
) |
template bool uhal::utilities::GetXMLattribute< false > | ( | const pugi::xml_node & | aNode, |
const std::string & | aAttrName, | ||
const char * | aTarget | ||
) |
template bool uhal::utilities::GetXMLattribute< false > | ( | const pugi::xml_node & | aNode, |
const std::string & | aAttrName, | ||
double & | aTarget | ||
) |
template bool uhal::utilities::GetXMLattribute< false > | ( | const pugi::xml_node & | aNode, |
const std::string & | aAttrName, | ||
float & | aTarget | ||
) |
template bool uhal::utilities::GetXMLattribute< false > | ( | const pugi::xml_node & | aNode, |
const std::string & | aAttrName, | ||
int32_t & | aTarget | ||
) |
template bool uhal::utilities::GetXMLattribute< false > | ( | const pugi::xml_node & | aNode, |
const std::string & | aAttrName, | ||
std::string & | aTarget | ||
) |
Referenced by uhal::NodeTreeBuilder::moduleNodeCreator(), uhal::NodeTreeBuilder::setAddr(), uhal::NodeTreeBuilder::setClassName(), uhal::NodeTreeBuilder::setDescription(), uhal::NodeTreeBuilder::setFirmwareInfo(), uhal::NodeTreeBuilder::setMask(), uhal::NodeTreeBuilder::setModeAndSize(), uhal::NodeTreeBuilder::setPars(), uhal::NodeTreeBuilder::setPermissions(), uhal::NodeTreeBuilder::setTags(), and uhal::NodeTreeBuilder::setUid().
template bool uhal::utilities::GetXMLattribute< false > | ( | const pugi::xml_node & | aNode, |
const std::string & | aAttrName, | ||
uint32_t & | aTarget | ||
) |
template bool uhal::utilities::GetXMLattribute< true > | ( | const pugi::xml_node & | aNode, |
const std::string & | aAttrName, | ||
bool & | aTarget | ||
) |
template bool uhal::utilities::GetXMLattribute< true > | ( | const pugi::xml_node & | aNode, |
const std::string & | aAttrName, | ||
const char * | aTarget | ||
) |
template bool uhal::utilities::GetXMLattribute< true > | ( | const pugi::xml_node & | aNode, |
const std::string & | aAttrName, | ||
double & | aTarget | ||
) |
template bool uhal::utilities::GetXMLattribute< true > | ( | const pugi::xml_node & | aNode, |
const std::string & | aAttrName, | ||
float & | aTarget | ||
) |
template bool uhal::utilities::GetXMLattribute< true > | ( | const pugi::xml_node & | aNode, |
const std::string & | aAttrName, | ||
int32_t & | aTarget | ||
) |
template bool uhal::utilities::GetXMLattribute< true > | ( | const pugi::xml_node & | aNode, |
const std::string & | aAttrName, | ||
std::string & | aTarget | ||
) |
template bool uhal::utilities::GetXMLattribute< true > | ( | const pugi::xml_node & | aNode, |
const std::string & | aAttrName, | ||
uint32_t & | aTarget | ||
) |
bool uhal::utilities::HttpGet | ( | const std::string & | aURL, |
HttpResponseType & | aResponse | ||
) |
Retrieve a file by HTTP.
aURL | a URL to retrieve |
aResponse | a structure into which the returned HTTP packet is parsed |
Definition at line 133 of file files.hpp.
References uhal::Error, uhal::Info, uhal::log(), uhal::HttpResponseType::method, uhal::Quote(), uhal::HttpResponseType::status, ThisLocation, and uhal::tests::write().
void uhal::utilities::OpenFile | ( | const std::string & | aProtocol, |
const std::string & | aFilenameExpr, | ||
const boost::filesystem::path & | aParentPath, | ||
boost::_bi::bind_t< R, F, L > | aBinder | ||
) |
Given a protocol and either a URL or a linux shell expression, open the file and call the callback function on each of them.
aProtocol | the protocol to be used to retrieve the file |
aFilenameExpr | a linux shell expression to be expanded or a URL to be retrieved |
aParentPath | a path which will be prepended to relative file names for local files. No meaning for http files. |
aBinder | a callback function to be called on the files |
Definition at line 353 of file files.hpp.
References uhal::log(), OpenFileHttp(), OpenFileLocal(), and uhal::Quote().
Referenced by uhal::ConnectionManager::ConnectionManager(), and uhal::NodeTreeBuilder::getNodeTree().
void uhal::utilities::OpenFileHttp | ( | const std::string & | aURL, |
boost::_bi::bind_t< R, F, L > | aBinder | ||
) |
Given a URL, retrieve the file and call the callback function on each of them.
aURL | a URL to retrieve |
aBinder | a callback function to be called on the retrieved URL |
Definition at line 328 of file files.hpp.
References uhal::HttpResponseType::content, uhal::log(), and uhal::Quote().
Referenced by OpenFile().
void uhal::utilities::OpenFileLocal | ( | const std::string & | aFilenameExpr, |
const boost::filesystem::path & | aParentPath, | ||
boost::_bi::bind_t< R, F, L > | aBinder | ||
) |
Given a linux shell expression, open all files which match it and call the callback function on each of them.
aFilenameExpr | a linux shell expression to be expanded |
aParentPath | a path which will be prepended to relative file names |
aBinder | a callback function to be called on each file matching the linux shell expression |
Definition at line 292 of file files.hpp.
References uhal::log(), uhal::Quote(), and ShellExpandFilenameExpr().
Referenced by OpenFile().
void uhal::utilities::ParseSemicolonDelimitedUriList | ( | const std::string & | aSemicolonDelimitedUriList, |
std::vector< std::pair< std::string, std::string > > & | aUriList | ||
) |
Parse a semicolon delimited list of URIs into a vector of protocol/address pairs.
aSemicolonDelimitedUriList | a string containing a semicolon delimited list of URIs |
aUriList | a vector to which the extracted protocol/address pairs are appended |
Definition at line 46 of file files.cpp.
References uhal::Debug, uhal::log(), and uhal::Quote().
Referenced by uhal::ConnectionManager::ConnectionManager(), and uhal::NodeTreeBuilder::getNodeTree().
void uhal::utilities::PugiXMLParseResultPrettifier | ( | const pugi::xml_parse_result & | aLoadResult, |
const boost::filesystem::path & | aPath, | ||
const std::vector< uint8_t > & | aFile | ||
) |
Helper function to make debugging failures when parsing XML files easier.
aLoadResult | the result of the parsing |
aPath | the full filename of file whose parsing failed |
aFile | a byte vector containing the contents of the file (stored like this because the file could be either local or retrieved by HTTP) |
Definition at line 57 of file xml.cpp.
References pugi::xml_parse_result::description(), uhal::Error, uhal::Integer(), uhal::log(), pugi::xml_parse_result::offset, and uhal::Quote().
Referenced by uhal::NodeTreeBuilder::CallBack(), and uhal::ConnectionManager::CallBack().
void uhal::utilities::ShellExpandFilenameExpr | ( | const std::string & | aFilenameExpr, |
const boost::filesystem::path & | aParentPath, | ||
std::vector< boost::filesystem::path > & | aFiles | ||
) |
Perform shell expansion of a linux shell expression ( e.g.
"~/c*.xml" -> "/usr/home/awr/connections.xml" ) and convert into boost::filesystem::paths
aFilenameExpr | a c-style string containing a linux shell expression to be expanded |
aParentPath | a path which will be prepended to relative file names |
aFiles | a pointer to a vector of boost::filesystem::paths onto which the returned file names are appended |
Definition at line 69 of file files.cpp.
References uhal::Debug, uhal::log(), and uhal::Quote().
Referenced by OpenFileLocal().
unsigned int uhal::utilities::TrailingRightBits | ( | uint32_t | aValue | ) |
Helper function to calculate the number of zero-bits at the righthand end of a 32-bit number.
aValue | a 32-bit number whose trailing zero-bits are to be counted |
Definition at line 44 of file bits.cpp.
Referenced by uhal::ValWord< T >::value(), and uhal::ClientInterface::write().