degate 0.1.1
LogicModelObjectBase.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 
00023 #include "globals.h"
00024 #include "LogicModelObjectBase.h"
00025 #include "Layer.h"
00026 #include "PlacedLogicModelObject.h"
00027 
00028 using namespace degate;
00029 
00030 LogicModelObjectBase::LogicModelObjectBase(object_id_t oid) :
00031   object_id(oid) {
00032 }
00033 
00034 LogicModelObjectBase::LogicModelObjectBase(std::string const& object_name,
00035                                            std::string const& object_description) :
00036   object_id(0),
00037   name(object_name),
00038   description(object_description) {
00039 }
00040 
00041 LogicModelObjectBase::LogicModelObjectBase(object_id_t oid,
00042                                            std::string const& object_name,
00043                                            std::string const& object_description) :
00044   object_id(oid),
00045   name(object_name),
00046   description(object_description) {
00047 }
00048 
00049 LogicModelObjectBase::~LogicModelObjectBase() {
00050 }
00051 
00052 void LogicModelObjectBase::set_name(std::string const& name) {
00053   this->name = name;
00054 }
00055 
00056 void LogicModelObjectBase::set_description(std::string const & description) {
00057   this->description = description;
00058 }
00059 
00060 std::string const & LogicModelObjectBase::get_name() const {
00061   return name;
00062 }
00063 
00064 std::string const & LogicModelObjectBase::get_description() const {
00065   return description;
00066 }
00067 
00068 bool LogicModelObjectBase::has_name() const {
00069   return !name.empty();
00070 }
00071 
00072 bool LogicModelObjectBase::has_description() const {
00073   return !description.empty();
00074 }
00075 
00076 
00077 void LogicModelObjectBase::set_object_id(object_id_t oid) {
00078   object_id = oid;
00079 }
00080 
00081 object_id_t LogicModelObjectBase::get_object_id() const {
00082   return object_id;
00083 }
00084 
00085 bool LogicModelObjectBase::has_valid_object_id() const {
00086   return object_id != 0;
00087 }
00088 
00089 
00090 const std::string LogicModelObjectBase::get_descriptive_identifier() const {
00091   // should be dispatched. In debug mode we break here.
00092   assert(1 == 0);
00093 
00094   boost::format fmter("Generic object %1%");
00095   fmter % get_object_id();;
00096   return fmter.str();
00097 }
00098 
00099 const std::string LogicModelObjectBase::get_object_type_name() const {
00100   return std::string("Generic object");
00101 }
00102