Main Page | Class Hierarchy | Class List | File List | Class Members

object.h

00001 /* 00002 * Copyright (C) 2006 Dip. Ing. dell'Informazione, University of Pisa, Italy 00003 * http://info.iet.unipi.it/~cng/ns2measure/ns2measure.html 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA, USA 00018 */ 00019 00032 #ifndef __MEASURE_OBJECT_H 00033 #define __MEASURE_OBJECT_H 00034 00035 #ifdef DEBUG 00036 #include <iostream> 00037 #endif // DEBUG 00038 00039 #include <string> 00040 00042 class Object { 00044 std::string className; 00046 unsigned int id; 00047 public: 00049 Object (std::string name) : className (name) { 00050 static unsigned int newId = 0; 00051 id = ++newId; 00052 #ifdef DEBUG 00053 std::cerr << "+ " << className << " (" << id << ")\n"; 00054 #endif // DEBUG 00055 } 00057 unsigned int getId () const { return id; } 00059 std::string getName () const { return className; } 00061 virtual ~Object () { 00062 #ifdef DEBUG 00063 std::cerr << "- " << className << " (" << id << ")\n"; 00064 #endif // DEBUG 00065 } 00066 }; 00067 00068 #endif // __MEASURE_OBJECT_H

Generated on Tue May 30 08:09:56 2006 for ns2measure by doxygen 1.3.7