Changeset 925
- Timestamp:
- 08/06/08 17:17:34
- Files:
-
- trunk/applications/osgdem/osgdem.cpp (modified) (5 diffs)
- trunk/include/vpb/BuildLog (modified) (4 diffs)
- trunk/include/vpb/BuildOptions (modified) (2 diffs)
- trunk/src/vpb/BuildOptions.cpp (modified) (2 diffs)
- trunk/src/vpb/BuildOptionsIO.cpp (modified) (1 diff)
- trunk/src/vpb/Commandline.cpp (modified) (2 diffs)
- trunk/src/vpb/DataSet.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/applications/osgdem/osgdem.cpp
r908 r925 204 204 } 205 205 206 207 206 double duration = 0.0; 208 207 … … 238 237 vpb::sync(); 239 238 240 intresult = dataset->run();239 result = dataset->run(); 241 240 242 241 if (dataset->getBuildLog() && report) … … 249 248 dataset->log(osg::NOTICE,"Elapsed time = %f",duration); 250 249 250 if (taskFile.valid()) 251 { 252 taskFile->setStatus(vpb::Task::COMPLETED); 253 } 254 255 } 256 catch(std::string str) 257 { 258 printf("Caught exception : %s\n",str.c_str()); 259 260 taskFile->setStatus(vpb::Task::FAILED); 261 262 result = 1; 263 251 264 } 252 265 catch(...) 253 266 { 254 267 printf("Caught exception.\n"); 268 269 taskFile->setStatus(vpb::Task::FAILED); 270 271 result = 1; 255 272 } 256 273 … … 261 278 if (taskFile.valid()) 262 279 { 263 taskFile->setStatus(vpb::Task::COMPLETED);264 280 taskFile->setProperty("duration",duration); 265 281 taskFile->write(); … … 269 285 vpb::sync(); 270 286 271 return 0;287 return result; 272 288 } 273 289 trunk/include/vpb/BuildLog
r917 r925 36 36 #include <sstream> 37 37 #include <fstream> 38 #include <iostream> 38 39 39 40 … … 98 99 void log(osg::NotifySeverity level, const char* message, ...); 99 100 101 void log(osg::NotifySeverity level, const std::string& message); 102 100 103 void setStartPendingTime(double t) { _startPendingTime = t; } 101 104 double getStartPendingTime() const { return _startPendingTime; } … … 192 195 const BuildLog* getBuildLog() const { return _buildLog.get(); } 193 196 197 void log(osg::NotifySeverity level, const std::string& message) const 198 { 199 if (level>osg::getNotifyLevel()) return; 200 201 if (_buildLog.valid()) 202 { 203 _buildLog->log(level, message); 204 } 205 else 206 { 207 std::cout<<message<<std::endl; 208 } 209 210 if (level==osg::FATAL) throw message; 211 } 212 194 213 void log(osg::NotifySeverity level, const char* format, ...) const 195 214 { … … 202 221 vsnprintf(str, sizeof(str), format, args); 203 222 _buildLog->log(level, str); 223 224 if (level==osg::FATAL) throw std::string(str); 204 225 } 205 226 else 206 227 { 207 228 vprintf(format, args); printf("\n"); 229 230 if (level==osg::FATAL) 231 { 232 char str[1024]; 233 vsnprintf(str, sizeof(str), format, args); 234 throw std::string(str); 235 } 208 236 } 209 237 va_end(args); 210 } 238 239 } 211 240 212 241 protected: trunk/include/vpb/BuildOptions
r890 r925 261 261 LayerInheritance getLayerInheritance() const { return _layerInheritance; } 262 262 263 void setAbortTaskOnError(bool flag) { _abortTaskOnError = flag; } 264 bool getAbortTaskOnError() const { return _abortTaskOnError; } 265 266 void setAbortRunOnError(bool flag) { _abortRunOnError = flag; } 267 bool getAbortRunOnError() const { return _abortRunOnError; } 263 268 264 269 protected: … … 323 328 324 329 LayerInheritance _layerInheritance; 330 331 bool _abortTaskOnError; 332 bool _abortRunOnError; 325 333 }; 326 334 trunk/src/vpb/BuildOptions.cpp
r913 r925 74 74 75 75 _layerInheritance = INHERIT_NEAREST_AVAILABLE; 76 77 _abortTaskOnError = true; 78 _abortRunOnError = false; 76 79 } 77 80 … … 148 151 149 152 _layerInheritance = rhs._layerInheritance; 153 154 _abortTaskOnError = rhs._abortTaskOnError; 155 _abortRunOnError = rhs._abortRunOnError; 150 156 } 151 157 trunk/src/vpb/BuildOptionsIO.cpp
r890 r925 221 221 { AEP(LayerInheritance); AEV(INHERIT_LOWEST_AVAILABLE); AEV(INHERIT_NEAREST_AVAILABLE); AEV(NO_INHERITANCE); } 222 222 223 ADD_BOOL_PROPERTY(AbortTaskOnError); 224 ADD_BOOL_PROPERTY(AbortRunOnError); 223 225 } 224 226 trunk/src/vpb/Commandline.cpp
r913 r925 497 497 usage.addCommandLineOption("--interpolate-imagery","Enable the use of interpolation when sampling data from source imagery."); 498 498 usage.addCommandLineOption("--no-interpolate-imagery","Disable the use of interpolation when sampling data from source imagery."); 499 usage.addCommandLineOption("--abort-task-on-error","Hint to osgdem to abort the build when any errors occur."); 500 usage.addCommandLineOption("--no-abort-task-on-error","Hint to osgdem to abort the build when any errors occur."); 501 usage.addCommandLineOption("--abort-run-on-error","Hint to vpbmaster to abort the run when any errors occur."); 502 usage.addCommandLineOption("--no-abort-run-on-error","Hint to vpbmaster to abort the run when any errors occur."); 499 503 } 500 504 … … 775 779 776 780 while (arguments.read("--type-attribute",typeAttributeName)) {} 781 782 while (arguments.read("--abort-task-on-error")) { buildOptions->setAbortTaskOnError(true); } 783 while (arguments.read("--no-abort-task-on-error")) { buildOptions->setAbortTaskOnError(false); } 784 785 while (arguments.read("--abort-run-on-error")) { buildOptions->setAbortRunOnError(true); } 786 while (arguments.read("--no-abort-run-on-error")) { buildOptions->setAbortRunOnError(false); } 777 787 778 788 float ratio=0.0f; trunk/src/vpb/DataSet.cpp
r924 r925 1485 1485 if (!result.success()) 1486 1486 { 1487 log(osg::WARN, "Error: error occurred when writing out file %s",filename.c_str()); 1487 osg::NotifySeverity level = getAbortTaskOnError() ? osg::FATAL : osg::WARN; 1488 log(level, "Error: do not have write permission to write out file %s",filename.c_str()); 1488 1489 } 1489 1490 } 1490 1491 else 1491 1492 { 1492 log(osg::WARN, "Error: do not have write permission to write out file %s",filename.c_str()); 1493 osg::NotifySeverity level = getAbortTaskOnError() ? osg::FATAL : osg::WARN; 1494 log(level, "Error: do not have write permission to write out file %s",filename.c_str()); 1493 1495 } 1494 1496 }
