Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 560


Ignore:
Timestamp:
Dec 17, 2007, 3:20:46 AM (17 years ago)
Author:
landauf
Message:
  • changed output from std::cout to COUT(level)
  • added SoftDebugLevel config-variable (its a hack, but it works fine)
Location:
code/branches/FICN/src
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FICN/src/audio/AudioManager.cc

    r513 r560  
    2727
    2828#include "AudioManager.h"
    29 
    30 
     29#include "../orxonox/core/Debug.h"
    3130
    3231namespace audio
     
    6160                        else
    6261                        {
    63                                 std::cout << "Started playing background sound"<<std::endl;
     62                                COUT(3) << "Info: Started playing background sound" << std::endl;
    6463                        }
    6564                }
     
    6968        void AudioManager::ambientStop()
    7069        {
    71                 std::cout << "Stopped playing background sound"<<std::endl;
     70                COUT(3) << "Info: Stopped playing background sound" << std::endl;
    7271        }
    7372
     
    8079                {
    8180                        bgSounds.push_back(tmp);
    82                         std::cout << "Added background sound "<<file<<std::endl;
     81                        COUT(3) << "Info: Added background sound " << file << std::endl;
    8382                }
    8483        }
     
    118117                                        }
    119118                                        bgSounds[currentBgSound].playback();
    120                                         std::cout << "Playing next background sound "<<std::endl;
     119                                        COUT(3) << "Info: Playing next background sound" << std::endl;
    121120                                }
    122121                        }
  • code/branches/FICN/src/audio/AudioStream.cc

    r513 r560  
    2828
    2929#include "AudioStream.h"
     30#include "../orxonox/core/Debug.h"
    3031
    3132namespace audio
     
    103104                if (loaded)
    104105                {
    105             std::cout
     106            COUT(3)
    106107                << "version         " << vorbisInfo->version         << "\n"
    107108                << "channels        " << vorbisInfo->channels        << "\n"
     
    115116
    116117            for(int i = 0; i < vorbisComment->comments; i++)
    117                 std::cout << "   " << vorbisComment->user_comments[i] << "\n";
    118 
    119             std::cout << std::endl;
     118                COUT(3) << "   " << vorbisComment->user_comments[i] << "\n";
     119
     120            COUT(3) << std::endl;
    120121                }
    121122        }
  • code/branches/FICN/src/audio/_AudioObject.cc

    r513 r560  
    3030#include <string>
    3131#include "AudioObject.h"
     32#include "../orxonox/core/Debug.h"
    3233
    3334namespace audio
     
    7475
    7576                SetListenerValues();
    76                 std::cout << "Play sone ambient background sound";
     77                COUT(3) << "Info: Play sone ambient background sound";
    7778        }
    7879
  • code/branches/FICN/src/loader/LevelLoader.cc

    r559 r560  
    133133                    mLoadOverlay->show();
    134134
    135                                 std::cout << "\n\n\nThis is Orxonox\nthe hottest 3D action shooter ever to exist\n\n\n";
    136                                 std::cout << "Level: " << name() << "\nDescription:" << description() << "\nImage:"<<image()<<"\n\n\n";
    137                                 std::cout << "Backgroundcolor: " << loadingBackgroundColor_ << "\nBackgroundimage:" << loadingBackgroundImage_ << "\n\n\n";
     135                                COUT(0) << "\n\n\nThis is Orxonox\nthe hottest 3D action shooter ever to exist\n\n\n";
     136                                COUT(0) << "Level: " << name() << "\nDescription:" << description() << "\nImage:"<<image()<<"\n\n\n";
     137                                COUT(4) << "Backgroundcolor: " << loadingBackgroundColor_ << "\nBackgroundimage:" << loadingBackgroundImage_ << "\n\n\n";
    138138
    139139                        }
     
    170170                                 mLoadOverlay->hide();
    171171                        }
    172                         std::cout << "Loading finished!\n\n\n\n\n";
     172                        COUT(0) << "Loading finished!\n\n\n\n\n";
    173173                }
    174174        }
  • code/branches/FICN/src/misc/String2Number.h

    r507 r560  
    55#include <sstream>
    66#include <iostream>
     7
     8#include "../orxonox/core/Debug.h"
    79
    810/**
     
    1618*
    1719* @example
    18 * float f; 
     20* float f;
    1921* String2Number<float>(f, std::string(" 123.45 "));
    2022*/
     
    2931        *
    3032        * First value is the target variable, the second vector is the
    31         * string where the number is taken from, the third parameter 
     33        * string where the number is taken from, the third parameter
    3234        * should be one of std::hex, std::dec or std::oct (dec is default value)
    3335        */
     
    3638          std::istringstream iss(s);
    3739          success_ = !(iss >> f >> t).fail();
    38          
     40
    3941          if (!success_ && haltOnError==1)
    4042          {
    41                 std::cout << "Conversion error from string to number in \"" << s << "\"" << std::endl;
     43                COUT(1) << "Error: Conversion from string to number in \"" << s << "\" failed." << std::endl;
    4244                exit(1);
    4345          }
  • code/branches/FICN/src/orxonox/core/CMakeLists.txt

    r555 r560  
    1111  SignalHandler.cc
    1212  ArgReader.cc
     13  DebugLevel.cc
    1314)
    1415
  • code/branches/FICN/src/orxonox/core/Debug.h

    r499 r560  
    2525
    2626#include <stdio.h>
     27
     28int getSoftDebugLevel();
    2729
    2830// DEFINE ERROR MODES
     
    3840
    3941#define ORX_HARD_DEBUG_LEVEL ORX_DEBUG
    40 #define ORX_SOFT_DEBUG_LEVEL ORX_WARNING // <-- fix that! should be a configurable setting
     42//#define ORX_SOFT_DEBUG_LEVEL ORX_WARNING // <-- fix that! should be a configurable setting
    4143
    4244///////////////////////////////////////////////////
     
    6163  #if ORX_HARD_DEBUG_LEVEL >= ORX_ERROR
    6264   #define PRINTF1 \
    63     if (ORX_SOFT_DEBUG_LEVEL >= ORX_ERROR) \
     65    if (getSoftDebugLevel() >= ORX_ERROR) \
    6466     printf("Error (in %s, line %d): ", __FILE__, __LINE__), PRINT_EXEC
    6567  #else
     
    6971  #if ORX_HARD_DEBUG_LEVEL >= ORX_WARNING
    7072   #define PRINTF2 \
    71     if (ORX_SOFT_DEBUG_LEVEL >= ORX_WARNING) \
     73    if (getSoftDebugLevel() >= ORX_WARNING) \
    7274     printf("Warning (in %s, line %d): ", __FILE__, __LINE__), PRINT_EXEC
    7375  #else
     
    7779  #if ORX_HARD_DEBUG_LEVEL >= ORX_INFO
    7880   #define PRINTF3 \
    79     if (ORX_SOFT_DEBUG_LEVEL >= ORX_INFO) \
     81    if (getSoftDebugLevel() >= ORX_INFO) \
    8082     printf("Info (in %s, line %d): ", __FILE__, __LINE__), PRINT_EXEC
    8183  #else
     
    8587  #if ORX_HARD_DEBUG_LEVEL >= ORX_DEBUG
    8688   #define PRINTF4 \
    87     if (ORX_SOFT_DEBUG_LEVEL >= ORX_DEBUG) \
     89    if (getSoftDebugLevel() >= ORX_DEBUG) \
    8890     printf("Debug (in %s, line %d): ", __FILE__, __LINE__), PRINT_EXEC
    8991  #else
     
    9395  #if ORX_HARD_DEBUG_LEVEL >= ORX_vDEBUG
    9496   #define PRINTF5 \
    95     if (ORX_SOFT_DEBUG_LEVEL >= ORX_vDEBUG) \
     97    if (getSoftDebugLevel() >= ORX_vDEBUG) \
    9698     printf("vDebug (in %s, line %d): ", __FILE__, __LINE__), PRINT_EXEC
    9799  #else
     
    124126  #if ORX_HARD_DEBUG_LEVEL >= ORX_ERROR
    125127   #define PRINT1  \
    126     if (ORX_SOFT_DEBUG_LEVEL >= ORX_ERROR)  \
     128    if (getSoftDebugLevel() >= ORX_ERROR)  \
    127129     PRINT_EXEC
    128130  #else
     
    132134  #if ORX_HARD_DEBUG_LEVEL >= ORX_WARNING
    133135   #define PRINT2 \
    134     if (ORX_SOFT_DEBUG_LEVEL >= ORX_WARNING) \
     136    if (getSoftDebugLevel() >= ORX_WARNING) \
    135137     PRINT_EXEC
    136138  #else
     
    140142  #if ORX_HARD_DEBUG_LEVEL >= ORX_INFO
    141143   #define PRINT3 \
    142     if (ORX_SOFT_DEBUG_LEVEL >= ORX_INFO) \
     144    if (getSoftDebugLevel() >= ORX_INFO) \
    143145     PRINT_EXEC
    144146  #else
     
    148150  #if ORX_HARD_DEBUG_LEVEL >= ORX_DEBUG
    149151   #define PRINT4 \
    150     if (ORX_SOFT_DEBUG_LEVEL >= ORX_DEBUG) \
     152    if (getSoftDebugLevel() >= ORX_DEBUG) \
    151153     PRINT_EXEC
    152154  #else
     
    156158  #if ORX_HARD_DEBUG_LEVEL >= ORX_vDEBUG
    157159   #define PRINT5 \
    158     if (ORX_SOFT_DEBUG_LEVEL >= ORX_vDEBUG) \
     160    if (getSoftDebugLevel() >= ORX_vDEBUG) \
    159161     PRINT_EXEC
    160162  #else
     
    188190  #if ORX_HARD_DEBUG_LEVEL >= ORX_ERROR
    189191   #define COUT1  \
    190     if (ORX_SOFT_DEBUG_LEVEL >= ORX_ERROR)  \
     192    if (getSoftDebugLevel() >= ORX_ERROR)  \
    191193     COUT_EXEC
    192194  #else
     
    197199  #if ORX_HARD_DEBUG_LEVEL >= ORX_WARNING
    198200   #define COUT2 \
    199     if (ORX_SOFT_DEBUG_LEVEL >= ORX_WARNING) \
     201    if (getSoftDebugLevel() >= ORX_WARNING) \
    200202     COUT_EXEC
    201203  #else
     
    206208  #if ORX_HARD_DEBUG_LEVEL >= ORX_INFO
    207209   #define COUT3 \
    208     if (ORX_SOFT_DEBUG_LEVEL >= ORX_INFO) \
     210    if (getSoftDebugLevel() >= ORX_INFO) \
    209211     COUT_EXEC
    210212  #else
     
    215217  #if ORX_HARD_DEBUG_LEVEL >= ORX_DEBUG
    216218   #define COUT4 \
    217     if (ORX_SOFT_DEBUG_LEVEL >= ORX_DEBUG) \
     219    if (getSoftDebugLevel() >= ORX_DEBUG) \
    218220     COUT_EXEC
    219221  #else
     
    224226  #if ORX_HARD_DEBUG_LEVEL >= ORX_vDEBUG
    225227   #define COUT5 \
    226     if (ORX_SOFT_DEBUG_LEVEL >= ORX_vDEBUG) \
     228    if (getSoftDebugLevel() >= ORX_vDEBUG) \
    227229     COUT_EXEC
    228230  #else
  • code/branches/FICN/src/orxonox/core/Error.cc

    r513 r560  
    2727
    2828#include "Error.h"
     29#include "Debug.h"
    2930
    3031namespace orxonox
     
    4243        Error::Error(int errorCode, std::string errorMsg)
    4344        {
    44                 std::cout << "############################ "<< std::endl
     45                COUT(1) << "############################ "<< std::endl
    4546                                                        << "#         Error "<<errorCode<< "          #"<< std::endl
    4647                                                        << "############################ "<< std::endl
     
    5859                        }
    5960                }
    60                 std::cout << errorMsg << std::endl<< std::endl;
     61                COUT(1) << errorMsg << std::endl<< std::endl;
    6162        }
    6263}
  • code/branches/FICN/src/orxonox/core/SignalHandler.cc

    r497 r560  
    1414*/
    1515
     16#include <assert.h>
     17
    1618#include "SignalHandler.h"
    17 #include <assert.h>
     19#include "Debug.h"
    1820
    1921SignalHandler * SignalHandler::singletonRef = NULL;
     
    101103  }
    102104
    103   printf( "recieved signal %s\ntry to write backtrace to file orxonox.log\n", sigName.c_str() );
     105  PRINTF(0)( "recieved signal %s\ntry to write backtrace to file orxonox.log\n", sigName.c_str() );
    104106
    105107  int sigPipe[2];
     
    129131    if ( someData != 0x12345678 )
    130132    {
    131       printf("something went wrong :(\n");
     133      PRINTF(0)("something went wrong :(\n");
    132134    }
    133135
     
    278280  if ( fwrite( bt.c_str(), 1, bt.length(), f ) != bt.length() )
    279281  {
    280     printf( ( std::string("could not write %d byte to ") + getInstance()->fileName ).c_str(), bt.length());
     282    PRINTF(0)( ( std::string("could not write %d byte to ") + getInstance()->fileName ).c_str(), bt.length());
    281283    exit(EXIT_FAILURE);
    282284  }
  • code/branches/FICN/src/orxonox/graphicsEngine.cc

    r546 r560  
    3535#include <OgreConfigFile.h>
    3636#include <OgreTextureManager.h>
     37#include "core/Debug.h"
    3738
    3839
     
    7475    {
    7576      scene_ = root_->createSceneManager(ST_GENERIC, "Default SceneManager");
    76       std::cout << "created SceneMan: " << scene_ << std::endl;
     77      COUT(3) << "Info: Created SceneMan: " << scene_ << std::endl;
    7778    }
    7879    return scene_;
  • code/branches/FICN/src/orxonox/objects/Ambient.cc

    r513 r560  
    3333#include "../../misc/Tokenizer.h"
    3434#include "../../misc/String2Number.h"
     35#include "../core/Debug.h"
    3536
    3637#include "Ambient.h"
     
    6465                mgr->setAmbientLight(ColourValue(r,g,b));
    6566
    66                 std::cout << "Loader: Set ambient light: "<<r<<" " << g << " " << b  << std::endl << std::endl;
     67                COUT(4) << "Loader: Set ambient light: "<<r<<" " << g << " " << b  << std::endl << std::endl;
    6768        }
    6869   }
  • code/branches/FICN/src/orxonox/objects/Camera.cc

    r515 r560  
    1111#include "../../misc/Tokenizer.h"
    1212#include "../../misc/String2Number.h"
     13#include "../core/Debug.h"
    1314
    1415#include "Camera.h"
     
    3031    {
    3132        Ogre::SceneManager* mgr = orxonox::Orxonox::getSingleton()->getSceneManager();
    32        
     33
    3334        if (xmlElem->Attribute("name") && xmlElem->Attribute("pos") && xmlElem->Attribute("lookat") && xmlElem->Attribute("node"))
    3435        {
    3536                //              <Camera name="Camera" pos="0,0,-250" lookat="0,0,0" />
    36                
     37
    3738                std::string name = xmlElem->Attribute("name");
    3839                std::string pos = xmlElem->Attribute("pos");
     
    5758
    5859                std::string node = xmlElem->Attribute("node");
    59                
     60
    6061                    Ogre::SceneNode* sceneNode = (Ogre::SceneNode*)mgr->getRootSceneNode()->getChild(node);
    6162                    sceneNode->attachObject((Ogre::MovableObject*)cam);
    62            
    63                
     63
     64
    6465                    Ogre::Viewport* vp = orxonox::Orxonox::getSingleton()->getOgrePointer()->getRoot()->getAutoCreatedWindow()->addViewport(cam);
    65                            
    6666
    67                 std::cout << "Loader: Created camera "<< name  << std::endl << std::endl;
    68         }       
     67
     68                COUT(4) << "Loader: Created camera "<< name  << std::endl << std::endl;
     69        }
    6970   }
    7071}
  • code/branches/FICN/src/orxonox/objects/Entity.cc

    r531 r560  
    66#include "../../misc/Tokenizer.h"
    77#include "../../misc/String2Number.h"
     8#include "../core/Debug.h"
    89
    910#include "Entity.h"
     
    2526    {
    2627        Ogre::SceneManager* mgr = orxonox::Orxonox::getSingleton()->getSceneManager();
    27        
     28
    2829        if (xmlElem->Attribute("name") && xmlElem->Attribute("src") && xmlElem->Attribute("node"))
    2930        {
     
    3132                std::string src = xmlElem->Attribute("src");
    3233                std::string node = xmlElem->Attribute("node");
    33                        
     34
    3435                        Ogre::Entity* entity = mgr->createEntity(name, src);
    3536
     
    3738                    sceneNode->attachObject((Ogre::MovableObject*)entity);
    3839
    39                 std::cout << "Loader: Created entity "<< name <<" with source " << src  << " at node " << node  << std::endl << std::endl;
    40         }       
     40                COUT(4) << "Loader: Created entity "<< name <<" with source " << src  << " at node " << node  << std::endl << std::endl;
     41        }
    4142   }
    42    
     43
    4344}
  • code/branches/FICN/src/orxonox/objects/SceneNode.cc

    r515 r560  
    66#include "../../misc/Tokenizer.h"
    77#include "../../misc/String2Number.h"
     8#include "../core/Debug.h"
    89
    910#include "SceneNode.h"
     
    2526    {
    2627        Ogre::SceneManager* mgr = orxonox::Orxonox::getSingleton()->getSceneManager();
    27        
     28
    2829        if (xmlElem->Attribute("name") && xmlElem->Attribute("pos"))
    2930        {
     
    3637                String2Number<float>(z, pos[2]);
    3738
    38                
     39
    3940                mgr->getRootSceneNode()->createChildSceneNode(name, Vector3(x,y,z));
    40                
    41                 std::cout << "Loader: Created node "<< name <<" : "<<x<<" " << y << " " << z  << std::endl << std::endl;
    42         }       
     41
     42                COUT(4) << "Loader: Created node "<< name <<" : "<<x<<" " << y << " " << z  << std::endl << std::endl;
     43        }
    4344   }
    4445}
  • code/branches/FICN/src/orxonox/objects/Skybox.cc

    r513 r560  
    3333#include "../../misc/Tokenizer.h"
    3434#include "../../misc/String2Number.h"
     35#include "../core/Debug.h"
    3536
    3637#include "Skybox.h"
     
    5859                mgr->setSkyBox(true, skyboxSrc);
    5960
    60                 std::cout << "Loader: Set skybox: "<< skyboxSrc << std::endl << std::endl;
     61                COUT(4) << "Loader: Set skybox: "<< skyboxSrc << std::endl << std::endl;
    6162        }
    6263   }
  • code/branches/FICN/src/orxonox/objects/SpaceshipSteeringObject.cc

    r519 r560  
    1111#include "../../misc/Tokenizer.h"
    1212#include "../../misc/String2Number.h"
     13#include "../core/Debug.h"
    1314
    1415#include "SpaceshipSteeringObject.h"
     
    3233    {
    3334        SpaceshipSteering* steering = orxonox::Orxonox::getSingleton()->getSteeringPointer();
    34        
     35
    3536        if (xmlElem->Attribute("node") && xmlElem->Attribute("forward") && xmlElem->Attribute("rotateupdown") && xmlElem->Attribute("rotaterightleft") && xmlElem->Attribute("looprightleft"))
    3637        {
     
    4647                String2Number<float>(rotaterightleft, rotaterightleftStr);
    4748                String2Number<float>(looprightleft, looprightleftStr);
    48            
     49
    4950                steering = new SpaceshipSteering(forward, rotateupdown, rotaterightleft, looprightleft);
    50                
     51
    5152                Ogre::SceneManager* mgr = orxonox::Orxonox::getSingleton()->getSceneManager();
    5253                    Ogre::SceneNode* sceneNode = (Ogre::SceneNode*)mgr->getRootSceneNode()->getChild(nodeStr);
    53                                        
     54
    5455                steering->addNode(sceneNode);
    55    
    56    
    57    
    58    
    59                 std::cout << "Loader: Initialized spaceship steering at node " << nodeStr << " values "<< forward << " " << rotateupdown << " "<< rotaterightleft << " "<< looprightleft << " "<< std::endl << std::endl;
    60         }       
     56
     57
     58
     59
     60                COUT(4) << "Loader: Initialized spaceship steering at node " << nodeStr << " values "<< forward << " " << rotateupdown << " "<< rotaterightleft << " "<< looprightleft << " "<< std::endl << std::endl;
     61        }
    6162   }
    6263}
  • code/branches/FICN/src/orxonox/orxonox.cc

    r546 r560  
    5656#include "core/ArgReader.h"
    5757#include "core/Factory.h"
     58#include "core/Debug.h"
    5859
    5960#include "../loader/LevelLoader.h"
     
    310311      if(ogre_ && ogre_->getRoot())
    311312        ogre_->getRoot()->addFrameListener(new network::ServerFrameListener()); // adds a framelistener for the server
    312       std::cout << "network framelistener added" << std::endl;
     313      COUT(3) << "Info: network framelistener added" << std::endl;
    313314    }
    314315    catch(exception &e)
    315316    {
    316       std::cout << "There was a problem initialising the server :(" << std::endl;
     317      COUT(1) << "Error: There was a problem initialising the server :(" << std::endl;
    317318    }
    318319    startRenderLoop();
  • code/branches/FICN/src/orxonox/spaceship_steering.cc

    r531 r560  
    2929#include "spaceship_steering.h"
    3030#include <iostream>
     31#include "core/Debug.h"
     32
    3133using namespace Ogre;
    3234
     
    3436maxSpeedRotateUpDown, float maxSpeedRotateRightLeft, float
    3537maxSpeedLoopRightLeft) {
    36        
    37         std::cout << "Steering was loaded" << std::endl;
     38
     39  COUT(3) << "Info: Steering was loaded" << std::endl;
    3840  moveForward_ = 0;
    3941  rotateUp_ = 0;
Note: See TracChangeset for help on using the changeset viewer.