26#include "UtilMacros.h"
30namespace RobotRaconteur
39class LoadInfoFile_traits
42 static bool LoadDeviceIdentifier(
const T& info_file,
const std::string& category,
43 std::vector<LocalIdentifierLockPtr>& locks,
44 boost::shared_ptr<RobotRaconteur::RobotRaconteurNode> node)
46 if (info_file && info_file->device_info && info_file->device_info->device &&
49 LocalIdentifierLockPtr l =
51 info_file->device_info->device = l->GetIdentifier();
60class ROBOTRACONTEUR_COMPANION_UTIL_API LoadInfoFile_traits<com::robotraconteur::device::DeviceInfoPtr>
63 static bool LoadDeviceIdentifier(
const com::robotraconteur::device::DeviceInfoPtr& info_file,
64 const std::string& category, std::vector<LocalIdentifierLockPtr>& locks,
65 const boost::shared_ptr<RobotRaconteur::RobotRaconteurNode>& node);
93 const std::string& category =
"unspecified",
94 boost::shared_ptr<RobotRaconteur::RobotRaconteurNode> node =
95 boost::shared_ptr<RobotRaconteur::RobotRaconteurNode>())
97 auto map = YAML::Load(file_text);
98 auto info = map.as<T>();
99 detail::LoadInfoFile_traits<T>::LoadDeviceIdentifier(info, category, identifier_locks, node);
126static T
LoadInfoFile(
const std::string& file_name, std::vector<LocalIdentifierLockPtr>& identifier_locks,
127 const std::string& category =
"unspecified",
128 boost::shared_ptr<RobotRaconteur::RobotRaconteurNode> node =
129 boost::shared_ptr<RobotRaconteur::RobotRaconteurNode>())
131 auto map = YAML::LoadFile(file_name);
132 auto info = map.as<T>();
133 detail::LoadInfoFile_traits<T>::LoadDeviceIdentifier(info, category, identifier_locks, node);
161 const std::string& category =
"unspecified",
162 boost::shared_ptr<RobotRaconteur::RobotRaconteurNode> rr_node =
163 boost::shared_ptr<RobotRaconteur::RobotRaconteurNode>())
165 auto info = node.as<T>();
166 detail::LoadInfoFile_traits<T>::LoadDeviceIdentifier(info, category, identifier_locks, rr_node);
bool IsIdentifierAnyName(const com::robotraconteur::identifier::IdentifierPtr &identifier)
Check if an identifier is "any" name (Name is empty).
bool IsIdentifierAnyUuid(const com::robotraconteur::identifier::IdentifierPtr &identifier)
Check if an identifier is "any" (UUID is all zeros).
static T LoadInfoFileFromNode(YAML::Node &node, std::vector< LocalIdentifierLockPtr > &identifier_locks, const std::string &category="unspecified", boost::shared_ptr< RobotRaconteur::RobotRaconteurNode > rr_node=boost::shared_ptr< RobotRaconteur::RobotRaconteurNode >())
Load an info file from a YAML node.
Definition InfoFileLoader.h:160
static T LoadInfoFile(const std::string &file_name, std::vector< LocalIdentifierLockPtr > &identifier_locks, const std::string &category="unspecified", boost::shared_ptr< RobotRaconteur::RobotRaconteurNode > node=boost::shared_ptr< RobotRaconteur::RobotRaconteurNode >())
Load an info file from a file.
Definition InfoFileLoader.h:126
static T LoadInfoFileFromString(const std::string &file_text, std::vector< LocalIdentifierLockPtr > &identifier_locks, const std::string &category="unspecified", boost::shared_ptr< RobotRaconteur::RobotRaconteurNode > node=boost::shared_ptr< RobotRaconteur::RobotRaconteurNode >())
Load an info file from a string.
Definition InfoFileLoader.h:92
LocalIdentifierLockPtr GetIdentifierForNameAndLock(const std::string &category, const std::string &name, boost::shared_ptr< RobotRaconteur::RobotRaconteurNode > node=boost::shared_ptr< RobotRaconteur::RobotRaconteurNode >())
Get the Identifier For Name And Lock object.