/*******************************************************************************
* TmsEventServerList.cc TMS List of Event Servers
* T.Barnaby, BEAM Ltd, 2007-04-19
*******************************************************************************
*/
#include <stdlib.h>
#include <stdint.h>
#include <TmsEventServerList.h>
namespace Tms {
TmsEventServerList::TmsEventServerList(){
}
TmsEventServerList::~TmsEventServerList(){
olock.lock();
olock.unlock();
}
BError TmsEventServerList::append(BString name){
BError err;
TmsEvent* e = new TmsEvent(name);
#ifdef ZAP
if(err = e->connectService(name)){
delete e;
printf("TmsEventServerList::append: Connection Error: %s\n", err.getString().retStr());
return err;
}
#endif
// printf("TmsEventServerList::append: Name: %s Num: %d\n", name.retStr(), oeventServers.number());
del(name); // Make sure there is only one entry
olock.lock();
oeventServers.append(e);
olock.unlock();
return err;
}
BError TmsEventServerList::del(BString name){
BError err;
BIter i;
olock.lock();
for(oeventServers.start(i); !oeventServers.isEnd(i); ){
if(oeventServers[i]->getServiceName() == name){
delete oeventServers[i];
oeventServers.del(i);
}
else {
oeventServers.next(i);
}
}
olock.unlock();
return err;
}