Exemplo n.º 1
0
void Sector::removeSector(string sectorName){
	Sector* tmp;

	for(vector<Sector*>::iterator it = _children.begin();it!=_children.end();++it){
		tmp = *it;

		if (tmp->getName().compare(sectorName)==0) {
			_children.erase(it);
			tmp->setSuperior(NULL);
			tmp->release();
			break;
		}
	}

	tmp=NULL;
}
Exemplo n.º 2
0
void Sector::removeSector(Sector* s){

	Sector* tmp;

	for(vector<Sector*>::iterator it = _children.begin();it!=_children.end();++it){
		tmp = *it;
		if (tmp == s) {
			_children.erase(it);
			tmp->setSuperior(NULL);
			tmp->release();
			break;
		}
	}

	tmp = NULL;
}
Exemplo n.º 3
0
Sector::~Sector() {
	tryToRemoveCurrentManager();

	if (_superior!=NULL) {
		_superior->release();
		_superior=NULL;
	}

	Sector* tmp;
	for(vector<Sector*>::iterator it = _children.begin();it!=_children.end();++it){
		tmp = *it;
		tmp->release();
	}
	_children.clear();
	tmp=NULL;

	_resultAdapter->release();
	_commandAdapter->release();

	if (_manager!=NULL) {
		_manager->release();
	}
}
Exemplo n.º 4
0
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;
}