Ejemplo n.º 1
0
	// called in Stored destructor
	// removes the object from list. returns iterator to next valid object.
	virtual void remove(Target * object)
	{
		// some STL versions of remove return void instead 
		// of returning iterator to next object. So we 
		// need to get it manually
		onRemove(object);	// raise onRemove event
		generator->free(object->id());
		object->localID=-1;
		//idGenerator.freeID(object->id());
	
		objects.erase(object->back);	
	}
Ejemplo n.º 2
0
	bool remap(ID source,ID target)	// change ID from source to target
	{
		// source->target
		// target->new id
		if(!contains(source))
			return false;	// remap failed

		// find object
		Objects::iterator it=objects.find(source);		
		// get pointer
		Object *object=it->second;//objects[source];
		// remove
		objects.erase(it);
	
		if(contains(target))	// if <target> is valid object -> remap it to new ID
			remap(target,generator->generate(getTarget(objects[target])));

		objects[target]=object;
		// set new ID
		object->localID=target;		
		object->back=objects.find(target);
		return true;
	}