|
degate 0.1.1
|
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 "globals.h" 00023 #include "Annotation.h" 00024 #include <boost/format.hpp> 00025 00026 using namespace degate; 00027 00028 Annotation::Annotation(int _min_x, int _max_x, int _min_y, int _max_y, 00029 class_id_t _class_id) : 00030 Rectangle(_min_x, _max_x, _min_y, _max_y), class_id(_class_id) { 00031 00032 } 00033 00034 Annotation::Annotation(BoundingBox const& bbox, class_id_t _class_id) : 00035 Rectangle(bbox.get_min_x(), bbox.get_max_x(), 00036 bbox.get_min_y(), bbox.get_max_y()), 00037 class_id(_class_id) { 00038 } 00039 00040 Annotation::~Annotation() { 00041 } 00042 00043 Annotation::class_id_t Annotation::get_class_id() const { 00044 return class_id; 00045 } 00046 00047 void Annotation::set_class_id(Annotation::class_id_t _class_id) { 00048 class_id = _class_id; 00049 } 00050 00051 const std::string Annotation::get_descriptive_identifier() const { 00052 boost::format fmter("%1% (id=%2%,class=%3%)"); 00053 fmter % get_object_id() % get_name() % get_class_id(); 00054 return fmter.str(); 00055 } 00056 00057 const std::string Annotation::get_object_type_name() const { 00058 return std::string("Annotation"); 00059 } 00060 00061 void Annotation::print(std::ostream & os, int n_tabs) const { 00062 00063 os 00064 << gen_tabs(n_tabs) << "Annotation name : " << get_name() << std::endl 00065 << gen_tabs(n_tabs) << "Description : " << get_description() << std::endl 00066 << gen_tabs(n_tabs) << "Object ID : " << get_object_id() << std::endl 00067 << gen_tabs(n_tabs) << "Bounding box : " << Rectangle::get_bounding_box().to_string() << std::endl 00068 << gen_tabs(n_tabs) << "Annotation class : " << get_class_id() << std::endl 00069 << std::endl; 00070 00071 os << std::endl; 00072 00073 } 00074 00075 Annotation::parameter_set_type::const_iterator Annotation::parameters_begin() const { 00076 return parameters.begin(); 00077 } 00078 00079 Annotation::parameter_set_type::const_iterator Annotation::parameters_end() const { 00080 return parameters.end(); 00081 }
1.7.4