degate  0.1.2
LogicModelObjectBase.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  Copyright 2012 Robert Nitsch
00007 
00008  Degate is free software: you can redistribute it and/or modify
00009  it under the terms of the GNU General Public License as published by
00010  the Free Software Foundation, either version 3 of the License, or
00011  any later version.
00012 
00013  Degate is distributed in the hope that it will be useful,
00014  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  GNU General Public License for more details.
00017 
00018  You should have received a copy of the GNU General Public License
00019  along with degate. If not, see <http://www.gnu.org/licenses/>.
00020 
00021 */
00022 
00023 #ifndef __LOGICMODELOBJECTBASE_H__
00024 #define __LOGICMODELOBJECTBASE_H__
00025 
00026 #include "globals.h"
00027 #include "DeepCopyable.h"
00028 #include <boost/format.hpp>
00029 
00030 namespace degate {
00031 
00032   /**
00033    * The class LogicModelObjectBase is the base class for basically every class
00034    * that represents a logic model object.
00035    */
00036   class LogicModelObjectBase : public DeepCopyableBase {
00037 
00038   private:
00039 
00040     object_id_t object_id;
00041 
00042     std::string name;
00043     std::string description;
00044 
00045   public:
00046 
00047     /**
00048      * Create a new object.
00049      */
00050 
00051     LogicModelObjectBase(object_id_t oid = 0);
00052 
00053     /**
00054      * The constructor.
00055      */
00056 
00057     LogicModelObjectBase(std::string const& object_name,
00058                          std::string const& object_description);
00059 
00060     /**
00061      * The constructor.
00062      */
00063 
00064     LogicModelObjectBase(object_id_t oid,
00065                          std::string const& object_name,
00066                          std::string const& object_description);
00067 
00068     /**
00069      * The dtor.
00070      */
00071 
00072     virtual ~LogicModelObjectBase();
00073 
00074     void cloneDeepInto(DeepCopyable_shptr destination, oldnew_t *oldnew) const;
00075 
00076     /**
00077      * Set the name for a logic model object. It is up to the user
00078      * how the object is named. But it should be identifying.
00079      */
00080 
00081     virtual void set_name(std::string const& name);
00082 
00083     /**
00084      * Set the description for a logic model object. It is up to the user
00085      * how the object is described.
00086      */
00087 
00088     virtual void set_description(std::string const & description);
00089 
00090     /**
00091      * Get the name for a logic model object.
00092      */
00093 
00094     virtual std::string const & get_name() const;
00095 
00096     /**
00097      * Get the description for a logic model object.
00098      */
00099 
00100     virtual std::string const & get_description() const;
00101 
00102     /**
00103      * Check if a logic model object has a name.
00104      */
00105 
00106     virtual bool has_name() const;
00107 
00108     /**
00109      * Check if a logic model object has a description.
00110      */
00111 
00112     virtual bool has_description() const;
00113 
00114     /**
00115      * Set the object ID for a logic model object.
00116      */
00117 
00118     virtual void set_object_id(object_id_t oid);
00119 
00120     /**
00121      * Get the object ID for a logic model object.
00122      */
00123 
00124     virtual object_id_t get_object_id() const;
00125 
00126     /**
00127      * Check if the logic model object has a valid object ID.
00128      */
00129 
00130     virtual bool has_valid_object_id() const;
00131 
00132 
00133     /**
00134      * Get a human readable string that describes the whole
00135      * logic model object. The string should be unique in order
00136      * to let the user identify the concrete object. But that
00137      * is not a must.
00138      */
00139 
00140     virtual const std::string get_descriptive_identifier() const;
00141 
00142     /**
00143      * Get a human readable string that names the object type,
00144      * e.g. "Wire" or "Gate port".
00145      */
00146 
00147     virtual const std::string get_object_type_name() const;
00148 
00149   };
00150 
00151   typedef std::shared_ptr<LogicModelObjectBase> LogicModelObjectBase_shptr;
00152   
00153   class LMOCompare {
00154   public:
00155     bool operator() (const LogicModelObjectBase &a, const LogicModelObjectBase &b) const;
00156     bool operator() (const LogicModelObjectBase_shptr &a, const LogicModelObjectBase_shptr &b) const;
00157   };
00158 }
00159 
00160 #endif