Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r431 - in trunk: Engine/Control Engine/Display Image Model/Groups Model/MiscObjects Model/Readers Model/Textures StandAlone UserInterface


Chronological Thread 
  • From: bigler@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r431 - in trunk: Engine/Control Engine/Display Image Model/Groups Model/MiscObjects Model/Readers Model/Textures StandAlone UserInterface
  • Date: Thu, 14 Jul 2005 00:09:51 -0600 (MDT)

Author: bigler
Date: Thu Jul 14 00:09:50 2005
New Revision: 431

Modified:
   trunk/Engine/Control/RTRT.cc
   trunk/Engine/Display/OpenGLDisplay.cc
   trunk/Image/TGAFile.cc
   trunk/Model/Groups/BVH.cc
   trunk/Model/MiscObjects/Difference.cc
   trunk/Model/Readers/PlyReader.cc
   trunk/Model/Textures/ImageTexture.cc
   trunk/StandAlone/manta.cc
   trunk/UserInterface/XWindowUI.cc
Log:

Added __FILE__ and __LINE__ arguments to thrown exceptions to match
the new code in SCIRun/Core.


Modified: trunk/Engine/Control/RTRT.cc
==============================================================================
--- trunk/Engine/Control/RTRT.cc        (original)
+++ trunk/Engine/Control/RTRT.cc        Thu Jul 14 00:09:50 2005
@@ -162,7 +162,8 @@
 {
   runningLock.lock();
   if(running)
-    throw InvalidState("renderLoop started while it is already running");
+    throw InvalidState("renderLoop started while it is already running",
+                       __FILE__, __LINE__);
   running=true;
   runningLock.unlock();
 
@@ -174,7 +175,7 @@
   scene->getObject()->preprocess(context);
 
   if(!currentImageCreator)
-    throw InvalidState("Image type was not selected");
+    throw InvalidState("Image type was not selected", __FILE__, __LINE__);
 
 #if NOTFINISHED
   check for existence of other components;
@@ -625,7 +626,8 @@
       currentImageTraverser->setupDisplayChannel(context);
     } while(context.isChanged() && --iteration > 0);
     if(!iteration)
-      throw InternalError("Pipeline/resolution negotiation failed");
+      throw InternalError("Pipeline/resolution negotiation failed",
+                          __FILE__, __LINE__);
     context.getResolution(channel->stereo, channel->xres, channel->yres);
     if(channel->xres <= 0)
       throw IllegalValue<int>("Resolution should be positive", 
channel->xres);
@@ -633,7 +635,8 @@
       throw IllegalValue<int>("Resolution should be positive", 
channel->yres);
 
     if(context.getMinDepth() > context.getMaxDepth())
-      throw InternalError("Pipeline depth negotiation failed");
+      throw InternalError("Pipeline depth negotiation failed",
+                          __FILE__, __LINE__);
     int depth = context.getMinDepth();
     if(depth == 1 && context.getMaxDepth() > 1)
       depth = 2; // Prefer double-buffering

Modified: trunk/Engine/Display/OpenGLDisplay.cc
==============================================================================
--- trunk/Engine/Display/OpenGLDisplay.cc       (original)
+++ trunk/Engine/Display/OpenGLDisplay.cc       Thu Jul 14 00:09:50 2005
@@ -92,12 +92,12 @@
   // Open the display and make sure it has opengl
   dpy = XOpenDisplay(NULL);
   if(!dpy)
-    throw InternalError("Error opening display");
+    throw InternalError("Error opening display", __FILE__, __LINE__);
   int error, event;
   if ( !glXQueryExtension( dpy, &error, &event) ) {
     XCloseDisplay(dpy);
     dpy=0;
-    throw InternalError("GL extension NOT available!\n");
+    throw InternalError("GL extension NOT available!\n", __FILE__, __LINE__);
   }
   int screen=DefaultScreen(dpy);
     
@@ -121,7 +121,7 @@
     vi = glXChooseVisual(dpy, screen, &attribList[0]);
     if(!vi){
       // Cannot find anything suitable
-      throw InternalError("Error selecting OpenGL visual");
+      throw InternalError("Error selecting OpenGL visual", __FILE__, 
__LINE__);
     }
   }
 
@@ -175,7 +175,7 @@
   XFree(vi);
 
   if(!glXMakeCurrent(dpy, win, cx))
-    throw InternalError("glXMakeCurrent failed!\n");
+    throw InternalError("glXMakeCurrent failed!\n", __FILE__, __LINE__);
 
   glClearColor(.05, .1, .2, 0);
   glClear(GL_COLOR_BUFFER_BIT);
