Permalink
Browse files

Removing SafePointerDowncast and other old school C++ codes and updat…

…ing to newer

C++ 11/14 standards instead.
  • Loading branch information...
imikejackson committed Oct 31, 2017
1 parent 66ccae9 commit e5e75b1df4410483d54522a061f45c63e6868363
Showing with 141 additions and 139 deletions.
  1. +1 −1 Source/Plugins/OrientationAnalysis/Widgets/QEbsdReferenceFrameDialog.cpp
  2. +5 −5 Source/Plugins/Processing/Test/MultiThresholdObjects2Test.cpp
  3. +2 −2 Source/Plugins/Processing/Test/MultiThresholdObjectsTest.cpp
  4. +4 −3 Source/Plugins/Statistics/StatisticsFilters/CorrelateValuesWithVectorDirection.cpp
  5. +1 −1 Source/Plugins/Statistics/StatisticsFilters/FindFeatureHistogram.cpp
  6. +2 −2 Source/Plugins/Statistics/StatisticsFilters/FitCorrelatedFeatureData.cpp
  7. +33 −33 Source/Plugins/Statistics/StatisticsFilters/GenerateEnsembleStatistics.cpp
  8. +1 −1 Source/Plugins/Statistics/StatisticsFilters/QuiltCellData.cpp
  9. +18 −18 Source/Plugins/StatsGenerator/StatsGeneratorFilters/StatsGeneratorUtilities.cpp
  10. +5 −5 Source/Plugins/StatsGenerator/Widgets/BoundaryPhaseWidget.cpp
  11. +4 −4 Source/Plugins/StatsGenerator/Widgets/MatrixPhaseWidget.cpp
  12. +10 −10 Source/Plugins/StatsGenerator/Widgets/PrecipitatePhaseWidget.cpp
  13. +10 −10 Source/Plugins/StatsGenerator/Widgets/PrimaryPhaseWidget.cpp
  14. +3 −3 Source/Plugins/StatsGenerator/Widgets/StatsGenAxisODFWidget.cpp
  15. +3 −3 Source/Plugins/StatsGenerator/Widgets/StatsGenMDFWidget.cpp
  16. +3 −3 Source/Plugins/StatsGenerator/Widgets/StatsGenODFWidget.cpp
  17. +1 −1 Source/Plugins/StatsGenerator/Widgets/StatsGenRDFWidget.cpp
  18. +9 −8 Source/Plugins/StatsGenerator/Widgets/TransformationPhaseWidget.cpp
  19. +4 −4 Source/Plugins/SyntheticBuilding/FilterParameterWidgets/InitializeSyntheticVolumeWidget.cpp
  20. +1 −1 Source/Plugins/SyntheticBuilding/SyntheticBuildingFilters/EstablishMatrixPhase.cpp
  21. +2 −2 Source/Plugins/SyntheticBuilding/SyntheticBuildingFilters/InitializeSyntheticVolume.cpp
  22. +7 −7 Source/Plugins/SyntheticBuilding/SyntheticBuildingFilters/InsertPrecipitatePhases.cpp
  23. +2 −2 Source/Plugins/SyntheticBuilding/SyntheticBuildingFilters/MatchCrystallography.cpp
  24. +10 −10 Source/Plugins/SyntheticBuilding/SyntheticBuildingFilters/PackPrimaryPhases.cpp
