Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9850 in orxonox.OLD


Ignore:
Timestamp:
Sep 28, 2006, 12:16:37 AM (18 years ago)
Author:
bensch
Message:

new_class_id: doxy-tags

Location:
branches/new_class_id/src/lib/util/loading
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/new_class_id/src/lib/util/loading/resource.cc

    r9847 r9850  
    2424namespace Resources
    2525{
     26  //! Define an ObjectList for the Resources
    2627  ObjectListDefinition(Resource);
    2728
    2829
    2930  /**
    30    * standard constructor
    31   */
     31   * @brief standard constructor
     32   * @param type the Type this resource belongs to.
     33   */
    3234  Resource::Resource (Type* type)
    3335      : _pointer(NULL), _type(type)
     
    3739
    3840  /**
    39    * standard deconstructor
     41   * @brief standard deconstructor
    4042   */
    4143  Resource::~Resource ()
     
    4446  }
    4547
    46 
     48  /**
     49   * @brief Locates a File inside of the Resources Paths and returns the appended path.
     50   *
     51   * @param fileName the Name of the file to look for.
     52   * @returns the Name of the File prepended with the PAth it is in, if found, empty String ("") otherwise.
     53   *
     54   * This Function searches in (ordered):
     55   * 1. mainGlobalPath (from ResourceManger)
     56   * 2. all of the global Paths (from ResourceManger)
     57   * 3. all of the Resources Paths (from Resources::Type)
     58   *
     59   * in each of these directory, first "./" is searched, and afterwards all of the subDirs (from Resources::Type) are searched.
     60   *
     61   * @todo finish it!!
     62   */
    4763  std::string Resource::locateFile(const std::string& fileName) const
    4864  {
     
    8399
    84100
    85 
     101  /**
     102   * @param loadString the Identifier of the Resource.
     103   * @returns a Store-Pointer to the Resource if found, NULL otherwise
     104   */
    86105  StorePointer* Resource::acquireResource(const std::string& loadString)
    87106  {
     
    97116  }
    98117
    99 
     118  /**
     119   * @brief registers a StorePointer to a Resource's Type.
     120   * @param pointer the StorePointer to register.
     121   */
    100122  void Resource::addResource(StorePointer* pointer)
    101123  {
     124    assert(pointer != NULL);
    102125    this->_type->addResource(pointer);
    103126  }
     
    111134  //// KEEPLEVEL ////
    112135  ///////////////////
     136  /**
     137   * @brief constructor of a KeepLevel.
     138   * @param keepLevelName the Name of the KeepLevel. Must be one Name of the defined Names in the ResourceManager.
     139   *
     140   * @note the Name is transformed into an Integer for fast interpretation.
     141   */
    113142  KeepLevel::KeepLevel(const std::string& keepLevelName)
    114143  {
     
    116145  }
    117146
     147  /**
     148   * @returns the name of the KeepLevel.
     149   */
    118150  const std::string& KeepLevel::name() const
    119151  {
     
    126158  //// STORE POINTER ////
    127159  ///////////////////////
     160  /**
     161   * @brief allocates a StorePointer.
     162   * @param loadString An identifier String that is unique between all resources of this type.
     163   * @param keepLevel the KeepLevel at wich to keep this resource.
     164   */
    128165  StorePointer::StorePointer(const std::string& loadString, const KeepLevel& keeplevel)
    129166      : _loadString(loadString), _keepLevel(keeplevel)
     
    136173  //// TYPE ////
    137174  //////////////
     175  /**
     176   * @brief allocates a Type.
     177   * @param typeName the Name of the Type to be stored in this Container.
     178   */
    138179  Type::Type(const std::string& typeName)
    139180      : _typeName(typeName)
     
    143184  }
    144185
     186  //! Destructs a Type.
    145187  Type::~Type()
    146188  {
     
    148190  }
    149191
     192  /**
     193   * @brief adds a Resource to this Resource's type.
     194   * @param resource the Resource to add.
     195   */
    150196  void Type::addResource(StorePointer* resource)
    151197  {
     
    153199  }
    154200
     201  /**
     202   * @brief adds a Path to the Type's resource-paths.
     203   * @param path the path-name to add.
     204   */
    155205  bool Type::addResourcePath(const std::string& path)
    156206  {
     
    164214  }
    165215
     216  /**
     217   * @brief Adds a SubPath to the Type's resource-subpaths.
     218   * @param subPath the subpath to add.
     219   */
    166220  bool Type::addResourceSubPath(const std::string& subPath)
    167221  {
     
    174228  }
    175229
     230  /**
     231   * @brief Unloads all Resources below a certain Level.
     232   * @param keepLevel the KeepLevel at what to remove the Resources from.
     233   */
    176234  void Type::unloadAllBelowKeepLevel(const Resources::KeepLevel& keepLevel)
    177235  {
     
    179237    for (it = this->_storedResources.begin(); it != this->_storedResources.end(); ++it)
    180238      if((*it)->keepLevel() < keepLevel && (*it)->last())
    181     {
    182       delete (*it);
    183       this->_storedResources.erase(it);
    184       it = this->_storedResources.begin();
    185     }
    186   }
    187 
    188 
     239      {
     240        delete (*it);
     241        this->_storedResources.erase(it);
     242        it = this->_storedResources.begin();
     243      }
     244  }
     245
     246  /**
     247   * @brief print out some nice Debug information in a beatifully designed style
     248   */
    189249  void Type::debug() const
    190250  {
  • branches/new_class_id/src/lib/util/loading/resource.h

    r9848 r9850  
    1414#include "filesys/directory.h"
    1515
     16//! A Namespace Resources and ResourceHandling is defined in.
    1617namespace Resources
    1718{
     
    2930    KeepLevel(const std::string& keepLevelName);
    3031
     32    //! Compare equality
    3133    inline bool operator==(const KeepLevel& keepLevel) const { return this->_keepLevel == keepLevel._keepLevel; };
     34    //! Compares inequality
    3235    inline bool operator!=(const KeepLevel& keepLevel) const { return this->_keepLevel != keepLevel._keepLevel; };
     36    //! Compares less/equal than
    3337    inline bool operator<=(const KeepLevel& keepLevel) const { return this->_keepLevel <= keepLevel._keepLevel; };
     38    //! Compares less than
    3439    inline bool operator<(const KeepLevel& keepLevel) const { return this->_keepLevel < keepLevel._keepLevel; };
    3540
    36     /** @returns the KeepLevel */
     41    /** @returns the KeepLevel as a number */
    3742    inline unsigned int keepLevel() const { return _keepLevel; };
    3843    const std::string& name() const;
     
    8590  public:
    8691    virtual ~Type();
    87     /** @returns true if the names match @param resourceName the Name to compare. @brief compare the Type with a Name */
    88     bool operator==(const std::string& resourceName) const { return this->_typeName == resourceName; };
     92    /** @returns true if the names match @param typeName the Name to compare. @brief compare the Type with a Name */
     93    bool operator==(const std::string& typeName) const { return this->_typeName == typeName; };
    8994
    9095    void addExtension(const std::string& extension);
Note: See TracChangeset for help on using the changeset viewer.