Qucs-core
0.0.19
|
00001 /* 00002 * object.h - generic object class definitions 00003 * 00004 * Copyright (C) 2003, 2004, 2005, 2006, 2008 Stefan Jahn <stefan@lkcc.org> 00005 * 00006 * This is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2, or (at your option) 00009 * any later version. 00010 * 00011 * This software is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this package; see the file COPYING. If not, write to 00018 * the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, 00019 * Boston, MA 02110-1301, USA. 00020 * 00021 * $Id: object.h 1871 2013-03-06 12:53:05Z crobarcro $ 00022 * 00023 */ 00024 00031 #ifndef __OBJECT_H__ 00032 #define __OBJECT_H__ 00033 00034 #include <string> 00035 #include "property.h" 00036 00037 #define MCREATOR(val) \ 00038 val (); \ 00039 static struct define_t miscdef; \ 00040 static struct define_t * definition (void) { return &miscdef; } 00041 00042 namespace qucs { 00043 00044 class variable; 00045 class vector; 00046 class property; 00047 00055 class object 00056 { 00057 public: 00059 object () : name(), props() {} ; 00061 object (const std::string &n) : name(n), props() {} ; 00063 void setName (const std::string &n) { this->name = n; }; 00065 const char * getName (void) const { return this->name.c_str(); }; 00066 void addProperty (const std::string &n, const char * const val, const bool def = false); 00067 void addProperty (const std::string &n, const nr_double_t, const bool def = false); 00068 void addProperty (const std::string &n, variable * const, const bool def = false); 00069 void setProperty (const std::string &n, const char * const); 00070 void setProperty (const std::string &n, nr_double_t); 00071 void setScaledProperty (const std::string &n, const nr_double_t); 00072 void setProperty (const std::string &n, variable * const); 00073 vector * getPropertyVector (const std::string &n) const; 00074 const char * getPropertyString (const std::string &n) const; 00075 const char * getPropertyReference (const std::string &n) const; 00076 nr_double_t getPropertyDouble (const std::string &n) const; 00077 nr_double_t getScaledProperty (const std::string &n) const; 00078 int getPropertyInteger (const std::string &n) const; 00079 bool hasProperty (const std::string &n) const ; 00080 bool isPropertyGiven (const std::string &n) const; 00081 int countProperties (void) const; 00082 const char * 00083 propertyList (void) const; 00084 00085 private: 00086 std::string name; 00087 properties props; 00088 }; 00089 00090 } // namespace qucs 00091 00092 #endif /* __OBJECT_H__ */