Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

typedobj.H

Go to the documentation of this file.
00001 /*
00002  * Copyright 2000, Brown University, Providence, RI.
00003  * 
00004  *                         All Rights Reserved
00005  * 
00006  * Permission to use, copy, modify, and distribute this software and its
00007  * documentation for any purpose other than its incorporation into a
00008  * commercial product is hereby granted without fee, provided that the
00009  * above copyright notice appear in all copies and that both that
00010  * copyright notice and this permission notice appear in supporting
00011  * documentation, and that the name of Brown University not be used in
00012  * advertising or publicity pertaining to distribution of the software
00013  * without specific, written prior permission.
00014  * 
00015  * BROWN UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
00016  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ANY
00017  * PARTICULAR PURPOSE.  IN NO EVENT SHALL BROWN UNIVERSITY BE LIABLE FOR
00018  * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
00019  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
00020  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
00021  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
00022  */
00023 #ifndef GLUE_TYPEDOBJ_H
00024 #define GLUE_TYPEDOBJ_H
00025 
00026 #include "std/dllimpexp.H"
00027 #include "std/strings.H"
00028 
00029 #define ISA(O)         (!!(O) && (O)->is_of_type(static_name()))
00030 #define ISOF(N,PAR)    (N == static_name() || PAR::is_of_type(N))
00031 #define IS(N)          (N == static_name())
00032 
00033 #ifdef GLUE_AVOID_STATIC_LOCAL_INLINE_VAR
00034    #define STAT_STR_RET str_ptr
00035 #else
00036    #define STAT_STR_RET Cstr_ptr &
00037 #endif
00038 #define DEFINE_BASE_TYPE(CLASS_NAME, CLASS_PTR)               \
00039    static  STAT_STR_RET static_name()         { RET_STAT_STR(#CLASS_NAME); } \
00040    virtual STAT_STR_RET class_name () const   { return static_name(); }   \
00041    virtual int  is_of_type(Cstr_ptr &n)const  { return n == static_name(); } \
00042    static  int  isa       (CLASS_PTR o)       { return ISA (o); }  \
00043    static  int  isa       (cTYPEDOBJ *o)      { return ISA (o); }
00044 
00045 #define DEFINE_DERIVED_TYPE(CLASS_NAME, CLASS_PAR, CLASS_PTR)               \
00046    static  STAT_STR_RET  static_name()         { RET_STAT_STR(#CLASS_NAME);} \
00047    virtual STAT_STR_RET class_name () const   { return static_name(); }   \
00048    virtual int  is_of_type(Cstr_ptr &n)const  { return ISOF(n,CLASS_PAR);}\
00049    static  int  isa       (CLASS_PTR  o)      { return ISA (o); }  \
00050    static  int  isa       (cTYPEDOBJ *o)      { return ISA (o); }
00051 
00052 typedef const class TYPEDOBJ cTYPEDOBJ;
00053 
00054 class DllImpExp TYPEDOBJ {
00055    public:
00056 
00057      /* -------- prototype functions overloaded by subclasses -------- */
00058  virtual STAT_STR_RET class_name ()           const = 0;
00059  virtual int          is_of_type(Cstr_ptr &t) const = 0; // { return IS(t); }
00060 };
00061 
00062 
00063 // Hack to protect to warn against tags/tagset.H not being included
00064 #ifndef DECLARE_TAGS_AND_DECODER
00065 #ifdef sun
00066 #define DECLARE_TAGS_AND_DECODER "You must include tags/tagset.H"
00067 #else
00068 #define DECLARE_TAGS_AND_DECODER(X) You_must_include_tagset_H_file_from_tags
00069 #endif
00070 #endif
00071 
00072 #endif

Generated on Mon Sep 15 16:25:57 2003 for gluebase by doxygen1.2.18