Skip to content

Commit

Permalink
Include template Keyword for MSVC and Clang
Browse files Browse the repository at this point in the history
  • Loading branch information
nyoungbq committed Aug 20, 2024
1 parent 29bc3e4 commit c17f038
Show file tree
Hide file tree
Showing 29 changed files with 47 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ class KMedoidsTemplate
KMedoidsTemplate(ComputeKMedoids* filter, const IDataArray* inputIDataArray, IDataArray* medoidsIDataArray, const std::unique_ptr<MaskCompare>& maskDataArray, usize numClusters,
Int32AbstractDataStore& fIds, ClusterUtilities::DistanceMetric distMetric, std::mt19937_64::result_type seed)
: m_Filter(filter)
, m_InputArray(inputIDataArray->getIDataStoreRefAs<AbstractDataStore<T>>())
, m_Medoids(medoidsIDataArray->getIDataStoreRefAs<AbstractDataStore<T>>())
, m_InputArray(inputIDataArray->template getIDataStoreRefAs<AbstractDataStore<T>>())
, m_Medoids(medoidsIDataArray->template getIDataStoreRefAs<AbstractDataStore<T>>())
, m_Mask(maskDataArray)
, m_NumClusters(numClusters)
, m_FeatureIds(fIds)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ struct RemoveComponentsFunctor
template <class ScalarType>
void operator()(IDataArray* originalArray, IDataArray* resizedArray, usize componentIndexToRemove) // Due to logic structure originalArray cannot be const
{
const auto& originalStoreRef = originalArray->getIDataStoreRefAs<AbstractDataStore<ScalarType>>();
auto& resizedStoreRef = resizedArray->getIDataStoreRefAs<AbstractDataStore<ScalarType>>();
const auto& originalStoreRef = originalArray->template getIDataStoreRefAs<AbstractDataStore<ScalarType>>();
auto& resizedStoreRef = resizedArray->template getIDataStoreRefAs<AbstractDataStore<ScalarType>>();

const usize originalTupleCount = originalStoreRef.getNumberOfTuples();
const usize originalCompCount = originalStoreRef.getNumberOfComponents();
Expand Down Expand Up @@ -42,8 +42,8 @@ struct ExtractComponentsFunctor
template <class ScalarType>
void operator()(IDataArray* inputArray, IDataArray* extractedCompArray, usize componentIndexToExtract) // Due to logic structure inputArray cannot be const
{
const auto& inputStoreRef = inputArray->getIDataStoreRefAs<AbstractDataStore<ScalarType>>();
auto& extractedStoreRef = extractedCompArray->getIDataStoreRefAs<AbstractDataStore<ScalarType>>();
const auto& inputStoreRef = inputArray->template getIDataStoreRefAs<AbstractDataStore<ScalarType>>();
auto& extractedStoreRef = extractedCompArray->template getIDataStoreRefAs<AbstractDataStore<ScalarType>>();

const usize inputTupleCount = inputStoreRef.getNumberOfTuples();
const usize inputCompCount = inputStoreRef.getNumberOfComponents();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct CopyDataFunctor
template <typename T>
void operator()(const IDataArray* srcIArray, IDataArray* destIArray, const std::vector<bool>& maskArray)
{
const auto& srcArray = srcIArray->getIDataStoreRefAs<AbstractDataStore<T>>();
const auto& srcArray = srcIArray->template getIDataStoreRefAs<AbstractDataStore<T>>();
auto& destArray = destIArray->getIDataStoreRefAs<AbstractDataStore<T>>();

bool useMask = !maskArray.empty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct FillBadDataUpdateTuplesFunctor
template <typename T>
void operator()(const Int32AbstractDataStore& featureIds, IDataArray* outputIDataArray, const std::vector<int32>& neighbors)
{
auto& outputStore = outputIDataArray->getIDataStoreRefAs<AbstractDataStore<T>>();
auto& outputStore = outputIDataArray->template getIDataStoreRefAs<AbstractDataStore<T>>();
FillBadDataUpdateTuples(featureIds, outputStore, neighbors);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct ExecuteFlyingEdgesFunctor
template <typename T>
void operator()(const ImageGeom& image, const IDataArray* iDataArray, float64 isoVal, TriangleGeom& triangleGeom, Float32AbstractDataStore& normals, AttributeMatrix& normAM)
{
FlyingEdgesAlgorithm flyingEdges = FlyingEdgesAlgorithm<T>(image, iDataArray->getIDataStoreRefAs<AbstractDataStore<T>>(), static_cast<T>(isoVal), triangleGeom, normals);
FlyingEdgesAlgorithm flyingEdges = FlyingEdgesAlgorithm<T>(image, iDataArray->template getIDataStoreRefAs<AbstractDataStore<T>>(), static_cast<T>(isoVal), triangleGeom, normals);
flyingEdges.pass1();
flyingEdges.pass2();
flyingEdges.pass3();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class TSpecificCompareFunctor : public SegmentFeatures::CompareFunctor
: m_Length(length)
, m_Tolerance(tolerance)
, m_FeatureIdsArray(featureIds)
, m_Data(data->getIDataStoreRefAs<DataStoreType>())
, m_Data(data->template getIDataStoreRefAs<DataStoreType>())
{
}
TSpecificCompareFunctor() = default;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class SilhouetteTemplate

SilhouetteTemplate(const IDataArray& inputIDataArray, Float64AbstractDataStore& outputDataArray, const std::unique_ptr<MaskCompare>& maskDataArray, usize numClusters,
const Int32AbstractDataStore& featureIds, ClusterUtilities::DistanceMetric distMetric)
: m_InputData(inputIDataArray.getIDataStoreRefAs<AbstractDataStoreT>())
: m_InputData(inputIDataArray.template getIDataStoreRefAs<AbstractDataStoreT>())
, m_OutputData(outputDataArray)
, m_Mask(maskDataArray)
, m_NumClusters(numClusters)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ struct SplitArraysFunctor
template <typename T>
void operator()(DataStructure& dataStructure, const IDataArray* inputIDataArray, const SplitAttributeArrayInputValues* inputValues)
{
const auto& inputStore = inputIDataArray->getIDataStoreRefAs<AbstractDataStore<T>>();
const auto& inputStore = inputIDataArray->template getIDataStoreRefAs<AbstractDataStore<T>>();
usize numTuples = inputStore.getNumberOfTuples();
usize numComponents = inputStore.getNumberOfComponents();
for(const auto& j : inputValues->ExtractComponents)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Result<> WriteAvizoRectilinearCoordinate::writeData(FILE* outputFile) const

fprintf(outputFile, "@1 # FeatureIds in z, y, x with X moving fastest, then Y, then Z\n");

const auto& featureIds = m_DataStructure.getDataAs<Int32Array>(m_InputValues->FeatureIdsArrayPath)->getIDataStoreRefAs<DataStore<int32>>();
const auto& featureIds = m_DataStructure.getDataAs<IDataArray>(m_InputValues->FeatureIdsArrayPath)->getIDataStoreRefAs<DataStore<int32>>();
const usize totalPoints = featureIds.getNumberOfTuples();

if(m_InputValues->WriteBinaryFile)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Result<> WriteAvizoUniformCoordinate::writeData(FILE* outputFile) const
{
fprintf(outputFile, "@1\n");

const auto& featureIds = m_DataStructure.getDataAs<Int32Array>(m_InputValues->FeatureIdsArrayPath)->getIDataStoreRefAs<DataStore<int32>>();
const auto& featureIds = m_DataStructure.getDataAs<IDataArray>(m_InputValues->FeatureIdsArrayPath)->getIDataStoreRefAs<DataStore<int32>>();
const usize totalPoints = featureIds.getNumberOfTuples();

if(m_InputValues->WriteBinaryFile)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ struct ExecuteFindDifferenceMapFunctor
{
using store_type = AbstractDataStore<DataType>;

auto& firstArray = firstArrayPtr->getIDataStoreRefAs<store_type>();
auto& secondArray = secondArrayPtr->getIDataStoreRefAs<store_type>();
auto& differenceMap = differenceMapPtr->getIDataStoreRefAs<store_type>();
auto& firstArray = firstArrayPtr->template getIDataStoreRefAs<store_type>();
auto& secondArray = secondArrayPtr->template getIDataStoreRefAs<store_type>();
auto& differenceMap = differenceMapPtr->template getIDataStoreRefAs<store_type>();

usize numTuples = firstArray.getNumberOfTuples();
int32 numComps = firstArray.getNumberOfComponents();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct ReplaceValueInArrayFunctor
template <typename ScalarType>
void operator()(IDataArray& workingArray, const std::string& removeValue, const std::string& replaceValue)
{
auto& dataStore = workingArray.getIDataStoreRefAs<AbstractDataStore<ScalarType>>();
auto& dataStore = workingArray.template getIDataStoreRefAs<AbstractDataStore<ScalarType>>();

auto removeVal = convertFromStringToType<ScalarType>(removeValue);
auto replaceVal = convertFromStringToType<ScalarType>(replaceValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ class CopyFeatureArrayToElementArrayImpl
using StoreType = AbstractDataStore<T>;

CopyFeatureArrayToElementArrayImpl(const IDataArray* selectedFeatureArray, const Int32AbstractDataStore& featureIdsStore, IDataArray* createdArray, const std::atomic_bool& shouldCancel)
: m_SelectedFeature(selectedFeatureArray->getIDataStoreRefAs<StoreType>())
: m_SelectedFeature(selectedFeatureArray->template getIDataStoreRefAs<StoreType>())
, m_FeatureIdsStore(featureIdsStore)
, m_CreatedStore(createdArray->getIDataStoreRefAs<StoreType>())
, m_CreatedStore(createdArray->template getIDataStoreRefAs<StoreType>())
, m_ShouldCancel(shouldCancel)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct CreateAndInitArrayFunctor
{
Result<T> result = ConvertTo<T>::convert(initValue);

auto* dataStore = iDataArray->getIDataStoreAs<AbstractDataStore<T>>();
auto* dataStore = iDataArray->template getIDataStoreAs<AbstractDataStore<T>>();
dataStore->fill(result.value());
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ struct CopyCellDataFunctor
template <typename T>
Result<> operator()(const IDataArray* selectedCellArray, const Int32AbstractDataStore& featureIds, IDataArray* createdArray, const std::atomic_bool& shouldCancel)
{
const auto& selectedCellStore = selectedCellArray->getIDataStoreRefAs<AbstractDataStore<T>>();
auto& createdDataStore = createdArray->getIDataStoreRefAs<AbstractDataStore<T>>();
const auto& selectedCellStore = selectedCellArray->template getIDataStoreRefAs<AbstractDataStore<T>>();
auto& createdDataStore = createdArray->template getIDataStoreRefAs<AbstractDataStore<T>>();

// Initialize the output array with a default value
createdDataStore.fill(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ class CropImageGeomDataArray
{
public:
CropImageGeomDataArray(const IDataArray& oldCellArray, IDataArray& newCellArray, const ImageGeom& srcImageGeom, std::array<uint64, 6> bounds, const std::atomic_bool& shouldCancel)
: m_OldCellStore(oldCellArray.getIDataStoreRefAs<AbstractDataStore<T>>())
, m_NewCellStore(newCellArray.getIDataStoreRefAs<AbstractDataStore<T>>())
: m_OldCellStore(oldCellArray.template getIDataStoreRefAs<AbstractDataStore<T>>())
, m_NewCellStore(newCellArray.template getIDataStoreRefAs<AbstractDataStore<T>>())
, m_SrcImageGeom(srcImageGeom)
, m_Bounds(bounds)
, m_ShouldCancel(shouldCancel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ struct CopyDataToCroppedGeometryFunctor
template <typename T>
void operator()(const IDataArray* inDataRef, IDataArray* outDataRef, const std::vector<int64>& croppedPoints)
{
const auto& inputData = inDataRef->getIDataStoreRefAs<AbstractDataStore<T>>();
auto& croppedData = outDataRef->getIDataStoreRefAs<AbstractDataStore<T>>();
const auto& inputData = inDataRef->template getIDataStoreRefAs<AbstractDataStore<T>>();
auto& croppedData = outDataRef->template getIDataStoreRefAs<AbstractDataStore<T>>();

usize nComps = inDataRef->getNumberOfComponents();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ struct CopyDataFunctor
template <typename T>
void operator()(IDataArray* inDataPtr, IDataArray* outDataPtr, std::unordered_map<int64, int64>& elementMap) const
{
auto& inputData = inDataPtr->getIDataStoreRefAs<AbstractDataStore<T>>();
auto& outputData = outDataPtr->getIDataStoreRefAs<AbstractDataStore<T>>();
auto& inputData = inDataPtr->template getIDataStoreRefAs<AbstractDataStore<T>>();
auto& outputData = outDataPtr->template getIDataStoreRefAs<AbstractDataStore<T>>();

usize nTuples = outDataPtr->getNumberOfTuples();
usize nComps = inDataPtr->getNumberOfComponents();
Expand All @@ -64,8 +64,8 @@ struct RemoveFlaggedVerticesFunctor
template <class T>
void operator()(IDataArray* inputDataPtr, IDataArray* outputDataArray, const std::vector<IGeometry::MeshIndexType>& indexMapping) const
{
auto& inputData = inputDataPtr->getIDataStoreRefAs<AbstractDataStore<T>>();
auto& outputData = outputDataArray->getIDataStoreRefAs<AbstractDataStore<T>>();
auto& inputData = inputDataPtr->template getIDataStoreRefAs<AbstractDataStore<T>>();
auto& outputData = outputDataArray->template getIDataStoreRefAs<AbstractDataStore<T>>();
usize nComps = inputData.getNumberOfComponents();
IGeometry::MeshIndexType notSeen = std::numeric_limits<IGeometry::MeshIndexType>::max();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct IdentifySampleFunctor
void operator()(const ImageGeom* imageGeom, IDataArray* goodVoxelsPtr, bool fillHoles)
{
std::vector<usize> cDims = {1};
auto& goodVoxels = goodVoxelsPtr->getIDataStoreRefAs<AbstractDataStore<T>>();
auto& goodVoxels = goodVoxelsPtr->template getIDataStoreRefAs<AbstractDataStore<T>>();

const auto totalPoints = static_cast<int64>(goodVoxelsPtr->getNumberOfTuples());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ struct FillArrayFunctor
template <typename T>
void operator()(IDataArray& iDataArray, const InitializeDataInputValues& inputValues)
{
auto& dataStore = iDataArray.getIDataStoreRefAs<AbstractDataStore<T>>();
auto& dataStore = iDataArray.template getIDataStoreRefAs<AbstractDataStore<T>>();
usize numComp = dataStore.getNumberOfComponents(); // We checked that the values string is greater than max comps size so proceed check free

switch(inputValues.initType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ struct InitializeArrayFunctor
rangeMax = std::numeric_limits<T>().max();
}

auto& dataStore = dataArray.getIDataStoreRefAs<AbstractDataStore<T>>();
auto& dataStore = dataArray.template getIDataStoreRefAs<AbstractDataStore<T>>();

auto&& [distribution, generator] = CreateRandomGenerator(rangeMin, rangeMax, seed);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct MapPointCloudDataByKernelFunctor
template <typename T>
void operator()(IDataArray* source, INeighborList* dynamic, std::vector<float>& kernelVals, const int64 kernel[3], const usize dims[3], usize curX, usize curY, usize curZ, usize vertIdx)
{
auto& inputData = source->getIDataStoreRefAs<AbstractDataStore<T>>();
auto& inputData = source->template getIDataStoreRefAs<AbstractDataStore<T>>();
auto* interpolatedDataPtr = dynamic_cast<NeighborList<T>*>(dynamic);

usize index = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ struct ExecuteThresholdHelper
template <typename Type, typename MaskType>
void operator()(ThresholdFilterHelper<MaskType>& helper, const IDataArray* iDataArray, Type trueValue, Type falseValue)
{
const auto& dataStore = iDataArray->getIDataStoreRefAs<AbstractDataStore<Type>>();
const auto& dataStore = iDataArray->template getIDataStoreRefAs<AbstractDataStore<Type>>();
helper.template filterData<Type>(dataStore, trueValue, falseValue);
}
};
Expand Down Expand Up @@ -218,7 +218,7 @@ struct ThresholdValueFunctor
{
// Traditionally we would do a check to ensure we get a valid pointer, I'm forgoing that check because it
// was essentially done in the preflight part.
ThresholdValue(comparisonValue, dataStructure, outputResultArray->getIDataStoreRefAs<AbstractDataStore<T>>(), err, replaceInput, inverse, trueValue, falseValue);
ThresholdValue(comparisonValue, dataStructure, outputResultArray->template getIDataStoreRefAs<AbstractDataStore<T>>(), err, replaceInput, inverse, trueValue, falseValue);
}
};

Expand Down Expand Up @@ -287,7 +287,7 @@ struct ThresholdSetFunctor

// Traditionally we would do a check to ensure we get a valid pointer, I'm forgoing that check because it
// was essentially done in the preflight part.
ThresholdSet<T>(inputComparisonSet, dataStructure, outputResultArray->getIDataStoreRefAs<AbstractDataStore<T>>(), err, replaceInput, inverse, trueValue, falseValue);
ThresholdSet<T>(inputComparisonSet, dataStructure, outputResultArray->template getIDataStoreRefAs<AbstractDataStore<T>>(), err, replaceInput, inverse, trueValue, falseValue);
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct CSVReadFileFunctor
template <typename T>
Result<> operator()(IDataArray* inputIDataArray, const fs::path& inputFilePath, uint64 skipLines, char delimiter)
{
auto& store = inputIDataArray->getIDataStoreRefAs<AbstractDataStore<T>>();
auto& store = inputIDataArray->template getIDataStoreRefAs<AbstractDataStore<T>>();
return CsvParser::ReadFile<T>(inputFilePath, store, skipLines, delimiter);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ struct RemoveFlaggedVerticesFunctor
template <class T>
void operator()(const IDataArray& sourceIDataArray, IDataArray& destIDataArray, const std::unique_ptr<MaskCompare>& maskCompare, size_t numVerticesToKeep) const
{
const auto& sourceDataStore = sourceIDataArray.getIDataStoreRefAs<AbstractDataStore<T>>();
auto& destinationDataStore = destIDataArray.getIDataStoreRefAs<AbstractDataStore<T>>();
const auto& sourceDataStore = sourceIDataArray.template getIDataStoreRefAs<AbstractDataStore<T>>();
auto& destinationDataStore = destIDataArray.template getIDataStoreRefAs<AbstractDataStore<T>>();
destinationDataStore.resizeTuples({numVerticesToKeep});

const usize numInputTuples = sourceDataStore.getNumberOfTuples();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct FindThresholdFunctor
template <class T>
void operator()(const IDataArray* inputObject, const Float32AbstractDataStore& gradMag, BoolAbstractDataStore& maskStore)
{
const auto& inputData = inputObject->getIDataStoreRefAs<AbstractDataStore<T>>();
const auto& inputData = inputObject->template getIDataStoreRefAs<AbstractDataStore<T>>();
usize numTuples = inputData.getNumberOfTuples();
float numerator = 0;
float denominator = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/simplnx/Utilities/ImageRotationUtilities.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ class RotateImageGeometryWithTrilinearInterpolation

m_FilterCallback->sendThreadSafeProgressMessage(fmt::format("{}: Transform Starting", sourceArray.getName()));

auto& newDataStore = m_TargetArray->getIDataStoreRefAs<AbstractDataStore<T>>();
auto& newDataStore = m_TargetArray->template getIDataStoreRefAs<AbstractDataStore<T>>();

DataStructure tempDataStructure;
ImageGeom* origImageGeomPtr = ImageGeom::Create(tempDataStructure, "Temp");
Expand Down
4 changes: 2 additions & 2 deletions src/simplnx/Utilities/OStreamUtilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ struct PrintDataArray
Result<> operator()(std::ostream& outputStrm, IDataArray* inputDataArray, const IFilter::MessageHandler& mesgHandler, const std::atomic_bool& shouldCancel, const std::string& delimiter = ",",
int32 componentsPerLine = 0)
{
auto& dataStore = inputDataArray->getIDataStoreRefAs<AbstractDataStore<ScalarType>>();
auto& dataStore = inputDataArray->template getIDataStoreRefAs<AbstractDataStore<ScalarType>>();
auto start = std::chrono::steady_clock::now();
auto numTuples = dataStore.getNumberOfTuples();
auto maxLine = static_cast<size_t>(componentsPerLine);
Expand Down Expand Up @@ -276,7 +276,7 @@ class TupleWriter : public ITupleWriter

public:
TupleWriter(const IDataArray& iDataArray, const std::string& delimiter)
: m_DataStore(iDataArray.getIDataStoreRefAs<AbstractDataStore<ScalarType>>())
: m_DataStore(iDataArray.template getIDataStoreRefAs<AbstractDataStore<ScalarType>>())
, m_Name(iDataArray.getName())
, m_Delimiter(delimiter)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,8 @@ inline void CompareMontage(const AbstractMontage& exemplar, const AbstractMontag
template <typename T>
void CompareDataArrays(const IDataArray& left, const IDataArray& right, usize start = 0)
{
const auto& oldDataStore = left.getIDataStoreRefAs<AbstractDataStore<T>>();
const auto& newDataStore = right.getIDataStoreRefAs<AbstractDataStore<T>>();
const auto& oldDataStore = left.template getIDataStoreRefAs<AbstractDataStore<T>>();
const auto& newDataStore = right.template getIDataStoreRefAs<AbstractDataStore<T>>();
usize end = oldDataStore.getSize();
INFO(fmt::format("Input Data Array:'{}' Output DataArray: '{}' bad comparison", left.getName(), right.getName()));
T oldVal;
Expand Down

0 comments on commit c17f038

Please sign in to comment.