degate  0.1.2
RCVContainer.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 <RCBase.h>
00023 #include <RCVContainer.h>
00024 
00025 using namespace degate;
00026 
00027 RCVContainer::RCVContainer() {
00028 }
00029 
00030 RCVContainer::~RCVContainer() {
00031 }
00032 
00033 void RCVContainer::push_back(RCViolation_shptr rcv) {
00034   violations.push_back(rcv);
00035 }
00036 
00037 RCVContainer::iterator RCVContainer::begin() { 
00038   return violations.begin(); 
00039 }
00040 
00041 RCVContainer::iterator RCVContainer::end() { 
00042   return violations.end(); 
00043 }
00044 
00045 RCVContainer::const_iterator RCVContainer::begin() const { 
00046   return violations.begin(); 
00047 }
00048 
00049 RCVContainer::const_iterator RCVContainer::end() const { 
00050   return violations.end(); 
00051 }
00052 
00053 void RCVContainer::clear() { 
00054   violations.clear(); 
00055 }
00056 
00057 size_t RCVContainer::size() const { 
00058   return violations.size(); 
00059 }
00060 
00061 bool RCVContainer::contains(RCViolation_shptr rcv) const { 
00062   return find(rcv) != end();
00063 }
00064 
00065 bool RCVContainer::erase(RCViolation_shptr rcv) {
00066   iterator iter = find(rcv);
00067   if(iter != end()) {
00068     violations.erase(iter);
00069     return true;
00070   }
00071   return false;
00072 }
00073 
00074 RCVContainer::iterator RCVContainer::find(RCViolation_shptr rcv) {
00075   for(iterator iter = begin(); iter != end(); ++iter) {
00076     if((*iter)->equals(rcv)) return iter;
00077   }
00078   return end();
00079 }
00080 
00081 RCVContainer::const_iterator RCVContainer::find(RCViolation_shptr rcv) const {
00082   for(const_iterator iter = begin(); iter != end(); ++iter) {
00083     if((*iter)->equals(rcv)) return iter;
00084   }
00085   return end();
00086 }