Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STYLE: Add in-class {} initializers to classes with virtual functions #3913

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Modules/Bridge/VTK/include/itkVTKImageExportBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ class ITKVTK_EXPORT VTKImageExportBase : public ProcessObject

private:
/** PipelineMTime from the last call to PipelineModifiedCallback. */
ModifiedTimeType m_LastPipelineMTime;
ModifiedTimeType m_LastPipelineMTime{};
};
} // end namespace itk

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ class ITK_TEMPLATE_EXPORT ChildTreeIterator : public TreeIteratorBase<TTreeType>
HasNext() const override;

private:
mutable ChildIdentifier m_ListPosition;
TreeNodeType * m_ParentNode;
mutable ChildIdentifier m_ListPosition{};
TreeNodeType * m_ParentNode{};
};

} // end namespace itk
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ class ITK_TEMPLATE_EXPORT LevelOrderTreeIterator : public TreeIteratorBase<TTree
int
GetLevel(const TreeNodeType * node) const;

int m_StartLevel;
int m_EndLevel;
mutable std::queue<const TreeNodeType *> m_Queue;
int m_StartLevel{};
int m_EndLevel{};
mutable std::queue<const TreeNodeType *> m_Queue{};
};

} // end namespace itk
Expand Down
2 changes: 1 addition & 1 deletion Modules/Compatibility/Deprecated/include/itkMutexLock.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class ITKDeprecated_EXPORT SimpleMutexLock
}

protected:
MutexType m_MutexLock;
MutexType m_MutexLock{};
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class ITK_TEMPLATE_EXPORT TreeChangeEvent : public ModifiedEvent
{}

protected:
const TreeIteratorBase<TTreeType> * m_ChangePosition;
const TreeIteratorBase<TTreeType> * m_ChangePosition{};
};

/** \class TreeNodeChangeEvent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,9 @@ class ITK_TEMPLATE_EXPORT TreeIteratorBase
TreeIteratorBase(const TTreeType * tree, const TreeNodeType * start);

mutable TreeNodeType * m_Position; // Current position of the iterator
mutable TreeNodeType * m_Begin;
const TreeNodeType * m_Root;
TTreeType * m_Tree;
mutable TreeNodeType * m_Begin{};
const TreeNodeType * m_Root{};
TTreeType * m_Tree{};

virtual bool
HasNext() const = 0;
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/include/itkCellInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ class ITK_TEMPLATE_EXPORT CellInterface

protected:
/** Store the set of cells using this boundary. */
UsingCellsContainer m_UsingCells;
UsingCellsContainer m_UsingCells{};
};

/** \class CellTraitsInfo
Expand Down
4 changes: 2 additions & 2 deletions Modules/Core/Common/include/itkConditionalConstIterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ class ITK_TEMPLATE_EXPORT ConditionalConstIterator
protected: // made protected so other iterators can access
/** Smart pointer to the source image. */
// SmartPointer<const ImageType> m_Image;
typename ImageType::ConstWeakPointer m_Image;
typename ImageType::ConstWeakPointer m_Image{};

/** Region type to iterate over. */
RegionType m_Region;
RegionType m_Region{};

/** Is the iterator at the end of its walk? */
bool m_IsAtEnd{ false };
Expand Down
14 changes: 7 additions & 7 deletions Modules/Core/Common/include/itkConstNeighborhoodIterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ class ITK_TEMPLATE_EXPORT ConstNeighborhoodIterator
const InternalPixelType * m_Begin{ nullptr };

/** The image on which iteration is defined. */
typename ImageType::ConstWeakPointer m_ConstImage;
typename ImageType::ConstWeakPointer m_ConstImage{};

/** A pointer to one past the last pixel in the iteration region. */
const InternalPixelType * m_End{ nullptr };
Expand All @@ -603,7 +603,7 @@ class ITK_TEMPLATE_EXPORT ConstNeighborhoodIterator
IndexType m_Loop{ { 0 } };

/** The region over which iteration is defined. */
RegionType m_Region;
RegionType m_Region{};

