HyperspaceExplorer 0.7.1
Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes
DisplayableClass Class Reference

Carries a description of a Displayable class, including its relation to other Displayables. More...

#include <DisplayableClass.h>

Collaboration diagram for DisplayableClass:
Collaboration graph
[legend]

List of all members.

Classes

struct  DisplayableClassException
 Thrown when a DisplayableClass object is requested that has not been registered. More...

Public Member Functions

 DisplayableClass (const std::string &name, const std::string &description, const std::string &parent_name)
std::string getName () const
std::string getDescription () const
void addDisplayable (const std::string &displayable_name)
 Adds a subclass to the current node.
std::vector< std::stringgetDisplayableNames () const
 Returns the names of the Displayable classes inheriting from the class described in this node.
std::vector< Displayable * > getDisplayables () const
 Not yet implemented. What was this about, again?
std::vector< DisplayableClassgetSubClasses () const
 Returns the classes which inherit from the class described in the current node.
void printSubclasses () const
 Print the list of classes inheriting from the current node.

Static Public Member Functions

static DisplayableClassfindClass (const std::string &class_name)
 Retrieves the info stored for the class with the name class_name.
static const DisplayableClassmakeRootNode (const std::string &class_name, const std::string &description)
 Generate the root node of the inheritance hierarchy.
static DisplayableClassgetRootNode ()
 The root node of the inheritance hierarchy.

Private Types

typedef std::map< std::string,
DisplayableClass * > 
subclass_container_type
typedef std::vector< std::stringdisplayable_container_type
typedef
subclass_container_type::iterator 
subclass_iterator
typedef
subclass_container_type::const_iterator 
subclass_const_iterator

Private Member Functions

 DisplayableClass (const std::string &name, const std::string &description)
 Create a DisplayableClass without a parent node. This may happen only once and creates the root node.
void addSubClass (DisplayableClass &child)
DisplayableClassfindSubClass (const std::string &class_name)

Private Attributes

std::string class_name_
std::string class_description_
subclass_container_type subclasses_
displayable_container_type displayables_

Static Private Attributes

static DisplayableClassroot_node_ = NULL
static Tree< DisplayableClassclass_tree_

Detailed Description

Carries a description of a Displayable class, including its relation to other Displayables.

Displayable classes belong to several categories - for instance, RealFunction, Surface or Object. Each of these classes contains subclasses, such as Torus1, Horizon or Hypersponge. These classes are arranged in a tree-like structure, mirroring the inheritance diagram of the classes. DisplayableClass represents one node in that inheritance tree.

The information stored in DisplayableClass nodes and the entire tree can be used to print a tree of the inheritance diagram, or to generate a menu structure of these classes.

Subclasses of Displayable must use the FunctionFactory::registerFunction() method on declaration (in the header file), such as this:

  class MyNewDisplayableSubclass: public Displayable {
    // ...
  };

  namespace {
    Displayable *createMyNewDisplayableSubclass() { return new MyNewDisplayableSubclass(); }
    const bool registeredXYZ =    // you must use a variable name that is unique in the anonymous namespace
            TheFunctionFactory::Instance().registerFunction(createMyNewDisplayableSubclass, "Displayable");
  }

Member Function Documentation

std::vector< Displayable * > DisplayableClass::getDisplayables ( ) const

Not yet implemented. What was this about, again?

Damn, I must remember to comment functions as soon as I write them.

DisplayableClass & DisplayableClass::getRootNode ( ) [static]

The root node of the inheritance hierarchy.

If this does not point to the class Displayable, shoot me.

Referenced by findClass(), makeRootNode(), and C4DView::Menu4D::Menu4D().

Here is the caller graph for this function:

const DisplayableClass & DisplayableClass::makeRootNode ( const std::string class_name,
const std::string description 
) [static]

Generate the root node of the inheritance hierarchy.

This function must be called in the header file Displayable.h. It must be called before any subclasses of Displayable are declared.

References getRootNode().

Here is the call graph for this function:


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends

Generated on Mon Apr 9 2012 20:25:17 for HyperspaceExplorer 0.7.1 by doxygen 1.7.4  -  Hosted bySourceForge.net Logo