From f417706b061985a6df8cc903ea646604edd9b74c Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 17 Nov 2009 12:54:55 +0000 Subject: [PATCH] Converted .ive plugin from using C++ exceptions to using a local equivelant, enabling the build on embedded systems. --- src/osgPlugins/ive/AlphaFunc.cpp | 6 +- src/osgPlugins/ive/AnimationPath.cpp | 6 +- src/osgPlugins/ive/AnimationPathCallback.cpp | 21 +- src/osgPlugins/ive/AnisotropicLighting.cpp | 6 +- src/osgPlugins/ive/AutoTransform.cpp | 6 +- src/osgPlugins/ive/AzimElevationSector.cpp | 2 +- src/osgPlugins/ive/AzimSector.cpp | 2 +- src/osgPlugins/ive/Billboard.cpp | 6 +- src/osgPlugins/ive/BlendColor.cpp | 6 +- src/osgPlugins/ive/BlendEquation.cpp | 6 +- src/osgPlugins/ive/BlendFunc.cpp | 6 +- src/osgPlugins/ive/BlinkSequence.cpp | 6 +- src/osgPlugins/ive/BumpMapping.cpp | 6 +- src/osgPlugins/ive/Camera.cpp | 6 +- src/osgPlugins/ive/CameraView.cpp | 6 +- src/osgPlugins/ive/Cartoon.cpp | 6 +- src/osgPlugins/ive/ClipNode.cpp | 6 +- src/osgPlugins/ive/ClipPlane.cpp | 6 +- src/osgPlugins/ive/ClusterCullingCallback.cpp | 6 +- src/osgPlugins/ive/ColorMask.cpp | 6 +- src/osgPlugins/ive/CompositeLayer.cpp | 6 +- src/osgPlugins/ive/ConeSector.cpp | 2 +- src/osgPlugins/ive/ConvexPlanarOccluder.cpp | 6 +- src/osgPlugins/ive/ConvexPlanarPolygon.cpp | 6 +- src/osgPlugins/ive/CoordinateSystemNode.cpp | 20 +- src/osgPlugins/ive/CullFace.cpp | 6 +- src/osgPlugins/ive/DOFTransform.cpp | 6 +- src/osgPlugins/ive/DataInputStream.cpp | 545 +++++++++++------- src/osgPlugins/ive/DataInputStream.h | 6 +- src/osgPlugins/ive/DataOutputStream.cpp | 25 +- src/osgPlugins/ive/DataOutputStream.h | 8 +- src/osgPlugins/ive/Depth.cpp | 6 +- src/osgPlugins/ive/DirectionalSector.cpp | 2 +- src/osgPlugins/ive/DrawArrayLengths.cpp | 6 +- src/osgPlugins/ive/DrawArrays.cpp | 6 +- src/osgPlugins/ive/DrawElementsUByte.cpp | 6 +- src/osgPlugins/ive/DrawElementsUInt.cpp | 6 +- src/osgPlugins/ive/DrawElementsUShort.cpp | 6 +- src/osgPlugins/ive/Drawable.cpp | 6 +- src/osgPlugins/ive/Effect.cpp | 6 +- src/osgPlugins/ive/ElevationSector.cpp | 2 +- src/osgPlugins/ive/EllipsoidModel.cpp | 6 +- src/osgPlugins/ive/Exception.h | 10 +- src/osgPlugins/ive/FadeText.cpp | 6 +- src/osgPlugins/ive/Fog.cpp | 6 +- src/osgPlugins/ive/FragmentProgram.cpp | 6 +- src/osgPlugins/ive/FrontFace.cpp | 6 +- src/osgPlugins/ive/Geode.cpp | 10 +- src/osgPlugins/ive/Geometry.cpp | 10 +- src/osgPlugins/ive/Group.cpp | 6 +- src/osgPlugins/ive/HeightFieldLayer.cpp | 6 +- src/osgPlugins/ive/Image.cpp | 8 +- src/osgPlugins/ive/ImageLayer.cpp | 6 +- src/osgPlugins/ive/ImageSequence.cpp | 6 +- src/osgPlugins/ive/Impostor.cpp | 6 +- src/osgPlugins/ive/LOD.cpp | 6 +- src/osgPlugins/ive/Layer.cpp | 6 +- src/osgPlugins/ive/Light.cpp | 6 +- src/osgPlugins/ive/LightModel.cpp | 6 +- src/osgPlugins/ive/LightPoint.cpp | 6 +- src/osgPlugins/ive/LightPointNode.cpp | 6 +- src/osgPlugins/ive/LightSource.cpp | 6 +- src/osgPlugins/ive/LineStipple.cpp | 6 +- src/osgPlugins/ive/LineWidth.cpp | 6 +- src/osgPlugins/ive/Locator.cpp | 6 +- src/osgPlugins/ive/Material.cpp | 6 +- src/osgPlugins/ive/MatrixTransform.cpp | 6 +- src/osgPlugins/ive/MultiSwitch.cpp | 6 +- src/osgPlugins/ive/MultiTextureControl.cpp | 6 +- src/osgPlugins/ive/Multisample.cpp | 6 +- src/osgPlugins/ive/Node.cpp | 8 +- src/osgPlugins/ive/Object.cpp | 2 +- src/osgPlugins/ive/OccluderNode.cpp | 6 +- src/osgPlugins/ive/OcclusionQueryNode.cpp | 6 +- src/osgPlugins/ive/PagedLOD.cpp | 6 +- src/osgPlugins/ive/Point.cpp | 6 +- src/osgPlugins/ive/PointSprite.cpp | 6 +- src/osgPlugins/ive/PolygonMode.cpp | 6 +- src/osgPlugins/ive/PolygonOffset.cpp | 6 +- src/osgPlugins/ive/PolygonStipple.cpp | 6 +- .../ive/PositionAttitudeTransform.cpp | 6 +- src/osgPlugins/ive/PrimitiveSet.cpp | 6 +- src/osgPlugins/ive/Program.cpp | 6 +- src/osgPlugins/ive/ProxyNode.cpp | 6 +- src/osgPlugins/ive/ReaderWriterIVE.cpp | 64 +- src/osgPlugins/ive/Scissor.cpp | 6 +- src/osgPlugins/ive/Scribe.cpp | 6 +- src/osgPlugins/ive/Sequence.cpp | 6 +- src/osgPlugins/ive/ShadeModel.cpp | 6 +- src/osgPlugins/ive/Shader.cpp | 6 +- src/osgPlugins/ive/Shape.cpp | 38 +- src/osgPlugins/ive/ShapeAttributeList.cpp | 2 +- src/osgPlugins/ive/ShapeDrawable.cpp | 10 +- src/osgPlugins/ive/SpecularHighlights.cpp | 6 +- src/osgPlugins/ive/StateSet.cpp | 10 +- src/osgPlugins/ive/Stencil.cpp | 6 +- src/osgPlugins/ive/Switch.cpp | 6 +- src/osgPlugins/ive/SwitchLayer.cpp | 6 +- src/osgPlugins/ive/TerrainTile.cpp | 6 +- src/osgPlugins/ive/TexEnv.cpp | 6 +- src/osgPlugins/ive/TexEnvCombine.cpp | 6 +- src/osgPlugins/ive/TexGen.cpp | 6 +- src/osgPlugins/ive/TexGenNode.cpp | 6 +- src/osgPlugins/ive/TexMat.cpp | 6 +- src/osgPlugins/ive/Text.cpp | 7 +- src/osgPlugins/ive/Text3D.cpp | 7 +- src/osgPlugins/ive/Texture.cpp | 6 +- src/osgPlugins/ive/Texture1D.cpp | 6 +- src/osgPlugins/ive/Texture2D.cpp | 6 +- src/osgPlugins/ive/Texture3D.cpp | 6 +- src/osgPlugins/ive/TextureCubeMap.cpp | 6 +- src/osgPlugins/ive/TextureRectangle.cpp | 6 +- src/osgPlugins/ive/Transform.cpp | 6 +- src/osgPlugins/ive/Uniform.cpp | 6 +- src/osgPlugins/ive/VertexProgram.cpp | 6 +- src/osgPlugins/ive/Viewport.cpp | 6 +- src/osgPlugins/ive/VisibilityGroup.cpp | 6 +- src/osgPlugins/ive/Volume.cpp | 6 +- src/osgPlugins/ive/VolumeCompositeLayer.cpp | 6 +- .../ive/VolumeCompositeProperty.cpp | 6 +- src/osgPlugins/ive/VolumeImageLayer.cpp | 6 +- src/osgPlugins/ive/VolumeLayer.cpp | 6 +- src/osgPlugins/ive/VolumeLocator.cpp | 6 +- .../ive/VolumePropertyAdjustmentCallback.cpp | 6 +- src/osgPlugins/ive/VolumeScalarProperty.cpp | 6 +- src/osgPlugins/ive/VolumeSwitchProperty.cpp | 6 +- src/osgPlugins/ive/VolumeTile.cpp | 6 +- .../ive/VolumeTransferFunctionProperty.cpp | 6 +- 128 files changed, 790 insertions(+), 655 deletions(-) diff --git a/src/osgPlugins/ive/AlphaFunc.cpp b/src/osgPlugins/ive/AlphaFunc.cpp index e95499bfa..036c18e45 100644 --- a/src/osgPlugins/ive/AlphaFunc.cpp +++ b/src/osgPlugins/ive/AlphaFunc.cpp @@ -27,7 +27,7 @@ void AlphaFunc::write(DataOutputStream* out){ if(obj) ((ive::Object*)(obj))->write(out); else - throw Exception("AlphaFunc::write(): Could not cast this osg::AlphaFunc to an osg::Object."); + out_THROW_EXCEPTION("AlphaFunc::write(): Could not cast this osg::AlphaFunc to an osg::Object."); // write AlphaFunc's properties out->writeInt(getFunction()); @@ -48,7 +48,7 @@ void AlphaFunc::read(DataInputStream* in){ if(obj) ((ive::Object*)(obj))->read(in); else - throw Exception("AlphaFunc::read(): Could not cast this osg::AlphaFunc to an osg::Object."); + in_THROW_EXCEPTION("AlphaFunc::read(): Could not cast this osg::AlphaFunc to an osg::Object."); // Read AlphaFunc's properties osg::AlphaFunc::ComparisonFunction comparison_funtion = osg::AlphaFunc::ComparisonFunction(in->readInt()); @@ -56,6 +56,6 @@ void AlphaFunc::read(DataInputStream* in){ setFunction(comparison_funtion, reference_value); } else{ - throw Exception("AlphaFunc::read(): Expected AlphaFunc identification."); + in_THROW_EXCEPTION("AlphaFunc::read(): Expected AlphaFunc identification."); } } diff --git a/src/osgPlugins/ive/AnimationPath.cpp b/src/osgPlugins/ive/AnimationPath.cpp index 0b66c32ed..ab91506b2 100644 --- a/src/osgPlugins/ive/AnimationPath.cpp +++ b/src/osgPlugins/ive/AnimationPath.cpp @@ -27,7 +27,7 @@ void AnimationPath::write(DataOutputStream* out){ ((ive::Object*)(obj))->write(out); } else - throw Exception("AnimationPath::write(): Could not cast this osg::AnimationPath to an osg::Object."); + out_THROW_EXCEPTION("AnimationPath::write(): Could not cast this osg::AnimationPath to an osg::Object."); // Write AnimationPath's properties. // Write loopmode @@ -55,7 +55,7 @@ void AnimationPath::read(DataInputStream* in){ ((ive::Object*)(obj))->read(in); } else - throw Exception("AnimationPath::read(): Could not cast this osg::AnimationPath to an osg::Object."); + in_THROW_EXCEPTION("AnimationPath::read(): Could not cast this osg::AnimationPath to an osg::Object."); // Read AnimationPath's properties // Read loopmode @@ -71,6 +71,6 @@ void AnimationPath::read(DataInputStream* in){ } } else{ - throw Exception("AnimationPath::read(): Expected AnimationPath identification."); + in_THROW_EXCEPTION("AnimationPath::read(): Expected AnimationPath identification."); } } diff --git a/src/osgPlugins/ive/AnimationPathCallback.cpp b/src/osgPlugins/ive/AnimationPathCallback.cpp index bed4ed119..fdd923845 100644 --- a/src/osgPlugins/ive/AnimationPathCallback.cpp +++ b/src/osgPlugins/ive/AnimationPathCallback.cpp @@ -28,7 +28,7 @@ void AnimationPathCallback::write(DataOutputStream* out){ ((ive::Object*)(obj))->write(out); } else - throw Exception("AnimationPathCallback::write(): Could not cast this osg::AnimationPathCallback to an osg::Object."); + out_THROW_EXCEPTION("AnimationPathCallback::write(): Could not cast this osg::AnimationPathCallback to an osg::Object."); // Write AnimationPathCallback's properties. out->writeVec3(_pivotPoint); @@ -38,14 +38,14 @@ void AnimationPathCallback::write(DataOutputStream* out){ out->writeDouble(_pauseTime); // Write animationpath if any if(getAnimationPath()) - { - out->writeInt(1); // true we have an animation path. + { + out->writeInt(1); // true we have an animation path. ((ive::AnimationPath*)(getAnimationPath()))->write(out); } - else - { - out->writeInt(0); // false we don't have an animation path. - } + else + { + out->writeInt(0); // false we don't have an animation path. + } } void AnimationPathCallback::read(DataInputStream* in){ @@ -60,7 +60,8 @@ void AnimationPathCallback::read(DataInputStream* in){ ((ive::Object*)(obj))->read(in); } else - throw Exception("AnimationPathCallback::read(): Could not cast this osg::AnimationPathCallback to an osg::Object."); + in_THROW_EXCEPTION("AnimationPathCallback::read(): Could not cast this osg::AnimationPathCallback to an osg::Object."); + // Read AnimationPathCallback's properties _pivotPoint = in->readVec3(); _timeOffset = in->readDouble(); @@ -69,13 +70,13 @@ void AnimationPathCallback::read(DataInputStream* in){ _pauseTime = in->readDouble(); // Read animationpath if any if(in->readInt()) - { + { osg::AnimationPath* path = new osg::AnimationPath(); ((ive::AnimationPath*)(path))->read(in); setAnimationPath(path); } } else{ - throw Exception("AnimationPathCallback::read(): Expected AnimationPathCallback identification."); + in_THROW_EXCEPTION("AnimationPathCallback::read(): Expected AnimationPathCallback identification."); } } diff --git a/src/osgPlugins/ive/AnisotropicLighting.cpp b/src/osgPlugins/ive/AnisotropicLighting.cpp index 087ded215..c15861a2c 100644 --- a/src/osgPlugins/ive/AnisotropicLighting.cpp +++ b/src/osgPlugins/ive/AnisotropicLighting.cpp @@ -25,7 +25,7 @@ void AnisotropicLighting::write(DataOutputStream* out){ ((ive::Effect*)(effect))->write(out); } else - throw Exception("AnisotropicLighting::write(): Could not cast this osgFX::AnisotropicLighting to an osgFX::Effect."); + out_THROW_EXCEPTION("AnisotropicLighting::write(): Could not cast this osgFX::AnisotropicLighting to an osgFX::Effect."); // Write AnisotropicLighting's properties. out->writeImage(getLightingMap()); @@ -45,13 +45,13 @@ void AnisotropicLighting::read(DataInputStream* in){ ((ive::Effect*)(effect))->read(in); } else - throw Exception("AnisotropicLighting::read(): Could not cast this osgFX::AnisotropicLighting to an osgFX::Effect."); + in_THROW_EXCEPTION("AnisotropicLighting::read(): Could not cast this osgFX::AnisotropicLighting to an osgFX::Effect."); // Read AnisotropicLighting's properties setLightingMap(in->readImage()); setLightNumber(in->readInt()); } else{ - throw Exception("AnisotropicLighting::read(): Expected AnisotropicLighting identification."); + in_THROW_EXCEPTION("AnisotropicLighting::read(): Expected AnisotropicLighting identification."); } } diff --git a/src/osgPlugins/ive/AutoTransform.cpp b/src/osgPlugins/ive/AutoTransform.cpp index 55e6dac47..11fde9473 100644 --- a/src/osgPlugins/ive/AutoTransform.cpp +++ b/src/osgPlugins/ive/AutoTransform.cpp @@ -26,7 +26,7 @@ void AutoTransform::write(DataOutputStream* out){ ((ive::Transform*)(trans))->write(out); } else - throw Exception("AutoTransform::write(): Could not cast this osg::AutoTransform to an osg::Transform."); + out_THROW_EXCEPTION("AutoTransform::write(): Could not cast this osg::AutoTransform to an osg::Transform."); // Write AutoTransform's properties. out->writeVec3(getPosition()); @@ -61,7 +61,7 @@ void AutoTransform::read(DataInputStream* in){ ((ive::Transform*)(trans))->read(in); } else - throw Exception("AutoTransform::read(): Could not cast this osg::AutoTransform to an osg::Transform."); + in_THROW_EXCEPTION("AutoTransform::read(): Could not cast this osg::AutoTransform to an osg::Transform."); // Read AutoTransform's properties setPosition(in->readVec3()); @@ -85,6 +85,6 @@ void AutoTransform::read(DataInputStream* in){ } else{ - throw Exception("AutoTransform::read(): Expected AutoTransform identification."); + in_THROW_EXCEPTION("AutoTransform::read(): Expected AutoTransform identification."); } } diff --git a/src/osgPlugins/ive/AzimElevationSector.cpp b/src/osgPlugins/ive/AzimElevationSector.cpp index 110fd1d67..647049b4c 100644 --- a/src/osgPlugins/ive/AzimElevationSector.cpp +++ b/src/osgPlugins/ive/AzimElevationSector.cpp @@ -49,6 +49,6 @@ void AzimElevationSector::read(DataInputStream* in){ setAzimuthRange(minAzimuth, maxAzimuth, fadeAngle); } else{ - throw Exception("AzimElevationSector::read(): Expected AzimElevationSector identification."); + in_THROW_EXCEPTION("AzimElevationSector::read(): Expected AzimElevationSector identification."); } } diff --git a/src/osgPlugins/ive/AzimSector.cpp b/src/osgPlugins/ive/AzimSector.cpp index 43cc4c90f..0cad16382 100644 --- a/src/osgPlugins/ive/AzimSector.cpp +++ b/src/osgPlugins/ive/AzimSector.cpp @@ -40,6 +40,6 @@ void AzimSector::read(DataInputStream* in){ setAzimuthRange(minAzimuth, maxAzimuth, fadeAngle); } else{ - throw Exception("AzimSector::read(): Expected AzimSector identification."); + in_THROW_EXCEPTION("AzimSector::read(): Expected AzimSector identification."); } } diff --git a/src/osgPlugins/ive/Billboard.cpp b/src/osgPlugins/ive/Billboard.cpp index b29aaf1a8..aea299d56 100644 --- a/src/osgPlugins/ive/Billboard.cpp +++ b/src/osgPlugins/ive/Billboard.cpp @@ -27,7 +27,7 @@ void Billboard::write(DataOutputStream* out){ ((ive::Geode*)(geode))->write(out); } else - throw Exception("Billboard::write(): Could not cast this osg::Billboard to an osg::Geode."); + out_THROW_EXCEPTION("Billboard::write(): Could not cast this osg::Billboard to an osg::Geode."); // Write Billboard's properties. // Write mode @@ -56,7 +56,7 @@ void Billboard::read(DataInputStream* in){ ((ive::Geode*)(geode))->read(in); } else - throw Exception("Billboard::read(): Could not cast this osg::Billboard to an osg::Geode."); + in_THROW_EXCEPTION("Billboard::read(): Could not cast this osg::Billboard to an osg::Geode."); // Read Billboard's properties // Read mode @@ -73,6 +73,6 @@ void Billboard::read(DataInputStream* in){ } else{ - throw Exception("Billboard::read(): Expected Billboard identification."); + in_THROW_EXCEPTION("Billboard::read(): Expected Billboard identification."); } } diff --git a/src/osgPlugins/ive/BlendColor.cpp b/src/osgPlugins/ive/BlendColor.cpp index 1c7d29db5..9a904786c 100644 --- a/src/osgPlugins/ive/BlendColor.cpp +++ b/src/osgPlugins/ive/BlendColor.cpp @@ -31,7 +31,7 @@ void BlendColor::write(DataOutputStream* out) if (obj) { ((ive::Object*)(obj))->write(out); } else { - throw Exception("BlendColor::write(): Could not cast this osg::BlendColor to an osg::Object."); + out_THROW_EXCEPTION("BlendColor::write(): Could not cast this osg::BlendColor to an osg::Object."); } // Write BlendColor's properties. @@ -51,7 +51,7 @@ void BlendColor::read(DataInputStream* in) if (obj) { ((ive::Object*)(obj))->read(in); } else { - throw Exception("BlendColor::read(): Could not cast this osg::BlendColor to an osg::Object."); + in_THROW_EXCEPTION("BlendColor::read(): Could not cast this osg::BlendColor to an osg::Object."); } // Read BlendColor's properties @@ -59,6 +59,6 @@ void BlendColor::read(DataInputStream* in) setConstantColor(in->readVec4()); } else { - throw Exception("BlendColor::read(): Expected BlendColor identification."); + in_THROW_EXCEPTION("BlendColor::read(): Expected BlendColor identification."); } } diff --git a/src/osgPlugins/ive/BlendEquation.cpp b/src/osgPlugins/ive/BlendEquation.cpp index cc2f0e335..04e45adfa 100644 --- a/src/osgPlugins/ive/BlendEquation.cpp +++ b/src/osgPlugins/ive/BlendEquation.cpp @@ -29,7 +29,7 @@ void BlendEquation::write(DataOutputStream* out){ ((ive::Object*)(obj))->write(out); } else - throw Exception("BlendEquation::write(): Could not cast this osg::BlendEquation to an osg::Object."); + out_THROW_EXCEPTION("BlendEquation::write(): Could not cast this osg::BlendEquation to an osg::Object."); // Write BlendEquation's properties. // Write source @@ -56,7 +56,7 @@ void BlendEquation::read(DataInputStream* in){ ((ive::Object*)(obj))->read(in); } else - throw Exception("BlendEquation::read(): Could not cast this osg::BlendEquation to an osg::Object."); + in_THROW_EXCEPTION("BlendEquation::read(): Could not cast this osg::BlendEquation to an osg::Object."); // Read BlendEquation's properties // Read source @@ -71,6 +71,6 @@ void BlendEquation::read(DataInputStream* in){ } } else{ - throw Exception("BlendEquation::read(): Expected BlendEquation identification."); + in_THROW_EXCEPTION("BlendEquation::read(): Expected BlendEquation identification."); } } diff --git a/src/osgPlugins/ive/BlendFunc.cpp b/src/osgPlugins/ive/BlendFunc.cpp index 3446fbfca..089ba4a3c 100644 --- a/src/osgPlugins/ive/BlendFunc.cpp +++ b/src/osgPlugins/ive/BlendFunc.cpp @@ -30,7 +30,7 @@ void BlendFunc::write(DataOutputStream* out){ ((ive::Object*)(obj))->write(out); } else - throw Exception("BlendFunc::write(): Could not cast this osg::BlendFunc to an osg::Object."); + out_THROW_EXCEPTION("BlendFunc::write(): Could not cast this osg::BlendFunc to an osg::Object."); // Write BlendFunc's properties. // Write source @@ -59,7 +59,7 @@ void BlendFunc::read(DataInputStream* in){ ((ive::Object*)(obj))->read(in); } else - throw Exception("BlendFunc::read(): Could not cast this osg::BlendFunc to an osg::Object."); + in_THROW_EXCEPTION("BlendFunc::read(): Could not cast this osg::BlendFunc to an osg::Object."); // Read BlendFunc's properties // Read source @@ -78,6 +78,6 @@ void BlendFunc::read(DataInputStream* in){ } else{ - throw Exception("BlendFunc::read(): Expected BlendFunc identification."); + in_THROW_EXCEPTION("BlendFunc::read(): Expected BlendFunc identification."); } } diff --git a/src/osgPlugins/ive/BlinkSequence.cpp b/src/osgPlugins/ive/BlinkSequence.cpp index 4b876cc16..3ab1d7712 100644 --- a/src/osgPlugins/ive/BlinkSequence.cpp +++ b/src/osgPlugins/ive/BlinkSequence.cpp @@ -26,7 +26,7 @@ void BlinkSequence::write(DataOutputStream* out){ ((ive::Object*)(obj))->write(out); } else - throw Exception("BlinkSequence::write(): Could not cast this osgSim::BlinkSequence to an osg::Object."); + out_THROW_EXCEPTION("BlinkSequence::write(): Could not cast this osgSim::BlinkSequence to an osg::Object."); // Write BlinkSequence's properties. @@ -62,7 +62,7 @@ void BlinkSequence::read(DataInputStream* in){ ((ive::Object*)(obj))->read(in); } else - throw Exception("BlinkSequence::read(): Could not cast this osgSim::BlinkSequence to an osg::Object."); + in_THROW_EXCEPTION("BlinkSequence::read(): Could not cast this osgSim::BlinkSequence to an osg::Object."); // Read BlinkSequence's properties // Read in pulse data. @@ -81,6 +81,6 @@ void BlinkSequence::read(DataInputStream* in){ } else{ - throw Exception("BlinkSequence::read(): Expected BlinkSequence identification."); + in_THROW_EXCEPTION("BlinkSequence::read(): Expected BlinkSequence identification."); } } diff --git a/src/osgPlugins/ive/BumpMapping.cpp b/src/osgPlugins/ive/BumpMapping.cpp index fa24d27c6..d9b7c3271 100644 --- a/src/osgPlugins/ive/BumpMapping.cpp +++ b/src/osgPlugins/ive/BumpMapping.cpp @@ -26,7 +26,7 @@ void BumpMapping::write(DataOutputStream* out){ ((ive::Effect*)(effect))->write(out); } else - throw Exception("BumpMapping::write(): Could not cast this osgFX::BumpMapping to an osgFX::Effect."); + out_THROW_EXCEPTION("BumpMapping::write(): Could not cast this osgFX::BumpMapping to an osgFX::Effect."); // Write BumpMapping's properties. out->writeInt(getLightNumber()); @@ -53,7 +53,7 @@ void BumpMapping::read(DataInputStream* in){ ((ive::Effect*)(effect))->read(in); } else - throw Exception("BumpMapping::read(): Could not cast this osgFX::BumpMapping to an osgFX::Effect."); + in_THROW_EXCEPTION("BumpMapping::read(): Could not cast this osgFX::BumpMapping to an osgFX::Effect."); // Read BumpMapping's properties setLightNumber(in->readInt()); @@ -69,6 +69,6 @@ void BumpMapping::read(DataInputStream* in){ setOverrideNormalMapTexture(tex); } else{ - throw Exception("BumpMapping::read(): Expected BumpMapping identification."); + in_THROW_EXCEPTION("BumpMapping::read(): Expected BumpMapping identification."); } } diff --git a/src/osgPlugins/ive/Camera.cpp b/src/osgPlugins/ive/Camera.cpp index 9b4db814b..2d3e860b5 100644 --- a/src/osgPlugins/ive/Camera.cpp +++ b/src/osgPlugins/ive/Camera.cpp @@ -29,7 +29,7 @@ void Camera::write(DataOutputStream* out){ ((ive::Transform*)(transform))->write(out); } else - throw Exception("Camera::write(): Could not cast this osg::Camera to an osg::Group."); + out_THROW_EXCEPTION("Camera::write(): Could not cast this osg::Camera to an osg::Group."); out->writeVec4(getClearColor()); @@ -103,7 +103,7 @@ void Camera::read(DataInputStream* in) ((ive::Transform*)(transform))->read(in); } else - throw Exception("Camera::read(): Could not cast this osg::Camera to an osg::Group."); + in_THROW_EXCEPTION("Camera::read(): Could not cast this osg::Camera to an osg::Group."); setClearColor(in->readVec4()); setClearMask(in->readUInt()); @@ -177,6 +177,6 @@ void Camera::read(DataInputStream* in) } } else{ - throw Exception("Camera::read(): Expected Camera identification"); + in_THROW_EXCEPTION("Camera::read(): Expected Camera identification"); } } diff --git a/src/osgPlugins/ive/CameraView.cpp b/src/osgPlugins/ive/CameraView.cpp index 60eac4958..a8f213bc8 100644 --- a/src/osgPlugins/ive/CameraView.cpp +++ b/src/osgPlugins/ive/CameraView.cpp @@ -29,7 +29,7 @@ void CameraView::write(DataOutputStream* out) ((ive::Transform*)(trans))->write(out); } else - throw Exception("CameraView::write(): Could not cast this osg::CameraView to an osg::Transform."); + out_THROW_EXCEPTION("CameraView::write(): Could not cast this osg::CameraView to an osg::Transform."); // Write CameraView's properties. out->writeVec3(getPosition()); @@ -53,7 +53,7 @@ void CameraView::read(DataInputStream* in){ ((ive::Transform*)(trans))->read(in); } else - throw Exception("CameraView::read(): Could not cast this osg::CameraView to an osg::Transform."); + in_THROW_EXCEPTION("CameraView::read(): Could not cast this osg::CameraView to an osg::Transform."); // Read CameraView's properties setPosition(in->readVec3()); @@ -64,6 +64,6 @@ void CameraView::read(DataInputStream* in){ } else { - throw Exception("CameraView::read(): Expected CameraView identification."); + in_THROW_EXCEPTION("CameraView::read(): Expected CameraView identification."); } } diff --git a/src/osgPlugins/ive/Cartoon.cpp b/src/osgPlugins/ive/Cartoon.cpp index 44c946fd4..b408a63ad 100644 --- a/src/osgPlugins/ive/Cartoon.cpp +++ b/src/osgPlugins/ive/Cartoon.cpp @@ -25,7 +25,7 @@ void Cartoon::write(DataOutputStream* out){ ((ive::Effect*)(effect))->write(out); } else - throw Exception("Cartoon::write(): Could not cast this osgFX::Cartoon to an osgFX::Effect."); + out_THROW_EXCEPTION("Cartoon::write(): Could not cast this osgFX::Cartoon to an osgFX::Effect."); // Write Cartoon's properties. out->writeVec4(getOutlineColor()); @@ -46,7 +46,7 @@ void Cartoon::read(DataInputStream* in){ ((ive::Effect*)(effect))->read(in); } else - throw Exception("Cartoon::read(): Could not cast this osgFX::Cartoon to an osgFX::Effect."); + in_THROW_EXCEPTION("Cartoon::read(): Could not cast this osgFX::Cartoon to an osgFX::Effect."); // Read Cartoon's properties setOutlineColor(in->readVec4()); @@ -54,6 +54,6 @@ void Cartoon::read(DataInputStream* in){ setLightNumber(in->readInt()); } else{ - throw Exception("Cartoon::read(): Expected Cartoon identification."); + in_THROW_EXCEPTION("Cartoon::read(): Expected Cartoon identification."); } } diff --git a/src/osgPlugins/ive/ClipNode.cpp b/src/osgPlugins/ive/ClipNode.cpp index b9afe6682..8b042742e 100644 --- a/src/osgPlugins/ive/ClipNode.cpp +++ b/src/osgPlugins/ive/ClipNode.cpp @@ -29,7 +29,7 @@ void ClipNode::write(DataOutputStream* out){ ((ive::Group*)(group))->write(out); } else - throw Exception("ClipNode::write(): Could not cast this osg::ClipNode to an osg::Group."); + out_THROW_EXCEPTION("ClipNode::write(): Could not cast this osg::ClipNode to an osg::Group."); // Write ClipNode's properties. if ( out->getVersion() >= VERSION_0037 ) @@ -58,7 +58,7 @@ void ClipNode::read(DataInputStream* in){ ((ive::Group*)(group))->read(in); } else - throw Exception("ClipNode::read(): Could not cast this osg::ClipNode to an osg::Object."); + in_THROW_EXCEPTION("ClipNode::read(): Could not cast this osg::ClipNode to an osg::Object."); // Read ClipNode's properties if ( in->getVersion() >= VERSION_0037 ) @@ -77,6 +77,6 @@ void ClipNode::read(DataInputStream* in){ } else{ - throw Exception("ClipNode::read(): Expected ClipNode identification."); + in_THROW_EXCEPTION("ClipNode::read(): Expected ClipNode identification."); } } diff --git a/src/osgPlugins/ive/ClipPlane.cpp b/src/osgPlugins/ive/ClipPlane.cpp index b3f86d19c..b9bf32b44 100644 --- a/src/osgPlugins/ive/ClipPlane.cpp +++ b/src/osgPlugins/ive/ClipPlane.cpp @@ -27,7 +27,7 @@ void ClipPlane::write(DataOutputStream* out){ if(obj) ((ive::Object*)(obj))->write(out); else - throw Exception("ClipPlane::write(): Could not cast this osg::ClipPlane to an osg::Object."); + out_THROW_EXCEPTION("ClipPlane::write(): Could not cast this osg::ClipPlane to an osg::Object."); // write ClipPlane's properties @@ -51,13 +51,13 @@ void ClipPlane::read(DataInputStream* in){ if(obj) ((ive::Object*)(obj))->read(in); else - throw Exception("ClipPlane::read(): Could not cast this osg::ClipPlane to an osg::Object."); + in_THROW_EXCEPTION("ClipPlane::read(): Could not cast this osg::ClipPlane to an osg::Object."); setClipPlane(in->readVec4d()); setClipPlaneNum(in->readUInt()); } else{ - throw Exception("ClipPlane::read(): Expected ClipPlane identification."); + in_THROW_EXCEPTION("ClipPlane::read(): Expected ClipPlane identification."); } } diff --git a/src/osgPlugins/ive/ClusterCullingCallback.cpp b/src/osgPlugins/ive/ClusterCullingCallback.cpp index 060af4d32..57b6e5927 100644 --- a/src/osgPlugins/ive/ClusterCullingCallback.cpp +++ b/src/osgPlugins/ive/ClusterCullingCallback.cpp @@ -29,7 +29,7 @@ void ClusterCullingCallback::write(DataOutputStream* out) ((ive::Object*)(obj))->write(out); } else - throw Exception("ClusterCullingCallback::write(): Could not cast this osg::ClusterCullingCallback to an osg::Object."); + out_THROW_EXCEPTION("ClusterCullingCallback::write(): Could not cast this osg::ClusterCullingCallback to an osg::Object."); // Write ClusterCullingCallback's properties. out->writeVec3(_controlPoint); @@ -53,7 +53,7 @@ void ClusterCullingCallback::read(DataInputStream* in) ((ive::Object*)(obj))->read(in); } else - throw Exception("ClusterCullingCallback::read(): Could not cast this osg::ClusterCullingCallback to an osg::Object."); + in_THROW_EXCEPTION("ClusterCullingCallback::read(): Could not cast this osg::ClusterCullingCallback to an osg::Object."); // Read ClusterCullingCallback's properties @@ -65,6 +65,6 @@ void ClusterCullingCallback::read(DataInputStream* in) } else { - throw Exception("ClusterCullingCallback::read(): Expected ClusterCullingCallback identification."); + in_THROW_EXCEPTION("ClusterCullingCallback::read(): Expected ClusterCullingCallback identification."); } } diff --git a/src/osgPlugins/ive/ColorMask.cpp b/src/osgPlugins/ive/ColorMask.cpp index c844e3516..9e1da988c 100644 --- a/src/osgPlugins/ive/ColorMask.cpp +++ b/src/osgPlugins/ive/ColorMask.cpp @@ -27,7 +27,7 @@ void ColorMask::write(DataOutputStream* out){ ((ive::Object*)(obj))->write(out); } else - throw Exception("ColorMask::write(): Could not cast this osg::ColorMask to an osg::Object."); + out_THROW_EXCEPTION("ColorMask::write(): Could not cast this osg::ColorMask to an osg::Object."); // Write ColorMask's properties. out->writeBool(getRedMask()); @@ -48,7 +48,7 @@ void ColorMask::read(DataInputStream* in){ ((ive::Object*)(obj))->read(in); } else - throw Exception("ColorMask::read(): Could not cast this osg::ColorMask to an osg::Object."); + in_THROW_EXCEPTION("ColorMask::read(): Could not cast this osg::ColorMask to an osg::Object."); // Read ColorMask's properties setRedMask(in->readBool()); @@ -57,6 +57,6 @@ void ColorMask::read(DataInputStream* in){ setAlphaMask(in->readBool()); } else{ - throw Exception("ColorMask::read(): Expected ColorMask identification."); + in_THROW_EXCEPTION("ColorMask::read(): Expected ColorMask identification."); } } diff --git a/src/osgPlugins/ive/CompositeLayer.cpp b/src/osgPlugins/ive/CompositeLayer.cpp index 9c0a272e9..2e83256c6 100644 --- a/src/osgPlugins/ive/CompositeLayer.cpp +++ b/src/osgPlugins/ive/CompositeLayer.cpp @@ -27,7 +27,7 @@ void CompositeLayer::write(DataOutputStream* out) if (layer) ((ive::Layer*)(layer))->write(out); else - throw Exception("CompositeLayer::write(): Could not cast this osgLayer::CompositeLayer to an osgTerrain::Layer."); + out_THROW_EXCEPTION("CompositeLayer::write(): Could not cast this osgLayer::CompositeLayer to an osgTerrain::Layer."); LayerHelper helper; @@ -52,7 +52,7 @@ void CompositeLayer::read(DataInputStream* in) // Peek on Layer's identification. int id = in->peekInt(); if (id != IVECOMPOSITELAYER) - throw Exception("CompositeLayer::read(): Expected CompositeLayer identification."); + in_THROW_EXCEPTION("CompositeLayer::read(): Expected CompositeLayer identification."); // Read Layer's identification. id = in->readInt(); @@ -62,7 +62,7 @@ void CompositeLayer::read(DataInputStream* in) if (layer) ((ive::Layer*)(layer))->read(in); else - throw Exception("CompositeLayer::read(): Could not cast this osgLayer::Layer to an osg::Group."); + in_THROW_EXCEPTION("CompositeLayer::read(): Could not cast this osgLayer::Layer to an osg::Group."); LayerHelper helper; diff --git a/src/osgPlugins/ive/ConeSector.cpp b/src/osgPlugins/ive/ConeSector.cpp index 344cd272c..c00e72a87 100644 --- a/src/osgPlugins/ive/ConeSector.cpp +++ b/src/osgPlugins/ive/ConeSector.cpp @@ -38,6 +38,6 @@ void ConeSector::read(DataInputStream* in){ setAngle(angle, fadeangle); } else{ - throw Exception("ConeSector::read(): Expected ConeSector identification."); + in_THROW_EXCEPTION("ConeSector::read(): Expected ConeSector identification."); } } diff --git a/src/osgPlugins/ive/ConvexPlanarOccluder.cpp b/src/osgPlugins/ive/ConvexPlanarOccluder.cpp index df41650df..f44f1ccd7 100644 --- a/src/osgPlugins/ive/ConvexPlanarOccluder.cpp +++ b/src/osgPlugins/ive/ConvexPlanarOccluder.cpp @@ -28,7 +28,7 @@ void ConvexPlanarOccluder::write(DataOutputStream* out){ ((ive::Object*)(obj))->write(out); } else - throw Exception("ConvexPlanarOccluder::write(): Could not cast this osg::ConvexPlanarOccluder to an osg::Object."); + out_THROW_EXCEPTION("ConvexPlanarOccluder::write(): Could not cast this osg::ConvexPlanarOccluder to an osg::Object."); // Write ConvexPlanarOccluder's properties. // Write planar polygon occluder. @@ -55,7 +55,7 @@ void ConvexPlanarOccluder::read(DataInputStream* in){ ((ive::Object*)(obj))->read(in); } else - throw Exception("ConvexPlanarOccluder::read(): Could not cast this osg::ConvexPlanarOccluder to an osg::Object."); + in_THROW_EXCEPTION("ConvexPlanarOccluder::read(): Could not cast this osg::ConvexPlanarOccluder to an osg::Object."); // Read ConvexPlanarOccluder's properties // Read planar polygon occluder. @@ -72,6 +72,6 @@ void ConvexPlanarOccluder::read(DataInputStream* in){ } else{ - throw Exception("ConvexPlanarOccluder::read(): Expected ConvexPlanarOccluder identification."); + in_THROW_EXCEPTION("ConvexPlanarOccluder::read(): Expected ConvexPlanarOccluder identification."); } } diff --git a/src/osgPlugins/ive/ConvexPlanarPolygon.cpp b/src/osgPlugins/ive/ConvexPlanarPolygon.cpp index cae2883af..c64a6e59c 100644 --- a/src/osgPlugins/ive/ConvexPlanarPolygon.cpp +++ b/src/osgPlugins/ive/ConvexPlanarPolygon.cpp @@ -26,7 +26,7 @@ void ConvexPlanarPolygon::write(DataOutputStream* out){ // ((ive::Object*)(obj))->write(out); //} //else - // throw Exception("ConvexPlanarPolygon::write(): Could not cast this osg::ConvexPlanarPolygon to an osg::Object."); + // in_THROW_EXCEPTION("ConvexPlanarPolygon::write(): Could not cast this osg::ConvexPlanarPolygon to an osg::Object."); // Write ConvexPlanarPolygon's properties. // Write Vertex list @@ -51,7 +51,7 @@ void ConvexPlanarPolygon::read(DataInputStream* in){ // ((ive::Object*)(obj))->read(in); //} //else - // throw Exception("ConvexPlanarPolygon::read(): Could not cast this osg::ConvexPlanarPolygon to an osg::Object."); + // in_THROW_EXCEPTION("ConvexPlanarPolygon::read(): Could not cast this osg::ConvexPlanarPolygon to an osg::Object."); // Read ConvexPlanarPolygon's properties // Read Vertex list @@ -62,6 +62,6 @@ void ConvexPlanarPolygon::read(DataInputStream* in){ } else{ - throw Exception("ConvexPlanarPolygon::read(): Expected ConvexPlanarPolygon identification."); + in_THROW_EXCEPTION("ConvexPlanarPolygon::read(): Expected ConvexPlanarPolygon identification."); } } diff --git a/src/osgPlugins/ive/CoordinateSystemNode.cpp b/src/osgPlugins/ive/CoordinateSystemNode.cpp index 514e4ad58..c867189ff 100644 --- a/src/osgPlugins/ive/CoordinateSystemNode.cpp +++ b/src/osgPlugins/ive/CoordinateSystemNode.cpp @@ -29,17 +29,17 @@ void CoordinateSystemNode::write(DataOutputStream* out) ((ive::Group*)(group))->write(out); } else - throw Exception("CoordinateSystemNode::write(): Could not cast this osg::CoordinateSystemNode to an osg::Group."); + out_THROW_EXCEPTION("CoordinateSystemNode::write(): Could not cast this osg::CoordinateSystemNode to an osg::Group."); // Write CoordinateSystemNode's properties. - out->writeString(getFormat()); - out->writeString(getCoordinateSystem()); + out->writeString(getFormat()); + out->writeString(getCoordinateSystem()); - out->writeBool(getEllipsoidModel()!=0); - if(getEllipsoidModel()) - { - ((ive::EllipsoidModel*)(getEllipsoidModel()))->write(out); - } + out->writeBool(getEllipsoidModel()!=0); + if(getEllipsoidModel()) + { + ((ive::EllipsoidModel*)(getEllipsoidModel()))->write(out); + } } @@ -56,7 +56,7 @@ void CoordinateSystemNode::read(DataInputStream* in){ ((ive::Group*)(group))->read(in); } else - throw Exception("CoordinateSystemNode::read(): Could not cast this osg::CoordinateSystemNode to an osg::Group."); + in_THROW_EXCEPTION("CoordinateSystemNode::read(): Could not cast this osg::CoordinateSystemNode to an osg::Group."); // Read CoordinateSystemNode's properties // Read format string @@ -75,6 +75,6 @@ void CoordinateSystemNode::read(DataInputStream* in){ } else{ - throw Exception("CoordinateSystemNode::read(): Expected CoordinateSystemNode identification."); + in_THROW_EXCEPTION("CoordinateSystemNode::read(): Expected CoordinateSystemNode identification."); } } diff --git a/src/osgPlugins/ive/CullFace.cpp b/src/osgPlugins/ive/CullFace.cpp index d3efdbbdb..087ea184b 100644 --- a/src/osgPlugins/ive/CullFace.cpp +++ b/src/osgPlugins/ive/CullFace.cpp @@ -27,7 +27,7 @@ void CullFace::write(DataOutputStream* out){ ((ive::Object*)(obj))->write(out); } else - throw Exception("CullFace::write(): Could not cast this osg::CullFace to an osg::Object."); + out_THROW_EXCEPTION("CullFace::write(): Could not cast this osg::CullFace to an osg::Object."); // Write CullFace's properties. out->writeInt(getMode()); } @@ -44,11 +44,11 @@ void CullFace::read(DataInputStream* in){ ((ive::Object*)(obj))->read(in); } else - throw Exception("CullFace::read(): Could not cast this osg::CullFace to an osg::Object."); + in_THROW_EXCEPTION("CullFace::read(): Could not cast this osg::CullFace to an osg::Object."); // Read CullFace's properties setMode((osg::CullFace::Mode)in->readInt()); } else{ - throw Exception("CullFace::read(): Expected CullFace identification."); + in_THROW_EXCEPTION("CullFace::read(): Expected CullFace identification."); } } diff --git a/src/osgPlugins/ive/DOFTransform.cpp b/src/osgPlugins/ive/DOFTransform.cpp index 9358b85cd..298a5c105 100644 --- a/src/osgPlugins/ive/DOFTransform.cpp +++ b/src/osgPlugins/ive/DOFTransform.cpp @@ -26,7 +26,7 @@ void DOFTransform::write(DataOutputStream* out){ ((ive::Transform*)(trans))->write(out); } else - throw Exception("DOFTransform::write(): Could not cast this osg::DOFTransform to an osg::Transform."); + out_THROW_EXCEPTION("DOFTransform::write(): Could not cast this osg::DOFTransform to an osg::Transform."); // Write DOFTransform's properties. out->writeMatrixd(getPutMatrix()); @@ -67,7 +67,7 @@ void DOFTransform::read(DataInputStream* in){ ((ive::Transform*)(trans))->read(in); } else - throw Exception("DOFTransform::read(): Could not cast this osg::DOFTransform to an osg::Transform."); + in_THROW_EXCEPTION("DOFTransform::read(): Could not cast this osg::DOFTransform to an osg::Transform."); // Read DOFTransform's properties setPutMatrix(in->readMatrixd()); @@ -97,6 +97,6 @@ void DOFTransform::read(DataInputStream* in){ setAnimationOn(in->readBool()); } else{ - throw Exception("DOFTransform::read(): Expected DOFTransform identification."); + in_THROW_EXCEPTION("DOFTransform::read(): Expected DOFTransform identification."); } } diff --git a/src/osgPlugins/ive/DataInputStream.cpp b/src/osgPlugins/ive/DataInputStream.cpp index 79590a5ca..b6bcfdb6d 100644 --- a/src/osgPlugins/ive/DataInputStream.cpp +++ b/src/osgPlugins/ive/DataInputStream.cpp @@ -157,7 +157,7 @@ DataInputStream::DataInputStream(std::istream* istream, const osgDB::ReaderWrite } if(!istream){ - throw Exception("DataInputStream::DataInputStream(): null pointer exception in argument."); + throwException("DataInputStream::DataInputStream(): null pointer exception in argument."); } endianType = readUInt() ; @@ -165,7 +165,7 @@ DataInputStream::DataInputStream(std::istream* istream, const osgDB::ReaderWrite if ( endianType != ENDIAN_TYPE) { // Make sure the file is simply swapped if ( endianType != OPPOSITE_ENDIAN_TYPE ) { - throw Exception("DataInputStream::DataInputStream(): This file has an unreadable endian type.") ; + throwException("DataInputStream::DataInputStream(): This file has an unreadable endian type.") ; } osg::notify(osg::INFO)<<"DataInputStream::DataInputStream: Reading a byteswapped file" << std::endl ; _byteswap = 1 ; @@ -175,7 +175,7 @@ DataInputStream::DataInputStream(std::istream* istream, const osgDB::ReaderWrite // Are we trying to open a binary .ive file which version are newer than this library. if(_version>VERSION){ - throw Exception("DataInputStream::DataInputStream(): The version found in the file is newer than this library can handle."); + throwException("DataInputStream::DataInputStream(): The version found in the file is newer than this library can handle."); } if (_version>=VERSION_0033) @@ -193,7 +193,8 @@ DataInputStream::DataInputStream(std::istream* istream, const osgDB::ReaderWrite if (!uncompress(*istream, data)) { - throw Exception("Error in uncompressing .ive"); + throwException("Error in uncompressing .ive"); + return; } _istream = new std::stringstream(data); @@ -292,7 +293,7 @@ bool DataInputStream::readBool(){ _istream->read(&c, CHARSIZE); if (_istream->rdstate() & _istream->failbit) - throw Exception("DataInputStream::readBool(): Failed to read boolean value."); + throwException("DataInputStream::readBool(): Failed to read boolean value."); if (_verboseOutput) std::cout<<"read/writeBool() ["<<(int)c<<"]"<read(&c, CHARSIZE); if (_istream->rdstate() & _istream->failbit) - throw Exception("DataInputStream::readChar(): Failed to read char value."); + throwException("DataInputStream::readChar(): Failed to read char value."); if (_verboseOutput) std::cout<<"read/writeChar() ["<<(int)c<<"]"<read((char*)&c, CHARSIZE); if (_istream->rdstate() & _istream->failbit) - throw Exception("DataInputStream::readUChar(): Failed to read unsigned char value."); + throwException("DataInputStream::readUChar(): Failed to read unsigned char value."); if (_verboseOutput) std::cout<<"read/writeUChar() ["<<(int)c<<"]"<read((char*)&s, SHORTSIZE); if (_istream->rdstate() & _istream->failbit) - throw Exception("DataInputStream::readUShort(): Failed to read unsigned short value."); + throwException("DataInputStream::readUShort(): Failed to read unsigned short value."); if (_verboseOutput) std::cout<<"read/writeUShort() ["<read((char*)&s, INTSIZE); if (_istream->rdstate() & _istream->failbit) - throw Exception("DataInputStream::readUInt(): Failed to read unsigned int value."); + throwException("DataInputStream::readUInt(): Failed to read unsigned int value."); if (_byteswap) osg::swapBytes((char *)&s,INTSIZE) ; @@ -362,7 +363,7 @@ int DataInputStream::readInt(){ // premature exit when reading .ive files under OSX!#?:! // Robet Osfield, September 12th 2003. // if (_istream->rdstate() & _istream->failbit) - // throw Exception("DataInputStream::readInt(): Failed to read int value."); + // throwException("DataInputStream::readInt(): Failed to read int value."); if (_byteswap) osg::swapBytes((char *)&i,INTSIZE) ; @@ -390,7 +391,7 @@ float DataInputStream::readFloat(){ float f; _istream->read((char*)&f, FLOATSIZE); if (_istream->rdstate() & _istream->failbit) - throw Exception("DataInputStream::readFloat(): Failed to read float value."); + throwException("DataInputStream::readFloat(): Failed to read float value."); if (_byteswap) osg::swapBytes((char *)&f,FLOATSIZE) ; @@ -402,7 +403,7 @@ long DataInputStream::readLong(){ long l; _istream->read((char*)&l, LONGSIZE); if (_istream->rdstate() & _istream->failbit) - throw Exception("DataInputStream::readLong(): Failed to read long value."); + throwException("DataInputStream::readLong(): Failed to read long value."); if (_byteswap) osg::swapBytes((char *)&l,LONGSIZE) ; @@ -414,7 +415,7 @@ unsigned long DataInputStream::readULong(){ unsigned long l; _istream->read((char*)&l, LONGSIZE); if (_istream->rdstate() & _istream->failbit) - throw Exception("DataInputStream::readULong(): Failed to read unsigned long value."); + throwException("DataInputStream::readULong(): Failed to read unsigned long value."); if (_byteswap) osg::swapBytes((char *)&l,LONGSIZE) ; @@ -428,7 +429,7 @@ double DataInputStream::readDouble() double d; _istream->read((char*)&d, DOUBLESIZE); if (_istream->rdstate() & _istream->failbit) - throw Exception("DataInputStream::readDouble(): Failed to read double value."); + throwException("DataInputStream::readDouble(): Failed to read double value."); if (_byteswap) osg::swapBytes((char *)&d,DOUBLESIZE) ; if (_verboseOutput) std::cout<<"read/writeDouble() ["<read((char*)s.c_str(), size); //if (_istream->rdstate() & _istream->failbit) - // throw Exception("DataInputStream::readString(): Failed to read string value."); + // throwException("DataInputStream::readString(): Failed to read string value."); if (_verboseOutput) std::cout<<"read/writeString() ["<read(data, size); if (_istream->rdstate() & _istream->failbit) - throw Exception("DataInputStream::readCharArray(): Failed to read char value."); + throwException("DataInputStream::readCharArray(): Failed to read char value."); if (_verboseOutput) std::cout<<"read/writeCharArray() ["< a = new osg::IntArray(size); _istream->read((char*)&((*a)[0]), INTSIZE*size); if (_istream->rdstate() & _istream->failbit) - throw Exception("DataInputStream::readIntArray(): Failed to read Int array."); + { + throwException("DataInputStream::readIntArray(): Failed to read Int array."); + return 0; + } if (_verboseOutput) std::cout<<"read/writeIntArray() ["< a = new osg::UByteArray(size); _istream->read((char*)&((*a)[0]), CHARSIZE*size); if (_istream->rdstate() & _istream->failbit) - throw Exception("DataInputStream::readUByteArray(): Failed to read UByte array."); + { + throwException("DataInputStream::readUByteArray(): Failed to read UByte array."); + return 0; + } if (_verboseOutput) std::cout<<"read/writeUByteArray() ["< a = new osg::UShortArray(size); _istream->read((char*)&((*a)[0]), SHORTSIZE*size); if (_istream->rdstate() & _istream->failbit) - throw Exception("DataInputStream::readUShortArray(): Failed to read UShort array."); + { + throwException("DataInputStream::readUShortArray(): Failed to read UShort array."); + return 0; + } if (_verboseOutput) std::cout<<"read/writeUShortArray() ["< a = new osg::UIntArray(size); _istream->read((char*)&((*a)[0]), INTSIZE*size); if (_istream->rdstate() & _istream->failbit) - throw Exception("DataInputStream::readUIntArray(): Failed to read UInt array."); + { + throwException("DataInputStream::readUIntArray(): Failed to read UInt array."); + return 0; + } if (_verboseOutput) std::cout<<"read/writeUIntArray() ["< a = new osg::Vec4ubArray(size); _istream->read((char*)&((*a)[0]), INTSIZE*size); if (_istream->rdstate() & _istream->failbit) - throw Exception("DataInputStream::readVec4ubArray(): Failed to read Vec4ub array."); + { + throwException("DataInputStream::readVec4ubArray(): Failed to read Vec4ub array."); + return 0; + } if (_verboseOutput) std::cout<<"read/writeVec4ubArray() ["<rdstate() & _istream->failbit) - throw Exception("DataInputStream::readFloatArray(): Failed to read float array."); + { + throwException("DataInputStream::readFloatArray(): Failed to read float array."); + return false; + } if (_verboseOutput) std::cout<<"read/writeFloatArray() ["< a = new osg::FloatArray(size); _istream->read((char*)&((*a)[0]), FLOATSIZE*size); if (_istream->rdstate() & _istream->failbit) - throw Exception("DataInputStream::readFloatArray(): Failed to read float array."); + { + throwException("DataInputStream::readFloatArray(): Failed to read float array."); + return 0; + } if (_verboseOutput) std::cout<<"read/writeFloatArray() ["< a = new osg::Vec2Array(size); _istream->read((char*)&((*a)[0]), FLOATSIZE*2*size); if (_istream->rdstate() & _istream->failbit) - throw Exception("DataInputStream::readVec2Array(): Failed to read Vec2 array."); + { + throwException("DataInputStream::readVec2Array(): Failed to read Vec2 array."); + return 0; + } if (_verboseOutput) std::cout<<"read/writeVec2Array() ["< a = new osg::Vec3Array(size); _istream->read((char*)&((*a)[0]), FLOATSIZE*3*size); if (_istream->rdstate() & _istream->failbit) - throw Exception("DataInputStream::readVec3Array(): Failed to read Vec3 array."); + { + throwException("DataInputStream::readVec3Array(): Failed to read Vec3 array."); + return 0; + } if (_verboseOutput) std::cout<<"read/writeVec3Array() ["< a = new osg::Vec4Array(size); _istream->read((char*)&((*a)[0]), FLOATSIZE*4*size); if (_istream->rdstate() & _istream->failbit) - throw Exception("DataInputStream::readVec4Array(): Failed to read Vec4 array."); + { + throwException("DataInputStream::readVec4Array(): Failed to read Vec4 array."); + return 0; + } if (_verboseOutput) std::cout<<"read/writeVec4Array() ["< a = new osg::Vec2bArray(size); _istream->read((char*)&((*a)[0]), CHARSIZE * 2 * size); if (_istream->rdstate() & _istream->failbit) - throw Exception("DataInputStream::readVec2bArray(): Failed to read Vec2b array."); + { + throwException("DataInputStream::readVec2bArray(): Failed to read Vec2b array."); + return 0; + } if (_verboseOutput) std::cout<<"read/writeVec2bArray() ["< a = new osg::Vec3bArray(size); _istream->read((char*)&((*a)[0]), CHARSIZE * 3 * size); if (_istream->rdstate() & _istream->failbit) - throw Exception("DataInputStream::readVec3bArray(): Failed to read Vec3b array."); + { + throwException("DataInputStream::readVec3bArray(): Failed to read Vec3b array."); + return 0; + } if (_verboseOutput) std::cout<<"read/writeVec3bArray() ["< a = new osg::Vec4bArray(size); _istream->read((char*)&((*a)[0]), CHARSIZE * 4 * size); if (_istream->rdstate() & _istream->failbit) - throw Exception("DataInputStream::readVec4bArray(): Failed to read Vec4b array."); + { + throwException("DataInputStream::readVec4bArray(): Failed to read Vec4b array."); + return 0; + } if (_verboseOutput) std::cout<<"read/writeVec4bArray() ["< a = new osg::Vec2sArray(size); _istream->read((char*)&((*a)[0]), SHORTSIZE * 2 * size); if (_istream->rdstate() & _istream->failbit) - throw Exception("DataInputStream::readVec2sArray(): Failed to read Vec2s array."); + { + throwException("DataInputStream::readVec2sArray(): Failed to read Vec2s array."); + return 0; + } if (_verboseOutput) std::cout<<"read/writeVec2sArray() ["< a = new osg::Vec3sArray(size); _istream->read((char*)&((*a)[0]), SHORTSIZE * 3 * size); if (_istream->rdstate() & _istream->failbit) - throw Exception("DataInputStream::readVec3sArray(): Failed to read Vec3s array."); + { + throwException("DataInputStream::readVec3sArray(): Failed to read Vec3s array."); + return 0; + } if (_verboseOutput) std::cout<<"read/writeVec3sArray() ["< a = new osg::Vec4sArray(size); _istream->read((char*)&((*a)[0]), SHORTSIZE * 4 * size); if (_istream->rdstate() & _istream->failbit) - throw Exception("DataInputStream::readVec4sArray(): Failed to read Vec4s array."); + { + throwException("DataInputStream::readVec4sArray(): Failed to read Vec4s array."); + return 0; + } if (_verboseOutput) std::cout<<"read/writeVec4sArray() ["< a = new osg::Vec2dArray(size); _istream->read((char*)&((*a)[0]), DOUBLESIZE*2*size); if (_istream->rdstate() & _istream->failbit) - throw Exception("DataInputStream::readVec2dArray(): Failed to read Vec2d array."); + { + throwException("DataInputStream::readVec2dArray(): Failed to read Vec2d array."); + return 0; + } if (_verboseOutput) std::cout<<"read/writeVec2dArray() ["< a = new osg::Vec3dArray(size); _istream->read((char*)&((*a)[0]), DOUBLESIZE*3*size); if (_istream->rdstate() & _istream->failbit) - throw Exception("DataInputStream::readVec3dArray(): Failed to read Vec3d array."); + { + throwException("DataInputStream::readVec3dArray(): Failed to read Vec3d array."); + return 0; + } if (_verboseOutput) std::cout<<"read/writeVec3dArray() ["< a = new osg::Vec4dArray(size); _istream->read((char*)&((*a)[0]), DOUBLESIZE*4*size); if (_istream->rdstate() & _istream->failbit) - throw Exception("DataInputStream::readVec4dArray(): Failed to read Vec4d array."); + { + throwException("DataInputStream::readVec4dArray(): Failed to read Vec4d array."); + return 0; + } if (_verboseOutput) std::cout<<"read/writeVec4dArray() ["<rdstate() & _istream->failbit) - throw Exception("DataInputStream::readMatrix(): Failed to read Matrix array."); + { + throwException("DataInputStream::readMatrix(): Failed to read Matrix array."); + return osg::Matrixf(); + } if (_verboseOutput) std::cout<<"read/writeMatrix() ["<rdstate() & _istream->failbit) - throw Exception("DataInputStream::readMatrix(): Failed to read Matrix array."); + { + throwException("DataInputStream::readMatrix(): Failed to read Matrix array."); + return osg::Matrixd(); + } if (_verboseOutput) std::cout<<"read/writeMatrix() ["< stateset = new osg::StateSet(); // read its properties from stream - ((ive::StateSet*)(stateset))->read(this); + ((ive::StateSet*)(stateset.get()))->read(this); + + // exit early if an exception has been set. + if (getException()) return 0; // and add it to the stateset map, _statesetMap[id] = stateset; @@ -1260,7 +1346,7 @@ osg::StateSet* DataInputStream::readStateSet() if (_verboseOutput) std::cout<<"read/writeStateSet() ["< attribute; int attributeID = peekInt(); if(attributeID == IVEALPHAFUNC){ attribute = new osg::AlphaFunc(); - ((ive::AlphaFunc*)(attribute))->read(this); + ((ive::AlphaFunc*)(attribute.get()))->read(this); } else if(attributeID == IVEBLENDCOLOR){ attribute = new osg::BlendColor(); - ((ive::BlendColor*)(attribute))->read(this); + ((ive::BlendColor*)(attribute.get()))->read(this); } else if(attributeID == IVEBLENDFUNC || attributeID == IVEBLENDFUNCSEPARATE){ attribute = new osg::BlendFunc(); - ((ive::BlendFunc*)(attribute))->read(this); + ((ive::BlendFunc*)(attribute.get()))->read(this); } else if(attributeID == IVEBLENDEQUATION){ attribute = new osg::BlendEquation(); - ((ive::BlendEquation*)(attribute))->read(this); + ((ive::BlendEquation*)(attribute.get()))->read(this); } else if(attributeID == IVEDEPTH){ attribute = new osg::Depth(); - ((ive::Depth*)(attribute))->read(this); + ((ive::Depth*)(attribute.get()))->read(this); } else if(attributeID == IVEVIEWPORT){ attribute = new osg::Viewport(); - ((ive::Viewport*)(attribute))->read(this); + ((ive::Viewport*)(attribute.get()))->read(this); } else if(attributeID == IVESCISSOR){ attribute = new osg::Scissor(); - ((ive::Scissor*)(attribute))->read(this); + ((ive::Scissor*)(attribute.get()))->read(this); } else if(attributeID == IVEMATERIAL){ attribute = new osg::Material(); - ((ive::Material*)(attribute))->read(this); + ((ive::Material*)(attribute.get()))->read(this); } else if(attributeID == IVECULLFACE){ attribute = new osg::CullFace(); - ((ive::CullFace*)(attribute))->read(this); + ((ive::CullFace*)(attribute.get()))->read(this); } else if(attributeID == IVECOLORMASK){ attribute = new osg::ColorMask(); - ((ive::ColorMask*)(attribute))->read(this); + ((ive::ColorMask*)(attribute.get()))->read(this); } else if(attributeID == IVECLIPPLANE){ attribute = new osg::ClipPlane(); - ((ive::ClipPlane*)(attribute))->read(this); + ((ive::ClipPlane*)(attribute.get()))->read(this); } else if(attributeID == IVEPOLYGONOFFSET){ attribute = new osg::PolygonOffset(); - ((ive::PolygonOffset*)(attribute))->read(this); + ((ive::PolygonOffset*)(attribute.get()))->read(this); } else if(attributeID == IVEPOLYGONMODE){ attribute = new osg::PolygonMode(); - ((ive::PolygonMode*)(attribute))->read(this); + ((ive::PolygonMode*)(attribute.get()))->read(this); } else if(attributeID == IVESHADEMODEL){ attribute = new osg::ShadeModel(); - ((ive::ShadeModel*)(attribute))->read(this); + ((ive::ShadeModel*)(attribute.get()))->read(this); } else if(attributeID == IVEPOINT){ attribute = new osg::Point(); - ((ive::Point*)(attribute))->read(this); + ((ive::Point*)(attribute.get()))->read(this); } else if(attributeID == IVELINEWIDTH){ attribute = new osg::LineWidth(); - ((ive::LineWidth*)(attribute))->read(this); + ((ive::LineWidth*)(attribute.get()))->read(this); } else if(attributeID == IVETEXTURE1D){ attribute = new osg::Texture1D(); - ((ive::Texture1D*)(attribute))->read(this); + ((ive::Texture1D*)(attribute.get()))->read(this); } else if(attributeID == IVETEXTURE2D){ attribute = new osg::Texture2D(); - ((ive::Texture2D*)(attribute))->read(this); + ((ive::Texture2D*)(attribute.get()))->read(this); } else if(attributeID == IVETEXTURE3D){ attribute = new osg::Texture3D(); - ((ive::Texture3D*)(attribute))->read(this); + ((ive::Texture3D*)(attribute.get()))->read(this); } else if(attributeID == IVETEXTURECUBEMAP){ attribute = new osg::TextureCubeMap(); - ((ive::TextureCubeMap*)(attribute))->read(this); + ((ive::TextureCubeMap*)(attribute.get()))->read(this); } else if(attributeID == IVETEXTURERECTANGLE){ attribute = new osg::TextureRectangle(); - ((ive::TextureRectangle*)(attribute))->read(this); + ((ive::TextureRectangle*)(attribute.get()))->read(this); } else if(attributeID == IVETEXENV){ attribute = new osg::TexEnv(); - ((ive::TexEnv*)(attribute))->read(this); + ((ive::TexEnv*)(attribute.get()))->read(this); } else if(attributeID == IVETEXENVCOMBINE){ attribute = new osg::TexEnvCombine(); - ((ive::TexEnvCombine*)(attribute))->read(this); + ((ive::TexEnvCombine*)(attribute.get()))->read(this); } else if(attributeID == IVETEXGEN){ attribute = new osg::TexGen(); - ((ive::TexGen*)(attribute))->read(this); + ((ive::TexGen*)(attribute.get()))->read(this); } else if(attributeID == IVETEXMAT){ attribute = new osg::TexMat(); - ((ive::TexMat*)(attribute))->read(this); + ((ive::TexMat*)(attribute.get()))->read(this); } else if(attributeID == IVEFRAGMENTPROGRAM){ attribute = new osg::FragmentProgram(); - ((ive::FragmentProgram*)(attribute))->read(this); + ((ive::FragmentProgram*)(attribute.get()))->read(this); } else if(attributeID == IVEVERTEXPROGRAM){ attribute = new osg::VertexProgram(); - ((ive::VertexProgram*)(attribute))->read(this); + ((ive::VertexProgram*)(attribute.get()))->read(this); } else if(attributeID == IVELIGHTMODEL){ attribute = new osg::LightModel(); - ((ive::LightModel*)(attribute))->read(this); + ((ive::LightModel*)(attribute.get()))->read(this); } else if(attributeID == IVEFRONTFACE){ attribute = new osg::FrontFace(); - ((ive::FrontFace*)(attribute))->read(this); + ((ive::FrontFace*)(attribute.get()))->read(this); } else if(attributeID == IVEPROGRAM){ attribute = new osg::Program(); - ((ive::Program*)(attribute))->read(this); + ((ive::Program*)(attribute.get()))->read(this); } else if(attributeID == IVEPOINTSPRITE){ attribute = new osg::PointSprite(); - ((ive::PointSprite*)(attribute))->read(this); + ((ive::PointSprite*)(attribute.get()))->read(this); } else if(attributeID == IVEMULTISAMPLE){ attribute = new osg::Multisample(); - ((ive::Multisample*)(attribute))->read(this); + ((ive::Multisample*)(attribute.get()))->read(this); } else if(attributeID == IVELINESTIPPLE){ attribute = new osg::LineStipple(); - ((ive::LineStipple*)(attribute))->read(this); + ((ive::LineStipple*)(attribute.get()))->read(this); } else if(attributeID == IVESTENCIL){ attribute = new osg::Stencil(); - ((ive::Stencil*)(attribute))->read(this); + ((ive::Stencil*)(attribute.get()))->read(this); } else if(attributeID == IVEFOG){ attribute = new osg::Fog(); - ((ive::Fog*)(attribute))->read(this); + ((ive::Fog*)(attribute.get()))->read(this); } else if(attributeID == IVELIGHT){ attribute = new osg::Light(); - ((ive::Light*)(attribute))->read(this); + ((ive::Light*)(attribute.get()))->read(this); } else if(attributeID == IVEPOLYGONSTIPPLE){ attribute = new osg::PolygonStipple(); - ((ive::PolygonStipple*)(attribute))->read(this); + ((ive::PolygonStipple*)(attribute.get()))->read(this); } else{ - throw Exception("Unknown StateAttribute in StateSet::read()"); + throwException("Unknown StateAttribute in StateSet::read()"); + return 0; } + + // exit early if an exception has been set. + if (getException()) return 0; // and add it to the stateattribute map, _stateAttributeMap[id] = attribute; @@ -1436,7 +1526,7 @@ osg::StateAttribute* DataInputStream::readStateAttribute() if (_verboseOutput) std::cout<<"read/writeStateAttribute() ["< uniform = new osg::Uniform(); // read its properties from stream - ((ive::Uniform*)(uniform))->read(this); + ((ive::Uniform*)(uniform.get()))->read(this); + + // exit early if an exception has been set. + if (getException()) return 0; // and add it to the uniform map, _uniformMap[id] = uniform; @@ -1460,7 +1553,7 @@ osg::Uniform* DataInputStream::readUniform() if (_verboseOutput) std::cout<<"read/writeUniform() ["< shader = new osg::Shader(); // read its properties from stream - ((ive::Shader*)(shader))->read(this); + ((ive::Shader*)(shader.get()))->read(this); + + // exit early if an exception has been set. + if (getException()) return 0; // and add it to the shader map, _shaderMap[id] = shader; @@ -1485,7 +1581,7 @@ osg::Shader* DataInputStream::readShader() if (_verboseOutput) std::cout<<"read/writeShader() ["< drawable; if(drawableTypeID == IVEGEOMETRY) { drawable = new osg::Geometry(); - ((Geometry*)(drawable))->read(this); + ((Geometry*)(drawable.get()))->read(this); } else if(drawableTypeID == IVESHAPEDRAWABLE) { drawable = new osg::ShapeDrawable(); - ((ShapeDrawable*)(drawable))->read(this); + ((ShapeDrawable*)(drawable.get()))->read(this); } else if(drawableTypeID == IVETEXT){ drawable = new osgText::Text(); - ((Text*)(drawable))->read(this); + ((Text*)(drawable.get()))->read(this); } else if(drawableTypeID == IVEFADETEXT){ drawable = new osgText::FadeText(); - ((FadeText*)(drawable))->read(this); + ((FadeText*)(drawable.get()))->read(this); } else if(drawableTypeID == IVETEXT3D){ drawable = new osgText::Text3D(); - ((Text3D*)(drawable))->read(this); + ((Text3D*)(drawable.get()))->read(this); } else - throw Exception("Unknown drawable drawableTypeIDentification in Geode::read()"); + throwException("Unknown drawable drawableTypeIDentification in Geode::read()"); + + // exit early if an exception has been set. + if (getException()) return 0; // and add it to the stateattribute map, @@ -1533,7 +1632,7 @@ osg::Drawable* DataInputStream::readDrawable() if (_verboseOutput) std::cout<<"read/writeDrawable() ["< shape; if(shapeTypeID == IVESPHERE) { shape = new osg::Sphere(); - ((Sphere*)(shape))->read(this); + ((Sphere*)(shape.get()))->read(this); } else if(shapeTypeID == IVEBOX) { shape = new osg::Box(); - ((Box*)(shape))->read(this); + ((Box*)(shape.get()))->read(this); } else if(shapeTypeID == IVECONE) { shape = new osg::Cone(); - ((Cone*)(shape))->read(this); + ((Cone*)(shape.get()))->read(this); } else if(shapeTypeID == IVECYLINDER) { shape = new osg::Cylinder(); - ((Cylinder*)(shape))->read(this); + ((Cylinder*)(shape.get()))->read(this); } else if(shapeTypeID == IVECAPSULE) { shape = new osg::Capsule(); - ((Capsule*)(shape))->read(this); + ((Capsule*)(shape.get()))->read(this); } else if(shapeTypeID == IVEHEIGHTFIELD) { shape = new osg::HeightField(); - ((HeightField*)(shape))->read(this); + ((HeightField*)(shape.get()))->read(this); } else - throw Exception("Unknown shape shapeTypeIDentification in Shape::read()"); + throwException("Unknown shape shapeTypeIDentification in Shape::read()"); + // exit early if an exception has been set. + if (getException()) return 0; // and add it to the stateattribute map, _shapeMap[id] = shape; @@ -1589,7 +1690,7 @@ osg::Shape* DataInputStream::readShape() if (_verboseOutput) std::cout<<"read/writeShape() ["< node; int nodeTypeID= peekInt(); if(nodeTypeID== IVEMATRIXTRANSFORM){ node = new osg::MatrixTransform(); - ((ive::MatrixTransform*)(node))->read(this); + ((ive::MatrixTransform*)(node.get()))->read(this); } else if(nodeTypeID== IVECAMERA){ node = new osg::Camera(); - ((ive::Camera*)(node))->read(this); + ((ive::Camera*)(node.get()))->read(this); } else if(nodeTypeID== IVECAMERAVIEW){ node = new osg::CameraView(); - ((ive::CameraView*)(node))->read(this); + ((ive::CameraView*)(node.get()))->read(this); } else if(nodeTypeID== IVEPOSITIONATTITUDETRANSFORM){ node = new osg::PositionAttitudeTransform(); - ((ive::PositionAttitudeTransform*)(node))->read(this); + ((ive::PositionAttitudeTransform*)(node.get()))->read(this); } else if(nodeTypeID== IVEAUTOTRANSFORM){ node = new osg::AutoTransform(); - ((ive::AutoTransform*)(node))->read(this); + ((ive::AutoTransform*)(node.get()))->read(this); } else if(nodeTypeID== IVEDOFTRANSFORM){ node = new osgSim::DOFTransform(); - ((ive::DOFTransform*)(node))->read(this); + ((ive::DOFTransform*)(node.get()))->read(this); } else if(nodeTypeID== IVETRANSFORM){ node = new osg::Transform(); - ((ive::Transform*)(node))->read(this); + ((ive::Transform*)(node.get()))->read(this); } else if(nodeTypeID== IVELIGHTSOURCE){ node = new osg::LightSource(); - ((ive::LightSource*)(node))->read(this); + ((ive::LightSource*)(node.get()))->read(this); } else if(nodeTypeID== IVETEXGENNODE){ node = new osg::TexGenNode(); - ((ive::TexGenNode*)(node))->read(this); + ((ive::TexGenNode*)(node.get()))->read(this); } else if(nodeTypeID== IVECLIPNODE){ node = new osg::ClipNode(); - ((ive::ClipNode*)(node))->read(this); + ((ive::ClipNode*)(node.get()))->read(this); } else if(nodeTypeID== IVESEQUENCE){ node = new osg::Sequence(); - ((ive::Sequence*)(node))->read(this); + ((ive::Sequence*)(node.get()))->read(this); } else if(nodeTypeID== IVELOD){ node = new osg::LOD(); - ((ive::LOD*)(node))->read(this); + ((ive::LOD*)(node.get()))->read(this); } else if(nodeTypeID== IVEPAGEDLOD){ node = new osg::PagedLOD(); - ((ive::PagedLOD*)(node))->read(this); + ((ive::PagedLOD*)(node.get()))->read(this); } else if(nodeTypeID== IVECOORDINATESYSTEMNODE){ node = new osg::CoordinateSystemNode(); - ((ive::CoordinateSystemNode*)(node))->read(this); + ((ive::CoordinateSystemNode*)(node.get()))->read(this); } else if(nodeTypeID== IVESWITCH){ node = new osg::Switch(); - ((ive::Switch*)(node))->read(this); + ((ive::Switch*)(node.get()))->read(this); } else if(nodeTypeID== IVEMULTISWITCH){ node = new osgSim::MultiSwitch(); - ((ive::MultiSwitch*)(node))->read(this); + ((ive::MultiSwitch*)(node.get()))->read(this); } else if(nodeTypeID== IVEIMPOSTOR){ node = new osgSim::Impostor(); - ((ive::Impostor*)(node))->read(this); + ((ive::Impostor*)(node.get()))->read(this); } else if(nodeTypeID== IVEOCCLUDERNODE){ node = new osg::OccluderNode(); - ((ive::OccluderNode*)(node))->read(this); + ((ive::OccluderNode*)(node.get()))->read(this); } else if(nodeTypeID== IVEOCCLUSIONQUERYNODE){ node = new osg::OcclusionQueryNode(); - ((ive::OcclusionQueryNode*)(node))->read(this); + ((ive::OcclusionQueryNode*)(node.get()))->read(this); } else if(nodeTypeID== IVEVISIBILITYGROUP){ node = new osgSim::VisibilityGroup(); - ((ive::VisibilityGroup*)(node))->read(this); + ((ive::VisibilityGroup*)(node.get()))->read(this); } else if(nodeTypeID== IVEPROXYNODE){ node = new osg::ProxyNode(); - ((ive::ProxyNode*)(node))->read(this); + ((ive::ProxyNode*)(node.get()))->read(this); } else if(nodeTypeID== IVEGROUP){ node = new osg::Group(); - ((ive::Group*)(node))->read(this); + ((ive::Group*)(node.get()))->read(this); } else if(nodeTypeID== IVEBILLBOARD){ node = new osg::Billboard(); - ((ive::Billboard*)(node))->read(this); + ((ive::Billboard*)(node.get()))->read(this); } else if(nodeTypeID== IVEGEODE){ node = new osg::Geode(); - ((ive::Geode*)(node))->read(this); + ((ive::Geode*)(node.get()))->read(this); } else if(nodeTypeID== IVELIGHTPOINTNODE){ node = new osgSim::LightPointNode(); - ((ive::LightPointNode*)(node))->read(this); + ((ive::LightPointNode*)(node.get()))->read(this); } else if(nodeTypeID== IVEMULTITEXTURECONTROL){ node = new osgFX::MultiTextureControl(); - ((ive::MultiTextureControl*)(node))->read(this); + ((ive::MultiTextureControl*)(node.get()))->read(this); } else if(nodeTypeID== IVEANISOTROPICLIGHTING){ node = new osgFX::AnisotropicLighting(); - ((ive::AnisotropicLighting*)(node))->read(this); + ((ive::AnisotropicLighting*)(node.get()))->read(this); } else if(nodeTypeID== IVEBUMPMAPPING){ node = new osgFX::BumpMapping(); - ((ive::BumpMapping*)(node))->read(this); + ((ive::BumpMapping*)(node.get()))->read(this); } else if(nodeTypeID== IVECARTOON){ node = new osgFX::Cartoon(); - ((ive::Cartoon*)(node))->read(this); + ((ive::Cartoon*)(node.get()))->read(this); } else if(nodeTypeID== IVESCRIBE){ node = new osgFX::Scribe(); - ((ive::Scribe*)(node))->read(this); + ((ive::Scribe*)(node.get()))->read(this); } else if(nodeTypeID== IVESPECULARHIGHLIGHTS){ node = new osgFX::SpecularHighlights(); - ((ive::SpecularHighlights*)(node))->read(this); + ((ive::SpecularHighlights*)(node.get()))->read(this); } else if(nodeTypeID== IVETERRAINTILE){ node = new osgTerrain::TerrainTile(); - ((ive::TerrainTile*)(node))->read(this); + ((ive::TerrainTile*)(node.get()))->read(this); } else if(nodeTypeID== IVEVOLUME){ node = new osgVolume::Volume(); - ((ive::Volume*)(node))->read(this); + ((ive::Volume*)(node.get()))->read(this); } else if(nodeTypeID== IVEVOLUMETILE){ node = new osgVolume::VolumeTile(); - ((ive::VolumeTile*)(node))->read(this); + ((ive::VolumeTile*)(node.get()))->read(this); } else{ - throw Exception("Unknown node identification in DataInputStream::readNode()"); + throwException("Unknown node identification in DataInputStream::readNode()"); } + // exit early if an exception has been set. + if (getException()) return 0; + // and add it to the node map, _nodeMap[id] = node; if (_verboseOutput) std::cout<<"read/writeNode() ["< layer = 0; int layerid = peekInt(); if (layerid==IVEHEIGHTFIELDLAYER) { layer = new osgTerrain::HeightFieldLayer; - ((ive::HeightFieldLayer*)(layer))->read(this); + ((ive::HeightFieldLayer*)(layer.get()))->read(this); } else if (layerid==IVEIMAGELAYER) { layer = new osgTerrain::ImageLayer; - ((ive::ImageLayer*)(layer))->read(this); + ((ive::ImageLayer*)(layer.get()))->read(this); } else if (layerid==IVESWITCHLAYER) { layer = new osgTerrain::SwitchLayer; - ((ive::SwitchLayer*)(layer))->read(this); + ((ive::SwitchLayer*)(layer.get()))->read(this); } else if (layerid==IVECOMPOSITELAYER) { layer = new osgTerrain::CompositeLayer; - ((ive::CompositeLayer*)(layer))->read(this); + ((ive::CompositeLayer*)(layer.get()))->read(this); } else if (layerid==IVEPROXYLAYER) { @@ -1813,8 +1917,11 @@ osgTerrain::Layer* DataInputStream::readLayer() layer = proxyLayer; } else{ - throw Exception("Unknown layer identification in DataInputStream::readLayer()"); + throwException("Unknown layer identification in DataInputStream::readLayer()"); } + + // exit early if an exception has been set. + if (getException()) return 0; // and add it to the node map, _layerMap[id] = layer; @@ -1822,7 +1929,7 @@ osgTerrain::Layer* DataInputStream::readLayer() if (_verboseOutput) std::cout<<"read/writeLayer() ["< locator = new osgTerrain::Locator(); // read its properties from stream - ((ive::Locator*)(locator))->read(this); + ((ive::Locator*)(locator.get()))->read(this); + + // exit early if an exception has been set. + if (getException()) return 0; // and add it to the locator map, _locatorMap[id] = locator; if (_verboseOutput) std::cout<<"read/writeLocator() ["< layer = 0; int layerid = peekInt(); if (layerid==IVEVOLUMEIMAGELAYER) { layer = new osgVolume::ImageLayer; - ((ive::VolumeImageLayer*)(layer))->read(this); + ((ive::VolumeImageLayer*)(layer.get()))->read(this); } else if (layerid==IVEVOLUMECOMPOSITELAYER) { layer = new osgVolume::CompositeLayer; - ((ive::VolumeCompositeLayer*)(layer))->read(this); + ((ive::VolumeCompositeLayer*)(layer.get()))->read(this); } else{ - throw Exception("Unknown layer identification in DataInputStream::readLayer()"); + throwException("Unknown layer identification in DataInputStream::readLayer()"); } + + // exit early if an exception has been set. + if (getException()) return 0; // and add it to the node map, _volumeLayerMap[id] = layer; @@ -1887,7 +2000,7 @@ osgVolume::Layer* DataInputStream::readVolumeLayer() if (_verboseOutput) std::cout<<"read/writeVolumeLayer() ["< locator = new osgVolume::Locator(); // read its properties from stream - ((ive::VolumeLocator*)(locator))->read(this); + ((ive::VolumeLocator*)(locator.get()))->read(this); + + // exit early if an exception has been set. + if (getException()) return 0; // and add it to the locator map, _volumeLocatorMap[id] = locator; if (_verboseOutput) std::cout<<"read/writeVolumeLocator() ["<second.get(); int layerid = peekInt(); - osgVolume::Property* property = 0; + osg::ref_ptr property = 0; if (layerid==IVEVOLUMECOMPOSITEPROPERTY) { property = new osgVolume::CompositeProperty; - ((ive::VolumeCompositeProperty*)(property))->read(this); + ((ive::VolumeCompositeProperty*)(property.get()))->read(this); } else if (layerid==IVEVOLUMESWITCHPROPERTY) { property = new osgVolume::SwitchProperty; - ((ive::VolumeSwitchProperty*)(property))->read(this); + ((ive::VolumeSwitchProperty*)(property.get()))->read(this); } else if (layerid==IVEVOLUMETRANSFERFUNCTIONPROPERTY) { property = new osgVolume::TransferFunctionProperty; - ((ive::VolumeTransferFunctionProperty*)(property))->read(this); + ((ive::VolumeTransferFunctionProperty*)(property.get()))->read(this); } else if (layerid==IVEVOLUMEMAXIMUMINTENSITYPROPERTY) { @@ -1957,36 +2073,39 @@ osgVolume::Property* DataInputStream::readVolumeProperty() { property = new osgVolume::IsoSurfaceProperty; readInt(); - ((ive::VolumeScalarProperty*)(property))->read(this); + ((ive::VolumeScalarProperty*)(property.get()))->read(this); } else if (layerid==IVEVOLUMEALPHAFUNCPROPERTY) { property = new osgVolume::AlphaFuncProperty; readInt(); - ((ive::VolumeScalarProperty*)(property))->read(this); + ((ive::VolumeScalarProperty*)(property.get()))->read(this); } else if (layerid==IVEVOLUMESAMPLEDENSITYPROPERTY) { property = new osgVolume::SampleDensityProperty; readInt(); - ((ive::VolumeScalarProperty*)(property))->read(this); + ((ive::VolumeScalarProperty*)(property.get()))->read(this); } else if (layerid==IVEVOLUMETRANSPARENCYPROPERTY) { property = new osgVolume::TransparencyProperty; readInt(); - ((ive::VolumeScalarProperty*)(property))->read(this); + ((ive::VolumeScalarProperty*)(property.get()))->read(this); } else{ - throw Exception("Unknown layer identification in DataInputStream::readVolumeProperty()"); + throwException("Unknown layer identification in DataInputStream::readVolumeProperty()"); } - + + // exit early if an exception has been set. + if (getException()) return 0; + // and add it to the locator map, _volumePropertyMap[id] = property; if (_verboseOutput) std::cout<<"read/writeVolumeProperty() ["<read(this); - return sal; + osg::ref_ptr sal = new osgSim::ShapeAttributeList; + ((ive::ShapeAttributeList*)sal.get())->read(this); + + // exit early if an exception has been set. + if (getException()) return 0; + + return sal.release(); } return 0; diff --git a/src/osgPlugins/ive/DataInputStream.h b/src/osgPlugins/ive/DataInputStream.h index e891e2ca8..3d9f42601 100644 --- a/src/osgPlugins/ive/DataInputStream.h +++ b/src/osgPlugins/ive/DataInputStream.h @@ -137,6 +137,10 @@ public: bool uncompress(std::istream& fin, std::string& destination) const; + void throwException(const std::string& message) { _exception = new Exception(message); } + void throwException(Exception* exception) { _exception = exception; } + const Exception* getException() const { return _exception.get(); } + private: @@ -161,7 +165,7 @@ private: osg::ref_ptr _options; - + osg::ref_ptr _exception; }; } diff --git a/src/osgPlugins/ive/DataOutputStream.cpp b/src/osgPlugins/ive/DataOutputStream.cpp index 219e66d09..1324e3d91 100644 --- a/src/osgPlugins/ive/DataOutputStream.cpp +++ b/src/osgPlugins/ive/DataOutputStream.cpp @@ -205,7 +205,10 @@ DataOutputStream::DataOutputStream(std::ostream * ostream, const osgDB::ReaderWr _output_ostream = _ostream = ostream; if(!_ostream) - throw Exception("DataOutputStream::DataOutputStream(): null pointer exception in argument."); + { + throwException("DataOutputStream::DataOutputStream(): null pointer exception in argument."); + return; + } writeUInt(ENDIAN_TYPE) ; writeUInt(getVersion()); @@ -489,7 +492,7 @@ void DataOutputStream::writeBinding(osg::Geometry::AttributeBinding b){ case osg::Geometry::BIND_PER_PRIMITIVE: writeChar((char) 2); break; case osg::Geometry::BIND_PER_PRIMITIVE_SET: writeChar((char) 3); break; case osg::Geometry::BIND_PER_VERTEX: writeChar((char) 4); break; - default: throw Exception("Unknown binding in DataOutputStream::writeBinding()"); + default: throwException("Unknown binding in DataOutputStream::writeBinding()"); } if (_verboseOutput) std::cout<<"read/writeBinding() ["<(a)); break; - default: throw Exception("Unknown array type in DataOutputStream::writeArray()"); + default: throwException("Unknown array type in DataOutputStream::writeArray()"); } } @@ -1107,7 +1110,7 @@ void DataOutputStream::writeStateAttribute(const osg::StateAttribute* attribute) else{ std::string className = attribute->className(); - throw Exception(std::string("StateSet::write(): Unknown StateAttribute: ").append(className)); + throwException(std::string("StateSet::write(): Unknown StateAttribute: ").append(className)); } if (_verboseOutput) std::cout<<"read/writeStateAttribute() ["<write(this); else { - throw Exception("Unknown drawable in DataOutputStream::writeDrawable()"); + throwException("Unknown drawable in DataOutputStream::writeDrawable()"); } if (_verboseOutput) std::cout<<"read/writeDrawable() ["<write(this); else { - throw Exception("Unknown shape in DataOutputStream::writeShape()"); + throwException("Unknown shape in DataOutputStream::writeShape()"); } if (_verboseOutput) std::cout<<"read/writeShape() ["<write(this); } else - throw Exception("Unknown node in Group::write()"); + throwException("Unknown node in Group::write()"); if (_verboseOutput) std::cout<<"read/writeNode() ["< ExternalFileWrittenMap; ExternalFileWrittenMap _externalFileWritten; + + osg::ref_ptr _exception; }; } diff --git a/src/osgPlugins/ive/Depth.cpp b/src/osgPlugins/ive/Depth.cpp index 098ad503c..be2c19803 100644 --- a/src/osgPlugins/ive/Depth.cpp +++ b/src/osgPlugins/ive/Depth.cpp @@ -25,7 +25,7 @@ void Depth::write(DataOutputStream* out){ ((ive::Object*)(obj))->write(out); } else - throw Exception("Depth::write(): Could not cast this osg::Depth to an osg::Object."); + out_THROW_EXCEPTION("Depth::write(): Could not cast this osg::Depth to an osg::Object."); // Write Depth's properties. out->writeInt(getFunction()); out->writeBool(getWriteMask()); @@ -45,7 +45,7 @@ void Depth::read(DataInputStream* in){ ((ive::Object*)(obj))->read(in); } else - throw Exception("Depth::read(): Could not cast this osg::Depth to an osg::Object."); + in_THROW_EXCEPTION("Depth::read(): Could not cast this osg::Depth to an osg::Object."); // Read CullFace's properties setFunction((osg::Depth::Function)in->readInt()); setWriteMask(in->readBool()); @@ -53,7 +53,7 @@ void Depth::read(DataInputStream* in){ setZFar(in->readFloat()); } else{ - throw Exception("Depth::read(): Expected Depth identification."); + in_THROW_EXCEPTION("Depth::read(): Expected Depth identification."); } } diff --git a/src/osgPlugins/ive/DirectionalSector.cpp b/src/osgPlugins/ive/DirectionalSector.cpp index ae855c0da..96ae7650d 100644 --- a/src/osgPlugins/ive/DirectionalSector.cpp +++ b/src/osgPlugins/ive/DirectionalSector.cpp @@ -42,6 +42,6 @@ void DirectionalSector::read(DataInputStream* in){ } else{ - throw Exception("DirectionalSector::read(): Expected DirectionalSector identification."); + in_THROW_EXCEPTION("DirectionalSector::read(): Expected DirectionalSector identification."); } } diff --git a/src/osgPlugins/ive/DrawArrayLengths.cpp b/src/osgPlugins/ive/DrawArrayLengths.cpp index 67b50dbab..dc6b566e8 100644 --- a/src/osgPlugins/ive/DrawArrayLengths.cpp +++ b/src/osgPlugins/ive/DrawArrayLengths.cpp @@ -27,7 +27,7 @@ void DrawArrayLengths::write(DataOutputStream* out){ ((ive::PrimitiveSet*)(prim))->write(out); } else - throw Exception("DrawArrayLengths::write(): Could not cast this osg::DrawArrayLengths to an osg::PrimitiveSet."); + out_THROW_EXCEPTION("DrawArrayLengths::write(): Could not cast this osg::DrawArrayLengths to an osg::PrimitiveSet."); // Write DrawArrayLengths's properties. out->writeInt(getFirst()); @@ -52,7 +52,7 @@ void DrawArrayLengths::read(DataInputStream* in){ ((ive::PrimitiveSet*)(prim))->read(in); } else - throw Exception("DrawArrayLengths::read(): Could not cast this osg::DrawArrayLengths to an osg::PrimitiveSet."); + in_THROW_EXCEPTION("DrawArrayLengths::read(): Could not cast this osg::DrawArrayLengths to an osg::PrimitiveSet."); // Read properties setFirst(in->readInt()); @@ -65,6 +65,6 @@ void DrawArrayLengths::read(DataInputStream* in){ } else{ - throw Exception("DrawArrayLengths::read(): Expected DrawArrayLengths identification."); + in_THROW_EXCEPTION("DrawArrayLengths::read(): Expected DrawArrayLengths identification."); } } diff --git a/src/osgPlugins/ive/DrawArrays.cpp b/src/osgPlugins/ive/DrawArrays.cpp index be22a59bb..178a0b291 100644 --- a/src/osgPlugins/ive/DrawArrays.cpp +++ b/src/osgPlugins/ive/DrawArrays.cpp @@ -27,7 +27,7 @@ void DrawArrays::write(DataOutputStream* out){ ((ive::PrimitiveSet*)(prim))->write(out); } else - throw Exception("DrawArrays::write(): Could not cast this osg::DrawArrays to an osg::PrimitiveSet."); + out_THROW_EXCEPTION("DrawArrays::write(): Could not cast this osg::DrawArrays to an osg::PrimitiveSet."); // Write DrawArrays's properties. @@ -47,7 +47,7 @@ void DrawArrays::read(DataInputStream* in){ ((ive::PrimitiveSet*)(prim))->read(in); } else - throw Exception("DrawArrays::read(): Could not cast this osg::DrawArrays to an osg::PrimitiveSet."); + in_THROW_EXCEPTION("DrawArrays::read(): Could not cast this osg::DrawArrays to an osg::PrimitiveSet."); // Read DrawArrays properties @@ -55,6 +55,6 @@ void DrawArrays::read(DataInputStream* in){ setCount(in->readInt()); } else{ - throw Exception("DrawArrays::read(): Expected DrawArrays identification."); + in_THROW_EXCEPTION("DrawArrays::read(): Expected DrawArrays identification."); } } diff --git a/src/osgPlugins/ive/DrawElementsUByte.cpp b/src/osgPlugins/ive/DrawElementsUByte.cpp index 66ea336ec..ea19e3e83 100644 --- a/src/osgPlugins/ive/DrawElementsUByte.cpp +++ b/src/osgPlugins/ive/DrawElementsUByte.cpp @@ -28,7 +28,7 @@ void DrawElementsUByte::write(DataOutputStream* out){ ((ive::PrimitiveSet*)(prim))->write(out); } else - throw Exception("DrawElementsUByte::write(): Could not cast this osg::DrawElementsUByte to an osg::PrimitiveSet."); + out_THROW_EXCEPTION("DrawElementsUByte::write(): Could not cast this osg::DrawElementsUByte to an osg::PrimitiveSet."); // Write DrawElementsUByte's properties. // Write array length and its elements. @@ -48,7 +48,7 @@ void DrawElementsUByte::read(DataInputStream* in){ ((ive::PrimitiveSet*)(prim))->read(in); } else - throw Exception("DrawElementsUByte::read(): Could not cast this osg::DrawElementsUByte to an osg::PrimitiveSet."); + in_THROW_EXCEPTION("DrawElementsUByte::read(): Could not cast this osg::DrawElementsUByte to an osg::PrimitiveSet."); // Read array length and its elements. int size = in->readInt(); @@ -57,6 +57,6 @@ void DrawElementsUByte::read(DataInputStream* in){ } else{ - throw Exception("DrawElementsUByte::read(): Expected DrawElementsUByte identification."); + in_THROW_EXCEPTION("DrawElementsUByte::read(): Expected DrawElementsUByte identification."); } } diff --git a/src/osgPlugins/ive/DrawElementsUInt.cpp b/src/osgPlugins/ive/DrawElementsUInt.cpp index d6962eee6..87b9b5cc1 100644 --- a/src/osgPlugins/ive/DrawElementsUInt.cpp +++ b/src/osgPlugins/ive/DrawElementsUInt.cpp @@ -29,7 +29,7 @@ void DrawElementsUInt::write(DataOutputStream* out){ ((ive::PrimitiveSet*)(prim))->write(out); } else - throw Exception("DrawElementsUInt::write(): Could not cast this osg::DrawElementsUInt to an osg::PrimitiveSet."); + out_THROW_EXCEPTION("DrawElementsUInt::write(): Could not cast this osg::DrawElementsUInt to an osg::PrimitiveSet."); // Write DrawElementsUInt's properties. // Write array length and its elements. @@ -50,7 +50,7 @@ void DrawElementsUInt::read(DataInputStream* in) ((ive::PrimitiveSet*)(prim))->read(in); } else - throw Exception("DrawElementsUInt::read(): Could not cast this osg::DrawElementsUInt to an osg::PrimitiveSet."); + in_THROW_EXCEPTION("DrawElementsUInt::read(): Could not cast this osg::DrawElementsUInt to an osg::PrimitiveSet."); // Read array length and its elements. int size = in->readInt(); @@ -66,6 +66,6 @@ void DrawElementsUInt::read(DataInputStream* in) } } else{ - throw Exception("DrawElementsUInt::read(): Expected DrawElementsUInt identification."); + in_THROW_EXCEPTION("DrawElementsUInt::read(): Expected DrawElementsUInt identification."); } } diff --git a/src/osgPlugins/ive/DrawElementsUShort.cpp b/src/osgPlugins/ive/DrawElementsUShort.cpp index 9efc359bf..2f37cd1d4 100644 --- a/src/osgPlugins/ive/DrawElementsUShort.cpp +++ b/src/osgPlugins/ive/DrawElementsUShort.cpp @@ -29,7 +29,7 @@ void DrawElementsUShort::write(DataOutputStream* out){ ((ive::PrimitiveSet*)(prim))->write(out); } else - throw Exception("DrawElementsUShort::write(): Could not cast this osg::DrawElementsUShort to an osg::PrimitiveSet."); + out_THROW_EXCEPTION("DrawElementsUShort::write(): Could not cast this osg::DrawElementsUShort to an osg::PrimitiveSet."); // Write DrawElementsUShort's properties. // Write array length and its elements. @@ -49,7 +49,7 @@ void DrawElementsUShort::read(DataInputStream* in){ ((ive::PrimitiveSet*)(prim))->read(in); } else - throw Exception("DrawElementsUShort::read(): Could not cast this osg::DrawElementsUShort to an osg::PrimitiveSet."); + in_THROW_EXCEPTION("DrawElementsUShort::read(): Could not cast this osg::DrawElementsUShort to an osg::PrimitiveSet."); // Read array length and its elements. int size = in->readInt(); @@ -65,6 +65,6 @@ void DrawElementsUShort::read(DataInputStream* in){ } } else{ - throw Exception("DrawElementsUShort::read(): Expected DrawElementsUShort identification."); + in_THROW_EXCEPTION("DrawElementsUShort::read(): Expected DrawElementsUShort identification."); } } diff --git a/src/osgPlugins/ive/Drawable.cpp b/src/osgPlugins/ive/Drawable.cpp index 92b801175..67b6afd9d 100644 --- a/src/osgPlugins/ive/Drawable.cpp +++ b/src/osgPlugins/ive/Drawable.cpp @@ -31,7 +31,7 @@ void Drawable::write(DataOutputStream* out) ((ive::Object*)(obj))->write(out); } else - throw Exception("Drawable::write(): Could not cast this osg::Drawable to an osg::Object."); + out_THROW_EXCEPTION("Drawable::write(): Could not cast this osg::Drawable to an osg::Object."); // Write Drawable's properties. @@ -90,7 +90,7 @@ void Drawable::read(DataInputStream* in) ((ive::Object*)(obj))->read(in); } else - throw Exception("Drawable::read(): Could not cast this osg::Drawable to an osg::Object."); + in_THROW_EXCEPTION("Drawable::read(): Could not cast this osg::Drawable to an osg::Object."); // Read in drawable's properties @@ -134,6 +134,6 @@ void Drawable::read(DataInputStream* in) } else{ - throw Exception("Drawable::read(): Expected Drawable identification."); + in_THROW_EXCEPTION("Drawable::read(): Expected Drawable identification."); } } diff --git a/src/osgPlugins/ive/Effect.cpp b/src/osgPlugins/ive/Effect.cpp index 38e6e7662..52fff9a7a 100644 --- a/src/osgPlugins/ive/Effect.cpp +++ b/src/osgPlugins/ive/Effect.cpp @@ -25,7 +25,7 @@ void Effect::write(DataOutputStream* out){ ((ive::Group*)(group))->write(out); } else - throw Exception("Effect::write(): Could not cast this osgFX::Effect to an osg::Group."); + out_THROW_EXCEPTION("Effect::write(): Could not cast this osgFX::Effect to an osg::Group."); // Write Effect's properties. out->writeBool(getEnabled()); @@ -46,7 +46,7 @@ void Effect::read(DataInputStream* in){ ((ive::Group*)(group))->read(in); } else - throw Exception("Effect::read(): Could not cast this osgFX::Effect to an osg::Group."); + in_THROW_EXCEPTION("Effect::read(): Could not cast this osgFX::Effect to an osg::Group."); // Read Effect's properties setEnabled(in->readBool()); @@ -54,6 +54,6 @@ void Effect::read(DataInputStream* in){ selectTechnique(in->readInt()); } else{ - throw Exception("Effect::read(): Expected Effect identification."); + in_THROW_EXCEPTION("Effect::read(): Expected Effect identification."); } } diff --git a/src/osgPlugins/ive/ElevationSector.cpp b/src/osgPlugins/ive/ElevationSector.cpp index 5a03b8d20..3a9253b47 100644 --- a/src/osgPlugins/ive/ElevationSector.cpp +++ b/src/osgPlugins/ive/ElevationSector.cpp @@ -38,6 +38,6 @@ void ElevationSector::read(DataInputStream* in){ setElevationRange(minElevation, maxElevation, fadeAngle); } else{ - throw Exception("ElevationSector::read(): Expected ElevationSector identification."); + in_THROW_EXCEPTION("ElevationSector::read(): Expected ElevationSector identification."); } } diff --git a/src/osgPlugins/ive/EllipsoidModel.cpp b/src/osgPlugins/ive/EllipsoidModel.cpp index eb6849894..cd3a3c32a 100644 --- a/src/osgPlugins/ive/EllipsoidModel.cpp +++ b/src/osgPlugins/ive/EllipsoidModel.cpp @@ -28,7 +28,7 @@ void EllipsoidModel::write(DataOutputStream* out){ ((ive::Object*)(obj))->write(out); } else - throw Exception("EllipsoidModel::write(): Could not cast this osg::EllipsoidModel to an osg::Object."); + out_THROW_EXCEPTION("EllipsoidModel::write(): Could not cast this osg::EllipsoidModel to an osg::Object."); // Write EllipsoidModel's properties. out->writeDouble(getRadiusEquator()); @@ -48,7 +48,7 @@ void EllipsoidModel::read(DataInputStream* in){ ((ive::Object*)(obj))->read(in); } else - throw Exception("EllipsoidModel::read(): Could not cast this osg::EllipsoidModel to an osg::Object."); + in_THROW_EXCEPTION("EllipsoidModel::read(): Could not cast this osg::EllipsoidModel to an osg::Object."); // Read EllipsoidModel's properties setRadiusEquator(in->readDouble()); @@ -57,6 +57,6 @@ void EllipsoidModel::read(DataInputStream* in){ } else{ - throw Exception("EllipsoidModel::read(): Expected EllipsoidModel identification."); + in_THROW_EXCEPTION("EllipsoidModel::read(): Expected EllipsoidModel identification."); } } diff --git a/src/osgPlugins/ive/Exception.h b/src/osgPlugins/ive/Exception.h index 17e512ada..5d47ccbda 100644 --- a/src/osgPlugins/ive/Exception.h +++ b/src/osgPlugins/ive/Exception.h @@ -2,14 +2,20 @@ #define IVE_EXCEPTION 1 #include +#include namespace ive{ -class Exception{ +#define THROW_EXCEPTION(str) { throwException(new Exception(str)); return; } +#define in_THROW_EXCEPTION(str) { in->throwException(new Exception(str)); return; } +#define out_THROW_EXCEPTION(str) { out->throwException(new Exception(str)); return; } + +class Exception : public osg::Referenced +{ public: Exception(std::string error); ~Exception(); - std::string getError(){return _error;}; + const std::string& getError() const { return _error; }; private: std::string _error; }; diff --git a/src/osgPlugins/ive/FadeText.cpp b/src/osgPlugins/ive/FadeText.cpp index be228b2c8..c20fe2e71 100644 --- a/src/osgPlugins/ive/FadeText.cpp +++ b/src/osgPlugins/ive/FadeText.cpp @@ -33,7 +33,7 @@ void FadeText::write(DataOutputStream* out){ ((ive::Text*)(text))->write(out); } else - throw Exception("FadeText::write(): Could not cast this osgText::FadeText to an osgText::Tex."); + out_THROW_EXCEPTION("FadeText::write(): Could not cast this osgText::FadeText to an osgText::Tex."); // Write FadeText's properties. out->writeFloat(getFadeSpeed()); @@ -51,11 +51,11 @@ void FadeText::read(DataInputStream* in){ ((ive::Text*)(text))->read(in); } else - throw Exception("FadeText::read(): Could not cast this osgText::FadeText to an osgText::Text."); + in_THROW_EXCEPTION("FadeText::read(): Could not cast this osgText::FadeText to an osgText::Text."); setFadeSpeed(in->readFloat()); } else{ - throw Exception("FadeText::read(): Expected FadeText identification."); + in_THROW_EXCEPTION("FadeText::read(): Expected FadeText identification."); } } diff --git a/src/osgPlugins/ive/Fog.cpp b/src/osgPlugins/ive/Fog.cpp index e356376d9..0460f221c 100644 --- a/src/osgPlugins/ive/Fog.cpp +++ b/src/osgPlugins/ive/Fog.cpp @@ -26,7 +26,7 @@ void Fog::write(DataOutputStream* out){ if(obj) ((ive::Object*)(obj))->write(out); else - throw Exception("Fog::write(): Could not cast this osg::Fog to an osg::Object."); + out_THROW_EXCEPTION("Fog::write(): Could not cast this osg::Fog to an osg::Object."); // write Fog's properties out->writeInt(getMode()); @@ -51,7 +51,7 @@ void Fog::read(DataInputStream* in){ if(obj) ((ive::Object*)(obj))->read(in); else - throw Exception("Fog::read(): Could not cast this osg::Fog to an osg::Object."); + in_THROW_EXCEPTION("Fog::read(): Could not cast this osg::Fog to an osg::Object."); // Read Fog's properties setMode(osg::Fog::Mode(in->readInt())); @@ -62,6 +62,6 @@ void Fog::read(DataInputStream* in){ setFogCoordinateSource(in->readInt()); } else{ - throw Exception("Fog::read(): Expected Fog identification."); + in_THROW_EXCEPTION("Fog::read(): Expected Fog identification."); } } diff --git a/src/osgPlugins/ive/FragmentProgram.cpp b/src/osgPlugins/ive/FragmentProgram.cpp index 9cd8c0bd7..6349a63c2 100644 --- a/src/osgPlugins/ive/FragmentProgram.cpp +++ b/src/osgPlugins/ive/FragmentProgram.cpp @@ -30,7 +30,7 @@ void FragmentProgram::write( DataOutputStream* out ) } else { - throw Exception("Material::write(): Could not cast this osg::FragmentProgram to an osg::Object."); + out_THROW_EXCEPTION("Material::write(): Could not cast this osg::FragmentProgram to an osg::Object."); } // Write FragmentProgram properties. @@ -62,7 +62,7 @@ void FragmentProgram::read(DataInputStream* in){ } else { - throw Exception( "Material::read(): Could not cast this osg::FragmentProgram to an osg::Object." ); + in_THROW_EXCEPTION( "Material::read(): Could not cast this osg::FragmentProgram to an osg::Object." ); } // Read data @@ -80,6 +80,6 @@ void FragmentProgram::read(DataInputStream* in){ } else { - throw Exception("FragmentProgram::read(): Expected FragmentProgram identification."); + in_THROW_EXCEPTION("FragmentProgram::read(): Expected FragmentProgram identification."); } } diff --git a/src/osgPlugins/ive/FrontFace.cpp b/src/osgPlugins/ive/FrontFace.cpp index 3f88bd22a..7886edb74 100644 --- a/src/osgPlugins/ive/FrontFace.cpp +++ b/src/osgPlugins/ive/FrontFace.cpp @@ -27,7 +27,7 @@ void FrontFace::write(DataOutputStream* out){ ((ive::Object*)(obj))->write(out); } else - throw Exception("FrontFace::write(): Could not cast this osg::FrontFace to an osg::Object."); + out_THROW_EXCEPTION("FrontFace::write(): Could not cast this osg::FrontFace to an osg::Object."); // Write FrontFace's properties. // Write mode @@ -46,7 +46,7 @@ void FrontFace::read(DataInputStream* in){ ((ive::Object*)(obj))->read(in); } else - throw Exception("FrontFace::read(): Could not cast this osg::FrontFace to an osg::Object."); + in_THROW_EXCEPTION("FrontFace::read(): Could not cast this osg::FrontFace to an osg::Object."); // Read FrontFace's properties // Read mode @@ -54,7 +54,7 @@ void FrontFace::read(DataInputStream* in){ } else{ - throw Exception("FrontFace::read(): Expected FrontFace identification."); + in_THROW_EXCEPTION("FrontFace::read(): Expected FrontFace identification."); } } diff --git a/src/osgPlugins/ive/Geode.cpp b/src/osgPlugins/ive/Geode.cpp index 8767788a9..7fa34d9a4 100644 --- a/src/osgPlugins/ive/Geode.cpp +++ b/src/osgPlugins/ive/Geode.cpp @@ -31,7 +31,7 @@ void Geode::write(DataOutputStream* out){ ((ive::Node*)(node))->write(out); } else - throw Exception("Geode::write(): Could not cast this osg::Geode to an osg::Node."); + out_THROW_EXCEPTION("Geode::write(): Could not cast this osg::Geode to an osg::Node."); // Write Geode's properties. @@ -45,7 +45,7 @@ void Geode::write(DataOutputStream* out){ if(dynamic_cast(drawable)) ((ive::Geometry*)(drawable))->write(out); else{ - throw Exception("Unknown drawable in Geode::write()"); + in_THROW_EXCEPTION("Unknown drawable in Geode::write()"); } #else out->writeDrawable(drawable); @@ -65,7 +65,7 @@ void Geode::read(DataInputStream* in){ ((ive::Node*)(node))->read(in); } else - throw Exception("Geode::read(): Could not cast this osg::Geode to an osg::Node."); + in_THROW_EXCEPTION("Geode::read(): Could not cast this osg::Geode to an osg::Node."); // Read number of drawables. @@ -81,13 +81,13 @@ void Geode::read(DataInputStream* in){ addDrawable(drawable); } else - throw Exception("Unknown drawable identification in Geode::read()"); + in_THROW_EXCEPTION("Unknown drawable identification in Geode::read()"); #else addDrawable(in->readDrawable()); #endif } } else{ - throw Exception("Geode::read(): Expected Geode identification."); + in_THROW_EXCEPTION("Geode::read(): Expected Geode identification."); } } diff --git a/src/osgPlugins/ive/Geometry.cpp b/src/osgPlugins/ive/Geometry.cpp index c2767e48d..9cc272a1d 100644 --- a/src/osgPlugins/ive/Geometry.cpp +++ b/src/osgPlugins/ive/Geometry.cpp @@ -33,7 +33,7 @@ void Geometry::write(DataOutputStream* out){ ((ive::Drawable*)(drawable))->write(out); } else - throw Exception("Geometry::write(): Could not cast this osg::Geometry to an osg::Drawable."); + out_THROW_EXCEPTION("Geometry::write(): Could not cast this osg::Geometry to an osg::Drawable."); // Write Geometry's properties. @@ -53,7 +53,7 @@ void Geometry::write(DataOutputStream* out){ else if(dynamic_cast(getPrimitiveSet(i))) ((ive::DrawElementsUInt*)(getPrimitiveSet(i)))->write(out); else - throw Exception("Unknown PrimitivSet in Geometry::write()"); + out_THROW_EXCEPTION("Unknown PrimitivSet in Geometry::write()"); } // Write vertex array if any @@ -178,7 +178,7 @@ void Geometry::read(DataInputStream* in){ ((ive::Drawable*)(drawable))->read(in); } else - throw Exception("Geometry::read(): Could not cast this osg::Geometry to an osg::Drawable."); + in_THROW_EXCEPTION("Geometry::read(): Could not cast this osg::Geometry to an osg::Drawable."); // Read geoemtry properties @@ -215,7 +215,7 @@ void Geometry::read(DataInputStream* in){ addPrimitiveSet(prim); } else{ - throw Exception("Unknown PrimitiveSet in Geometry::read()"); + in_THROW_EXCEPTION("Unknown PrimitiveSet in Geometry::read()"); } } @@ -314,6 +314,6 @@ void Geometry::read(DataInputStream* in){ } else{ - throw Exception("Geometry::read(): Expected Geometry identification."); + in_THROW_EXCEPTION("Geometry::read(): Expected Geometry identification."); } } diff --git a/src/osgPlugins/ive/Group.cpp b/src/osgPlugins/ive/Group.cpp index 306136b18..2e6047893 100644 --- a/src/osgPlugins/ive/Group.cpp +++ b/src/osgPlugins/ive/Group.cpp @@ -35,7 +35,7 @@ void Group::write(DataOutputStream* out){ static_cast(node)->write(out); } else - throw Exception("Group::write(): Could not cast this osg::Group to an osg::Node."); + out_THROW_EXCEPTION("Group::write(): Could not cast this osg::Group to an osg::Node."); // Write Group's properties. @@ -61,7 +61,7 @@ void Group::read(DataInputStream* in){ ((ive::Node*)(node))->read(in); } else - throw Exception("Group::read(): Could not cast this osg::Group to an osg::Node."); + in_THROW_EXCEPTION("Group::read(): Could not cast this osg::Group to an osg::Node."); // Read groups properties. @@ -75,6 +75,6 @@ void Group::read(DataInputStream* in){ } } else{ - throw Exception("Group::read(): Expected Group identification"); + in_THROW_EXCEPTION("Group::read(): Expected Group identification"); } } diff --git a/src/osgPlugins/ive/HeightFieldLayer.cpp b/src/osgPlugins/ive/HeightFieldLayer.cpp index cba525e24..507156b1b 100644 --- a/src/osgPlugins/ive/HeightFieldLayer.cpp +++ b/src/osgPlugins/ive/HeightFieldLayer.cpp @@ -30,7 +30,7 @@ void HeightFieldLayer::write(DataOutputStream* out) if (layer) ((ive::Layer*)(layer))->write(out); else - throw Exception("HeightFieldLayer::write(): Could not cast this osgLayer::HeightFieldLayer to an osgTerrain::Layer."); + out_THROW_EXCEPTION("HeightFieldLayer::write(): Could not cast this osgLayer::HeightFieldLayer to an osgTerrain::Layer."); if (getFileName().empty() && getHeightField()) @@ -87,7 +87,7 @@ void HeightFieldLayer::read(DataInputStream* in) // Peek on Layer's identification. int id = in->peekInt(); if (id != IVEHEIGHTFIELDLAYER) - throw Exception("HeightFieldLayer::read(): Expected HeightFieldLayer identification."); + in_THROW_EXCEPTION("HeightFieldLayer::read(): Expected HeightFieldLayer identification."); // Read Layer's identification. id = in->readInt(); @@ -97,7 +97,7 @@ void HeightFieldLayer::read(DataInputStream* in) if (layer) ((ive::Layer*)(layer))->read(in); else - throw Exception("HeightFieldLayer::read(): Could not cast this osgLayer::Layer to an osg::Group."); + in_THROW_EXCEPTION("HeightFieldLayer::read(): Could not cast this osgLayer::Layer to an osg::Group."); bool useInlineHeightField = in->readBool(); diff --git a/src/osgPlugins/ive/Image.cpp b/src/osgPlugins/ive/Image.cpp index 73b39705f..13b239fb8 100644 --- a/src/osgPlugins/ive/Image.cpp +++ b/src/osgPlugins/ive/Image.cpp @@ -30,7 +30,7 @@ void Image::write(DataOutputStream* out) ((ive::Object*)(obj))->write(out); } else - throw Exception("Image::write(): Could not cast this osg::Image to an osg::Object."); + out_THROW_EXCEPTION("Image::write(): Could not cast this osg::Image to an osg::Object."); // Write Image's properties. // Write name @@ -90,7 +90,7 @@ void Image::read(DataInputStream* in) ((ive::Object*)(obj))->read(in); } else - throw Exception("Image::read(): Could not cast this osg::Image to an osg::Object."); + in_THROW_EXCEPTION("Image::read(): Could not cast this osg::Image to an osg::Object."); // Read Image's properties. // Read name @@ -144,7 +144,7 @@ void Image::read(DataInputStream* in) //char* data = (char*)malloc (dataSize); char* data = new char[dataSize]; if(!data) - throw Exception("Image::read(): Unable to allocate memory for image data."); + in_THROW_EXCEPTION("Image::read(): Unable to allocate memory for image data."); in->readCharArray(data,dataSize); setImage(is, it, ir, internalTextureFormat, pixelFormat, dataType, (unsigned char* ) data, osg::Image::USE_NEW_DELETE, packing); @@ -153,6 +153,6 @@ void Image::read(DataInputStream* in) _mipmapData.swap(mipmapData); } else{ - throw Exception("Image::read(): Expected Image identification."); + in_THROW_EXCEPTION("Image::read(): Expected Image identification."); } } diff --git a/src/osgPlugins/ive/ImageLayer.cpp b/src/osgPlugins/ive/ImageLayer.cpp index 0b06beed6..33fd27da0 100644 --- a/src/osgPlugins/ive/ImageLayer.cpp +++ b/src/osgPlugins/ive/ImageLayer.cpp @@ -31,7 +31,7 @@ void ImageLayer::write(DataOutputStream* out) if (layer) ((ive::Layer*)(layer))->write(out); else - throw Exception("ImageLayer::write(): Could not cast this osgLayer::ImageLayer to an osgTerrain::Layer."); + out_THROW_EXCEPTION("ImageLayer::write(): Could not cast this osgLayer::ImageLayer to an osgTerrain::Layer."); IncludeImageMode imMode = out->getIncludeImageMode(getImage()); @@ -48,7 +48,7 @@ void ImageLayer::read(DataInputStream* in) // Peek on Layer's identification. int id = in->peekInt(); if (id != IVEIMAGELAYER) - throw Exception("ImageLayer::read(): Expected ImageLayer identification."); + in_THROW_EXCEPTION("ImageLayer::read(): Expected ImageLayer identification."); // Read Layer's identification. id = in->readInt(); @@ -58,7 +58,7 @@ void ImageLayer::read(DataInputStream* in) if (layer) ((ive::Layer*)(layer))->read(in); else - throw Exception("ImageLayer::read(): Could not cast this osgLayer::Layer to an osg::Group."); + in_THROW_EXCEPTION("ImageLayer::read(): Could not cast this osgLayer::Layer to an osg::Group."); bool deferExternalLayerLoading = osgTerrain::TerrainTile::getTileLoadedCallback().valid() ? diff --git a/src/osgPlugins/ive/ImageSequence.cpp b/src/osgPlugins/ive/ImageSequence.cpp index dac7f4e91..23ec9ec81 100644 --- a/src/osgPlugins/ive/ImageSequence.cpp +++ b/src/osgPlugins/ive/ImageSequence.cpp @@ -30,7 +30,7 @@ void ImageSequence::write(DataOutputStream* out) ((ive::Object*)(obj))->write(out); } else - throw Exception("ImageSequence::write(): Could not cast this osg::ImageSequence to an osg::Object."); + out_THROW_EXCEPTION("ImageSequence::write(): Could not cast this osg::ImageSequence to an osg::Object."); // Write ImageSequence's properties. @@ -71,7 +71,7 @@ void ImageSequence::read(DataInputStream* in) ((ive::Object*)(obj))->read(in); } else - throw Exception("ImageSequence::read(): Could not cast this osg::ImageSequence to an osg::Object."); + in_THROW_EXCEPTION("ImageSequence::read(): Could not cast this osg::ImageSequence to an osg::Object."); // Read ImageSequence's properties. @@ -97,6 +97,6 @@ void ImageSequence::read(DataInputStream* in) } else{ - throw Exception("ImageSequence::read(): Expected ImageSequence identification."); + in_THROW_EXCEPTION("ImageSequence::read(): Expected ImageSequence identification."); } } diff --git a/src/osgPlugins/ive/Impostor.cpp b/src/osgPlugins/ive/Impostor.cpp index 724b4f588..e853af157 100644 --- a/src/osgPlugins/ive/Impostor.cpp +++ b/src/osgPlugins/ive/Impostor.cpp @@ -27,7 +27,7 @@ void Impostor::write(DataOutputStream* out){ ((ive::LOD*)(lod))->write(out); } else - throw Exception("Impostor::write(): Could not cast this osg::Impostor to an osg::LOD."); + out_THROW_EXCEPTION("Impostor::write(): Could not cast this osg::Impostor to an osg::LOD."); // Write Impostor's properties. out->writeFloat(getImpostorThreshold()); } @@ -44,11 +44,11 @@ void Impostor::read(DataInputStream* in){ ((ive::LOD*)(lod))->read(in); } else - throw Exception("Impostor::read(): Could not cast this osg::Impostor to an osg::LOD."); + in_THROW_EXCEPTION("Impostor::read(): Could not cast this osg::Impostor to an osg::LOD."); // Read Impostor's properties setImpostorThreshold(in->readFloat()); } else{ - throw Exception("Impostor::read(): Expected Impostor identification."); + in_THROW_EXCEPTION("Impostor::read(): Expected Impostor identification."); } } diff --git a/src/osgPlugins/ive/LOD.cpp b/src/osgPlugins/ive/LOD.cpp index ff9577741..2d4cfbb9e 100644 --- a/src/osgPlugins/ive/LOD.cpp +++ b/src/osgPlugins/ive/LOD.cpp @@ -27,7 +27,7 @@ void LOD::write(DataOutputStream* out){ ((ive::Group*)(group))->write(out); } else - throw Exception("LOD::write(): Could not cast this osg::LOD to an osg::Group."); + out_THROW_EXCEPTION("LOD::write(): Could not cast this osg::LOD to an osg::Group."); // Write LOD's properties. out->writeFloat(getRadius()); @@ -60,7 +60,7 @@ void LOD::read(DataInputStream* in){ ((ive::Group*)(group))->read(in); } else - throw Exception("LOD::read(): Could not cast this osg::LOD to an osg::Group."); + in_THROW_EXCEPTION("LOD::read(): Could not cast this osg::LOD to an osg::Group."); // Read LOD's properties if ( in->getVersion() > VERSION_0002 ) @@ -82,6 +82,6 @@ void LOD::read(DataInputStream* in){ } } else{ - throw Exception("LOD::read(): Expected LOD identification."); + in_THROW_EXCEPTION("LOD::read(): Expected LOD identification."); } } diff --git a/src/osgPlugins/ive/Layer.cpp b/src/osgPlugins/ive/Layer.cpp index 521ab4896..2228469e4 100644 --- a/src/osgPlugins/ive/Layer.cpp +++ b/src/osgPlugins/ive/Layer.cpp @@ -35,7 +35,7 @@ void Layer::write(DataOutputStream* out) if (object) ((ive::Object*)(object))->write(out); else - throw Exception("Layer::write(): Could not cast this osgLayer::Layer to an osg::Object."); + out_THROW_EXCEPTION("Layer::write(): Could not cast this osgLayer::Layer to an osg::Object."); if (out->getVersion() >= VERSION_0023) @@ -74,7 +74,7 @@ void Layer::read(DataInputStream* in) // Peek on Layer's identification. int id = in->peekInt(); if (id != IVELAYER) - throw Exception("Layer::read(): Expected Layer identification."); + in_THROW_EXCEPTION("Layer::read(): Expected Layer identification."); // Read Layer's identification. id = in->readInt(); @@ -84,7 +84,7 @@ void Layer::read(DataInputStream* in) if(object) ((ive::Object*)(object))->read(in); else - throw Exception("Layer::read(): Could not cast this osgLayer::Layer to an osg::Group."); + in_THROW_EXCEPTION("Layer::read(): Could not cast this osgLayer::Layer to an osg::Group."); if (in->getVersion() >= VERSION_0023) { diff --git a/src/osgPlugins/ive/Light.cpp b/src/osgPlugins/ive/Light.cpp index fdabdb841..08cc380b9 100644 --- a/src/osgPlugins/ive/Light.cpp +++ b/src/osgPlugins/ive/Light.cpp @@ -27,7 +27,7 @@ void Light::write(DataOutputStream* out){ ((ive::Object*)(obj))->write(out); } else - throw Exception("Light::write(): Could not cast this osg::Light to an osg::Object."); + out_THROW_EXCEPTION("Light::write(): Could not cast this osg::Light to an osg::Object."); // Write Light's properties. out->writeInt(getLightNum()); out->writeVec4(getAmbient()); @@ -55,7 +55,7 @@ void Light::read(DataInputStream* in){ ((ive::Object*)(obj))->read(in); } else - throw Exception("Light::read(): Could not cast this osg::Light to an osg::Object."); + in_THROW_EXCEPTION("Light::read(): Could not cast this osg::Light to an osg::Object."); // Read Light's properties setLightNum(in->readInt()); setAmbient(in->readVec4()); @@ -70,6 +70,6 @@ void Light::read(DataInputStream* in){ setSpotCutoff(in->readFloat()); } else{ - throw Exception("Light::read(): Expected Light identification."); + in_THROW_EXCEPTION("Light::read(): Expected Light identification."); } } diff --git a/src/osgPlugins/ive/LightModel.cpp b/src/osgPlugins/ive/LightModel.cpp index 9b896876a..ab8203aac 100644 --- a/src/osgPlugins/ive/LightModel.cpp +++ b/src/osgPlugins/ive/LightModel.cpp @@ -27,7 +27,7 @@ void LightModel::write(DataOutputStream* out){ if(obj) ((ive::Object*)(obj))->write(out); else - throw Exception("LightModel::write(): Could not cast this osg::LightModel to an osg::Object."); + out_THROW_EXCEPTION("LightModel::write(): Could not cast this osg::LightModel to an osg::Object."); // write LightModel's properties out->writeBool(getTwoSided()); @@ -50,7 +50,7 @@ void LightModel::read(DataInputStream* in){ if(obj) ((ive::Object*)(obj))->read(in); else - throw Exception("LightModel::read(): Could not cast this osg::LightModel to an osg::Object."); + in_THROW_EXCEPTION("LightModel::read(): Could not cast this osg::LightModel to an osg::Object."); // Read LightModel's properties setTwoSided(in->readBool()); @@ -59,6 +59,6 @@ void LightModel::read(DataInputStream* in){ setColorControl((ColorControl)in->readInt()); } else{ - throw Exception("LightModel::read(): Expected LightModel identification."); + in_THROW_EXCEPTION("LightModel::read(): Expected LightModel identification."); } } diff --git a/src/osgPlugins/ive/LightPoint.cpp b/src/osgPlugins/ive/LightPoint.cpp index 7a22cf59e..0add16e77 100644 --- a/src/osgPlugins/ive/LightPoint.cpp +++ b/src/osgPlugins/ive/LightPoint.cpp @@ -52,7 +52,7 @@ void LightPoint::write(DataOutputStream* out){ ((ive::DirectionalSector*)(_sector.get()))->write(out); } else - throw Exception("Unknown sector in LightPoint::write()"); + out_THROW_EXCEPTION("Unknown sector in LightPoint::write()"); } // Write out osgSim::BlinkSequence. @@ -109,7 +109,7 @@ void LightPoint::read(DataInputStream* in){ _sector = sector; } else - throw Exception("Unknown sector in LightPoint::read()"); + in_THROW_EXCEPTION("Unknown sector in LightPoint::read()"); } // Read in osgSim::BlinkSequence. @@ -123,6 +123,6 @@ void LightPoint::read(DataInputStream* in){ _blendingMode = (osgSim::LightPoint::BlendingMode)in->readInt(); } else{ - throw Exception("LightPoint::read(): Expected LightPoint identification."); + in_THROW_EXCEPTION("LightPoint::read(): Expected LightPoint identification."); } } diff --git a/src/osgPlugins/ive/LightPointNode.cpp b/src/osgPlugins/ive/LightPointNode.cpp index e98213f0b..d23125512 100644 --- a/src/osgPlugins/ive/LightPointNode.cpp +++ b/src/osgPlugins/ive/LightPointNode.cpp @@ -27,7 +27,7 @@ void LightPointNode::write(DataOutputStream* out){ ((ive::Node*)(node))->write(out); } else - throw Exception("LightPointNode::write(): Could not cast this osgSim::LightPointNode to an osg::Node."); + out_THROW_EXCEPTION("LightPointNode::write(): Could not cast this osgSim::LightPointNode to an osg::Node."); // Write LightPointNode's properties. out->writeFloat(getMinPixelSize()); @@ -59,7 +59,7 @@ void LightPointNode::read(DataInputStream* in){ ((ive::Node*)(node))->read(in); } else - throw Exception("LightPointNode::read(): Could not cast this osgSim::LightPointNode to an osg::Object."); + in_THROW_EXCEPTION("LightPointNode::read(): Could not cast this osgSim::LightPointNode to an osg::Object."); // Read LightPointNode's properties setMinPixelSize(in->readFloat()); setMaxPixelSize(in->readFloat()); @@ -79,6 +79,6 @@ void LightPointNode::read(DataInputStream* in){ } } else{ - throw Exception("LightPointNode::read(): Expected LightPointNode identification."); + in_THROW_EXCEPTION("LightPointNode::read(): Expected LightPointNode identification."); } } diff --git a/src/osgPlugins/ive/LightSource.cpp b/src/osgPlugins/ive/LightSource.cpp index 23a85a0b1..954fcdc77 100644 --- a/src/osgPlugins/ive/LightSource.cpp +++ b/src/osgPlugins/ive/LightSource.cpp @@ -28,7 +28,7 @@ void LightSource::write(DataOutputStream* out){ ((ive::Group*)(group))->write(out); } else - throw Exception("LightSource::write(): Could not cast this osg::LightSource to an osg::Group."); + out_THROW_EXCEPTION("LightSource::write(): Could not cast this osg::LightSource to an osg::Group."); // Write LightSource's properties. // Write out light @@ -54,7 +54,7 @@ void LightSource::read(DataInputStream* in){ ((ive::Group*)(group))->read(in); } else - throw Exception("LightSource::read(): Could not cast this osg::LightSource to an osg::Object."); + in_THROW_EXCEPTION("LightSource::read(): Could not cast this osg::LightSource to an osg::Object."); // Read LightSource's properties // Read light @@ -68,6 +68,6 @@ void LightSource::read(DataInputStream* in){ setReferenceFrame((osg::LightSource::ReferenceFrame) in->readInt()); } else{ - throw Exception("LightSource::read(): Expected LightSource identification."); + in_THROW_EXCEPTION("LightSource::read(): Expected LightSource identification."); } } diff --git a/src/osgPlugins/ive/LineStipple.cpp b/src/osgPlugins/ive/LineStipple.cpp index 29b300cca..742a60c53 100644 --- a/src/osgPlugins/ive/LineStipple.cpp +++ b/src/osgPlugins/ive/LineStipple.cpp @@ -27,7 +27,7 @@ void LineStipple::write(DataOutputStream* out){ ((ive::Object*)(obj))->write(out); } else - throw Exception("LineStipple::write(): Could not cast this osg::LineStipple to an osg::Object."); + out_THROW_EXCEPTION("LineStipple::write(): Could not cast this osg::LineStipple to an osg::Object."); // Write LineStipple's properties. out->writeUShort(getPattern()); out->writeInt(getFactor()); @@ -45,12 +45,12 @@ void LineStipple::read(DataInputStream* in){ ((ive::Object*)(obj))->read(in); } else - throw Exception("LineStipple::read(): Could not cast this osg::LineStipple to an osg::Object."); + in_THROW_EXCEPTION("LineStipple::read(): Could not cast this osg::LineStipple to an osg::Object."); // Read LineStipple's properties setPattern(in->readUShort()); setFactor(in->readInt()); } else{ - throw Exception("LineStipple::read(): Expected LineStipple identification."); + in_THROW_EXCEPTION("LineStipple::read(): Expected LineStipple identification."); } } diff --git a/src/osgPlugins/ive/LineWidth.cpp b/src/osgPlugins/ive/LineWidth.cpp index e5f0617f2..f7f645251 100644 --- a/src/osgPlugins/ive/LineWidth.cpp +++ b/src/osgPlugins/ive/LineWidth.cpp @@ -27,7 +27,7 @@ void LineWidth::write(DataOutputStream* out){ ((ive::Object*)(obj))->write(out); } else - throw Exception("LineWidth::write(): Could not cast this osg::LineWidth to an osg::Object."); + out_THROW_EXCEPTION("LineWidth::write(): Could not cast this osg::LineWidth to an osg::Object."); // Write LineWidth's properties. out->writeFloat(getWidth()); } @@ -44,11 +44,11 @@ void LineWidth::read(DataInputStream* in){ ((ive::Object*)(obj))->read(in); } else - throw Exception("LineWidth::read(): Could not cast this osg::LineWidth to an osg::Object."); + in_THROW_EXCEPTION("LineWidth::read(): Could not cast this osg::LineWidth to an osg::Object."); // Read LineWidth's properties setWidth(in->readFloat()); } else{ - throw Exception("LineWidth::read(): Expected LineWidth identification."); + in_THROW_EXCEPTION("LineWidth::read(): Expected LineWidth identification."); } } diff --git a/src/osgPlugins/ive/Locator.cpp b/src/osgPlugins/ive/Locator.cpp index 2dbe0d629..62ff6f509 100644 --- a/src/osgPlugins/ive/Locator.cpp +++ b/src/osgPlugins/ive/Locator.cpp @@ -29,7 +29,7 @@ void Locator::write(DataOutputStream* out) if (object) ((ive::Object*)(object))->write(out); else - throw Exception("Layer::write(): Could not cast this osgLayer::Layer to an osg::Object."); + out_THROW_EXCEPTION("Layer::write(): Could not cast this osgLayer::Layer to an osg::Object."); out->writeInt(getCoordinateSystemType()); out->writeString(getFormat()); @@ -52,7 +52,7 @@ void Locator::read(DataInputStream* in) int id = in->peekInt(); if(id != IVELOCATOR) { - throw Exception("Locator::read(): Expected Locator identification."); + in_THROW_EXCEPTION("Locator::read(): Expected Locator identification."); } // Read Locator's identification. @@ -63,7 +63,7 @@ void Locator::read(DataInputStream* in) if(object) ((ive::Object*)(object))->read(in); else - throw Exception("Locator::read(): Could not cast this osgLocator::Locator to an osg::Group."); + in_THROW_EXCEPTION("Locator::read(): Could not cast this osgLocator::Locator to an osg::Group."); setCoordinateSystemType(static_cast(in->readInt())); setFormat(in->readString()); diff --git a/src/osgPlugins/ive/Material.cpp b/src/osgPlugins/ive/Material.cpp index fac4a976d..c31f83304 100644 --- a/src/osgPlugins/ive/Material.cpp +++ b/src/osgPlugins/ive/Material.cpp @@ -27,7 +27,7 @@ void Material::write(DataOutputStream* out){ ((ive::Object*)(obj))->write(out); } else - throw Exception("Material::write(): Could not cast this osg::Material to an osg::Object."); + out_THROW_EXCEPTION("Material::write(): Could not cast this osg::Material to an osg::Object."); // Write Material's properties. // Write color mode @@ -67,7 +67,7 @@ void Material::read(DataInputStream* in){ ((ive::Object*)(obj))->read(in); } else - throw Exception("Material::read(): Could not cast this osg::Material to an osg::Object."); + in_THROW_EXCEPTION("Material::read(): Could not cast this osg::Material to an osg::Object."); // Read color mode. _colorMode = (osg::Material::ColorMode)in->readInt(); @@ -93,6 +93,6 @@ void Material::read(DataInputStream* in){ _shininessBack = in->readFloat(); } else{ - throw Exception("Material::read(): Expected Material identification."); + in_THROW_EXCEPTION("Material::read(): Expected Material identification."); } } diff --git a/src/osgPlugins/ive/MatrixTransform.cpp b/src/osgPlugins/ive/MatrixTransform.cpp index 88462f6e5..f912ae797 100644 --- a/src/osgPlugins/ive/MatrixTransform.cpp +++ b/src/osgPlugins/ive/MatrixTransform.cpp @@ -28,7 +28,7 @@ void MatrixTransform::write(DataOutputStream* out){ ((ive::Group*)(group))->write(out); } else - throw Exception("MatrixTransform::write(): Could not cast this osg::MatrixTransform to an osg::Group."); + out_THROW_EXCEPTION("MatrixTransform::write(): Could not cast this osg::MatrixTransform to an osg::Group."); // Write MatrixTransform's properties. @@ -47,12 +47,12 @@ void MatrixTransform::read(DataInputStream* in){ ((ive::Group*)(group))->read(in); } else - throw Exception("MatrixTransform::read(): Could not cast this osg::MatrixTransform to an osg::Group."); + in_THROW_EXCEPTION("MatrixTransform::read(): Could not cast this osg::MatrixTransform to an osg::Group."); // Read matrix setMatrix(in->readMatrixd()); } else{ - throw Exception("MatrixTransform::read(): Expected MatrixTransform identification"); + in_THROW_EXCEPTION("MatrixTransform::read(): Expected MatrixTransform identification"); } } diff --git a/src/osgPlugins/ive/MultiSwitch.cpp b/src/osgPlugins/ive/MultiSwitch.cpp index b9fd22874..2f580639c 100644 --- a/src/osgPlugins/ive/MultiSwitch.cpp +++ b/src/osgPlugins/ive/MultiSwitch.cpp @@ -27,7 +27,7 @@ void MultiSwitch::write(DataOutputStream* out){ ((ive::Group*)(group))->write(out); } else - throw Exception("Switch::write(): Could not cast this osg::Switch to an osg::Group."); + out_THROW_EXCEPTION("Switch::write(): Could not cast this osg::Switch to an osg::Group."); // Write Switch's properties. out->writeBool(getNewChildDefaultValue()); @@ -57,7 +57,7 @@ void MultiSwitch::read(DataInputStream* in) ((ive::Group*)(group))->read(in); } else - throw Exception("Switch::read(): Could not cast this osg::Switch to an osg::Group."); + in_THROW_EXCEPTION("Switch::read(): Could not cast this osg::Switch to an osg::Group."); // Read Switch's properties setNewChildDefaultValue(in->readBool()); @@ -73,6 +73,6 @@ void MultiSwitch::read(DataInputStream* in) } } else{ - throw Exception("Switch::read(): Expected Switch identification."); + in_THROW_EXCEPTION("Switch::read(): Expected Switch identification."); } } diff --git a/src/osgPlugins/ive/MultiTextureControl.cpp b/src/osgPlugins/ive/MultiTextureControl.cpp index f71c377b2..64fba9a9d 100644 --- a/src/osgPlugins/ive/MultiTextureControl.cpp +++ b/src/osgPlugins/ive/MultiTextureControl.cpp @@ -27,7 +27,7 @@ void MultiTextureControl::write(DataOutputStream* out){ ((ive::Group*)(group))->write(out); } else - throw Exception("MultiTextureControl::write(): Could not cast this osg::MultiTextureControl to an osg::Group."); + out_THROW_EXCEPTION("MultiTextureControl::write(): Could not cast this osg::MultiTextureControl to an osg::Group."); // Write MultiTextureControl's properties. @@ -53,7 +53,7 @@ void MultiTextureControl::read(DataInputStream* in){ ((ive::Group*)(group))->read(in); } else - throw Exception("MultiTextureControl::read(): Could not cast this osg::MultiTextureControl to an osg::Group."); + in_THROW_EXCEPTION("MultiTextureControl::read(): Could not cast this osg::MultiTextureControl to an osg::Group."); // Read MultiTextureControl's properties @@ -66,6 +66,6 @@ void MultiTextureControl::read(DataInputStream* in){ } } else{ - throw Exception("MultiTextureControl::read(): Expected MultiTextureControl identification."); + in_THROW_EXCEPTION("MultiTextureControl::read(): Expected MultiTextureControl identification."); } } diff --git a/src/osgPlugins/ive/Multisample.cpp b/src/osgPlugins/ive/Multisample.cpp index d15909edf..212076d4e 100644 --- a/src/osgPlugins/ive/Multisample.cpp +++ b/src/osgPlugins/ive/Multisample.cpp @@ -26,7 +26,7 @@ void Multisample::write(DataOutputStream* out){ ((ive::Object*)(obj))->write(out); } else - throw Exception("Multisample::write(): Could not cast this osg::Multisample to an osg::Object."); + out_THROW_EXCEPTION("Multisample::write(): Could not cast this osg::Multisample to an osg::Object."); // Write Multisample's properties. out->writeFloat(getCoverage()); out->writeBool(getInvert()); @@ -45,13 +45,13 @@ void Multisample::read(DataInputStream* in){ ((ive::Object*)(obj))->read(in); } else - throw Exception("Multisample::read(): Could not cast this osg::Multisample to an osg::Object."); + in_THROW_EXCEPTION("Multisample::read(): Could not cast this osg::Multisample to an osg::Object."); // Read Multisample's properties setCoverage(in->readFloat()); setInvert(in->readBool()); setHint((Mode) in->readInt()); } else{ - throw Exception("Multisample::read(): Expected Multisample identification."); + in_THROW_EXCEPTION("Multisample::read(): Expected Multisample identification."); } } diff --git a/src/osgPlugins/ive/Node.cpp b/src/osgPlugins/ive/Node.cpp index 6b209d796..8ef0fdb19 100644 --- a/src/osgPlugins/ive/Node.cpp +++ b/src/osgPlugins/ive/Node.cpp @@ -35,7 +35,7 @@ void Node::write(DataOutputStream* out){ ((ive::Object*)(obj))->write(out); } else - throw Exception("Node::write(): Could not cast this osg::Node to an osg::Object."); + out_THROW_EXCEPTION("Node::write(): Could not cast this osg::Node to an osg::Object."); // Write osg::node properties. @@ -115,7 +115,7 @@ void Node::read(DataInputStream* in){ ((ive::Object*)(obj))->read(in); } else - throw Exception("Node::read(): Could not cast this osg::Node to an osg::Object."); + in_THROW_EXCEPTION("Node::read(): Could not cast this osg::Node to an osg::Object."); if ( in->getVersion() < VERSION_0012 ) { @@ -167,7 +167,7 @@ void Node::read(DataInputStream* in){ } else { - throw Exception("Unknown event callback identification in Node::read()"); + in_THROW_EXCEPTION("Unknown event callback identification in Node::read()"); } } @@ -188,6 +188,6 @@ void Node::read(DataInputStream* in){ setNodeMask(in->readUInt()); } else{ - throw Exception("Node::read(): Expected Node identification"); + in_THROW_EXCEPTION("Node::read(): Expected Node identification"); } } diff --git a/src/osgPlugins/ive/Object.cpp b/src/osgPlugins/ive/Object.cpp index fec76cf40..c8f9281e9 100644 --- a/src/osgPlugins/ive/Object.cpp +++ b/src/osgPlugins/ive/Object.cpp @@ -84,6 +84,6 @@ void Object::read(DataInputStream* in){ } else{ - throw Exception("Object::read(): Expected Object identification"); + in_THROW_EXCEPTION("Object::read(): Expected Object identification"); } } diff --git a/src/osgPlugins/ive/OccluderNode.cpp b/src/osgPlugins/ive/OccluderNode.cpp index 3a2afeaf6..fc271b9aa 100644 --- a/src/osgPlugins/ive/OccluderNode.cpp +++ b/src/osgPlugins/ive/OccluderNode.cpp @@ -28,7 +28,7 @@ void OccluderNode::write(DataOutputStream* out){ ((ive::Group*)(group))->write(out); } else - throw Exception("OccluderNode::write(): Could not cast this osg::OccluderNode to an osg::Group."); + out_THROW_EXCEPTION("OccluderNode::write(): Could not cast this osg::OccluderNode to an osg::Group."); // Write OccluderNode's properties. out->writeBool(getOccluder()!=0); if(getOccluder()) @@ -49,7 +49,7 @@ void OccluderNode::read(DataInputStream* in) ((ive::Group*)(group))->read(in); } else - throw Exception("OccluderNode::read(): Could not cast this osg::OccluderNode to an osg::Group."); + in_THROW_EXCEPTION("OccluderNode::read(): Could not cast this osg::OccluderNode to an osg::Group."); // Read OccluderNode's properties if(in->readBool()){ osg::ConvexPlanarOccluder* cpo = new osg::ConvexPlanarOccluder(); @@ -58,6 +58,6 @@ void OccluderNode::read(DataInputStream* in) } } else{ - throw Exception("OccluderNode::read(): Expected OccluderNode identification."); + in_THROW_EXCEPTION("OccluderNode::read(): Expected OccluderNode identification."); } } diff --git a/src/osgPlugins/ive/OcclusionQueryNode.cpp b/src/osgPlugins/ive/OcclusionQueryNode.cpp index c1910c705..93c7a466d 100644 --- a/src/osgPlugins/ive/OcclusionQueryNode.cpp +++ b/src/osgPlugins/ive/OcclusionQueryNode.cpp @@ -28,7 +28,7 @@ void OcclusionQueryNode::write( DataOutputStream* out ) ((ive::Group*)(group))->write(out); } else - throw Exception("OcclusionQueryNode::write(): Could not cast this osg::OcclusionQueryNode to an osg::Group."); + out_THROW_EXCEPTION("OcclusionQueryNode::write(): Could not cast this osg::OcclusionQueryNode to an osg::Group."); // Write OcclusionQueryNode's properties. out->writeBool( getQueriesEnabled() ); @@ -52,7 +52,7 @@ void OcclusionQueryNode::read( DataInputStream* in ) ((ive::Group*)(group))->read(in); } else - throw Exception("OcclusionQueryNode::read(): Could not cast this osg::OcclusionQueryNode to an osg::Group."); + in_THROW_EXCEPTION("OcclusionQueryNode::read(): Could not cast this osg::OcclusionQueryNode to an osg::Group."); // Read OcclusionQueryNode's properties setQueriesEnabled( in->readBool() ); @@ -61,6 +61,6 @@ void OcclusionQueryNode::read( DataInputStream* in ) setDebugDisplay( in->readBool() ); } else{ - throw Exception("OcclusionQueryNode::read(): Expected OcclusionQueryNode identification."); + in_THROW_EXCEPTION("OcclusionQueryNode::read(): Expected OcclusionQueryNode identification."); } } diff --git a/src/osgPlugins/ive/PagedLOD.cpp b/src/osgPlugins/ive/PagedLOD.cpp index b85383648..02a43b59c 100644 --- a/src/osgPlugins/ive/PagedLOD.cpp +++ b/src/osgPlugins/ive/PagedLOD.cpp @@ -31,7 +31,7 @@ void PagedLOD::write(DataOutputStream* out) static_cast(node)->write(out); } else - throw Exception("PagedLOD::write(): Could not cast this osg::PagedLOD to an osg::Node."); + out_THROW_EXCEPTION("PagedLOD::write(): Could not cast this osg::PagedLOD to an osg::Node."); out->writeString(getDatabasePath()); out->writeFloat(getRadius()); @@ -123,7 +123,7 @@ void PagedLOD::read(DataInputStream* in) ((ive::Node*)(node))->read(in); } else - throw Exception("PagedLOD::read(): Could not cast this osg::PagedLOD to an osg::Node."); + in_THROW_EXCEPTION("PagedLOD::read(): Could not cast this osg::PagedLOD to an osg::Node."); if ( in->getVersion() >= VERSION_0006 ) @@ -203,6 +203,6 @@ void PagedLOD::read(DataInputStream* in) } } else{ - throw Exception("LOD::read(): Expected LOD identification."); + in_THROW_EXCEPTION("LOD::read(): Expected LOD identification."); } } diff --git a/src/osgPlugins/ive/Point.cpp b/src/osgPlugins/ive/Point.cpp index a4a15ab0d..dccc40d3c 100644 --- a/src/osgPlugins/ive/Point.cpp +++ b/src/osgPlugins/ive/Point.cpp @@ -27,7 +27,7 @@ void Point::write(DataOutputStream* out){ ((ive::Object*)(obj))->write(out); } else - throw Exception("Point::write(): Could not cast this osg::Point to an osg::Object."); + out_THROW_EXCEPTION("Point::write(): Could not cast this osg::Point to an osg::Object."); // Write Point's properties. out->writeFloat(getSize()); out->writeFloat(getFadeThresholdSize()); @@ -48,7 +48,7 @@ void Point::read(DataInputStream* in){ ((ive::Object*)(obj))->read(in); } else - throw Exception("Point::read(): Could not cast this osg::Point to an osg::Object."); + in_THROW_EXCEPTION("Point::read(): Could not cast this osg::Point to an osg::Object."); // Read Point's properties setSize(in->readFloat()); setFadeThresholdSize(in->readFloat()); @@ -57,6 +57,6 @@ void Point::read(DataInputStream* in){ setMaxSize(in->readFloat()); } else{ - throw Exception("Point::read(): Expected Point identification."); + in_THROW_EXCEPTION("Point::read(): Expected Point identification."); } } diff --git a/src/osgPlugins/ive/PointSprite.cpp b/src/osgPlugins/ive/PointSprite.cpp index cb46571fe..db4c83dec 100644 --- a/src/osgPlugins/ive/PointSprite.cpp +++ b/src/osgPlugins/ive/PointSprite.cpp @@ -27,7 +27,7 @@ void PointSprite::write(DataOutputStream* out){ ((ive::Object*)(obj))->write(out); } else - throw Exception("PointSprite::write(): Could not cast this osg::PointSprite to an osg::Object."); + out_THROW_EXCEPTION("PointSprite::write(): Could not cast this osg::PointSprite to an osg::Object."); // Write PointSprite's properties. // Write mode @@ -46,7 +46,7 @@ void PointSprite::read(DataInputStream* in){ ((ive::Object*)(obj))->read(in); } else - throw Exception("PointSprite::read(): Could not cast this osg::PointSprite to an osg::Object."); + in_THROW_EXCEPTION("PointSprite::read(): Could not cast this osg::PointSprite to an osg::Object."); // Read PointSprite's properties // Read mode @@ -54,7 +54,7 @@ void PointSprite::read(DataInputStream* in){ } else{ - throw Exception("PointSprite::read(): Expected PointSprite identification."); + in_THROW_EXCEPTION("PointSprite::read(): Expected PointSprite identification."); } } diff --git a/src/osgPlugins/ive/PolygonMode.cpp b/src/osgPlugins/ive/PolygonMode.cpp index 58f37de79..d1832962e 100644 --- a/src/osgPlugins/ive/PolygonMode.cpp +++ b/src/osgPlugins/ive/PolygonMode.cpp @@ -27,7 +27,7 @@ void PolygonMode::write(DataOutputStream* out){ ((ive::Object*)(obj))->write(out); } else - throw Exception("PolygonMode::write(): Could not cast this osg::PolygonMode to an osg::Object."); + out_THROW_EXCEPTION("PolygonMode::write(): Could not cast this osg::PolygonMode to an osg::Object."); // Write PolygonMode's properties. out->writeInt(getMode(osg::PolygonMode::FRONT)); out->writeInt(getMode(osg::PolygonMode::BACK)); @@ -45,13 +45,13 @@ void PolygonMode::read(DataInputStream* in){ ((ive::Object*)(obj))->read(in); } else - throw Exception("PolygonMode::read(): Could not cast this osg::PolygonMode to an osg::Object."); + in_THROW_EXCEPTION("PolygonMode::read(): Could not cast this osg::PolygonMode to an osg::Object."); // Read PolygonMode's properties setMode(osg::PolygonMode::FRONT,(Mode)in->readInt()); setMode(osg::PolygonMode::BACK,(Mode)in->readInt()); } else{ - throw Exception("PolygonMode::read(): Expected PolygonMode identification."); + in_THROW_EXCEPTION("PolygonMode::read(): Expected PolygonMode identification."); } } diff --git a/src/osgPlugins/ive/PolygonOffset.cpp b/src/osgPlugins/ive/PolygonOffset.cpp index 35ec2db7c..dd8070e7c 100644 --- a/src/osgPlugins/ive/PolygonOffset.cpp +++ b/src/osgPlugins/ive/PolygonOffset.cpp @@ -27,7 +27,7 @@ void PolygonOffset::write(DataOutputStream* out){ ((ive::Object*)(obj))->write(out); } else - throw Exception("PolygonOffset::write(): Could not cast this osg::PolygonOffset to an osg::Object."); + out_THROW_EXCEPTION("PolygonOffset::write(): Could not cast this osg::PolygonOffset to an osg::Object."); // Write PolygonOffset's properties. out->writeFloat(getFactor()); out->writeFloat(getUnits()); @@ -45,12 +45,12 @@ void PolygonOffset::read(DataInputStream* in){ ((ive::Object*)(obj))->read(in); } else - throw Exception("PolygonOffset::read(): Could not cast this osg::PolygonOffset to an osg::Object."); + in_THROW_EXCEPTION("PolygonOffset::read(): Could not cast this osg::PolygonOffset to an osg::Object."); // Read PolygonOffset's properties setFactor(in->readFloat()); setUnits(in->readFloat()); } else{ - throw Exception("PolygonOffset::read(): Expected PolygonOffset identification."); + in_THROW_EXCEPTION("PolygonOffset::read(): Expected PolygonOffset identification."); } } diff --git a/src/osgPlugins/ive/PolygonStipple.cpp b/src/osgPlugins/ive/PolygonStipple.cpp index b3d25b0bc..d75c868a7 100644 --- a/src/osgPlugins/ive/PolygonStipple.cpp +++ b/src/osgPlugins/ive/PolygonStipple.cpp @@ -27,7 +27,7 @@ void PolygonStipple::write(DataOutputStream* out){ ((ive::Object*)(obj))->write(out); } else - throw Exception("PolygonStipple::write(): Could not cast this osg::PolygonStipple to an osg::Object."); + out_THROW_EXCEPTION("PolygonStipple::write(): Could not cast this osg::PolygonStipple to an osg::Object."); // Write PolygonStipple's properties. out->writeUByteArray(new osg::UByteArray(128,const_cast(getMask()))); } @@ -44,11 +44,11 @@ void PolygonStipple::read(DataInputStream* in){ ((ive::Object*)(obj))->read(in); } else - throw Exception("PolygonStipple::read(): Could not cast this osg::PolygonStipple to an osg::Object."); + in_THROW_EXCEPTION("PolygonStipple::read(): Could not cast this osg::PolygonStipple to an osg::Object."); // Read PolygonStipple's properties setMask((GLubyte *)in->readUByteArray()->getDataPointer()); } else{ - throw Exception("PolygonStipple::read(): Expected PolygonStipple identification."); + in_THROW_EXCEPTION("PolygonStipple::read(): Expected PolygonStipple identification."); } } diff --git a/src/osgPlugins/ive/PositionAttitudeTransform.cpp b/src/osgPlugins/ive/PositionAttitudeTransform.cpp index aadee5de8..7f583382d 100644 --- a/src/osgPlugins/ive/PositionAttitudeTransform.cpp +++ b/src/osgPlugins/ive/PositionAttitudeTransform.cpp @@ -27,7 +27,7 @@ void PositionAttitudeTransform::write(DataOutputStream* out){ ((ive::Transform*)(trans))->write(out); } else - throw Exception("PositionAttitudeTransform::write(): Could not cast this osg::PositionAttitudeTransform to an osg::Transform."); + out_THROW_EXCEPTION("PositionAttitudeTransform::write(): Could not cast this osg::PositionAttitudeTransform to an osg::Transform."); // Write PositionAttitudeTransform's properties. out->writeVec3(getPosition()); @@ -48,7 +48,7 @@ void PositionAttitudeTransform::read(DataInputStream* in){ ((ive::Transform*)(trans))->read(in); } else - throw Exception("PositionAttitudeTransform::read(): Could not cast this osg::PositionAttitudeTransform to an osg::Transform."); + in_THROW_EXCEPTION("PositionAttitudeTransform::read(): Could not cast this osg::PositionAttitudeTransform to an osg::Transform."); // Read PositionAttitudeTransform's properties setPosition(in->readVec3()); setAttitude(in->readQuat()); @@ -57,6 +57,6 @@ void PositionAttitudeTransform::read(DataInputStream* in){ } else{ - throw Exception("PositionAttitudeTransform::read(): Expected PositionAttitudeTransform identification."); + in_THROW_EXCEPTION("PositionAttitudeTransform::read(): Expected PositionAttitudeTransform identification."); } } diff --git a/src/osgPlugins/ive/PrimitiveSet.cpp b/src/osgPlugins/ive/PrimitiveSet.cpp index 221dedaf0..1af6d7298 100644 --- a/src/osgPlugins/ive/PrimitiveSet.cpp +++ b/src/osgPlugins/ive/PrimitiveSet.cpp @@ -27,7 +27,7 @@ void PrimitiveSet::write(DataOutputStream* out){ ((ive::Object*)(obj))->write(out); } else - throw Exception("PrimitiveSet::write(): Could not cast this osg::PrimitiveSet to an osg::Object."); + out_THROW_EXCEPTION("PrimitiveSet::write(): Could not cast this osg::PrimitiveSet to an osg::Object."); if ( out->getVersion() >= VERSION_0038 ) @@ -51,7 +51,7 @@ void PrimitiveSet::read(DataInputStream* in){ ((ive::Object*)(obj))->read(in); } else - throw Exception("PrimitiveSet::read(): Could not cast this osg::PrimitiveSet to an osg::Object."); + in_THROW_EXCEPTION("PrimitiveSet::read(): Could not cast this osg::PrimitiveSet to an osg::Object."); if ( in->getVersion() >= VERSION_0038 ) @@ -63,6 +63,6 @@ void PrimitiveSet::read(DataInputStream* in){ setMode(in->readInt()); } else{ - throw Exception("PrimitiveSet::read(): Expected PrimitiveSet identification."); + in_THROW_EXCEPTION("PrimitiveSet::read(): Expected PrimitiveSet identification."); } } diff --git a/src/osgPlugins/ive/Program.cpp b/src/osgPlugins/ive/Program.cpp index 7357f79ff..43194b3e4 100644 --- a/src/osgPlugins/ive/Program.cpp +++ b/src/osgPlugins/ive/Program.cpp @@ -28,7 +28,7 @@ void Program::write(DataOutputStream* out){ ((ive::Object*)(obj))->write(out); } else - throw Exception("Program::write(): Could not cast this osg::Program to an osg::Object."); + out_THROW_EXCEPTION("Program::write(): Could not cast this osg::Program to an osg::Object."); if ( out->getVersion() >= VERSION_0030 ) { @@ -70,12 +70,12 @@ void Program::read(DataInputStream* in) ((ive::Object*)(obj))->read(in); } else - throw Exception("Program::read(): Could not cast this osg::Program to an osg::Object."); + in_THROW_EXCEPTION("Program::read(): Could not cast this osg::Program to an osg::Object."); } else { - throw Exception("Program::read(): Expected Program identification."); + in_THROW_EXCEPTION("Program::read(): Expected Program identification."); } if ( in->getVersion() >= VERSION_0030 ) diff --git a/src/osgPlugins/ive/ProxyNode.cpp b/src/osgPlugins/ive/ProxyNode.cpp index 2d67714c9..e9cb2580d 100644 --- a/src/osgPlugins/ive/ProxyNode.cpp +++ b/src/osgPlugins/ive/ProxyNode.cpp @@ -57,7 +57,7 @@ void ProxyNode::write(DataOutputStream* out) static_cast(node)->write(out); } else - throw Exception("ProxyNode::write(): Could not cast this osg::ProxyNode to an osg::Node."); + out_THROW_EXCEPTION("ProxyNode::write(): Could not cast this osg::ProxyNode to an osg::Node."); out->writeFloat(getRadius()); out->writeInt(getCenterMode()); @@ -156,7 +156,7 @@ void ProxyNode::read(DataInputStream* in) ((ive::Node*)(node))->read(in); } else - throw Exception("ProxyNode::read(): Could not cast this osg::ProxyNode to an osg::Node."); + in_THROW_EXCEPTION("ProxyNode::read(): Could not cast this osg::ProxyNode to an osg::Node."); if (in->getOptions() && !in->getOptions()->getDatabasePathList().empty()) { @@ -208,6 +208,6 @@ void ProxyNode::read(DataInputStream* in) } else { - throw Exception("ProxyNode::read(): Expected ProxyNode identification."); + in_THROW_EXCEPTION("ProxyNode::read(): Expected ProxyNode identification."); } } diff --git a/src/osgPlugins/ive/ReaderWriterIVE.cpp b/src/osgPlugins/ive/ReaderWriterIVE.cpp index 93b370ec2..3d534aa90 100644 --- a/src/osgPlugins/ive/ReaderWriterIVE.cpp +++ b/src/osgPlugins/ive/ReaderWriterIVE.cpp @@ -80,28 +80,25 @@ class ReaderWriterIVE : public ReaderWriter virtual ReadResult readImage(std::istream& fin, const Options* options) const { - try{ - ive::DataInputStream in(&fin, options); - return in.readImage(ive::IMAGE_INCLUDE_DATA); - } - catch(ive::Exception e) + ive::DataInputStream in(&fin, options); + if (in.getException()) { - return e.getError(); + return in.getException()->getError(); } + + return in.readImage(ive::IMAGE_INCLUDE_DATA); } virtual ReadResult readNode(std::istream& fin, const Options* options) const { - try{ - // Create datainputstream. - ive::DataInputStream in(&fin, options); - - return in.readNode(); - } - catch(ive::Exception e) + // Create datainputstream. + ive::DataInputStream in(&fin, options); + if (in.getException()) { - return e.getError(); + return in.getException()->getError(); } + + return in.readNode(); } virtual WriteResult writeObject(const Object& object,const std::string& fileName, const osgDB::ReaderWriter::Options* options) const @@ -157,38 +154,31 @@ class ReaderWriterIVE : public ReaderWriter virtual WriteResult writeImage(const Image& image,std::ostream& fout, const osgDB::ReaderWriter::Options* options) const { - try + ive::DataOutputStream out(&fout, options); + out.writeImage(ive::IMAGE_INCLUDE_DATA, const_cast(&image)); + if (fout.fail()) return WriteResult::ERROR_IN_WRITING_FILE; + if (out.getException()) { - ive::DataOutputStream out(&fout, options); - out.writeImage(ive::IMAGE_INCLUDE_DATA, const_cast(&image)); - if (fout.fail()) return WriteResult::ERROR_IN_WRITING_FILE; - return WriteResult::FILE_SAVED; + osg::notify(osg::WARN)<<"Error writing IVE image: "<< out.getException()->getError() << std::endl; + return WriteResult::FILE_NOT_HANDLED; } - catch(ive::Exception e) - { - osg::notify(osg::WARN)<<"Error writing IVE image: "<< e.getError() << std::endl; - } - return WriteResult::FILE_NOT_HANDLED; + return WriteResult::FILE_SAVED; } virtual WriteResult writeNode(const Node& node,std::ostream& fout, const osgDB::ReaderWriter::Options* options) const { - try + ive::DataOutputStream out(&fout, options); + + out.writeNode(const_cast(&node)); + + if ( fout.fail() ) return WriteResult::ERROR_IN_WRITING_FILE; + if (out.getException()) { - ive::DataOutputStream out(&fout, options); - - out.writeNode(const_cast(&node)); - - if ( fout.fail() ) return WriteResult::ERROR_IN_WRITING_FILE; - - return WriteResult::FILE_SAVED; + osg::notify(osg::WARN)<<"Error writing IVE image: "<< out.getException()->getError() << std::endl; + return WriteResult::FILE_NOT_HANDLED; } - catch(ive::Exception e) - { - osg::notify(osg::WARN)<<"Error writing IVE file: "<< e.getError() << std::endl; - } - return WriteResult::FILE_NOT_HANDLED; + return WriteResult::FILE_SAVED; } }; diff --git a/src/osgPlugins/ive/Scissor.cpp b/src/osgPlugins/ive/Scissor.cpp index a903dd4b7..7f7609a03 100644 --- a/src/osgPlugins/ive/Scissor.cpp +++ b/src/osgPlugins/ive/Scissor.cpp @@ -27,7 +27,7 @@ void Scissor::write(DataOutputStream* out){ ((ive::Object*)(obj))->write(out); } else - throw Exception("Scissor::write(): Could not cast this osg::Scissor to an osg::Object."); + out_THROW_EXCEPTION("Scissor::write(): Could not cast this osg::Scissor to an osg::Object."); // Write Scissor's properties. out->writeInt(x()); @@ -48,7 +48,7 @@ void Scissor::read(DataInputStream* in){ ((ive::Object*)(obj))->read(in); } else - throw Exception("Scissor::read(): Could not cast this osg::Scissor to an osg::Object."); + in_THROW_EXCEPTION("Scissor::read(): Could not cast this osg::Scissor to an osg::Object."); // Read Scissor's properties x() = (GLenum)in->readInt(); @@ -58,6 +58,6 @@ void Scissor::read(DataInputStream* in){ } else{ - throw Exception("Scissor::read(): Expected Scissor identification."); + in_THROW_EXCEPTION("Scissor::read(): Expected Scissor identification."); } } diff --git a/src/osgPlugins/ive/Scribe.cpp b/src/osgPlugins/ive/Scribe.cpp index 24a7d8276..0d4285988 100644 --- a/src/osgPlugins/ive/Scribe.cpp +++ b/src/osgPlugins/ive/Scribe.cpp @@ -25,7 +25,7 @@ void Scribe::write(DataOutputStream* out){ ((ive::Effect*)(effect))->write(out); } else - throw Exception("Scribe::write(): Could not cast this osgFX::Scribe to an osgFX::Effect."); + out_THROW_EXCEPTION("Scribe::write(): Could not cast this osgFX::Scribe to an osgFX::Effect."); // Write Scribe's properties. out->writeVec4(getWireframeColor()); @@ -45,13 +45,13 @@ void Scribe::read(DataInputStream* in){ ((ive::Effect*)(effect))->read(in); } else - throw Exception("Scribe::read(): Could not cast this osgFX::Scribe to an osgFX::Effect."); + in_THROW_EXCEPTION("Scribe::read(): Could not cast this osgFX::Scribe to an osgFX::Effect."); // Read Scribe's properties setWireframeColor(in->readVec4()); setWireframeLineWidth(in->readFloat()); } else{ - throw Exception("Scribe::read(): Expected Scribe identification."); + in_THROW_EXCEPTION("Scribe::read(): Expected Scribe identification."); } } diff --git a/src/osgPlugins/ive/Sequence.cpp b/src/osgPlugins/ive/Sequence.cpp index fc019671b..6a4dc1fc4 100644 --- a/src/osgPlugins/ive/Sequence.cpp +++ b/src/osgPlugins/ive/Sequence.cpp @@ -30,7 +30,7 @@ void Sequence::write(DataOutputStream* out) } else { - throw Exception("Sequence::write(): Could not cast this osg::Sequence to an osg::Group."); + out_THROW_EXCEPTION("Sequence::write(): Could not cast this osg::Sequence to an osg::Group."); } // Write Sequence's properties. @@ -104,7 +104,7 @@ void Sequence::read(DataInputStream* in) } else { - throw Exception("Sequence::read(): Could not cast this osg::Sequence to an osg::Group."); + in_THROW_EXCEPTION("Sequence::read(): Could not cast this osg::Sequence to an osg::Group."); } // Read Sequence's properties @@ -153,6 +153,6 @@ void Sequence::read(DataInputStream* in) } else { - throw Exception("Sequence::read(): Expected Sequence identification."); + in_THROW_EXCEPTION("Sequence::read(): Expected Sequence identification."); } } diff --git a/src/osgPlugins/ive/ShadeModel.cpp b/src/osgPlugins/ive/ShadeModel.cpp index 790b33c3b..0a86ca43e 100644 --- a/src/osgPlugins/ive/ShadeModel.cpp +++ b/src/osgPlugins/ive/ShadeModel.cpp @@ -27,7 +27,7 @@ void ShadeModel::write(DataOutputStream* out){ ((ive::Object*)(obj))->write(out); } else - throw Exception("ShadeModel::write(): Could not cast this osg::ShadeModel to an osg::Object."); + out_THROW_EXCEPTION("ShadeModel::write(): Could not cast this osg::ShadeModel to an osg::Object."); // Write ShadeModel's properties. out->writeInt(getMode()); } @@ -44,11 +44,11 @@ void ShadeModel::read(DataInputStream* in){ ((ive::Object*)(obj))->read(in); } else - throw Exception("ShadeModel::read(): Could not cast this osg::ShadeModel to an osg::Object."); + in_THROW_EXCEPTION("ShadeModel::read(): Could not cast this osg::ShadeModel to an osg::Object."); // Read ShadeModel's properties setMode((Mode)in->readInt()); } else{ - throw Exception("ShadeModel::read(): Expected ShadeModel identification."); + in_THROW_EXCEPTION("ShadeModel::read(): Expected ShadeModel identification."); } } diff --git a/src/osgPlugins/ive/Shader.cpp b/src/osgPlugins/ive/Shader.cpp index 0d365b082..3f99dc79c 100644 --- a/src/osgPlugins/ive/Shader.cpp +++ b/src/osgPlugins/ive/Shader.cpp @@ -28,7 +28,7 @@ void Shader::write(DataOutputStream* out){ ((ive::Object*)(obj))->write(out); } else - throw Exception("Shader::write(): Could not cast this osg::Shader to an osg::Object."); + out_THROW_EXCEPTION("Shader::write(): Could not cast this osg::Shader to an osg::Object."); if ( out->getVersion() < VERSION_0012 ) { @@ -54,12 +54,12 @@ void Shader::read(DataInputStream* in) ((ive::Object*)(obj))->read(in); } else - throw Exception("Shader::read(): Could not cast this osg::Shader to an osg::Object."); + in_THROW_EXCEPTION("Shader::read(): Could not cast this osg::Shader to an osg::Object."); } else { - throw Exception("Shader::read(): Expected Shader identification."); + in_THROW_EXCEPTION("Shader::read(): Expected Shader identification."); } if ( in->getVersion() < VERSION_0012 ) diff --git a/src/osgPlugins/ive/Shape.cpp b/src/osgPlugins/ive/Shape.cpp index 5e5781322..c8911e0cd 100644 --- a/src/osgPlugins/ive/Shape.cpp +++ b/src/osgPlugins/ive/Shape.cpp @@ -36,7 +36,7 @@ void Sphere::write(DataOutputStream* out) ((ive::Object*)(obj))->write(out); } else - throw Exception("Sphere::write(): Could not cast this osg::Sphere to an osg::Object."); + out_THROW_EXCEPTION("Sphere::write(): Could not cast this osg::Sphere to an osg::Object."); // Write Sphere's properties. out->writeVec3(getCenter()); @@ -58,7 +58,7 @@ void Sphere::read(DataInputStream* in) ((ive::Object*)(obj))->read(in); } else - throw Exception("Sphere::read(): Could not cast this osg::Sphere to an osg::Object."); + in_THROW_EXCEPTION("Sphere::read(): Could not cast this osg::Sphere to an osg::Object."); // Read Sphere's properties setCenter(in->readVec3()); @@ -67,7 +67,7 @@ void Sphere::read(DataInputStream* in) } else { - throw Exception("Sphere::read(): Expected Sphere identification."); + in_THROW_EXCEPTION("Sphere::read(): Expected Sphere identification."); } } @@ -87,7 +87,7 @@ void Box::write(DataOutputStream* out) ((ive::Object*)(obj))->write(out); } else - throw Exception("Box::write(): Could not cast this osg::Box to an osg::Object."); + out_THROW_EXCEPTION("Box::write(): Could not cast this osg::Box to an osg::Object."); // Write Box's properties. out->writeVec3(getCenter()); @@ -110,7 +110,7 @@ void Box::read(DataInputStream* in) ((ive::Object*)(obj))->read(in); } else - throw Exception("Box::read(): Could not cast this osg::Box to an osg::Object."); + in_THROW_EXCEPTION("Box::read(): Could not cast this osg::Box to an osg::Object."); // Read Box's properties setCenter(in->readVec3()); @@ -120,7 +120,7 @@ void Box::read(DataInputStream* in) } else { - throw Exception("Box::read(): Expected Box identification."); + in_THROW_EXCEPTION("Box::read(): Expected Box identification."); } } @@ -140,7 +140,7 @@ void Cone::write(DataOutputStream* out) ((ive::Object*)(obj))->write(out); } else - throw Exception("Cone::write(): Could not cast this osg::Cone to an osg::Object."); + out_THROW_EXCEPTION("Cone::write(): Could not cast this osg::Cone to an osg::Object."); // Write Cone's properties. out->writeVec3(getCenter()); @@ -164,7 +164,7 @@ void Cone::read(DataInputStream* in) ((ive::Object*)(obj))->read(in); } else - throw Exception("Cone::read(): Could not cast this osg::Cone to an osg::Object."); + in_THROW_EXCEPTION("Cone::read(): Could not cast this osg::Cone to an osg::Object."); // Read Cone's properties setCenter(in->readVec3()); @@ -175,7 +175,7 @@ void Cone::read(DataInputStream* in) } else { - throw Exception("Cone::read(): Expected Cone identification."); + in_THROW_EXCEPTION("Cone::read(): Expected Cone identification."); } } @@ -195,7 +195,7 @@ void Cylinder::write(DataOutputStream* out) ((ive::Object*)(obj))->write(out); } else - throw Exception("Cylinder::write(): Could not cast this osg::Cylinder to an osg::Object."); + out_THROW_EXCEPTION("Cylinder::write(): Could not cast this osg::Cylinder to an osg::Object."); // Write Cylinder's properties. out->writeVec3(getCenter()); @@ -219,7 +219,7 @@ void Cylinder::read(DataInputStream* in) ((ive::Object*)(obj))->read(in); } else - throw Exception("Cylinder::read(): Could not cast this osg::Cylinder to an osg::Object."); + in_THROW_EXCEPTION("Cylinder::read(): Could not cast this osg::Cylinder to an osg::Object."); // Read Cylinder's properties setCenter(in->readVec3()); @@ -230,7 +230,7 @@ void Cylinder::read(DataInputStream* in) } else { - throw Exception("Cylinder::read(): Expected Cylinder identification."); + in_THROW_EXCEPTION("Cylinder::read(): Expected Cylinder identification."); } } @@ -250,7 +250,7 @@ void Capsule::write(DataOutputStream* out) ((ive::Object*)(obj))->write(out); } else - throw Exception("Capsule::write(): Could not cast this osg::Capsule to an osg::Object."); + out_THROW_EXCEPTION("Capsule::write(): Could not cast this osg::Capsule to an osg::Object."); // Write Capsule's properties. out->writeVec3(getCenter()); @@ -274,7 +274,7 @@ void Capsule::read(DataInputStream* in) ((ive::Object*)(obj))->read(in); } else - throw Exception("Capsule::read(): Could not cast this osg::Capsule to an osg::Object."); + in_THROW_EXCEPTION("Capsule::read(): Could not cast this osg::Capsule to an osg::Object."); // Read Capsule's properties setCenter(in->readVec3()); @@ -285,7 +285,7 @@ void Capsule::read(DataInputStream* in) } else { - throw Exception("Capsule::read(): Expected Capsule identification."); + in_THROW_EXCEPTION("Capsule::read(): Expected Capsule identification."); } } @@ -305,7 +305,7 @@ void HeightField::write(DataOutputStream* out) ((ive::Object*)(obj))->write(out); } else - throw Exception("HeightField::write(): Could not cast this osg::HeightField to an osg::Object."); + out_THROW_EXCEPTION("HeightField::write(): Could not cast this osg::HeightField to an osg::Object."); // Write HeightField's properties. out->writeUInt(getNumColumns()); @@ -344,7 +344,7 @@ void HeightField::read(DataInputStream* in) ((ive::Object*)(obj))->read(in); } else - throw Exception("HeightField::read(): Could not cast this osg::HeightField to an osg::Object."); + in_THROW_EXCEPTION("HeightField::read(): Could not cast this osg::HeightField to an osg::Object."); // Read HeightField's properties //setColor(in->readVec4()); @@ -363,7 +363,7 @@ void HeightField::read(DataInputStream* in) unsigned int size = in->readUInt(); in->_istream->read((char*)&(getHeightList()[0]), FLOATSIZE*size); if (in->_istream->rdstate() & in->_istream->failbit) - throw Exception("HeightField::read(): Failed to read height array."); + in_THROW_EXCEPTION("HeightField::read(): Failed to read height array."); if (in->_byteswap) { float *ptr = (float*)&(getHeightList()[0]) ; for (unsigned int i = 0 ; i < size ; i++ ) { @@ -374,7 +374,7 @@ void HeightField::read(DataInputStream* in) } else { - throw Exception("HeightField::read(): Expected HeightField identification."); + in_THROW_EXCEPTION("HeightField::read(): Expected HeightField identification."); } } diff --git a/src/osgPlugins/ive/ShapeAttributeList.cpp b/src/osgPlugins/ive/ShapeAttributeList.cpp index 18abebe4c..9c09e014c 100644 --- a/src/osgPlugins/ive/ShapeAttributeList.cpp +++ b/src/osgPlugins/ive/ShapeAttributeList.cpp @@ -57,7 +57,7 @@ void ShapeAttributeList::read(DataInputStream* in) } } else{ - throw Exception("ShapeAttributeList::read(): Expected ShapeAttributeList identification."); + in_THROW_EXCEPTION("ShapeAttributeList::read(): Expected ShapeAttributeList identification."); } } diff --git a/src/osgPlugins/ive/ShapeDrawable.cpp b/src/osgPlugins/ive/ShapeDrawable.cpp index 0b113a7b2..c640473da 100644 --- a/src/osgPlugins/ive/ShapeDrawable.cpp +++ b/src/osgPlugins/ive/ShapeDrawable.cpp @@ -32,7 +32,7 @@ void ShapeDrawable::write(DataOutputStream* out) ((ive::Drawable*)(drawable))->write(out); } else - throw Exception("ShapeDrawable::write(): Could not cast this osg::ShapeDrawable to an osg::Object."); + out_THROW_EXCEPTION("ShapeDrawable::write(): Could not cast this osg::ShapeDrawable to an osg::Object."); } else @@ -42,7 +42,7 @@ void ShapeDrawable::write(DataOutputStream* out) ((ive::Object*)(obj))->write(out); } else - throw Exception("ShapeDrawable::write(): Could not cast this osg::ShapeDrawable to an osg::Object."); + out_THROW_EXCEPTION("ShapeDrawable::write(): Could not cast this osg::ShapeDrawable to an osg::Object."); } // Write ShapeDrawable's properties. @@ -76,7 +76,7 @@ void ShapeDrawable::read(DataInputStream* in) ((ive::Drawable*)(drawable))->read(in); } else - throw Exception("ShapeDrawable::read(): Could not cast this osg::ShapeDrawable to an osg::Object."); + in_THROW_EXCEPTION("ShapeDrawable::read(): Could not cast this osg::ShapeDrawable to an osg::Object."); } else { @@ -86,7 +86,7 @@ void ShapeDrawable::read(DataInputStream* in) ((ive::Object*)(obj))->read(in); } else - throw Exception("ShapeDrawable::read(): Could not cast this osg::ShapeDrawable to an osg::Object."); + in_THROW_EXCEPTION("ShapeDrawable::read(): Could not cast this osg::ShapeDrawable to an osg::Object."); } // Read ShapeDrawable's properties @@ -100,6 +100,6 @@ void ShapeDrawable::read(DataInputStream* in) } else { - throw Exception("ShapeDrawable::read(): Expected ShapeDrawable identification."); + in_THROW_EXCEPTION("ShapeDrawable::read(): Expected ShapeDrawable identification."); } } diff --git a/src/osgPlugins/ive/SpecularHighlights.cpp b/src/osgPlugins/ive/SpecularHighlights.cpp index 452b3327a..51e5b6523 100644 --- a/src/osgPlugins/ive/SpecularHighlights.cpp +++ b/src/osgPlugins/ive/SpecularHighlights.cpp @@ -25,7 +25,7 @@ void SpecularHighlights::write(DataOutputStream* out){ ((ive::Effect*)(effect))->write(out); } else - throw Exception("SpecularHighlights::write(): Could not cast this osgFX::SpecularHighlights to an osgFX::Effect."); + out_THROW_EXCEPTION("SpecularHighlights::write(): Could not cast this osgFX::SpecularHighlights to an osgFX::Effect."); // Write SpecularHighlights's properties. out->writeInt(getLightNumber()); @@ -47,7 +47,7 @@ void SpecularHighlights::read(DataInputStream* in){ ((ive::Effect*)(effect))->read(in); } else - throw Exception("SpecularHighlights::read(): Could not cast this osgFX::SpecularHighlights to an osgFX::Effect."); + in_THROW_EXCEPTION("SpecularHighlights::read(): Could not cast this osgFX::SpecularHighlights to an osgFX::Effect."); // Read SpecularHighlights's properties setLightNumber(in->readInt()); @@ -56,6 +56,6 @@ void SpecularHighlights::read(DataInputStream* in){ setSpecularExponent(in->readFloat()); } else{ - throw Exception("SpecularHighlights::read(): Expected SpecularHighlights identification."); + in_THROW_EXCEPTION("SpecularHighlights::read(): Expected SpecularHighlights identification."); } } diff --git a/src/osgPlugins/ive/StateSet.cpp b/src/osgPlugins/ive/StateSet.cpp index 58c377d10..049df99ee 100644 --- a/src/osgPlugins/ive/StateSet.cpp +++ b/src/osgPlugins/ive/StateSet.cpp @@ -29,14 +29,14 @@ void StateSet::write(DataOutputStream* out){ ((ive::Object*)(obj))->write(out); } else - throw Exception("StateSet::write(): Could not cast this osg::StateSet to an osg::Object."); + out_THROW_EXCEPTION("StateSet::write(): Could not cast this osg::StateSet to an osg::Object."); // Write render bin bin details. switch(getRenderBinMode()){ case osg::StateSet::INHERIT_RENDERBIN_DETAILS: out->writeChar((char)0);break; case osg::StateSet::USE_RENDERBIN_DETAILS: out->writeChar((char)1);break; case osg::StateSet::OVERRIDE_RENDERBIN_DETAILS: out->writeChar((char)2);break; - default: throw Exception("Unknown RenderBinMode in StateSet::write()"); + default: out_THROW_EXCEPTION("Unknown RenderBinMode in StateSet::write()"); } out->writeInt(getBinNumber()); out->writeString(getBinName()); @@ -113,7 +113,7 @@ void StateSet::read(DataInputStream* in){ ((ive::Object*)(obj))->read(in);; } else - throw Exception("StateSet::read(): Could not cast this osg::StateSet to an osg::Object."); + in_THROW_EXCEPTION("StateSet::read(): Could not cast this osg::StateSet to an osg::Object."); // Read render bin details. char c = in->readChar(); @@ -132,7 +132,7 @@ void StateSet::read(DataInputStream* in){ case 3: setRenderBinDetails(num, name, osg::StateSet::USE_RENDERBIN_DETAILS); break; - default: throw Exception("Unknown RenderBinMode in StateSet::read()"); + default: in_THROW_EXCEPTION("Unknown RenderBinMode in StateSet::read()"); } // Read stateset modes. @@ -187,6 +187,6 @@ void StateSet::read(DataInputStream* in){ } } else{ - throw Exception("StateSet::read(): Expected StateSet identification"); + in_THROW_EXCEPTION("StateSet::read(): Expected StateSet identification"); } } diff --git a/src/osgPlugins/ive/Stencil.cpp b/src/osgPlugins/ive/Stencil.cpp index 34c8afdcd..6f31d0b21 100644 --- a/src/osgPlugins/ive/Stencil.cpp +++ b/src/osgPlugins/ive/Stencil.cpp @@ -27,7 +27,7 @@ void Stencil::write(DataOutputStream* out){ ((ive::Object*)(obj))->write(out); } else - throw Exception("Stencil::write(): Could not cast this osg::Stencil to an osg::Object."); + out_THROW_EXCEPTION("Stencil::write(): Could not cast this osg::Stencil to an osg::Object."); // Write Stencil's properties. out->writeInt(getFunction()); @@ -56,7 +56,7 @@ void Stencil::read(DataInputStream* in){ ((ive::Object*)(obj))->read(in); } else - throw Exception("Stencil::read(): Could not cast this osg::Stencil to an osg::Object."); + in_THROW_EXCEPTION("Stencil::read(): Could not cast this osg::Stencil to an osg::Object."); setFunction((Function)in->readInt()); setFunctionRef(in->readInt()); @@ -70,6 +70,6 @@ void Stencil::read(DataInputStream* in){ } else{ - throw Exception("Stencil::read(): Expected Stencil identification."); + in_THROW_EXCEPTION("Stencil::read(): Expected Stencil identification."); } } diff --git a/src/osgPlugins/ive/Switch.cpp b/src/osgPlugins/ive/Switch.cpp index 6d0915c6b..981bf3ee3 100644 --- a/src/osgPlugins/ive/Switch.cpp +++ b/src/osgPlugins/ive/Switch.cpp @@ -27,7 +27,7 @@ void Switch::write(DataOutputStream* out){ ((ive::Group*)(group))->write(out); } else - throw Exception("Switch::write(): Could not cast this osg::Switch to an osg::Group."); + out_THROW_EXCEPTION("Switch::write(): Could not cast this osg::Switch to an osg::Group."); // Write Switch's properties. // Write childrens value. @@ -48,7 +48,7 @@ void Switch::read(DataInputStream* in){ ((ive::Group*)(group))->read(in); } else - throw Exception("Switch::read(): Could not cast this osg::Switch to an osg::Group."); + in_THROW_EXCEPTION("Switch::read(): Could not cast this osg::Switch to an osg::Group."); // Read Switch's properties // Read childrens value. @@ -57,6 +57,6 @@ void Switch::read(DataInputStream* in){ } else{ - throw Exception("Switch::read(): Expected Switch identification."); + in_THROW_EXCEPTION("Switch::read(): Expected Switch identification."); } } diff --git a/src/osgPlugins/ive/SwitchLayer.cpp b/src/osgPlugins/ive/SwitchLayer.cpp index fa741de47..4c44ada0b 100644 --- a/src/osgPlugins/ive/SwitchLayer.cpp +++ b/src/osgPlugins/ive/SwitchLayer.cpp @@ -27,7 +27,7 @@ void SwitchLayer::write(DataOutputStream* out) if (layer) ((ive::CompositeLayer*)(layer))->write(out); else - throw Exception("SwitchLayer::write(): Could not cast this osgLayer::SwitchLayer to an osgTerrain::Layer."); + out_THROW_EXCEPTION("SwitchLayer::write(): Could not cast this osgLayer::SwitchLayer to an osgTerrain::Layer."); out->writeInt(getActiveLayer()); @@ -38,7 +38,7 @@ void SwitchLayer::read(DataInputStream* in) // Peek on Layer's identification. int id = in->peekInt(); if (id != IVESWITCHLAYER) - throw Exception("SwitchLayer::read(): Expected SwitchLayer identification."); + in_THROW_EXCEPTION("SwitchLayer::read(): Expected SwitchLayer identification."); // Read Layer's identification. id = in->readInt(); @@ -48,7 +48,7 @@ void SwitchLayer::read(DataInputStream* in) if (layer) ((ive::CompositeLayer*)(layer))->read(in); else - throw Exception("SwitchLayer::read(): Could not cast this osgLayer::Layer to an osg::Group."); + in_THROW_EXCEPTION("SwitchLayer::read(): Could not cast this osgLayer::Layer to an osg::Group."); setActiveLayer(in->readInt()); } diff --git a/src/osgPlugins/ive/TerrainTile.cpp b/src/osgPlugins/ive/TerrainTile.cpp index d10994a82..403b15882 100644 --- a/src/osgPlugins/ive/TerrainTile.cpp +++ b/src/osgPlugins/ive/TerrainTile.cpp @@ -29,7 +29,7 @@ void TerrainTile::write(DataOutputStream* out) if(group) ((ive::Group*)(group))->write(out); else - throw Exception("Terrain::write(): Could not cast this osgTerrain::Terrain to an osg::Group."); + out_THROW_EXCEPTION("Terrain::write(): Could not cast this osgTerrain::Terrain to an osg::Group."); if (out->getVersion() >= VERSION_0026) { @@ -73,7 +73,7 @@ void TerrainTile::read(DataInputStream* in) { // Peek on Terrain's identification. int id = in->peekInt(); - if (id != IVETERRAINTILE) throw Exception("TerrainTile::read(): Expected Terrain identification."); + if (id != IVETERRAINTILE) in_THROW_EXCEPTION("TerrainTile::read(): Expected Terrain identification."); // Read Terrain's identification. id = in->readInt(); @@ -82,7 +82,7 @@ void TerrainTile::read(DataInputStream* in) if(group) ((ive::Group*)(group))->read(in); else - throw Exception("Terrain::read(): Could not cast this osgTerrain::Terrain to an osg::Group."); + in_THROW_EXCEPTION("Terrain::read(): Could not cast this osgTerrain::Terrain to an osg::Group."); if (in->getVersion() >= VERSION_0026) { diff --git a/src/osgPlugins/ive/TexEnv.cpp b/src/osgPlugins/ive/TexEnv.cpp index a0ef7e104..fa2aa9f30 100644 --- a/src/osgPlugins/ive/TexEnv.cpp +++ b/src/osgPlugins/ive/TexEnv.cpp @@ -27,7 +27,7 @@ void TexEnv::write(DataOutputStream* out){ ((ive::Object*)(obj))->write(out); } else - throw Exception("TexEnv::write(): Could not cast this osg::TexEnv to an osg::Object."); + out_THROW_EXCEPTION("TexEnv::write(): Could not cast this osg::TexEnv to an osg::Object."); // Write TexEnv's properties. // Write mode @@ -48,7 +48,7 @@ void TexEnv::read(DataInputStream* in){ ((ive::Object*)(obj))->read(in); } else - throw Exception("TexEnv::read(): Could not cast this osg::TexEnv to an osg::Object."); + in_THROW_EXCEPTION("TexEnv::read(): Could not cast this osg::TexEnv to an osg::Object."); // Read TexEnv's properties // Read mode @@ -57,6 +57,6 @@ void TexEnv::read(DataInputStream* in){ setColor(in->readVec4()); } else{ - throw Exception("TexEnv::read(): Expected TexEnv identification."); + in_THROW_EXCEPTION("TexEnv::read(): Expected TexEnv identification."); } } diff --git a/src/osgPlugins/ive/TexEnvCombine.cpp b/src/osgPlugins/ive/TexEnvCombine.cpp index da9606ca1..9839bb4f8 100644 --- a/src/osgPlugins/ive/TexEnvCombine.cpp +++ b/src/osgPlugins/ive/TexEnvCombine.cpp @@ -27,7 +27,7 @@ void TexEnvCombine::write(DataOutputStream* out){ ((ive::Object*)(obj))->write(out); } else - throw Exception("TexEnvCombine::write(): Could not cast this osg::TexEnvCombine to an osg::Object."); + out_THROW_EXCEPTION("TexEnvCombine::write(): Could not cast this osg::TexEnvCombine to an osg::Object."); // Write TexEnvCombine's properties. // Write combine method @@ -66,7 +66,7 @@ void TexEnvCombine::read(DataInputStream* in){ ((ive::Object*)(obj))->read(in); } else - throw Exception("TexEnvCombine::read(): Could not cast this osg::TexEnvCombine to an osg::Object."); + in_THROW_EXCEPTION("TexEnvCombine::read(): Could not cast this osg::TexEnvCombine to an osg::Object."); // Read TexEnvCombine's properties // Read combine method @@ -93,6 +93,6 @@ void TexEnvCombine::read(DataInputStream* in){ } else{ - throw Exception("TexEnvCombine::read(): Expected TexEnvCombine identification."); + in_THROW_EXCEPTION("TexEnvCombine::read(): Expected TexEnvCombine identification."); } } diff --git a/src/osgPlugins/ive/TexGen.cpp b/src/osgPlugins/ive/TexGen.cpp index a9db11d59..b05f8824e 100644 --- a/src/osgPlugins/ive/TexGen.cpp +++ b/src/osgPlugins/ive/TexGen.cpp @@ -27,7 +27,7 @@ void TexGen::write(DataOutputStream* out){ ((ive::Object*)(obj))->write(out); } else - throw Exception("TexGen::write(): Could not cast this osg::TexGen to an osg::Object."); + out_THROW_EXCEPTION("TexGen::write(): Could not cast this osg::TexGen to an osg::Object."); // Write TexGen's properties. // Write mode @@ -54,7 +54,7 @@ void TexGen::read(DataInputStream* in){ ((ive::Object*)(obj))->read(in); } else - throw Exception("TexGen::read(): Could not cast this osg::TexGen to an osg::Object."); + in_THROW_EXCEPTION("TexGen::read(): Could not cast this osg::TexGen to an osg::Object."); // Read TexGen's properties setMode((osg::TexGen::Mode)in->readInt()); @@ -68,6 +68,6 @@ void TexGen::read(DataInputStream* in){ } else{ - throw Exception("TexGen::read(): Expected TexGen identification."); + in_THROW_EXCEPTION("TexGen::read(): Expected TexGen identification."); } } diff --git a/src/osgPlugins/ive/TexGenNode.cpp b/src/osgPlugins/ive/TexGenNode.cpp index 9a62626a1..5ceb9410e 100644 --- a/src/osgPlugins/ive/TexGenNode.cpp +++ b/src/osgPlugins/ive/TexGenNode.cpp @@ -28,7 +28,7 @@ void TexGenNode::write(DataOutputStream* out){ ((ive::Group*)(group))->write(out); } else - throw Exception("TexGenNode::write(): Could not cast this osg::TexGenNode to an osg::Group."); + out_THROW_EXCEPTION("TexGenNode::write(): Could not cast this osg::TexGenNode to an osg::Group."); // Write TexGenNode's properties. @@ -54,7 +54,7 @@ void TexGenNode::read(DataInputStream* in){ ((ive::Group*)(group))->read(in); } else - throw Exception("TexGenNode::read(): Could not cast this osg::TexGenNode to an osg::Object."); + in_THROW_EXCEPTION("TexGenNode::read(): Could not cast this osg::TexGenNode to an osg::Object."); // Read TexGenNode's properties @@ -68,6 +68,6 @@ void TexGenNode::read(DataInputStream* in){ } } else{ - throw Exception("TexGenNode::read(): Expected TexGenNode identification."); + in_THROW_EXCEPTION("TexGenNode::read(): Expected TexGenNode identification."); } } diff --git a/src/osgPlugins/ive/TexMat.cpp b/src/osgPlugins/ive/TexMat.cpp index 94e8e100e..94a56f5b4 100644 --- a/src/osgPlugins/ive/TexMat.cpp +++ b/src/osgPlugins/ive/TexMat.cpp @@ -27,7 +27,7 @@ void TexMat::write(DataOutputStream* out){ ((ive::Object*)(obj))->write(out); } else - throw Exception("TexMat::write(): Could not cast this osg::TexMat to an osg::Object."); + out_THROW_EXCEPTION("TexMat::write(): Could not cast this osg::TexMat to an osg::Object."); // Write TexMat's properties. // Write mode @@ -52,7 +52,7 @@ void TexMat::read(DataInputStream* in){ ((ive::Object*)(obj))->read(in); } else - throw Exception("TexMat::read(): Could not cast this osg::TexMat to an osg::Object."); + in_THROW_EXCEPTION("TexMat::read(): Could not cast this osg::TexMat to an osg::Object."); // Read TexMat's properties // Read matrix @@ -65,6 +65,6 @@ void TexMat::read(DataInputStream* in){ } else{ - throw Exception("TexMat::read(): Expected TexMat identification."); + in_THROW_EXCEPTION("TexMat::read(): Expected TexMat identification."); } } diff --git a/src/osgPlugins/ive/Text.cpp b/src/osgPlugins/ive/Text.cpp index cc9bb6e85..9d2b637bc 100644 --- a/src/osgPlugins/ive/Text.cpp +++ b/src/osgPlugins/ive/Text.cpp @@ -32,7 +32,8 @@ void Text::write(DataOutputStream* out){ ((ive::Drawable*)(obj))->write(out); } else - throw Exception("Text::write(): Could not cast this osgText::Text to an osg::Drawable."); + out_THROW_EXCEPTION("Text::write(): Could not cast this osgText::Text to an osg::Drawable."); + // Write Text's properties. if( getFont() ) { @@ -154,7 +155,7 @@ void Text::read(DataInputStream* in){ ((ive::Drawable*)(obj))->read(in); } else - throw Exception("Text::read(): Could not cast this osgText::Text to an osg::Drawable."); + in_THROW_EXCEPTION("Text::read(): Could not cast this osgText::Text to an osg::Drawable."); // Read Text's properties unsigned int width, height; @@ -253,6 +254,6 @@ void Text::read(DataInputStream* in){ } else{ - throw Exception("Text::read(): Expected Text identification."); + in_THROW_EXCEPTION("Text::read(): Expected Text identification."); } } diff --git a/src/osgPlugins/ive/Text3D.cpp b/src/osgPlugins/ive/Text3D.cpp index 592afc240..a0bcff4c8 100644 --- a/src/osgPlugins/ive/Text3D.cpp +++ b/src/osgPlugins/ive/Text3D.cpp @@ -33,7 +33,8 @@ void Text3D::write(DataOutputStream* out){ ((ive::Drawable*)(obj))->write(out); } else - throw Exception("Text::write(): Could not cast this osgText::Text to an osg::Drawable."); + out_THROW_EXCEPTION("Text::write(): Could not cast this osgText::Text to an osg::Drawable."); + // Write Text's properties. if( getFont() ) { @@ -136,7 +137,7 @@ void Text3D::read(DataInputStream* in){ ((ive::Drawable*)(obj))->read(in); } else - throw Exception("Text::read(): Could not cast this osgText::Text to an osg::Drawable."); + in_THROW_EXCEPTION("Text::read(): Could not cast this osgText::Text to an osg::Drawable."); // Read Text's properties unsigned int width, height; @@ -212,6 +213,6 @@ void Text3D::read(DataInputStream* in){ } else{ - throw Exception("Text3D::read(): Expected ShadeModel identification."); + in_THROW_EXCEPTION("Text3D::read(): Expected ShadeModel identification."); } } diff --git a/src/osgPlugins/ive/Texture.cpp b/src/osgPlugins/ive/Texture.cpp index d829afaa7..bfafddbb2 100644 --- a/src/osgPlugins/ive/Texture.cpp +++ b/src/osgPlugins/ive/Texture.cpp @@ -28,7 +28,7 @@ void Texture::write(DataOutputStream* out){ ((ive::Object*)(obj))->write(out); } else - throw Exception("Texture::write(): Could not cast this osg::Texture to an osg::Object."); + out_THROW_EXCEPTION("Texture::write(): Could not cast this osg::Texture to an osg::Object."); // Write Texture's properties. out->writeInt(_wrap_s); @@ -79,7 +79,7 @@ void Texture::read(DataInputStream* in) ((ive::Object*)(obj))->read(in); } else - throw Exception("Texture::read(): Could not cast this osg::Texture to an osg::Object."); + in_THROW_EXCEPTION("Texture::read(): Could not cast this osg::Texture to an osg::Object."); // Read properties _wrap_s = (osg::Texture::WrapMode)in->readInt(); @@ -115,6 +115,6 @@ void Texture::read(DataInputStream* in) } else { - throw Exception("Texture::read(): Expected Texture identification."); + in_THROW_EXCEPTION("Texture::read(): Expected Texture identification."); } } diff --git a/src/osgPlugins/ive/Texture1D.cpp b/src/osgPlugins/ive/Texture1D.cpp index 25e50f5cb..7bf250a48 100644 --- a/src/osgPlugins/ive/Texture1D.cpp +++ b/src/osgPlugins/ive/Texture1D.cpp @@ -28,7 +28,7 @@ void Texture1D::write(DataOutputStream* out){ ((ive::Texture*)(tex))->write(out); } else - throw Exception("Texture1D::write(): Could not cast this osg::Texture1D to an osg::Texture."); + out_THROW_EXCEPTION("Texture1D::write(): Could not cast this osg::Texture1D to an osg::Texture."); // Write Texture1D's properties. // Write image. @@ -48,7 +48,7 @@ void Texture1D::read(DataInputStream* in){ ((ive::Texture*)(tex))->read(in); } else - throw Exception("Texture1D::read(): Could not cast this osg::Texture1D to an osg::Texture."); + in_THROW_EXCEPTION("Texture1D::read(): Could not cast this osg::Texture1D to an osg::Texture."); // Read image. // Should we read image data from stream @@ -58,6 +58,6 @@ void Texture1D::read(DataInputStream* in){ } } else{ - throw Exception("Texture1D::read(): Expected Texture1D identification."); + in_THROW_EXCEPTION("Texture1D::read(): Expected Texture1D identification."); } } diff --git a/src/osgPlugins/ive/Texture2D.cpp b/src/osgPlugins/ive/Texture2D.cpp index 3742d83f3..bb1d55889 100644 --- a/src/osgPlugins/ive/Texture2D.cpp +++ b/src/osgPlugins/ive/Texture2D.cpp @@ -28,7 +28,7 @@ void Texture2D::write(DataOutputStream* out){ ((ive::Texture*)(tex))->write(out); } else - throw Exception("Texture2D::write(): Could not cast this osg::Texture2D to an osg::Texture."); + out_THROW_EXCEPTION("Texture2D::write(): Could not cast this osg::Texture2D to an osg::Texture."); // Write Texture2D's properties. // Write image. @@ -48,7 +48,7 @@ void Texture2D::read(DataInputStream* in){ ((ive::Texture*)(tex))->read(in); } else - throw Exception("Texture2D::read(): Could not cast this osg::Texture2D to an osg::Texture."); + in_THROW_EXCEPTION("Texture2D::read(): Could not cast this osg::Texture2D to an osg::Texture."); // Read image. osg::Image *image = in->readImage(); @@ -57,6 +57,6 @@ void Texture2D::read(DataInputStream* in){ } } else{ - throw Exception("Texture2D::read(): Expected Texture2D identification."); + in_THROW_EXCEPTION("Texture2D::read(): Expected Texture2D identification."); } } diff --git a/src/osgPlugins/ive/Texture3D.cpp b/src/osgPlugins/ive/Texture3D.cpp index 418188577..d9f33db7e 100644 --- a/src/osgPlugins/ive/Texture3D.cpp +++ b/src/osgPlugins/ive/Texture3D.cpp @@ -28,7 +28,7 @@ void Texture3D::write(DataOutputStream* out){ ((ive::Texture*)(tex))->write(out); } else - throw Exception("Texture3D::write(): Could not cast this osg::Texture3D to an osg::Texture."); + out_THROW_EXCEPTION("Texture3D::write(): Could not cast this osg::Texture3D to an osg::Texture."); // Write Texture3D's properties. // Write image. @@ -48,7 +48,7 @@ void Texture3D::read(DataInputStream* in){ ((ive::Texture*)(tex))->read(in); } else - throw Exception("Texture3D::read(): Could not cast this osg::Texture3D to an osg::Texture."); + in_THROW_EXCEPTION("Texture3D::read(): Could not cast this osg::Texture3D to an osg::Texture."); // Read image. // Should we read image data from stream @@ -58,6 +58,6 @@ void Texture3D::read(DataInputStream* in){ } } else{ - throw Exception("Texture3D::read(): Expected Texture3D identification."); + in_THROW_EXCEPTION("Texture3D::read(): Expected Texture3D identification."); } } diff --git a/src/osgPlugins/ive/TextureCubeMap.cpp b/src/osgPlugins/ive/TextureCubeMap.cpp index 56b5e427c..43b4e0745 100644 --- a/src/osgPlugins/ive/TextureCubeMap.cpp +++ b/src/osgPlugins/ive/TextureCubeMap.cpp @@ -28,7 +28,7 @@ void TextureCubeMap::write(DataOutputStream* out){ ((ive::Texture*)(tex))->write(out); } else - throw Exception("TextureCubeMap::write(): Could not cast this osg::TextureCubeMap to an osg::Texture."); + out_THROW_EXCEPTION("TextureCubeMap::write(): Could not cast this osg::TextureCubeMap to an osg::Texture."); // Write TextureCubeMap's properties. // Write texture size @@ -75,7 +75,7 @@ void TextureCubeMap::read(DataInputStream* in) ((ive::Texture*)(tex))->read(in); } else - throw Exception("TextureCubeMap::read(): Could not cast this osg::TextureCubeMap to an osg::Texture."); + in_THROW_EXCEPTION("TextureCubeMap::read(): Could not cast this osg::TextureCubeMap to an osg::Texture."); // Read TextureCubeMap's properties // Read texture size @@ -110,7 +110,7 @@ void TextureCubeMap::read(DataInputStream* in) } else{ - throw Exception("TextureCubeMap::read(): Expected TextureCubeMap identification."); + in_THROW_EXCEPTION("TextureCubeMap::read(): Expected TextureCubeMap identification."); } } diff --git a/src/osgPlugins/ive/TextureRectangle.cpp b/src/osgPlugins/ive/TextureRectangle.cpp index 3056d2c48..2d95890cb 100644 --- a/src/osgPlugins/ive/TextureRectangle.cpp +++ b/src/osgPlugins/ive/TextureRectangle.cpp @@ -28,7 +28,7 @@ void TextureRectangle::write(DataOutputStream* out){ ((ive::Texture*)(tex))->write(out); } else - throw Exception("TextureRectangle::write(): Could not cast this osg::TextureRectangle to an osg::Texture."); + out_THROW_EXCEPTION("TextureRectangle::write(): Could not cast this osg::TextureRectangle to an osg::Texture."); // Write TextureRectangle's properties. // Write image. @@ -48,7 +48,7 @@ void TextureRectangle::read(DataInputStream* in){ ((ive::Texture*)(tex))->read(in); } else - throw Exception("TextureRectangle::read(): Could not cast this osg::TextureRectangle to an osg::Texture."); + in_THROW_EXCEPTION("TextureRectangle::read(): Could not cast this osg::TextureRectangle to an osg::Texture."); // Read image. // Should we read image data from stream @@ -58,6 +58,6 @@ void TextureRectangle::read(DataInputStream* in){ } } else{ - throw Exception("TextureRectangle::read(): Expected TextureRectangle identification."); + in_THROW_EXCEPTION("TextureRectangle::read(): Expected TextureRectangle identification."); } } diff --git a/src/osgPlugins/ive/Transform.cpp b/src/osgPlugins/ive/Transform.cpp index b74e15946..7e13eb461 100644 --- a/src/osgPlugins/ive/Transform.cpp +++ b/src/osgPlugins/ive/Transform.cpp @@ -27,7 +27,7 @@ void Transform::write(DataOutputStream* out){ ((ive::Group*)(group))->write(out); } else - throw Exception("Transform::write(): Could not cast this osg::Transform to an osg::Group."); + out_THROW_EXCEPTION("Transform::write(): Could not cast this osg::Transform to an osg::Group."); // Write Transform's properties. out->writeInt(getReferenceFrame()); } @@ -44,11 +44,11 @@ void Transform::read(DataInputStream* in){ ((ive::Group*)(group))->read(in); } else - throw Exception("Transform::read(): Could not cast this osg::Transform to an osg::Group."); + in_THROW_EXCEPTION("Transform::read(): Could not cast this osg::Transform to an osg::Group."); // Read Transform's properties setReferenceFrame((osg::Transform::ReferenceFrame)in->readInt()); } else{ - throw Exception("Transform::read(): Expected Transform identification."); + in_THROW_EXCEPTION("Transform::read(): Expected Transform identification."); } } diff --git a/src/osgPlugins/ive/Uniform.cpp b/src/osgPlugins/ive/Uniform.cpp index b4255aba3..4400ab8af 100644 --- a/src/osgPlugins/ive/Uniform.cpp +++ b/src/osgPlugins/ive/Uniform.cpp @@ -29,7 +29,7 @@ void Uniform::write(DataOutputStream* out){ ((ive::Object*)(obj))->write(out); } else - throw Exception("Uniform::write(): Could not cast this osg::Uniform to an osg::Object."); + out_THROW_EXCEPTION("Uniform::write(): Could not cast this osg::Uniform to an osg::Object."); out->writeInt(getType()); @@ -156,12 +156,12 @@ void Uniform::read(DataInputStream* in) ((ive::Object*)(obj))->read(in); } else - throw Exception("Uniform::read(): Could not cast this osg::Uniform to an osg::Object."); + in_THROW_EXCEPTION("Uniform::read(): Could not cast this osg::Uniform to an osg::Object."); } else { - throw Exception("Uniform::read(): Expected Uniform identification."); + in_THROW_EXCEPTION("Uniform::read(): Expected Uniform identification."); } setType(static_cast(in->readInt())); diff --git a/src/osgPlugins/ive/VertexProgram.cpp b/src/osgPlugins/ive/VertexProgram.cpp index 5a6c5adfd..2119b21a3 100644 --- a/src/osgPlugins/ive/VertexProgram.cpp +++ b/src/osgPlugins/ive/VertexProgram.cpp @@ -30,7 +30,7 @@ void VertexProgram::write( DataOutputStream* out ) } else { - throw Exception("Material::write(): Could not cast this osg::VertexProgram to an osg::Object."); + out_THROW_EXCEPTION("Material::write(): Could not cast this osg::VertexProgram to an osg::Object."); } // Write VertexProgram properties. @@ -54,7 +54,7 @@ void VertexProgram::read(DataInputStream* in){ } else { - throw Exception( "Material::read(): Could not cast this osg::VertexProgram to an osg::Object." ); + in_THROW_EXCEPTION( "Material::read(): Could not cast this osg::VertexProgram to an osg::Object." ); } // Read data @@ -63,6 +63,6 @@ void VertexProgram::read(DataInputStream* in){ } else { - throw Exception("VertexProgram::read(): Expected VertexProgram identification."); + in_THROW_EXCEPTION("VertexProgram::read(): Expected VertexProgram identification."); } } diff --git a/src/osgPlugins/ive/Viewport.cpp b/src/osgPlugins/ive/Viewport.cpp index 996460e59..6a4b0d522 100644 --- a/src/osgPlugins/ive/Viewport.cpp +++ b/src/osgPlugins/ive/Viewport.cpp @@ -27,7 +27,7 @@ void Viewport::write(DataOutputStream* out){ ((ive::Object*)(obj))->write(out); } else - throw Exception("Viewport::write(): Could not cast this osg::Viewport to an osg::Object."); + out_THROW_EXCEPTION("Viewport::write(): Could not cast this osg::Viewport to an osg::Object."); // Write Viewport's properties. out->writeInt(static_cast(x())); @@ -48,7 +48,7 @@ void Viewport::read(DataInputStream* in){ ((ive::Object*)(obj))->read(in); } else - throw Exception("Viewport::read(): Could not cast this osg::Viewport to an osg::Object."); + in_THROW_EXCEPTION("Viewport::read(): Could not cast this osg::Viewport to an osg::Object."); // Read Viewport's properties x() = in->readInt(); @@ -58,6 +58,6 @@ void Viewport::read(DataInputStream* in){ } else{ - throw Exception("Viewport::read(): Expected Viewport identification."); + in_THROW_EXCEPTION("Viewport::read(): Expected Viewport identification."); } } diff --git a/src/osgPlugins/ive/VisibilityGroup.cpp b/src/osgPlugins/ive/VisibilityGroup.cpp index a35624245..8b68218b0 100644 --- a/src/osgPlugins/ive/VisibilityGroup.cpp +++ b/src/osgPlugins/ive/VisibilityGroup.cpp @@ -26,7 +26,7 @@ void VisibilityGroup::write(DataOutputStream* out){ ((ive::Group*)(group))->write(out); } else - throw Exception("VisibilityGroup::write(): Could not cast this osgSim::VisibilityGroup to an osg::Group."); + out_THROW_EXCEPTION("VisibilityGroup::write(): Could not cast this osgSim::VisibilityGroup to an osg::Group."); // Write VisibilityGroup's properties. out->writeNode(getVisibilityVolume()); @@ -46,13 +46,13 @@ void VisibilityGroup::read(DataInputStream* in){ ((ive::Group*)(group))->read(in); } else - throw Exception("VisibilityGroup::read(): Could not cast this osgSim::VisibilityGroup to an osg::Group."); + in_THROW_EXCEPTION("VisibilityGroup::read(): Could not cast this osgSim::VisibilityGroup to an osg::Group."); // Read VisibilityGroup's properties setVisibilityVolume(in->readNode()); setVolumeIntersectionMask(in->readUInt()); setSegmentLength(in->readFloat()); } else{ - throw Exception("VisibilityGroup::read(): Expected VisibilityGroup identification."); + in_THROW_EXCEPTION("VisibilityGroup::read(): Expected VisibilityGroup identification."); } } diff --git a/src/osgPlugins/ive/Volume.cpp b/src/osgPlugins/ive/Volume.cpp index 75599fe7b..b0c64a092 100644 --- a/src/osgPlugins/ive/Volume.cpp +++ b/src/osgPlugins/ive/Volume.cpp @@ -26,14 +26,14 @@ void Volume::write(DataOutputStream* out) if(group) ((ive::Group*)(group))->write(out); else - throw Exception("Volume::write(): Could not cast this osgVolume::Volume to an osg::Group."); + out_THROW_EXCEPTION("Volume::write(): Could not cast this osgVolume::Volume to an osg::Group."); } void Volume::read(DataInputStream* in) { // Peek on Volume's identification. int id = in->peekInt(); - if (id != IVEVOLUME) throw Exception("Volume::read(): Expected Volume identification."); + if (id != IVEVOLUME) in_THROW_EXCEPTION("Volume::read(): Expected Volume identification."); // Read Volume's identification. id = in->readInt(); @@ -42,6 +42,6 @@ void Volume::read(DataInputStream* in) if(group) ((ive::Group*)(group))->read(in); else - throw Exception("Volume::read(): Could not cast this osgVolume::Volume to an osg::Group."); + in_THROW_EXCEPTION("Volume::read(): Could not cast this osgVolume::Volume to an osg::Group."); } diff --git a/src/osgPlugins/ive/VolumeCompositeLayer.cpp b/src/osgPlugins/ive/VolumeCompositeLayer.cpp index 6cd76aaeb..412c8c471 100644 --- a/src/osgPlugins/ive/VolumeCompositeLayer.cpp +++ b/src/osgPlugins/ive/VolumeCompositeLayer.cpp @@ -28,7 +28,7 @@ void VolumeCompositeLayer::write(DataOutputStream* out) if (layer) ((ive::VolumeLayer*)(layer))->write(out); else - throw Exception("VolumeCompositeLayer::write(): Could not cast this osgVolume::CompositeLayer to an osgVolume::Layer."); + out_THROW_EXCEPTION("VolumeCompositeLayer::write(): Could not cast this osgVolume::CompositeLayer to an osgVolume::Layer."); out->writeUInt(getNumLayers()); for(unsigned int i=0; ipeekInt(); if (id != IVEVOLUMECOMPOSITELAYER) - throw Exception("VolumeCompositeLayer::read(): Expected CompositeLayer identification."); + in_THROW_EXCEPTION("VolumeCompositeLayer::read(): Expected CompositeLayer identification."); // Read Layer's identification. id = in->readInt(); @@ -61,7 +61,7 @@ void VolumeCompositeLayer::read(DataInputStream* in) if (layer) ((ive::VolumeLayer*)(layer))->read(in); else - throw Exception("VolumeCompositeLayer::read(): Could not cast this osgVolume::Layer to an osg::Group."); + in_THROW_EXCEPTION("VolumeCompositeLayer::read(): Could not cast this osgVolume::Layer to an osg::Group."); unsigned int numLayers = in->readUInt(); for(unsigned int i=0; iwrite(out); else - throw Exception("VolumeCompositeProperty::write(): Could not cast this osgVolume::CompositeProperty to an osg::Object."); + out_THROW_EXCEPTION("VolumeCompositeProperty::write(): Could not cast this osgVolume::CompositeProperty to an osg::Object."); out->writeUInt(getNumProperties()); for(unsigned int i=0; ipeekInt(); if (id != IVEVOLUMECOMPOSITEPROPERTY) - throw Exception("VolumeCompositeProperty::read(): Expected CompositeProperty identification."); + in_THROW_EXCEPTION("VolumeCompositeProperty::read(): Expected CompositeProperty identification."); // Read Layer's identification. id = in->readInt(); @@ -54,7 +54,7 @@ void VolumeCompositeProperty::read(DataInputStream* in) if (object) ((ive::Object*)(object))->read(in); else - throw Exception("VolumeCompositeProperty::write(): Could not cast this osgVolume::CompositeProperty to an osg::Object."); + in_THROW_EXCEPTION("VolumeCompositeProperty::write(): Could not cast this osgVolume::CompositeProperty to an osg::Object."); unsigned int numProperties = in->readUInt(); for(unsigned int i=0; iwrite(out); else - throw Exception("VolumeImageLayer::write(): Could not cast this osgVolume::ImageLayer to an osgVolume::Layer."); + out_THROW_EXCEPTION("VolumeImageLayer::write(): Could not cast this osgVolume::ImageLayer to an osgVolume::Layer."); IncludeImageMode imMode = out->getIncludeImageMode(getImage()); @@ -46,7 +46,7 @@ void VolumeImageLayer::read(DataInputStream* in) // Peek on Layer's identification. int id = in->peekInt(); if (id != IVEVOLUMEIMAGELAYER) - throw Exception("VolumeImageLayer::read(): Expected ImageLayer identification."); + in_THROW_EXCEPTION("VolumeImageLayer::read(): Expected ImageLayer identification."); // Read Layer's identification. id = in->readInt(); @@ -56,7 +56,7 @@ void VolumeImageLayer::read(DataInputStream* in) if (layer) ((ive::VolumeLayer*)(layer))->read(in); else - throw Exception("ImageLayer::read(): Could not cast this osgVolume::Layer to an osg::Group."); + in_THROW_EXCEPTION("ImageLayer::read(): Could not cast this osgVolume::Layer to an osg::Group."); // Should we read image data from stream IncludeImageMode includeImg = (IncludeImageMode)in->readChar(); diff --git a/src/osgPlugins/ive/VolumeLayer.cpp b/src/osgPlugins/ive/VolumeLayer.cpp index 66e3999b7..a1ae2f2c2 100644 --- a/src/osgPlugins/ive/VolumeLayer.cpp +++ b/src/osgPlugins/ive/VolumeLayer.cpp @@ -33,7 +33,7 @@ void VolumeLayer::write(DataOutputStream* out) if (object) ((ive::Object*)(object))->write(out); else - throw Exception("VolumeLayer::write(): Could not cast this osgVolume::Layer to an osg::Object."); + out_THROW_EXCEPTION("VolumeLayer::write(): Could not cast this osgVolume::Layer to an osg::Object."); out->writeVolumeLocator(getLocator()); out->writeVolumeProperty(getProperty()); @@ -44,7 +44,7 @@ void VolumeLayer::read(DataInputStream* in) // Peek on Layer's identification. int id = in->peekInt(); if (id != IVEVOLUMELAYER) - throw Exception("VolumeLayer::read(): Expected Layer identification."); + in_THROW_EXCEPTION("VolumeLayer::read(): Expected Layer identification."); // Read Layer's identification. id = in->readInt(); @@ -54,7 +54,7 @@ void VolumeLayer::read(DataInputStream* in) if(object) ((ive::Object*)(object))->read(in); else - throw Exception("VolumeLayer::read(): Could not cast this osgVolume::Layer to an osg::Object."); + in_THROW_EXCEPTION("VolumeLayer::read(): Could not cast this osgVolume::Layer to an osg::Object."); setLocator(in->readVolumeLocator()); setProperty(in->readVolumeProperty()); diff --git a/src/osgPlugins/ive/VolumeLocator.cpp b/src/osgPlugins/ive/VolumeLocator.cpp index 4843c17ba..098c242f1 100644 --- a/src/osgPlugins/ive/VolumeLocator.cpp +++ b/src/osgPlugins/ive/VolumeLocator.cpp @@ -28,7 +28,7 @@ void VolumeLocator::write(DataOutputStream* out) if (object) ((ive::Object*)(object))->write(out); else - throw Exception("VolumeLocaotr::write(): Could not cast this osgVolume::Locator to an osg::Object."); + out_THROW_EXCEPTION("VolumeLocaotr::write(): Could not cast this osgVolume::Locator to an osg::Object."); out->writeMatrixd(getTransform()); } @@ -39,7 +39,7 @@ void VolumeLocator::read(DataInputStream* in) int id = in->peekInt(); if(id != IVEVOLUMELOCATOR) { - throw Exception("VolumeLocator::read(): Expected Locator identification."); + in_THROW_EXCEPTION("VolumeLocator::read(): Expected Locator identification."); } // Read Locator's identification. @@ -50,7 +50,7 @@ void VolumeLocator::read(DataInputStream* in) if(object) ((ive::Object*)(object))->read(in); else - throw Exception("VolumeLocator::read(): Could not cast this osgVolume::Locator to an osg::Object."); + in_THROW_EXCEPTION("VolumeLocator::read(): Could not cast this osgVolume::Locator to an osg::Object."); setTransform(in->readMatrixd()); diff --git a/src/osgPlugins/ive/VolumePropertyAdjustmentCallback.cpp b/src/osgPlugins/ive/VolumePropertyAdjustmentCallback.cpp index 5e2697471..2a761a119 100644 --- a/src/osgPlugins/ive/VolumePropertyAdjustmentCallback.cpp +++ b/src/osgPlugins/ive/VolumePropertyAdjustmentCallback.cpp @@ -29,7 +29,7 @@ void VolumePropertyAdjustmentCallback::write(DataOutputStream* out) ((ive::Object*)(obj))->write(out); } else - throw Exception("VolumePropertyAdjustmentCallback::write(): Could not cast this osg::VolumePropertyAdjustmentCallback to an osg::Object."); + out_THROW_EXCEPTION("VolumePropertyAdjustmentCallback::write(): Could not cast this osg::VolumePropertyAdjustmentCallback to an osg::Object."); // Write VolumePropertyAdjustmentCallback's properties. out->writeInt(getKeyEventCyclesForward()); @@ -55,7 +55,7 @@ void VolumePropertyAdjustmentCallback::read(DataInputStream* in) ((ive::Object*)(obj))->read(in); } else - throw Exception("VolumePropertyAdjustmentCallback::read(): Could not cast this osg::VolumePropertyAdjustmentCallback to an osg::Object."); + in_THROW_EXCEPTION("VolumePropertyAdjustmentCallback::read(): Could not cast this osg::VolumePropertyAdjustmentCallback to an osg::Object."); // Read VolumePropertyAdjustmentCallback's properties @@ -68,6 +68,6 @@ void VolumePropertyAdjustmentCallback::read(DataInputStream* in) } else { - throw Exception("VolumePropertyAdjustmentCallback::read(): Expected VolumePropertyAdjustmentCallback identification."); + in_THROW_EXCEPTION("VolumePropertyAdjustmentCallback::read(): Expected VolumePropertyAdjustmentCallback identification."); } } diff --git a/src/osgPlugins/ive/VolumeScalarProperty.cpp b/src/osgPlugins/ive/VolumeScalarProperty.cpp index ad8b5b0ef..c663fcc12 100644 --- a/src/osgPlugins/ive/VolumeScalarProperty.cpp +++ b/src/osgPlugins/ive/VolumeScalarProperty.cpp @@ -29,7 +29,7 @@ void VolumeScalarProperty::write(DataOutputStream* out) if (object) ((ive::Object*)(object))->write(out); else - throw Exception("VolumeScalarProperty::write(): Could not cast this osgVolume::ScalarProperty to an osg::Object."); + out_THROW_EXCEPTION("VolumeScalarProperty::write(): Could not cast this osgVolume::ScalarProperty to an osg::Object."); out->writeFloat(getValue()); } @@ -39,7 +39,7 @@ void VolumeScalarProperty::read(DataInputStream* in) // Peek on Layer's identification. int id = in->peekInt(); if (id != IVEVOLUMESCALARPROPERTY) - throw Exception("VolumeScalarProperty::read(): Expected CompositeProperty identification."); + in_THROW_EXCEPTION("VolumeScalarProperty::read(): Expected CompositeProperty identification."); // Read Layer's identification. id = in->readInt(); @@ -49,7 +49,7 @@ void VolumeScalarProperty::read(DataInputStream* in) if (object) ((ive::Object*)(object))->read(in); else - throw Exception("VolumeScalarProperty::write(): Could not cast this osgVolume::ScalarProperty to an osg::Object."); + in_THROW_EXCEPTION("VolumeScalarProperty::write(): Could not cast this osgVolume::ScalarProperty to an osg::Object."); setValue(in->readFloat()); } diff --git a/src/osgPlugins/ive/VolumeSwitchProperty.cpp b/src/osgPlugins/ive/VolumeSwitchProperty.cpp index 8d789612e..edd60767d 100644 --- a/src/osgPlugins/ive/VolumeSwitchProperty.cpp +++ b/src/osgPlugins/ive/VolumeSwitchProperty.cpp @@ -29,7 +29,7 @@ void VolumeSwitchProperty::write(DataOutputStream* out) if (cp) ((ive::VolumeCompositeProperty*)(cp))->write(out); else - throw Exception("VolumeImageLayer::write(): Could not cast this osgVolume::SwitchProperty to an osgVolume::CompositeProperty."); + out_THROW_EXCEPTION("VolumeImageLayer::write(): Could not cast this osgVolume::SwitchProperty to an osgVolume::CompositeProperty."); out->writeUInt(getActiveProperty()); } @@ -39,7 +39,7 @@ void VolumeSwitchProperty::read(DataInputStream* in) // Peek on Layer's identification. int id = in->peekInt(); if (id != IVEVOLUMESWITCHPROPERTY) - throw Exception("VolumeSwitchProperty::read(): Expected CompositeProperty identification."); + in_THROW_EXCEPTION("VolumeSwitchProperty::read(): Expected CompositeProperty identification."); // Read Layer's identification. id = in->readInt(); @@ -49,7 +49,7 @@ void VolumeSwitchProperty::read(DataInputStream* in) if (cp) ((ive::VolumeCompositeProperty*)(cp))->read(in); else - throw Exception("VolumeImageLayer::read(): Could not cast this osgVolume::SwitchProperty to an osgVolume::CompositeProperty."); + in_THROW_EXCEPTION("VolumeImageLayer::read(): Could not cast this osgVolume::SwitchProperty to an osgVolume::CompositeProperty."); setActiveProperty(in->readUInt()); } diff --git a/src/osgPlugins/ive/VolumeTile.cpp b/src/osgPlugins/ive/VolumeTile.cpp index 3116cce62..a91525d74 100644 --- a/src/osgPlugins/ive/VolumeTile.cpp +++ b/src/osgPlugins/ive/VolumeTile.cpp @@ -30,7 +30,7 @@ void VolumeTile::write(DataOutputStream* out) if(group) ((ive::Group*)(group))->write(out); else - throw Exception("VolumeTile::write(): Could not cast this osgVolume::VolumeTile to an osg::Group."); + out_THROW_EXCEPTION("VolumeTile::write(): Could not cast this osgVolume::VolumeTile to an osg::Group."); out->writeVolumeLocator(getLocator()); @@ -44,7 +44,7 @@ void VolumeTile::read(DataInputStream* in) { // Peek on VolumeTile's identification. int id = in->peekInt(); - if (id != IVEVOLUMETILE) throw Exception("VolumeTile::read(): Expected Volume identification."); + if (id != IVEVOLUMETILE) in_THROW_EXCEPTION("VolumeTile::read(): Expected Volume identification."); // Read VolumeTile's identification. id = in->readInt(); @@ -53,7 +53,7 @@ void VolumeTile::read(DataInputStream* in) if(group) ((ive::Group*)(group))->read(in); else - throw Exception("VolumeTile::read(): Could not cast this osgVolume::VolumeTile to an osg::Group."); + in_THROW_EXCEPTION("VolumeTile::read(): Could not cast this osgVolume::VolumeTile to an osg::Group."); setLocator(in->readVolumeLocator()); setLayer(in->readVolumeLayer()); diff --git a/src/osgPlugins/ive/VolumeTransferFunctionProperty.cpp b/src/osgPlugins/ive/VolumeTransferFunctionProperty.cpp index 06a29c373..a0dd749f8 100644 --- a/src/osgPlugins/ive/VolumeTransferFunctionProperty.cpp +++ b/src/osgPlugins/ive/VolumeTransferFunctionProperty.cpp @@ -29,7 +29,7 @@ void VolumeTransferFunctionProperty::write(DataOutputStream* out) if (object) ((ive::Object*)(object))->write(out); else - throw Exception("VolumeTransferFunctionProperty::write(): Could not cast this osgVolume::TransferFunctionProperty to an osg::Object."); + out_THROW_EXCEPTION("VolumeTransferFunctionProperty::write(): Could not cast this osgVolume::TransferFunctionProperty to an osg::Object."); osg::TransferFunction1D* tf = dynamic_cast(getTransferFunction()); @@ -73,7 +73,7 @@ void VolumeTransferFunctionProperty::read(DataInputStream* in) // Peek on Layer's identification. int id = in->peekInt(); if (id != IVEVOLUMETRANSFERFUNCTIONPROPERTY) - throw Exception("VolumeTransferFunctionProperty::read(): Expected CompositeProperty identification."); + in_THROW_EXCEPTION("VolumeTransferFunctionProperty::read(): Expected CompositeProperty identification."); // Read Layer's identification. id = in->readInt(); @@ -83,7 +83,7 @@ void VolumeTransferFunctionProperty::read(DataInputStream* in) if (object) ((ive::Object*)(object))->read(in); else - throw Exception("VolumeTransferFunctionProperty::write(): Could not cast this osgVolume::TransferFunctionProperty to an osg::Object."); + in_THROW_EXCEPTION("VolumeTransferFunctionProperty::write(): Could not cast this osgVolume::TransferFunctionProperty to an osg::Object."); unsigned int numDimensions = in->readUInt(); if (numDimensions==1)