44 #include <boost/regex.hpp>
45 #include <boost/spirit/include/qi.hpp>
48 #if BOOST_VERSION >= 106000
50 using boost::placeholders::_1;
51 using boost::placeholders::_2;
52 using boost::placeholders::_3;
60 connection_file ( aConnectionFile )
85 if (
id != aConnectionDescriptor.
id )
90 if (
uri != aConnectionDescriptor.
uri )
109 boost::lock_guard<boost::mutex> lLock (
mMutex );
110 std::vector< std::pair<std::string, std::string> > lConnectionFiles;
113 for ( std::vector< std::pair<std::string, std::string> >::iterator lIt = lConnectionFiles.begin() ; lIt != lConnectionFiles.end() ; ++lIt )
124 boost::lock_guard<boost::mutex> lLock (
mMutex );
125 std::vector< std::pair<std::string, std::string> > lConnectionFiles;
128 for ( std::vector< std::pair<std::string, std::string> >::iterator lIt = lConnectionFiles.begin() ; lIt != lConnectionFiles.end() ; ++lIt )
143 boost::lock_guard<boost::mutex> lLock (
mMutex );
147 exception::ConnectionUIDDoesNotExist lExc;
148 log ( lExc ,
"Connection map contains no entries" );
156 exception::ConnectionUIDDoesNotExist lExc;
157 log ( lExc ,
"Device ID , " ,
Quote ( aId ) ,
", does not exist in connection map" );
163 log (
Info() ,
"ConnectionManager created node tree: " , *lNode );
172 boost::lock_guard<boost::mutex> lLock (
mMutex );
174 log (
Info() ,
"ConnectionManager created node tree: " , *lNode );
183 boost::lock_guard<boost::mutex> lLock (
mMutex );
185 log (
Info() ,
"ConnectionManager created node tree: " , *lNode );
193 std::vector<std::string> lDevices;
198 lDevices.push_back ( lIt->first );
207 std::vector<std::string> lDevices;
212 boost::cmatch lMatch;
214 if ( boost::regex_match ( lIt->first.c_str() , lMatch , boost::regex ( aRegex ) ) )
216 lDevices.push_back ( lIt->first );
227 boost::lock_guard<boost::mutex> lLock (
mMutex );
228 log(
Info(),
"ConnectionManager is clearing the address filename -> Node tree cache");
235 std::pair< std::set< std::string >::iterator ,
bool > lInsert =
mPreviouslyOpenedFiles.insert ( aProtocol+ ( aPath.string() ) );
237 if ( ! lInsert.second )
239 log (
Info() ,
"File " ,
Quote ( aProtocol+ ( aPath.string() ) ) ,
" has already been parsed. I am not reparsing and will continue with next document for now but be aware!" );
262 std::pair< std::map< std::string, ConnectionDescriptor >::iterator ,
bool > lInsert =
mConnectionDescriptors.insert ( std::make_pair ( lDescriptor.
id , lDescriptor ) );
264 if ( !lInsert.second )
266 if ( lInsert.first->second == lDescriptor )
268 log (
Info() ,
"Duplicate connection entry found:"
269 "\n > id = " , lDescriptor.
id ,
270 "\n > uri = " , lDescriptor.
uri ,
272 "\n Continuing for now but be aware!" );
276 exception::DuplicatedUID lExc;
277 log ( lExc ,
"Duplicate connection ID " ,
Quote ( lDescriptor.
id ) ,
" found in connections file " ,
278 Quote ( aProtocol+ ( aPath.string() ) ) ,
" but parameters do not match! Bailing!" );
285 log (
Error() ,
"Construction of Connection Descriptor failed. Continuing with next Connection Descriptor for now but be aware!" );