From 71b884e97b437866395f1453932489d3479d0043 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 12 Jun 2012 16:38:51 +0200 Subject: [PATCH] Removed remaining uses of template template parameters. --- .../include/PolyVoxCore/VoxelFilters.h | 4 +- library/PolyVoxCore/source/VoxelFilters.cpp | 4 +- .../include/PolyVoxUtil/Serialization.h | 32 +++++----- .../include/PolyVoxUtil/Serialization.inl | 58 +++++++++---------- tests/TestAStarPathfinder.cpp | 8 +-- 5 files changed, 53 insertions(+), 53 deletions(-) diff --git a/library/PolyVoxCore/include/PolyVoxCore/VoxelFilters.h b/library/PolyVoxCore/include/PolyVoxCore/VoxelFilters.h index 8e338e4f..f6f53035 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/VoxelFilters.h +++ b/library/PolyVoxCore/include/PolyVoxCore/VoxelFilters.h @@ -28,8 +28,8 @@ freely, subject to the following restrictions: namespace PolyVox { - template< template class VolumeType> - float computeSmoothedVoxel(typename VolumeType::Sampler& volIter); + template< typename VolumeType > + float computeSmoothedVoxel(typename VolumeType::Sampler& volIter); } #endif diff --git a/library/PolyVoxCore/source/VoxelFilters.cpp b/library/PolyVoxCore/source/VoxelFilters.cpp index 19881cd6..16862989 100644 --- a/library/PolyVoxCore/source/VoxelFilters.cpp +++ b/library/PolyVoxCore/source/VoxelFilters.cpp @@ -25,8 +25,8 @@ freely, subject to the following restrictions: namespace PolyVox { - template< template class VolumeType> - float computeSmoothedVoxel(typename VolumeType::Sampler& volIter) + template< typename VolumeType > + float computeSmoothedVoxel(typename VolumeType::Sampler& volIter) { float sum = 0.0; diff --git a/library/PolyVoxUtil/include/PolyVoxUtil/Serialization.h b/library/PolyVoxUtil/include/PolyVoxUtil/Serialization.h index 61eebfb7..25afe118 100644 --- a/library/PolyVoxUtil/include/PolyVoxUtil/Serialization.h +++ b/library/PolyVoxUtil/include/PolyVoxUtil/Serialization.h @@ -42,29 +42,29 @@ namespace PolyVox //////////////////////////////////////////////////////////////////////////////// // THESE FUNCTIONS ARE DEPRECATED. USE VERSIONED 'loadVolume' AND 'saveVolume' INSTEAD. //////////////////////////////////////////////////////////////////////////////// - template< template class VolumeType, typename VoxelType> - polyvox_shared_ptr< VolumeType > loadVolumeRaw(std::istream& stream, VolumeSerializationProgressListener* progressListener = 0); - template< template class VolumeType, typename VoxelType> - void saveVolumeRaw(std::ostream& stream, VolumeType& volume, VolumeSerializationProgressListener* progressListener = 0); + template< typename VolumeType > + polyvox_shared_ptr< VolumeType > loadVolumeRaw(std::istream& stream, VolumeSerializationProgressListener* progressListener = 0); + template< typename VolumeType > + void saveVolumeRaw(std::ostream& stream, VolumeType& volume, VolumeSerializationProgressListener* progressListener = 0); - template< template class VolumeType, typename VoxelType> - polyvox_shared_ptr< VolumeType > loadVolumeRle(std::istream& stream, VolumeSerializationProgressListener* progressListener = 0); - template< template class VolumeType, typename VoxelType> - void saveVolumeRle(std::ostream& stream, VolumeType& volume, VolumeSerializationProgressListener* progressListener = 0); + template< typename VolumeType > + polyvox_shared_ptr< VolumeType > loadVolumeRle(std::istream& stream, VolumeSerializationProgressListener* progressListener = 0); + template< typename VolumeType > + void saveVolumeRle(std::ostream& stream, VolumeType& volume, VolumeSerializationProgressListener* progressListener = 0); //////////////////////////////////////////////////////////////////////////////// // END OF DEPRECATED FUNCTIONS //////////////////////////////////////////////////////////////////////////////// - template< template class VolumeType, typename VoxelType> - bool loadVolume(std::istream& stream, VolumeType& volume, VolumeSerializationProgressListener* progressListener = 0); - template< template class VolumeType, typename VoxelType> - bool saveVolume(std::ostream& stream, VolumeType& volume, VolumeSerializationProgressListener* progressListener = 0); + template< typename VolumeType > + bool loadVolume(std::istream& stream, VolumeType& volume, VolumeSerializationProgressListener* progressListener = 0); + template< typename VolumeType > + bool saveVolume(std::ostream& stream, VolumeType& volume, VolumeSerializationProgressListener* progressListener = 0); - template< template class VolumeType, typename VoxelType> - bool loadVersion0(std::istream& stream, VolumeType& volume, VolumeSerializationProgressListener* progressListener = 0); - template< template class VolumeType, typename VoxelType> - bool saveVersion0(std::ostream& stream, VolumeType& volume, VolumeSerializationProgressListener* progressListener = 0); + template< typename VolumeType > + bool loadVersion0(std::istream& stream, VolumeType& volume, VolumeSerializationProgressListener* progressListener = 0); + template< typename VolumeType > + bool saveVersion0(std::ostream& stream, VolumeType& volume, VolumeSerializationProgressListener* progressListener = 0); } #include "PolyVoxUtil/Serialization.inl" diff --git a/library/PolyVoxUtil/include/PolyVoxUtil/Serialization.inl b/library/PolyVoxUtil/include/PolyVoxUtil/Serialization.inl index c65535ba..f251af9e 100644 --- a/library/PolyVoxUtil/include/PolyVoxUtil/Serialization.inl +++ b/library/PolyVoxUtil/include/PolyVoxUtil/Serialization.inl @@ -25,8 +25,8 @@ namespace PolyVox { //Note: we don't do much error handling in here - exceptions will simply be propergated up to the caller. //FIXME - think about pointer ownership issues. Or could return volume by value if the copy constructor is shallow - template< template class VolumeType, typename VoxelType> - polyvox_shared_ptr< VolumeType > loadVolumeRaw(std::istream& stream, VolumeSerializationProgressListener* progressListener) + template< typename VolumeType > + polyvox_shared_ptr< VolumeType > loadVolumeRaw(std::istream& stream, VolumeSerializationProgressListener* progressListener) { assert(false); //THIS FUNCTION IS DEPRECATED. REMOVE THIS ASSERT TO CONTINUE, BUT SWITCH TO 'loadVolume()' ASAP. @@ -43,7 +43,7 @@ namespace PolyVox uint16_t volumeDepth = 0x0001 << volumeDepthPower; //FIXME - need to support non cubic volumes - polyvox_shared_ptr< VolumeType > volume(new LargeVolume(volumeWidth, volumeHeight, volumeDepth)); + polyvox_shared_ptr< VolumeType > volume(new LargeVolume(volumeWidth, volumeHeight, volumeDepth)); //Read data for(uint16_t z = 0; z < volumeDepth; ++z) @@ -59,7 +59,7 @@ namespace PolyVox { for(uint16_t x = 0; x < volumeWidth; ++x) { - VoxelType value; + VolumeType::VoxelType value; stream.read(reinterpret_cast(&value), sizeof(value)); volume->setVoxelAt(x,y,z,value); @@ -76,8 +76,8 @@ namespace PolyVox return volume; } - template< template class VolumeType, typename VoxelType> - void saveVolumeRaw(std::ostream& stream, VolumeType& volume, VolumeSerializationProgressListener* progressListener) + template< typename VolumeType > + void saveVolumeRaw(std::ostream& stream, VolumeType& volume, VolumeSerializationProgressListener* progressListener) { assert(false); //THIS FUNCTION IS DEPRECATED. REMOVE THIS ASSERT TO CONTINUE, BUT SWITCH TO 'saveVolume()' ASAP. @@ -95,7 +95,7 @@ namespace PolyVox stream.write(reinterpret_cast(&volumeDepthPower), sizeof(volumeDepthPower)); //Write data - VolumeType::Sampler volIter(&volume); + VolumeType::Sampler volIter(&volume); for(uint16_t z = 0; z < volumeDepth; ++z) { //Update progress once per slice. @@ -110,7 +110,7 @@ namespace PolyVox for(uint16_t x = 0; x < volumeWidth; ++x) { volIter.setPosition(x,y,z); - VoxelType value = volIter.getVoxel(); + VolumeType::VoxelType value = volIter.getVoxel(); stream.write(reinterpret_cast(&value), sizeof(value)); } } @@ -125,8 +125,8 @@ namespace PolyVox //Note: we don't do much error handling in here - exceptions will simply be propergated up to the caller. //FIXME - think about pointer ownership issues. Or could return volume by value if the copy constructor is shallow - template< template class VolumeType, typename VoxelType> - polyvox_shared_ptr< VolumeType > loadVolumeRle(std::istream& stream, VolumeSerializationProgressListener* progressListener) + template< typename VolumeType > + polyvox_shared_ptr< VolumeType > loadVolumeRle(std::istream& stream, VolumeSerializationProgressListener* progressListener) { assert(false); //THIS FUNCTION IS DEPRECATED. REMOVE THIS ASSERT TO CONTINUE, BUT SWITCH TO 'loadVolume()' ASAP. @@ -143,12 +143,12 @@ namespace PolyVox uint16_t volumeDepth = 0x0001 << volumeDepthPower; //FIXME - need to support non cubic volumes - polyvox_shared_ptr< VolumeType > volume(new LargeVolume(volumeWidth, volumeHeight, volumeDepth)); + polyvox_shared_ptr< VolumeType > volume(new LargeVolume(volumeWidth, volumeHeight, volumeDepth)); //Read data bool firstTime = true; uint32_t runLength = 0; - VoxelType value; + VolumeType::VoxelType value; stream.read(reinterpret_cast(&value), sizeof(value)); stream.read(reinterpret_cast(&runLength), sizeof(runLength)); for(uint16_t z = 0; z < volumeDepth; ++z) @@ -190,8 +190,8 @@ namespace PolyVox return volume; } - template< template class VolumeType, typename VoxelType> - void saveVolumeRle(std::ostream& stream, VolumeType& volume, VolumeSerializationProgressListener* progressListener) + template< typename VolumeType > + void saveVolumeRle(std::ostream& stream, VolumeType& volume, VolumeSerializationProgressListener* progressListener) { assert(false); //THIS FUNCTION IS DEPRECATED. REMOVE THIS ASSERT TO CONTINUE, BUT SWITCH TO 'saveVolume()' ASAP. @@ -209,8 +209,8 @@ namespace PolyVox stream.write(reinterpret_cast(&volumeDepthPower), sizeof(volumeDepthPower)); //Write data - VolumeType::Sampler volIter(&volume); - VoxelType current; + VolumeType::Sampler volIter(&volume); + VolumeType::VoxelType current; uint32_t runLength = 0; bool firstTime = true; for(uint16_t z = 0; z < volumeDepth; ++z) @@ -227,7 +227,7 @@ namespace PolyVox for(uint16_t x = 0; x < volumeWidth; ++x) { volIter.setPosition(x,y,z); - VoxelType value = volIter.getVoxel(); + VolumeType::VoxelType value = volIter.getVoxel(); if(firstTime) { current = value; @@ -265,8 +265,8 @@ namespace PolyVox // New version of load/save code with versioning //////////////////////////////////////////////////////////////////////////////////////////////////// - template< template class VolumeType, typename VoxelType> - bool loadVolume(std::istream& stream, VolumeType& volume, VolumeSerializationProgressListener* progressListener) + template< typename VolumeType > + bool loadVolume(std::istream& stream, VolumeType& volume, VolumeSerializationProgressListener* progressListener) { char pIdentifier[8]; stream.read(pIdentifier, 7); @@ -290,8 +290,8 @@ namespace PolyVox } - template< template class VolumeType, typename VoxelType> - bool saveVolume(std::ostream& stream, VolumeType& volume, VolumeSerializationProgressListener* progressListener) + template< typename VolumeType > + bool saveVolume(std::ostream& stream, VolumeType& volume, VolumeSerializationProgressListener* progressListener) { char pIdentifier[] = "PolyVox"; stream.write(pIdentifier, 7); @@ -304,8 +304,8 @@ namespace PolyVox //Note: we don't do much error handling in here - exceptions will simply be propergated up to the caller. //FIXME - think about pointer ownership issues. Or could return volume by value if the copy constructor is shallow - template< template class VolumeType, typename VoxelType> - bool loadVersion0(std::istream& stream, VolumeType& volume, VolumeSerializationProgressListener* progressListener) + template< typename VolumeType > + bool loadVersion0(std::istream& stream, VolumeType& volume, VolumeSerializationProgressListener* progressListener) { //Read volume dimensions uint16_t volumeWidth = 0; @@ -322,7 +322,7 @@ namespace PolyVox //Read data bool firstTime = true; uint32_t runLength = 0; - VoxelType value; + VolumeType::VoxelType value; stream.read(reinterpret_cast(&value), sizeof(value)); stream.read(reinterpret_cast(&runLength), sizeof(runLength)); for(uint16_t z = 0; z < volumeDepth; ++z) @@ -364,8 +364,8 @@ namespace PolyVox return true; } - template< template class VolumeType, typename VoxelType> - bool saveVersion0(std::ostream& stream, VolumeType& volume, VolumeSerializationProgressListener* progressListener) + template< typename VolumeType > + bool saveVersion0(std::ostream& stream, VolumeType& volume, VolumeSerializationProgressListener* progressListener) { //Write volume dimensions uint16_t volumeWidth = volume.getWidth(); @@ -377,8 +377,8 @@ namespace PolyVox stream.write(reinterpret_cast(&volumeDepth), sizeof(volumeDepth)); //Write data - VolumeType::Sampler volIter(&volume); - VoxelType current; + VolumeType::Sampler volIter(&volume); + VolumeType::VoxelType current; uint32_t runLength = 0; bool firstTime = true; for(uint16_t z = 0; z < volumeDepth; ++z) @@ -395,7 +395,7 @@ namespace PolyVox for(uint16_t x = 0; x < volumeWidth; ++x) { volIter.setPosition(x,y,z); - VoxelType value = volIter.getVoxel(); + VolumeType::VoxelType value = volIter.getVoxel(); if(firstTime) { current = value; diff --git a/tests/TestAStarPathfinder.cpp b/tests/TestAStarPathfinder.cpp index 11e92af6..45838bde 100644 --- a/tests/TestAStarPathfinder.cpp +++ b/tests/TestAStarPathfinder.cpp @@ -31,8 +31,8 @@ freely, subject to the following restrictions: using namespace PolyVox; -template< template class VolumeType, typename VoxelType> -bool testVoxelValidator(const VolumeType* volData, const Vector3DInt32& v3dPos) +template< typename VolumeType> +bool testVoxelValidator(const VolumeType* volData, const Vector3DInt32& v3dPos) { //Voxels are considered valid candidates for the path if they are inside the volume... if(volData->getEnclosingRegion().containsPoint(v3dPos) == false) @@ -40,7 +40,7 @@ bool testVoxelValidator(const VolumeType* volData, const Vector3DInt3 return false; } - VoxelType voxel = volData->getVoxelAt(v3dPos); + VolumeType::VoxelType voxel = volData->getVoxelAt(v3dPos); if(voxel != 0) { return false; @@ -150,7 +150,7 @@ void TestAStarPathfinder::testExecute() std::list result; //Create an AStarPathfinder - AStarPathfinderParams< RawVolume > params(&volData, Vector3DInt32(0,0,0), Vector3DInt32(15,15,15), &result, 1.0f, 10000, TwentySixConnected, &testVoxelValidator); + AStarPathfinderParams< RawVolume > params(&volData, Vector3DInt32(0,0,0), Vector3DInt32(15,15,15), &result, 1.0f, 10000, TwentySixConnected, &testVoxelValidator >); AStarPathfinder< RawVolume > pathfinder(params); //Execute the pathfinder.