degate  0.1.2
RCVContainer.h
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 #ifndef __RCVCONTAINER_H__
00023 #define __RCVCONTAINER_H__
00024 
00025 #include <boost/foreach.hpp>
00026 #include <memory>
00027 #include <list>
00028 #include <RCBase.h>
00029 
00030 namespace degate {
00031 
00032   // forward declaration
00033   class RCViolation;
00034   typedef std::shared_ptr<RCViolation> RCViolation_shptr;
00035 
00036   /**
00037    * Representation for a container type, which holds a list
00038    * of Rule Check Violations.
00039    */
00040   class RCVContainer {
00041   public:
00042     typedef std::list<RCViolation_shptr> container_type;
00043     typedef container_type::iterator iterator;
00044     typedef container_type::const_iterator const_iterator;
00045 
00046   private:
00047     container_type violations;
00048 
00049   public:
00050     /**
00051      * The ctor.
00052      */
00053     RCVContainer();
00054 
00055     /**
00056      * The dtor.
00057      */
00058     ~RCVContainer();
00059 
00060     /**
00061      * Add a RC violation to the container.
00062      */
00063     void push_back(RCViolation_shptr rcv);
00064     
00065     /**
00066      * Get an iterator to the start of the list.
00067      */
00068     iterator begin();
00069 
00070     /**
00071      * Get an iterator to the end of the list.
00072      */
00073     iterator end();
00074 
00075     /**
00076      * Get a const iterator for the start of the list.
00077      */
00078     const_iterator begin() const;
00079 
00080     /**
00081      * Get a const iterator for the end of the list.
00082      */
00083     const_iterator end() const;
00084     
00085     /**
00086      * Clear entire list of RC violations.
00087      */
00088     void clear();
00089 
00090     /**
00091      * Find a RC violation in the container.
00092      */
00093     iterator find(RCViolation_shptr rcv);
00094 
00095     /**
00096      * Find a RC violation and return a const iterator.
00097      */
00098     const_iterator find(RCViolation_shptr rcv) const;
00099 
00100     /**
00101      * Get the number of entries.
00102      */
00103     size_t size() const;
00104 
00105     /**
00106      * Check if the container has already stored a specific RC violation.
00107      * @param rcv The RC violation for which the presence should be checked.
00108      * @return Returns true, if the RC violation is present in the container.
00109      */
00110     bool contains(RCViolation_shptr rcv) const;
00111 
00112     /**
00113      * Erase a specific RC violation.
00114      * @param rcv The RC violation, which should be removed.
00115      * @return Returns true, if the RC violation was found and removed.
00116      *   Else false is returned.
00117      */
00118     bool erase(RCViolation_shptr rcv);
00119 
00120   };
00121 
00122 }
00123 
00124 #endif