@@ -185,13 +185,13 @@
   // Get the fonts.  You need to call this with a current GL context.
   fontInfo = XHelper::getX11Font(dpy);
   if (!fontInfo)
-    throw InternalError("getX11Font failed!\n");
+    throw InternalError("getX11Font failed!\n", __FILE__, __LINE__);
   fontbase = XHelper::getGLFont(fontInfo);
   if (fontbase == 0)
-    throw InternalError("getGLFont failed!\n");
+    throw InternalError("getGLFont failed!\n", __FILE__, __LINE__);
 
   if(!glXMakeCurrent(dpy, None, NULL))
-    throw InternalError("glXMakeCurrent failed!\n");
+    throw InternalError("glXMakeCurrent failed!\n", __FILE__, __LINE__);
 }
 
 void OpenGLDisplay::displayImage(const DisplayContext& context,
@@ -213,7 +213,7 @@
 
   if(!madeCurrent){
     if(!glXMakeCurrent(dpy, win, cx))
-      throw InternalError("glXMakeCurrent failed!\n");
+      throw InternalError("glXMakeCurrent failed!\n", __FILE__, __LINE__);
     madeCurrent=true;
   }
   bool stereo;
@@ -284,7 +284,8 @@
       glDrawPixels(xres, yres, GL_RGB, GL_FLOAT, si->getRaw(0));
     }
   } else {
-    throw InternalError("Unknown image type in OpenGLDisplay");
+    throw InternalError("Unknown image type in OpenGLDisplay",
+                        __FILE__, __LINE__);
   }
 
   display_frame_rate(1.0/(currentTime-last_frame_time));

Modified: trunk/Image/TGAFile.cc
==============================================================================
--- trunk/Image/TGAFile.cc      (original)
+++ trunk/Image/TGAFile.cc      Thu Jul 14 00:09:50 2005
@@ -39,7 +39,8 @@
   {
     ofstream out( filename.c_str(), ios::out | ios::binary );
     if ( !out )
-      throw InternalError( "Couldn't open TGA file for writing: " + filename 
);
+      throw InternalError("Couldn't open TGA file for writing: " + filename,
+                          __FILE__, __LINE__);
     out.put( 0 );                 // ID length: 0
     out.put( 0 );                 // Color map type: None
     out.put( 2 );                 // Image type: uncompressed, true-color 
image
@@ -125,7 +126,8 @@
           ++buffer;
         }
     } else {
-      throw InternalError( "Unknown image type in writeTGA()" );
+      throw InternalError("Unknown image type in writeTGA()",
+                          __FILE__, __LINE__);
     }
   }
 
@@ -152,14 +154,16 @@
   {
     ifstream in( filename.c_str(), ios::in | ios::binary );
     if ( !in )
-      throw InternalError( "Couldn't open TGA file for reading: " + filename 
);
+      throw InternalError("Couldn't open TGA file for reading: " + filename,
+                          __FILE__, __LINE__);
     int id_length = in.get();
     int color_map_type = in.get();
     if ( color_map_type != 0 )
-      throw InternalError( "Color map TGA files currently unsupported" );
+      throw InternalError("Color map TGA files currently unsupported",
+                          __FILE__, __LINE__);
     int image_type = in.get();
     if ( image_type != 2 )
-      throw InternalError( "Only uncompressed true-color TGA files currently 
supported" );
+      throw InternalError("Only uncompressed true-color TGA files currently 
supported", __FILE__, __LINE__);
     int color_map_first_entry_index = readShort( in );
     int color_map_length = readShort( in );
     int color_map_entry_size = in.get();
@@ -198,7 +202,8 @@
         }
       return si;
     }
-    throw InternalError( "Unhandled pixel depth and alpha for TGA files" );
+    throw InternalError("Unhandled pixel depth and alpha for TGA files",
+                        __FILE__, __LINE__);
   }
 
 }

Modified: trunk/Model/Groups/BVH.cc
==============================================================================
--- trunk/Model/Groups/BVH.cc   (original)
+++ trunk/Model/Groups/BVH.cc   Thu Jul 14 00:09:50 2005
@@ -263,7 +263,7 @@
     delete [] objValues;
   }
   else {
-    throw InternalError("Unknown build mode: "+buildMode);
+    throw InternalError("Unknown build mode: "+buildMode, __FILE__, 
__LINE__);
   }
 
 
