object_base.h

Go to the documentation of this file.
00001 #ifndef OBJECT_BASE_CLASS
00002 #define OBJECT_BASE_CLASS
00003 
00004 /*****************************************************************************\
00005 *                                                                             *
00006 *  Name   : object_base                                                       *
00007 *  Author : Chris Koeritz                                                     *
00008 *                                                                             *
00009 *******************************************************************************
00010 * Copyright (c) 1999-$now By Author.  This program is free software; you can  *
00011 * redistribute it and/or modify it under the terms of the GNU General Public  *
00012 * License as published by the Free Software Foundation; either version 2 of   *
00013 * the License or (at your option) any later version.  This is online at:      *
00014 *     http://www.fsf.org/copyleft/gpl.html                                    *
00015 * Please send any updates to: fred@gruntose.com                               *
00016 \*****************************************************************************/
00017 
00018 #include "istring.h"
00019 
00021 
00032 class object_base
00033 {
00034 public:
00035   virtual ~object_base();  
00036   
00037   virtual const char *class_name() const = 0;
00039 
00043   virtual istring instance_name() const;
00045 
00051   virtual istring text_form() const;
00053 
00059 };
00060 
00062 
00064 
00071 #define IMPLEMENT_CLASS_NAME(objname) \
00072   static const char *static_class_name() { return (objname); } \
00073   virtual const char *class_name() const { return static_class_name(); }
00074 
00076 
00078 
00082 class istring_object : public virtual object_base, public istring
00083 {
00084 public:
00085   istring_object() : object_base(), istring() {}
00086   istring_object(const istring &initial) : object_base(), istring(initial) {}
00087   IMPLEMENT_CLASS_NAME("istring");
00088 };
00089 
00091 
00093 class clonable
00094 {
00095 public:
00096   virtual ~clonable();
00097   virtual clonable *clone() const = 0;
00098 };
00099 
00101 
00103 
00108 class synchronizer_base
00109 {
00110 public:
00111   virtual ~synchronizer_base();
00112   virtual void establish_lock() = 0;
00113   virtual void repeal_lock() = 0;
00114 };
00115 
00117 
00119 template <class type1, class type2>
00120 class pairing
00121 {
00122 public:
00123   type1 _a;
00124   type2 _b;
00125 
00126   pairing<type1, type2>(type1 a, type2 b) : _a(a), _b(b) {}
00127 
00128   type1 &get1() { return _a; }
00129   const type1 &get1() const { return _a; }
00130   type2 &get2() { return _b; }
00131   const type2 &get2() const { return _b; }
00132 };
00133 
00134 #endif
00135 

Generated on Sat Aug 30 04:31:42 2008 for HOOPLE Libraries by  doxygen 1.5.1