class InheritanceThe SCATMECH library makes heavy use of class inheritance. In order to aid run-time creation of instances of these classes, it is helpful to have a database of all the child classes for any parent class. The class Inheritance enables such a database of the inheritance structure of a class. Thus, each class which is part of an inheritance structure has a static data member static Inheritance inheritance; and a virtual member function virtual Model* clone() const; This static member contains pointers to all of the class' children. A macro Get_Model(_Model) creates a menu, from which a user can chose a child class of Model, and returns a pointer to a _Model. Another macro Get_Named_Model(_Model,name) returns a _Model named name. Include file:#include "inherit.h" Source code:inherit.cpp See also:SCATMECH Home, BRDF_Model, SphericalScatterer, PSD_Function, Slope_Distribution_Function, Shadow_Function, Phase_Function Definition of public elements:
class Inheritance {
    Inheritance(const string& name,const string& description);
    string get_name();
    string get_description();
    Model* get_model();
    Model* get_named_model(const string& name);
    bool is_virtual() const;
    bool is_instantiable() const;
    const Inheritance* get_named_inheritance(const std::string& model) const;
    const InheritanceList& get_children() const;
    const Inheritance* get_parent_inheritance() const;
    void get_parameters(ModelParameterList& result,bool top=true) const;
    const ModelParameterBase* get_modelparameter(const std::string& param) const;
    Model* make() const;
    Model* clone(const Model& m) const;
    void Register_Model();
};
#define Get_Model(_Model)            _Model::inheritance.Get_Model()
#define Get_Named_Model(_Model,name) _Model::inheritance.Get_Named_Model(name)
#define Register_Model(_Model)       _Model::inheritance.Register_Model()
void Register_SCATMECH_Models();
        Inheritance(const string& name,const string& description)
 string get_name()
         |