degate  0.1.2
ObjectSet.cc
Go to the documentation of this file.
00001 /* -*-c++-*-
00002 
00003  This file is part of the IC reverse engineering tool degate.
00004 
00005  Copyright 2008, 2009, 2010 by Martin Schobert
00006 
00007  Degate is free software: you can redistribute it and/or modify
00008  it under the terms of the GNU General Public License as published by
00009  the Free Software Foundation, either version 3 of the License, or
00010  any later version.
00011 
00012  Degate is distributed in the hope that it will be useful,
00013  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  GNU General Public License for more details.
00016 
00017  You should have received a copy of the GNU General Public License
00018  along with degate. If not, see <http://www.gnu.org/licenses/>.
00019 
00020  */
00021 
00022 #include <ObjectSet.h>
00023 #include <algorithm>
00024 #include <memory>
00025 
00026 using namespace std;
00027 using namespace degate;
00028 
00029 
00030 bool degate::is_removable(PlacedLogicModelObject_shptr o) {
00031   return std::dynamic_pointer_cast<GatePort>(o) == NULL;
00032 }
00033 
00034 bool degate::is_interconnectable(PlacedLogicModelObject_shptr o) {
00035   return std::dynamic_pointer_cast<ConnectedLogicModelObject>(o) != NULL;
00036 }
00037 
00038 
00039 
00040 void ObjectSet::clear() {
00041   objects.clear();
00042 }
00043 
00044 
00045 void ObjectSet::add(PlacedLogicModelObject_shptr object) {
00046   objects.insert(object);
00047 }
00048 
00049 
00050 void ObjectSet::remove(PlacedLogicModelObject_shptr object) {
00051 
00052   object_set_type::iterator it = find(objects.begin(), objects.end(), object);
00053 
00054   if(it != objects.end()) {
00055     objects.erase(it);
00056   }
00057 }
00058 
00059