Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Sep 22, 2006, 10:20:14 PM (18 years ago)
Author:
bensch
Message:

nicer definition of the StorePointer

Location:
branches/new_class_id/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/new_class_id/src/lib/graphics/importer/resource_texture.cc

    r9788 r9789  
    88    : NewResource(&ResourceTexture::type)
    99{
    10   NewResource::Pointer* ptr = this->acquireResource(imageName + ',' + "TEST");
     10  NewResource::StorePointer* ptr = this->acquireResource(imageName + ',' + "TEST");
    1111
    1212  if (ptr)
     
    2020    std::string fileName = this->NewResource::locateFile(imageName);
    2121    this->Texture::loadImage(fileName, target);
    22     this->NewResource::addResource(new ResourceTexture::TextureResourcePointer(imageName + ',' + "TEST", KeepLevel(), this->Texture::dataPointer()));
     22    this->NewResource::addResource(new ResourceTexture::TextureResourcePointer(imageName + ',' + "TEST", KeepLevel(0), this->Texture::dataPointer()));
    2323  }
    2424}
     
    3232
    3333ResourceTexture::TextureResourcePointer::TextureResourcePointer(const std::string& loadString, const NewResource::KeepLevel& keepLevel, const TextureData::Pointer& data)
    34     : NewResource::Pointer(loadString, keepLevel) , pointer(data)
     34    : NewResource::StorePointer(loadString, keepLevel) , pointer(data)
    3535{}
    3636
  • branches/new_class_id/src/lib/graphics/importer/resource_texture.h

    r9788 r9789  
    1919
    2020private:
    21 class TextureResourcePointer : public NewResource::Pointer
     21class TextureResourcePointer : public NewResource::StorePointer
    2222  {
    2323  public:
  • branches/new_class_id/src/lib/util/loading/resource.cc

    r9788 r9789  
    4242    this->_type->setID(NewResource::_resourceTypes.size()-1);
    4343  }
    44 
    4544}
    4645
     
    6665
    6766
    68 NewResource::Pointer* NewResource::acquireResource(const std::string& loadString)
     67NewResource::StorePointer* NewResource::acquireResource(const std::string& loadString)
    6968{
    7069  //const NewResource::Type* const type = NewResource::_resourceTypes[this->_type->id()];
     
    9493
    9594
    96 void NewResource::addResource(NewResource::Pointer* pointer)
     95void NewResource::addResource(NewResource::StorePointer* pointer)
    9796{
    9897  this->_type->addResource(pointer);
     
    107106
    108107
    109 
    110 void NewResource::KeepLevel::setKeepLevelName(unsigned int level, const std::string& name)
     108std::vector<std::string>  NewResource::KeepLevel::_keepLevelNames;
     109void NewResource::KeepLevel::defineKeepLevelName(unsigned int level, const std::string& name)
    111110{
    112   if (_keepLevelName.size() <= level)
    113     _keepLevelName.resize(level+1);
    114   _keepLevelName[level] = name;
     111  if (_keepLevelNames.size() <= level)
     112    _keepLevelNames.resize(level+1);
     113  _keepLevelNames[level] = name;
    115114}
    116115
    117116
    118117
    119 void NewResource::Type::addResource(NewResource::Pointer* resource)
     118void NewResource::Type::addResource(NewResource::StorePointer* resource)
    120119{
    121120  this->_storedResources.push_back(resource);
     
    124123
    125124
    126 NewResource::Pointer::Pointer(const std::string& loadString, const NewResource::KeepLevel& keeplevel)
    127   : _loadString(loadString), _keepLevel(keeplevel)
     125NewResource::StorePointer::StorePointer(const std::string& loadString, const NewResource::KeepLevel& keeplevel)
     126    : _loadString(loadString), _keepLevel(keeplevel)
    128127{}
    129128
  • branches/new_class_id/src/lib/util/loading/resource.h

    r9788 r9789  
    88
    99#include "base_object.h"
    10 #include "multi_type.h"
    1110#include <string>
    1211#include <vector>
     
    2625  {
    2726  public:
    28     void setKeepLevelName(unsigned int level, const std::string& name);
     27    KeepLevel(unsigned int keepLevel) { _keepLevel = keepLevel; };
     28    KeepLevel(const std::string& keepLevelName);
     29
     30    static void defineKeepLevelName(unsigned int level, const std::string& name);
    2931  private:
    30     std::vector<std::string>     _keepLevelName;
     32    unsigned int                        _keepLevel;
     33  private:
     34    static std::vector<std::string>     _keepLevelNames;
    3135  };
    3236
     37
    3338protected:
    34   class Pointer
     39  class StorePointer
    3540  {
    3641  public:
    37     Pointer(const std::string& loadString, const NewResource::KeepLevel& keeplevel);
     42    StorePointer(const std::string& loadString, const NewResource::KeepLevel& keeplevel);
    3843    const std::string& loadString() const { return _loadString; };
    3944    const NewResource::KeepLevel& keepLevel() const { return _keepLevel; };
    4045
    4146  private:
    42     std::string              _loadString;             //!< An identifier, to match when loading a File.
     47    std::string                 _loadString;             //!< An identifier, to match when loading a File.
    4348    NewResource::KeepLevel      _keepLevel;              //!< The Priority of this resource. (can only be increased, so none else will delete this)
    4449  };
     
    6065    const std::vector<std::string>& resourcePaths() const { return _resourcePaths; };
    6166    const std::vector<std::string>& resourceSubPaths() const { return _resourceSubPaths; };
    62     const std::vector<NewResource::Pointer*>& storedResources() const { return _storedResources; };
     67    const std::vector<NewResource::StorePointer*>& storedResources() const { return _storedResources; };
    6368
    6469    void setID(int id);
    65     void addResource(NewResource::Pointer* resource);
     70    void addResource(NewResource::StorePointer* resource);
    6671
    6772  private:
     
    7277    std::vector<std::string>        _fileExtensions;
    7378
    74     std::vector<NewResource::Pointer*> _storedResources;
     79    std::vector<NewResource::StorePointer*> _storedResources;
    7580  };
    7681
     
    9297
    9398protected:
    94   NewResource::Pointer* acquireResource(const std::string& loadString);
    95   void addResource(NewResource::Pointer* pointer);
     99  NewResource::StorePointer* acquireResource(const std::string& loadString);
     100  void addResource(NewResource::StorePointer* pointer);
    96101
    97102private:
    98   NewResource::Pointer*       _pointer;                         //!< Virtual Pointer to the ResourceData.
     103  NewResource::StorePointer*       _pointer;                         //!< Virtual Pointer to the ResourceData.
    99104  NewResource::Type*          _type;                            //!< Type of the NewResource.
    100105
  • branches/new_class_id/src/orxonox.cc

    r9768 r9789  
    327327
    328328//#include "util/loading/dynamic_loader.h"
    329 
     329#include "loading/resource.h"
    330330/**
    331331 * initializes and loads resource files
Note: See TracChangeset for help on using the changeset viewer.