/** The internal array of offsets that provide support for regions of
* interest.
Expand All @@ -616,7 +616,7 @@ class ITK_TEMPLATE_EXPORT ConstNeighborhoodIterator
* By default this points to m_BoundaryCondition, but
* OverrideBoundaryCondition allows a user to point this variable an external
* boundary condition. */
ImageBoundaryConditionPointerType m_BoundaryCondition;
ImageBoundaryConditionPointerType m_BoundaryCondition{};

/** Denotes which of the iterators dimensional sides spill outside
* region of interest boundaries. By default `false` for each dimension. */
Expand All @@ -631,19 +631,19 @@ class ITK_TEMPLATE_EXPORT ConstNeighborhoodIterator
mutable bool m_IsInBoundsValid{ false };

/** Lower threshold of in-bounds loop counter values. */
IndexType m_InnerBoundsLow;
IndexType m_InnerBoundsLow{};

/** Upper threshold of in-bounds loop counter values. */
IndexType m_InnerBoundsHigh;
IndexType m_InnerBoundsHigh{};

/** Default boundary condition. */
TBoundaryCondition m_InternalBoundaryCondition;
TBoundaryCondition m_InternalBoundaryCondition{};

/** Does the specified region need to worry about boundary conditions? */
bool m_NeedToUseBoundaryCondition{ false };

/** Functor type used to access neighborhoods of pixel pointers */
NeighborhoodAccessorFunctorType m_NeighborhoodAccessorFunctor;
NeighborhoodAccessorFunctorType m_NeighborhoodAccessorFunctor{};
};

template <typename TImage>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ class ITK_TEMPLATE_EXPORT ConstNeighborhoodIteratorWithOnlyIndex : public Neighb
IndexType m_Bound{ { 0 } };

/** The image on which iteration is defined. */
typename ImageType::ConstPointer m_ConstImage;
typename ImageType::ConstPointer m_ConstImage{};

/** The end index for iteration within the itk::Image region
* on which this ConstNeighborhoodIteratorWithOnlyIndex is defined. */
Expand All @@ -385,7 +385,7 @@ class ITK_TEMPLATE_EXPORT ConstNeighborhoodIteratorWithOnlyIndex : public Neighb
IndexType m_Loop{ { 0 } };

/** The region over which iteration is defined. */
RegionType m_Region;
RegionType m_Region{};

/** Denotes which of the iterators dimensional sides spill outside
* region of interest boundaries. By default `false` for each dimension. */
Expand All @@ -400,10 +400,10 @@ class ITK_TEMPLATE_EXPORT ConstNeighborhoodIteratorWithOnlyIndex : public Neighb
mutable bool m_IsInBoundsValid{ false };

/** Lower threshold of in-bounds loop counter values. */
IndexType m_InnerBoundsLow;
IndexType m_InnerBoundsLow{};

/** Upper threshold of in-bounds loop counter values. */
IndexType m_InnerBoundsHigh;
IndexType m_InnerBoundsHigh{};

/** Does the specified region need to worry about boundary conditions? */
bool m_NeedToUseBoundaryCondition{ false };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ class ITK_TEMPLATE_EXPORT ConstShapedNeighborhoodIterator : private Neighborhood


bool m_CenterIsActive{ false };
IndexListType m_ActiveIndexList;
IndexListType m_ActiveIndexList{};
};
} // namespace itk

Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/include/itkConstantBoundaryCondition.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class ITK_TEMPLATE_EXPORT ConstantBoundaryCondition : public ImageBoundaryCondit
GetPixel(const IndexType & index, const TInputImage * image) const override;

private:
OutputPixelType m_Constant;
OutputPixelType m_Constant{};
};
} // end namespace itk

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,19 @@ class ITK_TEMPLATE_EXPORT CorrespondenceDataStructureIterator
return m_CorrespondingListPointer;
}

CorrespondingListIterator m_CorrespondingListIterator;
SecondaryNodeListIterator m_SecondaryListIterator;
CorrespondingListIterator m_CorrespondingListIterator{};
SecondaryNodeListIterator m_SecondaryListIterator{};

