#ifndef _VIEW_UTILS_HH_ #define _VIEW_UTILS_HH_ ////////////////////////////////////////////////////////////////////////// // // Function: viewUtils.hh // Purpose: // // Created: 12/09/99 Pierre Savard // History: // ////////////////////////////////////////////////////////////////////////// #include "Calor/CalorPredicates.hh" #include "CalorObjects/PhysicsTowerView.hh" // These functions are similar to the STL algorithms set_union, set_intersection // etc. This will be moved out of here soon. inline void view_union(PhysicsTowerView& p1, PhysicsTowerView& p2){ for(Towers::const_iterator iter = p1.begin(); iter != p1.end(); ++iter){ Towers::const_iterator imatch = std::find_if(p2.begin(),p2.end(),IndexMatch((*iter)->index())); if(imatch == p2.end()) p2.push_back(*iter); } } inline void view_intersection(PhysicsTowerView& p1, PhysicsTowerView& p2, PhysicsTowerView& p3){ for(Towers::const_iterator it = p1.begin(); it != p1.end(); ++it){ Towers::const_iterator imatch = std::find_if(p2.begin(),p2.end(),IndexMatch((*it)->index())); if(imatch != p2.end()) p3.push_back(*it); } } inline void view_remove(PhysicsTowerView& p1, PhysicsTowerView& p2){ for(Towers::const_iterator it = p2.begin(); it != p2.end(); ++it){ Towers::iterator imatch = std::find_if(p1.begin(),p1.end(),IndexMatch((*it)->index())); if(imatch != p1.end()) p1.erase(imatch); } } #endif // _VIEW_UTILS_HH_