55 map<string,map<string,service_cmd> >::iterator i = _services.find( name ) ;
56 if( i == _services.end() )
58 map<string,service_cmd> cmds ;
59 _services[name] = cmds ;
63 string err = (string)
"The service " + name
64 +
" has already been registered" ;
86 const string &cmd_descript,
87 const string &format )
89 map<string,map<string,service_cmd> >::iterator si ;
90 si = _services.find( service ) ;
91 if( si != _services.end() )
93 map<string,service_cmd>::const_iterator ci ;
94 ci = (*si).second.find( cmd ) ;
95 if( ci != (*si).second.end() )
97 string err = (string)
"Attempting to add command "
98 + (*ci).first +
" to the service "
99 + service +
", command alrady exists" ;
103 sc._description = cmd_descript ;
104 sc._formats[format] = format ;
105 (*si).second[cmd] = sc ;
109 string err = (string)
"Attempting to add commands to the service "
110 + service +
" that has not yet been registered" ;
126 const string &format )
128 map<string,map<string,service_cmd> >::iterator si ;
129 si = _services.find( service ) ;
130 if( si != _services.end() )
132 map<string,service_cmd>::iterator ci = (*si).second.find( cmd ) ;
133 if( ci != (*si).second.end() )
135 map<string,string>::iterator fi ;
136 fi = (*ci).second._formats.find( format ) ;
137 if( fi == (*ci).second._formats.end() )
139 (*ci).second._formats[format] = format ;
143 string err = (string)
"Attempting to add format "
144 + format +
" to command " + cmd
145 +
" for service " + service
146 +
" where the format has already been registered" ;
152 string err = (string)
"Attempting to add a format " + format
153 +
" to command " + cmd +
" for service " + service
154 +
" where the command has not been registered" ;
160 string err = (string)
"Attempting to add a format " + format
161 +
" to command " + cmd +
" for a service " + service
162 +
" that has not been registered" ;
178 map<string,map<string,service_cmd> >::iterator i ;
179 i = _services.find( service ) ;
180 if( i != _services.end() )
183 _services.erase( i ) ;
188 map<string,map<string,string> >::iterator hi = _handles.begin() ;
189 map<string,map<string,string> >::iterator he = _handles.end() ;
190 for( ; hi != he; hi++ )
192 map<string,string>::iterator hsi = (*hi).second.find( service ) ;
193 if( hsi != (*hi).second.end() )
195 (*hi).second.erase( hsi ) ;
218 const string &format )
221 map<string,map<string,service_cmd> >::iterator si ;
222 si = _services.find( service ) ;
223 if( si != _services.end() )
227 map<string,service_cmd>::iterator ci = (*si).second.find( cmd ) ;
228 if( ci != (*si).second.end() )
230 if( !format.empty() )
232 map<string,string>::iterator fi ;
233 fi = (*ci).second._formats.find( format ) ;
234 if( fi != (*ci).second._formats.end() )
266 const string &service )
268 map<string,map<string,service_cmd> >::iterator si ;
269 si = _services.find( service ) ;
270 if( si == _services.end() )
272 string err = (string)
"Registering a handler to handle service "
273 + service +
" that has not yet been registered" ;
277 map<string,map<string,string> >::iterator hi = _handles.find( handler ) ;
278 if( hi == _handles.end() )
280 map<string,string> services ;
281 services[service] = service ;
282 _handles[handler] = services ;
286 map<string,string>::iterator ci = (*hi).second.find( service ) ;
287 if( ci == (*hi).second.end() )
289 (*hi).second[service] = service ;
304 const string &service )
306 bool handled = false ;
307 map<string,map<string,string> >::iterator hi = _handles.find( handler ) ;
308 if( hi != _handles.end() )
310 map<string,string>::iterator si = (*hi).second.find( service ) ;
311 if( si != (*hi).second.end() )
329 list<string> &services )
331 map<string,map<string,string> >::iterator hi = _handles.find( handler ) ;
332 if( hi != _handles.end() )
334 map<string,string>::const_iterator si = (*hi).second.begin() ;
335 map<string,string>::const_iterator se = (*hi).second.end() ;
336 for( ; si != se; si++ )
338 services.push_back( (*si).second ) ;
354 map<string,map<string,service_cmd> >::iterator si = _services.begin() ;
355 map<string,map<string,service_cmd> >::iterator se = _services.end() ;
356 for( ; si != se; si++ )
358 map<string,string> props ;
359 props[
"name"] = (*si).first ;
360 info.
begin_tag(
"serviceDescription", &props ) ;
361 map<string,service_cmd>::iterator ci = (*si).second.begin() ;
362 map<string,service_cmd>::iterator ce = (*si).second.end() ;
363 for( ; ci != ce; ci++ )
365 map<string,string> cprops ;
366 cprops[
"name"] = (*ci).first ;
368 info.
add_tag(
"description", (*ci).second._description ) ;
369 map<string,string>::iterator fi = (*ci).second._formats.begin() ;
370 map<string,string>::iterator fe = (*ci).second._formats.end() ;
371 for( ; fi != fe; fi++ )
373 map<string,string> fprops ;
374 fprops[
"name"] = (*fi).first ;
375 info.
add_tag(
"format",
"", &fprops ) ;
379 info.
end_tag(
"serviceDescription" ) ;
394 << (
void *)
this <<
")" << endl ;
398 map<string,map<string,service_cmd> >::const_iterator si ;
399 si = _services.begin() ;
400 map<string,map<string,service_cmd> >::const_iterator se ;
401 se = _services.end() ;
402 for( ; si != se; si++ )
406 map<string,service_cmd>::const_iterator ci = (*si).second.begin() ;
407 map<string,service_cmd>::const_iterator ce = (*si).second.end() ;
408 for( ; ci != ce; ci++ )
413 << (*ci).second._description << endl ;
416 map<string,string>::const_iterator fi ;
417 fi = (*ci).second._formats.begin() ;
418 map<string,string>::const_iterator fe ;
419 fe = (*ci).second._formats.end() ;
420 for( ; fi != fe; fi++ )
432 map<string,map<string,string> >::const_iterator hi = _handles.begin() ;
433 map<string,map<string,string> >::const_iterator he = _handles.end() ;
434 for( ; hi != he; hi++ )
437 map<string,string>::const_iterator hsi = (*hi).second.begin() ;
438 map<string,string>::const_iterator hse = (*hi).second.end() ;
439 bool isfirst = true ;
440 for( ; hsi != hse; hsi++ )
442 if( !isfirst ) strm <<
", " ;
444 strm << (*hsi).first ;