bool Sector::_sendCommandExcept(Command* cmd, Sector* except) { bool suc = true; if (!_commandAdapter->dispatch((Event*)cmd)) { suc = false; } Sector* tmp; for(vector<Sector*>::iterator it = _children.begin();it!=_children.end();++it){ tmp = *it; if (tmp!=except) { if (!tmp->sendCommand(cmd)) { suc = false; } } } tmp=NULL; return suc; }
int main(void) { MyManager * mgr = new MyManager(); Sector* s = new Sector("root",mgr); MyFunc* f = new MyFunc(s); s->addFunction(f); Command* cmd = new Command("MyFunc"); s->sendCommand(cmd); cmd->release(); Request* req = new Request(""); s->sendRequest(req); req->release(); cout<<s->getName()<<endl; f->release(); s->release(); mgr->release(); return EXIT_SUCCESS; }