Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 11, 2010, 12:34:00 AM (14 years ago)
Author:
landauf
Message:

merged doc branch back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/libraries/core/SubclassIdentifier.h

    r7268 r7401  
    2929/**
    3030    @file
     31    @ingroup Class Identifier
    3132    @brief Definition of SubclassIdentifier.
     33
     34    @anchor SubclassIdentifierExample
    3235
    3336    SubclassIdentifier is a separated class, acting like an Identifier, but has a given class.
    3437    You can only assign Identifiers of exactly the given class or of a derivative to a SubclassIdentifier.
     38
     39    Example:
     40
     41    You can assign an Identifier either through the constructor or by using the assignment @c operator=:
     42    @code
     43    SubclassIdentifier<BaseClass> identifier = Class(SubClass);
     44    @endcode
     45
     46    The @c operator-> is overloaded an returns the assigned Identifier. That way you can just call
     47    functions of the assigned Identifier by using @c ->function():
     48    @code
     49    SubclassIdentifier<BaseClass> identifier = Class(SubClass);
     50    identifier->getName();      // returns "SubClass"
     51    @endcode
     52
     53    There are two possibilities to create an object out of a SubclassIdentifier: Either you just use
     54    the @c fabricate() function of the assigned Identifier through the overloaded @c operator->, which
     55    returns a @c BaseObject* pointer, or you use the function of SubclassIdentifier, this time by using
     56    @c operator., which returns a @c BaseClass* pointer (@a BaseClass is the baseclass specified by the
     57    template argument):
     58    @code
     59    identifier->fabricate();    // calls Identifier::fabricate(), creates a SubClass, returns a BaseObject* pointer
     60
     61    identifier.fabricate();     // calls SubclassIdentifier::fabricate(), creates a SubClass, returns a BaseClass* pointer
     62    @endcode
    3563*/
    3664
     
    4977    // ###   SubclassIdentifier    ###
    5078    // ###############################
    51     //! The SubclassIdentifier acts almost like an Identifier, but has some prerequisites.
    5279    /**
     80        @brief The SubclassIdentifier acts almost like an Identifier, but has some prerequisites.
     81
    5382        You can only assign an Identifier that belongs to a class T (or derived) to a SubclassIdentifier<T>.
    54         If you assign something else, the program aborts.
    55         Because we know the minimum type, a dynamic_cast is done, which makes it easier to create a new object.
     83        If you assign something else, the program prints an error.
     84
     85        Because we know the base-type, a @c dynamic_cast is done, which makes it easier to create a new object.
     86
     87        @see See @ref SubclassIdentifierExample "SubclassIdentifier.h" for some examples.
    5688    */
    5789    template <class T>
     
    5991    {
    6092        public:
    61             /**
    62                 @brief Constructor: Automaticaly assigns the Identifier of the given class.
    63             */
     93            /// Constructor: Automaticaly assigns the Identifier of the given class.
    6494            SubclassIdentifier()
    6595            {
     
    6797            }
    6898
    69             /**
    70                 @brief Constructor: Assigns the given Identifier.
    71                 @param identifier The Identifier
    72             */
     99            /// Constructor: Assigns the given Identifier.
    73100            SubclassIdentifier(Identifier* identifier)
    74101            {
     
    76103            }
    77104
    78             /**
    79                 @brief Copyconstructor: Assigns the identifier of the other SubclassIdentifier.
    80                 @param identifier The other SublcassIdentifier
    81             */
     105            /// Copyconstructor: Assigns the identifier of another SubclassIdentifier.
    82106            template <class O>
    83107            SubclassIdentifier(const SubclassIdentifier<O>& identifier)
     
    113137            }
    114138
    115             /**
    116                 @brief Overloading of the = operator: assigns the identifier of the other SubclassIdentifier.
    117                 @param identifier The other SublcassIdentifier
    118             */
     139            /// Overloading of the = operator: assigns the identifier of another SubclassIdentifier.
    119140            template <class O>
    120141            SubclassIdentifier<T>& operator=(const SubclassIdentifier<O>& identifier)
     
    123144            }
    124145
    125             /**
    126                 @brief Overloading of the * operator: returns the assigned identifier.
    127             */
     146            /// Overloading of the * operator: returns the assigned identifier.
    128147            inline Identifier* operator*() const
    129148            {
     
    131150            }
    132151
    133             /**
    134                 @brief Overloading of the -> operator: returns the assigned identifier.
    135             */
     152            /// Overloading of the -> operator: returns the assigned identifier.
    136153            inline Identifier* operator->() const
    137154            {
     
    139156            }
    140157
    141             /**
    142                 @brief Returns the assigned identifier. This allows you to assign a SubclassIdentifier to a normal Identifier*.
    143             */
     158            /// Returns the assigned identifier. This allows you to assign a SubclassIdentifier to a normal Identifier*.
    144159            inline operator Identifier*() const
    145160            {
     
    147162            }
    148163
    149             /**
    150                 @brief Creates a new object of the type of the assigned Identifier and dynamic_casts it to the minimal type given by T.
    151                 @return The new object
    152             */
     164            /// Creates a new object of the type of the assigned Identifier and dynamic_casts it to the minimal type given by T.
    153165            T* fabricate(BaseObject* creator) const
    154166            {
     
    181193            }
    182194
    183             /** @brief Returns the assigned identifier. @return The identifier */
     195            /// Returns the assigned identifier.
    184196            inline Identifier* getIdentifier() const
    185197                { return this->identifier_; }
Note: See TracChangeset for help on using the changeset viewer.