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

general/STypeInfo.h File Reference

#include <iostream>
#include <cmath>
#include <LEDA/list.h>
#include <LEDA/string.h>
#include "SUtil.h"

Include dependency graph for STypeInfo.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class  STypeInfo

Defines

#define TYPEINFOSTART
#define dbgOn   false
#define TYPEINFOEND(theName, theClassifier)
#define TYPEINFO0(theName, theClassifier)
#define TYPEINFO1(theName, theClassifier, theSuper1)
#define TYPEINFO2(theName, theClassifier, theSuper1, theSuper2)
#define TYPEINFO3(theName, theClassifier, theSuper1, theSuper2, theSuper3)
#define TYPEINFOVAR(theName)


Define Documentation

#define dbgOn   false
 

#define TYPEINFO0 theName,
theClassifier   
 

Value:

TYPEINFOSTART         \
  TYPEINFOEND(theName, theClassifier)
Macro that generates the three STypeInfo-memberfunctions.
Parameters:
theName  the name of the class in C++
theClassifier  the name of the class in the classification scheme e.g. "P" or "Q"
See also:
STypeInfo

#define TYPEINFO1 theName,
theClassifier,
theSuper1   
 

Value:

TYPEINFOSTART           \
    l = theSuper1::getTypeInfo();     \
    _ancesAndSelf.conc(l);        \
  TYPEINFOEND(theName, theClassifier)
Macro that generates the three STypeInfo-member functions for a class that is derived from one super-class.
Parameters:
theName  the name of the class in C++
theClassifier  the name of the class in the classification scheme e.g. "P" or "Q"
theSuper1  the name of the super-class
See also:
STypeInfo

#define TYPEINFO2 theName,
theClassifier,
theSuper1,
theSuper2   
 

Value:

TYPEINFOSTART             \
    l = theSuper1::getTypeInfo();       \
    _ancesAndSelf.conc(l);          \
    l = theSuper2::getTypeInfo();       \
    _ancesAndSelf.conc(l);          \
  TYPEINFOEND(theName, theClassifier)
Macro that generates the three STypeInfo-member functions for a class that was is derived from two classes (multiple inheritance).
Parameters:
theName  the name of the class in C++
theClassifier  the name of the class in the classification scheme e.g. "P" or "Q"
theSuper1  the name of the super-class 1
theSuper2  the name of the super-class 2
See also:
STypeInfo

#define TYPEINFO3 theName,
theClassifier,
theSuper1,
theSuper2,
theSuper3   
 

Value:

TYPEINFOSTART                 \
    l = theSuper1::getTypeInfo();           \
    _ancesAndSelf.conc(l);              \
    l = theSuper2::getTypeInfo();           \
    _ancesAndSelf.conc(l);              \
    l = theSuper3::getTypeInfo();           \
    _ancesAndSelf.conc(l);              \
  TYPEINFOEND(theName, theClassifier)
Macro that generates the three STypeInfo-member functions for a class that was is derived from three classes (multiple inheritance).
Parameters:
theName  the name of the class in C++
theClassifier  the name of the class in the classification scheme e.g. "P" or "Q"
theSuper1  the name of the super-class 1
theSuper2  the name of the super-class 2
theSuper3  the name of the super-class 3
See also:
STypeInfo

#define TYPEINFOEND theName,
theClassifier   
 

Value:

_ancesAndSelf.sort();             \
    _ancesAndSelf.unique();             \
    _ancesAndSelf.append(theClassifier);          \
    dbgVar("ancesAndSelf", _ancesAndSelf);                                      \
    _validAncesAndSelf = true;                                                  \
    return _ancesAndSelf;             \
  };                    \
  virtual leda_string getClassifier() const { return theClassifier; };          \
  virtual bool isInstanceOf(const leda_string &classifier) const {              \
    return ( NULL != theName::getTypeInfo().search(classifier) );   \
  };                    \
  virtual void assureInstanceOf(const leda_string &classifier) const {    \
    if( !isInstanceOf(classifier) ) {                                           \
      std::cerr << "You tried to use an object of the class \""           \
           << theClassifier << "\" as an instance of the \"" << classifier  \
     << "\" class" << std::endl;                                          \
      std::cerr << "A cast isn't possible here!" << std::endl                   \
     << "This object is an instance of:" << std::endl                     \
     << theName::getTypeInfo() << std::endl;              \
      exit(1);                  \
    }                   \
  }

#define TYPEINFOSTART
 

Value:

private:          \
  static bool _validAncesAndSelf;   \
  static leda_list<leda_string> _ancesAndSelf;  \
public:           \
  static const leda_list<leda_string> &getTypeInfo() {  \
    if( _validAncesAndSelf )      \
      return _ancesAndSelf;     \
                \
    leda_list<leda_string> l;

#define TYPEINFOVAR theName   
 

Value:

bool theName::_validAncesAndSelf = false; \
  leda_list<leda_string> theName::_ancesAndSelf;
Macro to be included in the source file. Makes sure that the static variables exist.
Parameters:
theName  name of the class
See also:
STypeInfo


Generated on Thu May 22 16:48:54 2003 for Sketch-it! by doxygen1.2.18