@@ -281,12 +281,12 @@
     if(node->left > 0){
       stack[nstack++] = node->left;
       if(nstack >= MAXDEPTH)
-        throw InternalError("Depth of BVH exceeds maximum depth: 
"+to_string(MAXDEPTH)+", must change MAXDEPTH in "+__FILE__);
+        throw InternalError("Depth of BVH exceeds maximum depth: 
"+to_string(MAXDEPTH)+", must change MAXDEPTH in "+__FILE__, __FILE__, 
__LINE__);
     }
     if(node->right > 0){
       stack[nstack++] = node->right;
       if(nstack >= MAXDEPTH)
-        throw InternalError("Depth of BVH exceeds maximum depth: 
"+to_string(MAXDEPTH)+", must change MAXDEPTH in "+__FILE__);
+        throw InternalError("Depth of BVH exceeds maximum depth: 
"+to_string(MAXDEPTH)+", must change MAXDEPTH in "+__FILE__, __FILE__, 
__LINE__);
     }
   }
 

Modified: trunk/Model/MiscObjects/Difference.cc
==============================================================================
--- trunk/Model/MiscObjects/Difference.cc       (original)
+++ trunk/Model/MiscObjects/Difference.cc       Thu Jul 14 00:09:50 2005
@@ -9,7 +9,7 @@
 Difference::Difference(Object* object1, Object* object2)
   : object1(object1), object2(object2)
 {
-  throw InternalError("Difference not yet implemented");
+  throw InternalError("Difference not yet implemented", __FILE__, __LINE__);
 }
 
 Difference::~Difference()

Modified: trunk/Model/Readers/PlyReader.cc
==============================================================================
--- trunk/Model/Readers/PlyReader.cc    (original)
+++ trunk/Model/Readers/PlyReader.cc    Thu Jul 14 00:09:50 2005
@@ -130,7 +130,7 @@
      {
          ostringstream msg;
          msg << "An error occured while trying to load the following ply 
file: " << fileName;
-         throw SCIRun::FileNotFound(msg.str());
+         throw SCIRun::FileNotFound(msg.str(), __FILE__, __LINE__);
      }
 
      

Modified: trunk/Model/Textures/ImageTexture.cc
==============================================================================
--- trunk/Model/Textures/ImageTexture.cc        (original)
+++ trunk/Model/Textures/ImageTexture.cc        Thu Jul 14 00:09:50 2005
@@ -82,7 +82,8 @@
                                             y - bottom );
       }
     } else {
-      throw SCIRun::InternalError( "Unknown image type in ImageTexture" );
+      throw SCIRun::InternalError("Unknown image type in ImageTexture",
+                                  __FILE__, __LINE__);
     }
   }
 

Modified: trunk/StandAlone/manta.cc
==============================================================================
--- trunk/StandAlone/manta.cc   (original)
+++ trunk/StandAlone/manta.cc   Thu Jul 14 00:09:50 2005
@@ -121,20 +121,24 @@
       rtrt->setScenePath(".:../scenes");
     rtrt->changeNumWorkers(1);
     if(!rtrt->selectImageType("rgba8"))
-      throw InternalError("default image not found");
+      throw InternalError("default image not found", __FILE__, __LINE__);
     if(!rtrt->selectLoadBalancer("workqueue"))
-      throw InternalError("default load balancer not found");
+      throw InternalError("default load balancer not found",
+                          __FILE__, __LINE__);
     if(!rtrt->selectImageTraverser("tiled"))
-      throw InternalError("default image traverser not found");
+      throw InternalError("default image traverser not found",
+                          __FILE__, __LINE__);
     if(!rtrt->selectPixelSampler("singlesample"))
-      throw InternalError("default pixel sampler not found");
+      throw InternalError("default pixel sampler not found",
+                          __FILE__, __LINE__);
     if(!rtrt->selectRenderer("raytracer"))
-      throw InternalError("default renderer not found");
+      throw InternalError("default renderer not found", __FILE__, __LINE__);
     if(!rtrt->selectShadowAlgorithm("hard"))
-      throw InternalError("default shadow algorithm not found");
+      throw InternalError("default shadow algorithm not found",
+                          __FILE__, __LINE__);
     Camera* currentCamera = rtrt->createCamera("pinhole(-eye 3 3 2 -lookat 0 
0 0.3 -up 0 0 1 -fov 60)");
     if(!currentCamera)
-      throw InternalError("cannot create default camera");
+      throw InternalError("cannot create default camera", __FILE__, 
__LINE__);
     int xres = 512, yres = 512;
     bool channelCreated=false;
     bool haveUI = false;

