Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3676 in orxonox.OLD for orxonox/trunk/src/lib


Ignore:
Timestamp:
Mar 30, 2005, 5:42:02 PM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: debug-information for ResourceManager

Location:
orxonox/trunk/src/lib/util
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/util/resource_manager.cc

    r3672 r3676  
    217217          if(isFile(fullName))
    218218            {
     219              PRINTF(4)("Image %s resides to %s\n", fileName, fullName);
    219220              tmpResource->pointer = new Texture(fullName);
    220221            }
     
    229230                  sprintf(imgName, "%s%s", tmpDir, fileName);
    230231                  if(isFile(imgName))
    231                     tmpResource->pointer = new Texture(imgName);
     232                    {
     233                      PRINTF(4)("Image %s resides to %s\n", fileName, imgName);
     234                      tmpResource->pointer = new Texture(imgName);
     235                      delete []imgName;
     236                      break;
     237                    }
    232238                  delete []imgName;
    233239                  tmpDir = iterator->nextElement();
     
    242248          PRINTF(1)("No type found for %s.\n   !!This should not happen unless the Type is not supported yet.!!\n", tmpResource->name);
    243249          break;
    244         }
    245      
    246       // checking if the File really exists.
    247       if(!isFile(fullName))
    248         {
    249           PRINTF(2)("Sorry, %s is not a regular file.\n", fullName);
    250           tmpResource->pointer = NULL;
    251250        }
    252251      this->resourceList->add(tmpResource);
     
    413412    return false;
    414413}
     414
     415/**
     416   \brief outputs debug information about the ResourceManager
     417*/
     418void ResourceManager::debug(void)
     419{
     420  PRINT(0)("=RM===================================\n");
     421  PRINT(0)("= RESOURCE-MANAGER DEBUG INFORMATION =\n");
     422  PRINT(0)("======================================\n");
     423  // if it is not initialized
     424  PRINT(0)(" Reference is: %p\n", ResourceManager::singletonRef);
     425  PRINT(0)(" Data-Directory is: %s\n", this->dataDir);
     426  PRINT(0)(" List of Image-Directories: ");
     427  tIterator<char>* tmpIt = imageDirs->getIterator();
     428  char* tmpDir = tmpIt->nextElement();
     429  while(tmpDir)
     430    {
     431      PRINT(0)("%s ",tmpDir);
     432      tmpDir = tmpIt->nextElement();
     433    }
     434  delete tmpIt;
     435  PRINT(0)("\n");
     436
     437  PRINT(0)("List of all stored Resources:\n");
     438  tIterator<Resource>* iterator = resourceList->getIterator();
     439  Resource* enumRes = iterator->nextElement();
     440  while (enumRes)
     441    {
     442      PRINT(0)("-----------------------------------------\n");
     443      PRINT(0)("Name: %s; References: %d; Type:", enumRes->name, enumRes->count);
     444      switch (enumRes->type)
     445        {
     446        case OBJ:
     447          PRINT(0)("ObjectModel\n");
     448          break;
     449        case PRIM:
     450          PRINT(0)("PrimitiveModel\n");
     451          break;
     452        case IMAGE:
     453          PRINT(0)("ImageFile (Texture)\n");
     454          break;
     455        default:
     456          PRINT(0)("SoundFile\n");
     457          break;
     458        }
     459      PRINT(0)("gets deleted at ");
     460      switch(enumRes->prio)
     461        {
     462        default:
     463        case RP_NO:
     464          PRINT(0)("first posibility (0)\n");
     465          break;
     466        case RP_LEVEL:
     467          PRINT(0)("the end of the Level (1)\n");
     468          break;
     469        case RP_CAMPAIGN:
     470          PRINT(0)("the end of the campaign (2)\n");
     471          break;
     472        case RP_GAME:
     473          PRINT(0)("when leaving the game (3)\n");
     474          break;
     475        }
     476      enumRes = iterator->nextElement();
     477    }
     478  delete iterator;
     479
     480
     481
     482  PRINT(0)("==================================RM==\n");
     483}
  • orxonox/trunk/src/lib/util/resource_manager.h

    r3672 r3676  
    6363  bool unload(Resource* resource, ResourcePriority = RP_NO);
    6464  bool unloadAllByPriority(ResourcePriority prio);
     65  void debug(void);
    6566
    6667 private:
     
    7778 
    7879  bool isDir(const char* directory);
    79   bool isFile(const char* directory); 
     80  bool isFile(const char* directory);
     81
    8082};
    8183
Note: See TracChangeset for help on using the changeset viewer.