コード例 #1
0
ファイル: Box.cpp プロジェクト: BackupTheBerlios/mutabor
	bool BoxClass::Replace(Route & oldroute, Route & newroute) {
		DEBUGLOG(smartptr,_T("oldroute; %p, newroute; %p"),
			 (void*)oldroute.get(),(void*)newroute.get());
		bool found = Remove(oldroute);
		mutASSERT(found);
		if (found)
			Add(newroute);

		DEBUGLOG(smartptr,_T("oldroute; %p, newroute; %p"),
			 (void*)oldroute.get(),(void*)newroute.get());
		return found;
	}
コード例 #2
0
ファイル: Box.cpp プロジェクト: BackupTheBerlios/mutabor
	void BoxClass::Add(Route & route) {
		BoxLock lock(this);
		DEBUGLOG(smartptr,_T("Route; %p"),(void*)route.get());
#ifdef DEBUG
		routeListType::const_iterator i =
			find(routes.begin(),routes.end(),route);
		mutASSERT(i == routes.end());
		mutASSERT(IsInBoxList(this));
#endif
		TRACEC;
		routes.push_back(route);
		DEBUGLOG(smartptr,_T("Route; %p saved"),(void*)route.get());
	}
コード例 #3
0
ファイル: Box.cpp プロジェクト: BackupTheBerlios/mutabor
	bool BoxClass::Remove(Route & route) {
		BoxLock lock(this);
		DEBUGLOG(smartptr,_T("Route: %p (%d)"),
			 (void*)route.get(),
			 (int)intrusive_ptr_get_refcount(route.get()));
		routeListType::iterator i =
			std::find(routes.begin(),routes.end(),route);
		bool found = (i != routes.end());
		mutASSERT(found);
		if (found) {
			(*i).reset();// list can save some memory for reuse,
			// but route must be deleted
			routes.erase(i);
		}
		DEBUGLOG(smartptr,_T("Route; %p (%d)"),(void*)route.get(),
			 (int)intrusive_ptr_get_refcount(route.get()));
		return found;
	}