Modified: trunk/UserInterface/XWindowUI.cc
==============================================================================
--- trunk/UserInterface/XWindowUI.cc    (original)
+++ trunk/UserInterface/XWindowUI.cc    Thu Jul 14 00:09:50 2005
@@ -79,13 +79,13 @@
 
   // Open the display and setup file descriptors for threads
   if(pipe(xpipe) == -1){
-    throw ErrnoException("XWindowUI pipe", errno);
+    throw ErrnoException("XWindowUI pipe", errno, __FILE__, __LINE__);
   }
   dpy = XOpenDisplay(NULL);
   if(!dpy)
-    throw InternalError("XOpenDisplay failed");
+    throw InternalError("XOpenDisplay failed", __FILE__, __LINE__);
   if(XAddConnectionWatch(dpy, connection_watch, 
reinterpret_cast<XPointer>(this)) == 0)
-    throw InternalError("XAddConnectionWatch failed");
+    throw InternalError("XAddConnectionWatch failed", __FILE__, __LINE__);
 
   if(xfds.size() == 0){
     // XAddConnectionWatch must be broken.  To fix it, we look at the
@@ -93,7 +93,7 @@
     // file descriptors are between the two.
     int tmp_pipe[2];
     if(pipe(tmp_pipe) == -1)
-      throw ErrnoException("XWindowUI pipe2", errno);
+      throw ErrnoException("XWindowUI pipe2", errno, __FILE__, __LINE__);
     for(int i=xpipe[1]+1; i<tmp_pipe[0];i++)
       addConnection(i);
   }
@@ -173,14 +173,14 @@
     }
     int s = select(max+1, &readfds, 0, 0, 0);
     if(s == -1)
-      throw ErrnoException("XWindowUI select", errno);
+      throw ErrnoException("XWindowUI select", errno, __FILE__, __LINE__);
 
     if(FD_ISSET(xpipe[0], &readfds)){
       // Process the pipe...
       int token;
       ssize_t s = read(xpipe[0], &token, sizeof(token));
       if(s != sizeof(token))
-       throw ErrnoException("XWindowUI read pipe", errno);
+       throw ErrnoException("XWindowUI read pipe", errno, __FILE__, 
__LINE__);
       switch(token){
       case TOKEN_NOOP:
        break;
@@ -190,7 +190,8 @@
        xlock.lock();
        break;
       default:
-       throw InternalError("XWindowUI::Unknown token in pipe");
+       throw InternalError("XWindowUI::Unknown token in pipe",
+                            __FILE__, __LINE__);
       }
     }
     bool have_some = false;
@@ -225,7 +226,7 @@
   int token = TOKEN_LOCK;
   ssize_t s = write(xpipe[1], &token, sizeof(int));
   if(s != sizeof(int)){
-    throw ErrnoException("XWindowUI write 3", errno);
+    throw ErrnoException("XWindowUI write 3", errno, __FILE__, __LINE__);
   }
   xlock.lock();
 }  
@@ -280,12 +281,13 @@
 {
   cerr << description << ": " << (void*)key << '\n';
   if(key == 0)
-    throw InternalError("tried to register invalid key: "+description);
+    throw InternalError("tried to register invalid key: "+description,
+                        __FILE__, __LINE__);
 
   for(vector<KeyTab>::iterator iter = keys.begin();
       iter != keys.end(); iter++){
     if(key == iter->key && state == iter->state)
-      throw InternalError("Two functions mapped to the same key: 
"+description+" and "+iter->description);
+      throw InternalError("Two functions mapped to the same key: 
"+description+" and "+iter->description, __FILE__, __LINE__);
   }
   KeyTab entry;
   entry.key = key;
@@ -304,7 +306,7 @@
   for(vector<MouseTab>::iterator iter = mouse.begin();
       iter != mouse.end(); iter++){
     if(button == iter->button && state == iter->state)
-      throw InternalError("Two functions mapped to the same mouse button: 
"+description+" and "+iter->description);
+      throw InternalError("Two functions mapped to the same mouse button: 
"+description+" and "+iter->description, __FILE__, __LINE__);
   }
   MouseTab entry;
   entry.state = state;




  • [MANTA] r431 - in trunk: Engine/Control Engine/Display Image Model/Groups Model/MiscObjects Model/Readers Model/Textures StandAlone UserInterface, bigler, 07/14/2005

Archive powered by MHonArc 2.6.16.

Top of page