@@ -575,7 +575,7 @@ void QEbsdReferenceFrameDialog::generateImageRGB(IDataArray::Pointer dataArray,
return;
}
UInt8ArrayType* rgbArray = UInt8ArrayType::SafePointerDownCast(dataArray.get());
UInt8ArrayType::Pointer rgbArray = std::dynamic_pointer_cast<UInt8ArrayType>(dataArray);
uint8_t* generatedColors = rgbArray->getPointer(0);
for(size_t y = 0; y < dims[1]; ++y)
@@ -174,7 +174,7 @@ class MultiThresholdObjects2Test
DataArrayPath path = DataArrayPath(dataContainerName, SIMPL::Defaults::CellAttributeMatrixName, outputName);
IDataArray::Pointer thresholdArray =
filter->getDataContainerArray()->getDataContainer(path.getDataContainerName())->getAttributeMatrix(path.getAttributeMatrixName())->getAttributeArray(path.getDataArrayName());
DataArray<bool>* inputArray = DataArray<bool>::SafePointerDownCast(thresholdArray.get());
DataArray<bool>::Pointer inputArray = std::dynamic_pointer_cast<DataArray<bool>>(thresholdArray);
bool* inputArrayPtr = inputArray->getPointer(0); // pointer for threshold array created from the filter for the float array
// For the comparison value of 0.1, the threshold array elements 0 to 9 should be false and 10 through 19 should be true
@@ -248,7 +248,7 @@ class MultiThresholdObjects2Test
DataArrayPath path = DataArrayPath(dataContainerName, SIMPL::Defaults::CellAttributeMatrixName, outputName);
IDataArray::Pointer thresholdArray =
filter->getDataContainerArray()->getDataContainer(path.getDataContainerName())->getAttributeMatrix(path.getAttributeMatrixName())->getAttributeArray(path.getDataArrayName());
DataArray<bool>* inputArray = DataArray<bool>::SafePointerDownCast(thresholdArray.get());
DataArray<bool>::Pointer inputArray = std::dynamic_pointer_cast<DataArray<bool>>(thresholdArray);
bool* inputArrayPtr = inputArray->getPointer(0); // pointer for threshold array created from the filter for the float array
// For the comparison value of 0.1, the threshold array elements 0 to 9 should be false and 10 through 19 should be true
@@ -268,12 +268,12 @@ class MultiThresholdObjects2Test
DataArrayPath path = DataArrayPath("dc", "CellData", "TestArrayFloat");
IDataArray::Pointer idataf = filter->getDataContainerArray()->getDataContainer(path)->getAttributeMatrix(path)->getAttributeArray(path.getDataArrayName());
DataArray<float>* dataf = DataArray<float>::SafePointerDownCast(idataf.get());
DataArray<float>::Pointer dataf = std::dynamic_pointer_cast<DataArray<float>>(idataf);
ComparisonValueTestAll(filter, dataf, 0.1f, "FloatComparison");
path.setDataArrayName("TestArrayInt");
IDataArray::Pointer idatai = filter->getDataContainerArray()->getDataContainer(path)->getAttributeMatrix(path)->getAttributeArray(path.getDataArrayName());
DataArray<int>* datai = DataArray<int>::SafePointerDownCast(idatai.get());
DataArray<int>::Pointer datai = std::dynamic_pointer_cast<DataArray<int>>(idatai);
ComparisonValueTestAll(filter, datai, 10, "IntComparison");
return 1;
@@ -288,7 +288,7 @@ class MultiThresholdObjects2Test
DataArrayPath path = DataArrayPath("dc", "CellData", "TestArrayInt");
IDataArray::Pointer idatai = filter->getDataContainerArray()->getDataContainer(path)->getAttributeMatrix(path)->getAttributeArray(path.getDataArrayName());
// DataArray<int>* datai = DataArray<int>::SafePointerDownCast(idatai.get());
// DataArray<int>::Pointer datai = std::dynamic_pointer_cast<DataArray<int>>(idatai);
// Check AND / OR operators
ComparisonSet::Pointer compSet = ComparisonSet::New();
@@ -152,7 +152,7 @@ class MultiThresholdObjectsTest
DataArrayPath path = DataArrayPath("dc1", SIMPL::Defaults::CellAttributeMatrixName, SIMPL::GeneralData::ThresholdArray);
IDataArray::Pointer thresholdArray = vdc->getAttributeMatrix(path.getAttributeMatrixName())->getAttributeArray(path.getDataArrayName());
DataArray<bool>* inputArray = DataArray<bool>::SafePointerDownCast(thresholdArray.get());
DataArray<bool>::Pointer inputArray = std::dynamic_pointer_cast<DataArray<bool>>(thresholdArray);
bool* inputArrayPtr = inputArray->getPointer(0); // pointer for threshold array created from the filter for the float array
// For the comparison value of 0.1, the threshold array elements 0 to 9 should be false and 10 through 19 should be true
@@ -187,7 +187,7 @@ class MultiThresholdObjectsTest
DataArrayPath path1 = DataArrayPath("dc1", SIMPL::Defaults::CellAttributeMatrixName, "ThresholdArray1");
IDataArray::Pointer thresholdArray1 = vdc->getAttributeMatrix(path1.getAttributeMatrixName())->getAttributeArray(path1.getDataArrayName());
DataArray<bool>* inputArray1 = DataArray<bool>::SafePointerDownCast(thresholdArray1.get());
DataArray<bool>::Pointer inputArray1 = std::dynamic_pointer_cast<DataArray<bool>>(thresholdArray1);
bool* inputArrayPtr1 = inputArray1->getPointer(0); // pointer for threshold array created from the filter for the int array
// For the comparison value of 15, the threshold array elements 0 to 15 should be false and 16 through 19 should be true
@@ -173,15 +173,16 @@ void CorrelateValuesWithVectorDirection::preflight()
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
template <typename T> void addToLambert(IDataArray::Pointer correlatedData, size_t bin, size_t point, double* m_LambertProjection)
template <typename T>
void addToLambert(IDataArray::Pointer correlatedData, size_t bin, size_t point, double* m_LambertProjection)
{
DataArray<T>* correlatedArray = DataArray<T>::SafePointerDownCast(correlatedData.get());
typename DataArray<T>::Pointer correlatedArray = std::dynamic_pointer_cast<DataArray<T>>(correlatedData);
if(nullptr == correlatedArray)
{
return;
}
size_t numComps = correlatedArray->getNumberOfComponents();
int numComps = correlatedArray->getNumberOfComponents();
T* m_CorrelatedData = correlatedArray->getPointer(0);
for(int j = 0; j < numComps; j++)
@@ -198,7 +198,7 @@ void FindFeatureHistogram::preflight()
// -----------------------------------------------------------------------------
template <typename T> void findHistogram(IDataArray::Pointer inputData, int32_t* ensembleArray, int32_t* eIds, int NumberOfBins, bool removeBiasedFeatures, bool* biasedFeatures)
{
DataArray<T>* featureArray = DataArray<T>::SafePointerDownCast(inputData.get());
typename DataArray<T>::Pointer featureArray = std::dynamic_pointer_cast<DataArray<T>>(inputData);
if(nullptr == featureArray)
{
return;
@@ -248,8 +248,8 @@ void fitData(IDataArray::Pointer inputData, float* ensembleArray, int32_t* eIds,
distributionAnalysis.push_back(LogNormalOps::New());
distributionAnalysis.push_back(PowerLawOps::New());
DataArray<T>* featureArray = DataArray<T>::SafePointerDownCast(inputData.get());
if(nullptr == featureArray)
typename DataArray<T>::Pointer featureArray = std::dynamic_pointer_cast<DataArray<T>>(inputData);
if(nullptr == featureArray.get())
{
return;
}
Oops, something went wrong.

0 comments on commit e5e75b1

Please sign in to comment.