|
degate 0.1.1
|
00001 /* 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 "globals.h" 00023 #include "LogicModelObjectBase.h" 00024 #include "Net.h" 00025 #include "Layer.h" 00026 #include "LogicModel.h" 00027 #include "ConnectedLogicModelObject.h" 00028 #include "degate_exceptions.h" 00029 00030 using namespace degate; 00031 00032 Net::Net() { 00033 } 00034 00035 Net::~Net() { 00036 } 00037 00038 Net::connection_iterator Net::begin() { 00039 return connections.begin(); 00040 } 00041 00042 Net::connection_iterator Net::end() { 00043 return connections.end(); 00044 } 00045 00046 void Net::remove_object(object_id_t oid) { 00047 00048 if(oid == 0) 00049 throw InvalidObjectIDException("The object that has to be " 00050 "removed from the net has no object ID."); 00051 00052 connection_iterator i = connections.find(oid); 00053 if(i != connections.end()) { 00054 connections.erase(i); 00055 } 00056 else 00057 throw CollectionLookupException("Can't remove object from the the net, " 00058 "because it is not in the net."); 00059 } 00060 00061 void Net::remove_object(ConnectedLogicModelObject_shptr o) { 00062 remove_object(o->get_object_id()); 00063 } 00064 00065 00066 void Net::add_object(object_id_t oid) { 00067 if(oid == 0) 00068 throw InvalidObjectIDException("The object that has to be " 00069 "added to the net has no object ID."); 00070 else 00071 connections.insert(oid); 00072 } 00073 00074 void Net::add_object(ConnectedLogicModelObject_shptr o) { 00075 add_object(o->get_object_id()); 00076 } 00077 00078 00079 00080 unsigned int Net::size() const { 00081 return connections.size(); 00082 } 00083 00084 const std::string Net::get_descriptive_identifier() const { 00085 boost::format fmter("Net %1%"); 00086 fmter % get_object_id();; 00087 return fmter.str(); 00088 }
1.7.4