typename TStructureType::NodeListType::iterator m_NodeListIterator;
typename TStructureType::NodeListType::iterator m_NodeListIterator{};

protected:
/** Is the iterator at the end of its walk? */
bool m_IsAtEnd;
TStructureType * m_Structure;
ItemType * m_CorrespondingNodePointer;
CorrespondingListType * m_CorrespondingListPointer;
SecondaryNodeListType * m_SecondaryListPointer;
NodeListType * m_NodeListPointer;
bool m_IsAtEnd{};
TStructureType * m_Structure{};
ItemType * m_CorrespondingNodePointer{};
CorrespondingListType * m_CorrespondingListPointer{};
SecondaryNodeListType * m_SecondaryListPointer{};
NodeListType * m_NodeListPointer{};
};
} // end namespace itk

Expand Down
10 changes: 5 additions & 5 deletions Modules/Core/Common/include/itkDomainThreader.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class ITK_TEMPLATE_EXPORT DomainThreader : public Object
static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION
ThreaderCallback(void * arg);

AssociateType * m_Associate;
AssociateType * m_Associate{};

private:
void
Expand All @@ -180,10 +180,10 @@ class ITK_TEMPLATE_EXPORT DomainThreader : public Object
* well into that number.
* This value is determined at the beginning of \c Execute(). */
ThreadIdType m_NumberOfWorkUnitsUsed{ 0 };
ThreadIdType m_NumberOfWorkUnits;
typename DomainPartitionerType::Pointer m_DomainPartitioner;
DomainType m_CompleteDomain;
MultiThreaderBase::Pointer m_MultiThreader;
ThreadIdType m_NumberOfWorkUnits{};
typename DomainPartitionerType::Pointer m_DomainPartitioner{};
DomainType m_CompleteDomain{};
MultiThreaderBase::Pointer m_MultiThreader{};
};

} // namespace itk
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/include/itkExceptionObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class ITKCommon_EXPORT ExceptionObject : public std::exception
private:
class ExceptionData;

std::shared_ptr<const ExceptionData> m_ExceptionData;
std::shared_ptr<const ExceptionData> m_ExceptionData{};
};

/** Generic inserter operator for ExceptionObject and its subclasses. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,40 +239,40 @@ class ITK_TEMPLATE_EXPORT FloodFilledFunctionConditionalConstIterator : public C

protected: // made protected so other iterators can access
/** Smart pointer to the function we're evaluating */
SmartPointer<FunctionType> m_Function;
SmartPointer<FunctionType> m_Function{};

/** A temporary image used for storing info about indices
* 0 = pixel has not yet been processed
* 1 = pixel is not inside the function
* 2 = pixel is inside the function, neighbor check incomplete
* 3 = pixel is inside the function, neighbor check complete */
using TTempImage = Image<unsigned char, Self::NDimensions>;
typename TTempImage::Pointer m_TemporaryPointer;
typename TTempImage::Pointer m_TemporaryPointer{};

/** A list of locations to start the recursive fill */
SeedsContainerType m_Seeds;
SeedsContainerType m_Seeds{};

/** The origin of the source image */
typename ImageType::PointType m_ImageOrigin;
typename ImageType::PointType m_ImageOrigin{};

/** The spacing of the source image */
typename ImageType::SpacingType m_ImageSpacing;
typename ImageType::SpacingType m_ImageSpacing{};

/** Region of the source image */
RegionType m_ImageRegion;
RegionType m_ImageRegion{};

/** Stack used to hold the path of the iterator through the image */
std::queue<IndexType> m_IndexStack;
std::queue<IndexType> m_IndexStack{};

/** Location vector used in the flood algorithm */
FunctionInputType m_LocationVector;
FunctionInputType m_LocationVector{};

/** Indicates whether or not we've found a neighbor that needs to be
* checked. */
bool m_FoundUncheckedNeighbor;
bool m_FoundUncheckedNeighbor{};

