Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9724 in orxonox.OLD for branches/new_class_id/src


Ignore:
Timestamp:
Sep 8, 2006, 12:20:55 PM (18 years ago)
Author:
bensch
Message:

many many documentations and one new functiopm

Location:
branches/new_class_id/src/lib/lang
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/new_class_id/src/lib/lang/base_object.cc

    r9718 r9724  
    2525/**
    2626 * @brief sets the name from a LoadXML-Element
    27  * @param root the element to load from
     27 * @param objectName: The name of the Object.
    2828 */
    2929BaseObject::BaseObject(const std::string& objectName)
     
    100100/**
    101101 * @brief Seeks in the Inheritance if it matches objectList.
    102  * @param objectList The ObjectList this should be a member of (by Pointer-comparison).
     102 * @param classID The ClassID this should be a member of (by Pointer-comparison).
    103103 * @return True if found, false if not.
    104104 */
     
    141141
    142142
     143/**
     144 * @brief This is for debug purposes, to see the Inheritances of this Object and its classes.
     145 *
     146 * The Inheritance will be listed in a Linear fashion, diamand structures are resolved in a linear dependency.
     147 */
    143148void BaseObject::listInheritance() const
    144149{
  • branches/new_class_id/src/lib/lang/base_object.h

    r9718 r9724  
    2626class BaseObject : public sigslot::has_slots<>
    2727{
     28  //! Declare an ObjectList for this Class.
    2829  ObjectListDeclaration(BaseObject);
    2930public:
     
    4849  inline const std::string& getClassName() const { return _classes.front()._objectList->name(); };
    4950
     51  /** @returns the ClassID of this Object */
    5052  inline const ClassID& getClassID() const { return _classes.front()._objectList->identity(); }
    5153  /** @returns the ID of the Topmost object of the ClassStack */
  • branches/new_class_id/src/lib/lang/object_list.cc

    r9716 r9724  
    9898/**
    9999 * @brief Checks if a Class with name already exists.
    100  * @param name The Name of the Class to check.
     100 * @param id The id of the Class to check.
    101101 * @return true if such a class already exists.
    102102 */
     
    233233}
    234234
     235
     236/**
     237 * @returns An alphabetically sorted List of all stored ClassNames.
     238 */
     239const std::list<std::string>& ObjectListBase::getClassNames()
     240{
     241  if (ObjectListBase::classCount() != ObjectListBase::_classNames.size())
     242  {
     243    ObjectListBase::_classNames.clear();
     244
     245    for (classNameMap::const_iterator it = ObjectListBase::_classesByName->begin();
     246         it != ObjectListBase::_classesByName->end();
     247         ++it)
     248    {
     249      ObjectListBase::_classNames.push_back((*it).second->name());
     250    }
     251  }
     252  return ObjectListBase::_classNames;
     253}
     254
     255
    235256#include "base_object.h"
    236257
    237258/**
    238259 * @brief Prints out some debugging information about a given List.
     260 * @param level:
     261 *  1: List ObjectListsand how many object.
     262 *  2: 1+List ObjectLists entries, and information about Objects.
    239263 */
    240264void ObjectListBase::debug(unsigned int level) const
     
    259283
    260284
     285/**
     286 * @brief prints out debug output about all Lists
     287 * @param level:
     288 *  0: list number of ClassList and general info.
     289 *  1: 0+List ObjectLists and how many object.
     290 *  2: 1+List ObjectLists entries, and information about Objects.
     291 */
    261292void ObjectListBase::debugAll(unsigned int level)
    262293{
  • branches/new_class_id/src/lib/lang/object_list.h

    r9718 r9724  
    2828   static ObjectList<ClassName> _objectList
    2929
     30/**
     31 * @brief Use this macro to easily define a Class to store its own ObjectListDefinition
     32 * @param ClassName: the Name of the Class.
     33 * @param ID: optional set a Fixed ID.
     34 */
    3035#define ObjectListDefinitionID(ClassName, ID) \
    3136   ObjectList<ClassName> ClassName::_objectList(#ClassName, ID)
    3237
    33 
     38/**
     39 * @brief Use this macro to easily define a Class to store its own ObjectListDefinition
     40 * @param ClassName: the Name of the Class.
     41 */
    3442#define ObjectListDefinition(ClassName) \
    3543    ObjectListDefinitionID(ClassName, -1)
     
    4351{
    4452public:
    45   //! A fast iterator Base-Class, for iterator-casting and storing.
    46   /**
    47    * @note This Iterator is explicitely used only for storage purposes in the BaseObject
    48    */
    49   class IteratorBase { };
    50 
    5153  /** @brief A Typedefinition for the Base-List that can be retrieved with getBaseObjectList(base_list*) */
    5254  typedef std::list<BaseObject*>        base_list;
    5355  /** @brief An iterator for the base_list */
    5456  typedef base_list::iterator           base_iterator;
     57  //! A fast iterator Base-Class, for iterator-casting and storing.
     58  /** @note This Iterator is explicitely used only for storage purposes in the BaseObject */
     59  class IteratorBase { };
    5560
    5661public:
    5762  /** @returns The Identity of the Class stored within. */
    58   inline const ClassID&              identity() const { return _identity; }
     63  inline const ClassID&                 identity() const { return _identity; }
    5964  /** @returns the ID of the Identity of the ObjectList */
    6065  inline int                            id() const { return _id; };
     
    6772  /** @param name The name to compare @returns true on match, false otherwise */
    6873  inline bool                           operator==(const std::string& name) const { return _name == name; };
    69   /** @param id The id to check @returns true on match, false otherwise */
     74  /** @param id The id to acquire @param name the Name to acquire @brief stores a Name and an ID in a pointer. */
    7075  inline void                           acquireID(const int*& id, const std::string*& name) const { id = &_id; name = &_name; };
    7176  /** @brief fills a list of Objects into a BaseObject*-List. @param list the list to fill */
     
    104109
    105110private:
    106   ObjectListBase(const ObjectListBase&);
     111  /** @brief hidden copy constructor. */
     112  ObjectListBase(const ObjectListBase&) {};
    107113
    108114  static bool                         classIDExists(int id);
     
    153159 *   and not loaded before the ObjectList.
    154160 *
    155  * @example Iterating: Iteration is made easy, and fast as follows:
     161 * example: Iterating: Iteration is made easy, and fast as follows:
    156162 *   for (ObjectList<PlayerStats>::const_iterator it = PlayerStats::objectList().begin();
    157163 *      it != PlayerStats::objectList().end();
     
    161167 *   }
    162168 *
    163  * @example Find an Object:
     169 * example: Find an Object:
    164170 * Playable* playable = Playable::objectList("orxonox-super-rocket-fighter"); // searches an Object By its name.
    165171 *
     
    192198  virtual BaseObject*                getBaseObject(const std::string& name) const;
    193199  T*                                 getObject(const std::string& name) const;
     200  /** @returns A constant list of Objects of this Class. */
    194201  inline const list&                 objects() const { return _objects; };
    195202  bool                               exists(const T* const object) const;
     
    314321/**
    315322 * @brief registers an Object to the ObjectList.
    316  * @param T object the Object to register.
     323 * @param object The Object to register.
    317324 * @returns a pointer to the iterator inside of the list.
    318325 */
Note: See TracChangeset for help on using the changeset viewer.