"Fossies" - the Fresh Open Source Software Archive

Member "OpenSP-1.5.2/include/TypeId.h" (21 Jul 2005, 714 Bytes) of package /linux/misc/old/OpenSP-1.5.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "TypeId.h" see the Fossies "Dox" file reference documentation.

    1 // Copyright (c) 1994 James Clark
    2 // See the file COPYING for copying permission.
    3 
    4 #ifndef TypeId_INCLUDED
    5 #define TypeId_INCLUDED 1
    6 
    7 #ifdef SP_NAMESPACE
    8 namespace SP_NAMESPACE {
    9 #endif
   10 
   11 class SP_API TypeId {
   12 public:
   13   TypeId(const void *const *bases) : bases_(bases) { }
   14   // Is this object of type ti?
   15   int isA(TypeId ti) const;
   16   // Can an object with this dynamic type be cast from a static type FROM
   17   // to a static type TO?
   18   int canCast(TypeId to, TypeId from) const;
   19   int operator==(TypeId ti) const { return bases_ == ti.bases_; }
   20   int operator!=(TypeId ti) const { return bases_ != ti.bases_; }
   21 private:
   22   const void *const *bases_;
   23 };
   24 
   25 #ifdef SP_NAMESPACE
   26 }
   27 #endif
   28 
   29 #endif /* not TypeId_INCLUDED */