/** Indicates whether or not an index is valid (inside an image)/ */
bool m_IsValidIndex;
bool m_IsValidIndex{};
};
} // end namespace itk

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class ITK_TEMPLATE_EXPORT FloodFilledSpatialFunctionConditionalConstIterator
* 3) Intersect: if any of the corners of the pixel in physical space are inside the function,
* then the pixel is inside the function */

unsigned char m_InclusionStrategy;
unsigned char m_InclusionStrategy{};
};
} // end namespace itk

Expand Down
10 changes: 5 additions & 5 deletions Modules/Core/Common/include/itkImageConstIterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -377,18 +377,18 @@ class ITK_TEMPLATE_EXPORT ImageConstIterator
}

protected: // made protected so other iterators can access
typename TImage::ConstWeakPointer m_Image;
typename TImage::ConstWeakPointer m_Image{};

RegionType m_Region; // region to iterate over

OffsetValueType m_Offset;
OffsetValueType m_Offset{};
OffsetValueType m_BeginOffset; // offset to first pixel in region
OffsetValueType m_EndOffset; // offset to one pixel past last pixel in region

const InternalPixelType * m_Buffer;
const InternalPixelType * m_Buffer{};

AccessorType m_PixelAccessor;
AccessorFunctorType m_PixelAccessorFunctor;
AccessorType m_PixelAccessor{};
AccessorFunctorType m_PixelAccessorFunctor{};
};
} // end namespace itk

Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/include/itkImageKernelOperator.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class ITK_TEMPLATE_EXPORT ImageKernelOperator : public NeighborhoodOperator<TPix
Fill(const CoefficientVector & coeff) override;

private:
typename ImageType::ConstPointer m_ImageKernel;
typename ImageType::ConstPointer m_ImageKernel{};
};
} // namespace itk

Expand Down
10 changes: 5 additions & 5 deletions Modules/Core/Common/include/itkImageReverseConstIterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -391,18 +391,18 @@ class ITK_TEMPLATE_EXPORT ImageReverseConstIterator
}

protected: // made protected so other iterators can access
typename ImageType::ConstWeakPointer m_Image;
typename ImageType::ConstWeakPointer m_Image{};

RegionType m_Region; // region to iterate over

SizeValueType m_Offset;
SizeValueType m_Offset{};
SizeValueType m_BeginOffset; // offset to last pixel in region
SizeValueType m_EndOffset; // offset to one pixel before first pixel

const InternalPixelType * m_Buffer;
const InternalPixelType * m_Buffer{};

AccessorType m_PixelAccessor;
AccessorFunctorType m_PixelAccessorFunctor;
AccessorType m_PixelAccessor{};
AccessorFunctorType m_PixelAccessorFunctor{};
};
} // end namespace itk

Expand Down
4 changes: 2 additions & 2 deletions Modules/Core/Common/include/itkImageSink.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ class ImageSink

private:
unsigned int m_NumberOfStreamDivisions{ 1 };
RegionSplitterPointer m_RegionSplitter;
InputImageRegionType m_CurrentInputRegion;
RegionSplitterPointer m_RegionSplitter{};
InputImageRegionType m_CurrentInputRegion{};

/**
* Tolerances for checking whether input images are defined to
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/include/itkImageSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ class ITK_TEMPLATE_EXPORT ImageSource
itkSetMacro(DynamicMultiThreading, bool);
itkBooleanMacro(DynamicMultiThreading);

bool m_DynamicMultiThreading;
bool m_DynamicMultiThreading{};
};
} // end namespace itk

Expand Down
4 changes: 2 additions & 2 deletions Modules/Core/Common/include/itkImageToImageFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,8 @@ class ITK_TEMPLATE_EXPORT ImageToImageFilter
* Tolerances for checking whether input images are defined to
* occupy the same physical space.
*/
double m_CoordinateTolerance;
double m_DirectionTolerance;
double m_CoordinateTolerance{};
double m_DirectionTolerance{};
};
} // end namespace itk

Expand Down
Loading