Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Sep 22, 2006, 6:55:52 PM (18 years ago)
Author:
bensch
Message:

renaming for namespace-purposes

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

Legend:

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

    r9786 r9788  
    66
    77ResourceTexture::ResourceTexture(const std::string& imageName, GLenum target)
    8     : Resource(&ResourceTexture::type)
     8    : NewResource(&ResourceTexture::type)
    99{
    10   Resource::Pointer* ptr = this->acquireResource(imageName + ',' + "TEST");
     10  NewResource::Pointer* ptr = this->acquireResource(imageName + ',' + "TEST");
    1111
    1212  if (ptr)
     
    1818  {
    1919    printf("NOT FOUNT TEXTURE: %s\n", imageName.c_str());
    20     std::string fileName = this->Resource::locateFile(imageName);
     20    std::string fileName = this->NewResource::locateFile(imageName);
    2121    this->Texture::loadImage(fileName, target);
    22     this->Resource::addResource(new ResourceTexture::TextureResourcePointer(imageName + ',' + "TEST", KeepLevel(), this->Texture::dataPointer()));
     22    this->NewResource::addResource(new ResourceTexture::TextureResourcePointer(imageName + ',' + "TEST", KeepLevel(), this->Texture::dataPointer()));
    2323  }
    2424}
    2525
    2626
    27 Resource::Type ResourceTexture::type(Texture::staticClassID());
     27NewResource::Type ResourceTexture::type(Texture::staticClassID());
    2828
    2929
     
    3131
    3232
    33 ResourceTexture::TextureResourcePointer::TextureResourcePointer(const std::string& loadString, const Resource::KeepLevel& keepLevel, const TextureData::Pointer& data)
    34     : Resource::Pointer(loadString, keepLevel) , pointer(data)
     33ResourceTexture::TextureResourcePointer::TextureResourcePointer(const std::string& loadString, const NewResource::KeepLevel& keepLevel, const TextureData::Pointer& data)
     34    : NewResource::Pointer(loadString, keepLevel) , pointer(data)
    3535{}
    3636
  • branches/new_class_id/src/lib/graphics/importer/resource_texture.h

    r9785 r9788  
    1212
    1313
    14 class ResourceTexture : public Texture, public Resource
     14class ResourceTexture : public Texture, public NewResource
    1515{
    1616public:
     
    1919
    2020private:
    21 class TextureResourcePointer : public Resource::Pointer
     21class TextureResourcePointer : public NewResource::Pointer
    2222  {
    2323  public:
    24     TextureResourcePointer(const std::string& loadString, const Resource::KeepLevel& keepLevel, const TextureData::Pointer& data);
     24    TextureResourcePointer(const std::string& loadString, const NewResource::KeepLevel& keepLevel, const TextureData::Pointer& data);
    2525    inline const TextureData::Pointer& ptr() const { return pointer; }
    2626  private:
     
    2929
    3030private:
    31   static Resource::Type type;
     31  static NewResource::Type type;
    3232};
    3333
  • branches/new_class_id/src/lib/util/loading/resource.cc

    r9787 r9788  
    1919#include "filesys/file.h"
    2020
    21 ObjectListDefinition(Resource);
     21ObjectListDefinition(NewResource);
    2222
    2323
    24 std::vector<Resource::Type*>    Resource::_resourceTypes;
     24std::vector<NewResource::Type*>    NewResource::_resourceTypes;
    2525
    2626//! GLOBALS
    27 Directory Resource::_mainGlobalPath;
    28 std::vector<Directory>        Resource::_globalPaths;
     27Directory NewResource::_mainGlobalPath;
     28std::vector<Directory>        NewResource::_globalPaths;
    2929
    3030
     
    3232 * standard constructor
    3333*/
    34 Resource::Resource (Resource::Type* type)
     34NewResource::NewResource (NewResource::Type* type)
    3535    : _pointer(NULL), _type(type)
    3636{
    37   this->registerObject(this, Resource::_objectList);
     37  this->registerObject(this, NewResource::_objectList);
    3838
    3939  if(this->_type->id() == -1)
    4040  {
    41     Resource::_resourceTypes.push_back(this->_type);
    42     this->_type->setID(Resource::_resourceTypes.size()-1);
     41    NewResource::_resourceTypes.push_back(this->_type);
     42    this->_type->setID(NewResource::_resourceTypes.size()-1);
    4343  }
    4444
     
    4848 * standard deconstructor
    4949 */
    50 Resource::~Resource ()
     50NewResource::~NewResource ()
    5151{
    5252  // delete what has to be deleted here
     
    5454
    5555
    56 std::string Resource::locateFile(const std::string& fileName)
     56std::string NewResource::locateFile(const std::string& fileName)
    5757{
    5858  if (File(fileName).exists())
    5959    return fileName;
    60   else if ((Resource::_mainGlobalPath+File(fileName)) . exists() )
    61     return (Resource::_mainGlobalPath + File(fileName)).name();
     60  else if ((NewResource::_mainGlobalPath+File(fileName)) . exists() )
     61    return (NewResource::_mainGlobalPath + File(fileName)).name();
    6262
    6363  return std::string("/home/bensch/svn/orxonox/data/") + fileName;
     
    6666
    6767
    68 Resource::Pointer* Resource::acquireResource(const std::string& loadString)
     68NewResource::Pointer* NewResource::acquireResource(const std::string& loadString)
    6969{
    70   //const Resource::Type* const type = Resource::_resourceTypes[this->_type->id()];
     70  //const NewResource::Type* const type = NewResource::_resourceTypes[this->_type->id()];
    7171
    7272  for (unsigned int i = 0; i < _type->storedResources().size(); ++i)
     
    7979}
    8080
    81 void Resource::setMainGlobalPath(const Directory& directory)
     81void NewResource::setMainGlobalPath(const Directory& directory)
    8282{
    83   Resource::_mainGlobalPath = directory;
    84   Resource::_mainGlobalPath.open();
     83  NewResource::_mainGlobalPath = directory;
     84  NewResource::_mainGlobalPath.open();
    8585}
    8686
    87 void Resource::addGlobalPath(const Directory& directory)
     87void NewResource::addGlobalPath(const Directory& directory)
    8888{
    89   std::vector<Directory>::const_iterator it = std::find(Resource::_globalPaths.begin(), Resource::_globalPaths.end(), directory);
    90   if (it == Resource::_globalPaths.end())
    91     Resource::_globalPaths.push_back(directory);
     89  std::vector<Directory>::const_iterator it = std::find(NewResource::_globalPaths.begin(), NewResource::_globalPaths.end(), directory);
     90  if (it == NewResource::_globalPaths.end())
     91    NewResource::_globalPaths.push_back(directory);
    9292}
    9393
    9494
    9595
    96 void Resource::addResource(Resource::Pointer* pointer)
     96void NewResource::addResource(NewResource::Pointer* pointer)
    9797{
    9898  this->_type->addResource(pointer);
     
    108108
    109109
    110 void Resource::KeepLevel::setKeepLevelName(unsigned int level, const std::string& name)
     110void NewResource::KeepLevel::setKeepLevelName(unsigned int level, const std::string& name)
    111111{
    112112  if (_keepLevelName.size() <= level)
     
    117117
    118118
    119 void Resource::Type::addResource(Resource::Pointer* resource)
     119void NewResource::Type::addResource(NewResource::Pointer* resource)
    120120{
    121121  this->_storedResources.push_back(resource);
     
    124124
    125125
    126 Resource::Pointer::Pointer(const std::string& loadString, const Resource::KeepLevel& keeplevel)
     126NewResource::Pointer::Pointer(const std::string& loadString, const NewResource::KeepLevel& keeplevel)
    127127  : _loadString(loadString), _keepLevel(keeplevel)
    128128{}
    129129
    130130
    131 void Resource::Type::setID(int id)
     131void NewResource::Type::setID(int id)
    132132{
    133133  this->_id = id;
  • branches/new_class_id/src/lib/util/loading/resource.h

    r9786 r9788  
    11/*!
    22 * @file resource.h
    3  * @brief Definition of a Resource.
     3 * @brief Definition of a NewResource.
    44*/
    55
     
    1515#include "filesys/directory.h"
    1616
    17 //! A Resource is an Object, that can be loaded from Disk
     17//! A NewResource is an Object, that can be loaded from Disk
    1818/**
    1919 *
    2020 */
    21 class Resource : virtual public BaseObject
     21class NewResource : virtual public BaseObject
    2222{
    23   ObjectListDeclaration(Resource);
     23  ObjectListDeclaration(NewResource);
    2424public:
    2525  class KeepLevel
     
    3535  {
    3636  public:
    37     Pointer(const std::string& loadString, const Resource::KeepLevel& keeplevel);
     37    Pointer(const std::string& loadString, const NewResource::KeepLevel& keeplevel);
    3838    const std::string& loadString() const { return _loadString; };
    39     const Resource::KeepLevel& keepLevel() const { return _keepLevel; };
     39    const NewResource::KeepLevel& keepLevel() const { return _keepLevel; };
    4040
    4141  private:
    4242    std::string              _loadString;             //!< An identifier, to match when loading a File.
    43     Resource::KeepLevel      _keepLevel;              //!< The Priority of this resource. (can only be increased, so none else will delete this)
     43    NewResource::KeepLevel      _keepLevel;              //!< The Priority of this resource. (can only be increased, so none else will delete this)
    4444  };
    4545
     
    6060    const std::vector<std::string>& resourcePaths() const { return _resourcePaths; };
    6161    const std::vector<std::string>& resourceSubPaths() const { return _resourceSubPaths; };
    62     const std::vector<Resource::Pointer*>& storedResources() const { return _storedResources; };
     62    const std::vector<NewResource::Pointer*>& storedResources() const { return _storedResources; };
    6363
    6464    void setID(int id);
    65     void addResource(Resource::Pointer* resource);
     65    void addResource(NewResource::Pointer* resource);
    6666
    6767  private:
     
    7272    std::vector<std::string>        _fileExtensions;
    7373
    74     std::vector<Resource::Pointer*> _storedResources;
     74    std::vector<NewResource::Pointer*> _storedResources;
    7575  };
    7676
    7777
    7878public:
    79   Resource(Resource::Type* type);
    80   virtual ~Resource();
     79  NewResource(NewResource::Type* type);
     80  virtual ~NewResource();
    8181
    8282  virtual bool reload() { return false; };
     
    9292
    9393protected:
    94   Resource::Pointer* acquireResource(const std::string& loadString);
    95   void addResource(Resource::Pointer* pointer);
     94  NewResource::Pointer* acquireResource(const std::string& loadString);
     95  void addResource(NewResource::Pointer* pointer);
    9696
    9797private:
    98   Resource::Pointer*       _pointer;                         //!< Virtual Pointer to the ResourceData.
    99   Resource::Type*          _type;                            //!< Type of the Resource.
     98  NewResource::Pointer*       _pointer;                         //!< Virtual Pointer to the ResourceData.
     99  NewResource::Type*          _type;                            //!< Type of the NewResource.
    100100
    101101
    102   static std::vector<Resource::Type*>    _resourceTypes;
     102  static std::vector<NewResource::Type*>    _resourceTypes;
    103103
    104104  //! GLOBALS
Note: See TracChangeset for help on using the changeset viewer.