Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
STYLE: Change aggregate classes to mirror std::array
In reviewing the the 3 aggregate special classes itkIndex.h, itkSize.h, and itkOffset.h, these classes are intended to have construction and performance characteristics that are similar to the std::array class. During review of the std::array implementation details as aggregate POD type, some modifications were identified to ensure that these itk classes are intended to meet the requirements of POD data types. A primary benefit of being conformant with std::array is that understanding these classes is equivalent to understanding the well documented subtlties of the std::array class. Each class has an additional set of overlaoded "math" operations to allow specialized behaviors necessary for image Index/Size/Offset relationships. In addition to providing the array API that allows the Index class to be used from methods in the <algorithms>, the interal data storage is aligned following the pattern of the std::array storage in order to allow for potential optimizations. ** Since this is an aggregate base type, prevent prevent deriving from this class by marking it as ``final'' as is highly recommended for the std::array class. ** Ensure that these classes are POD conformant ** Added itkIndexTest.cpp that test the class (Previously missing). The itkSizeTest.cxx and the current itkIndexTest.cxx exercises the code, but does not actually fail if one of the computations is incorrect. Test are written with GoogleTest ** The IndexLexicographicCompare and OffsetLexicographicCompare were used in very few places only one place to allow storing Index values in a std::map. This behavior is moved to a separate file in itkIndexLexicographicCompare.h Replace forward declared embeded functional for compare typedefs with independant common functional template in an independant header file. IndexLexicographicCompare & SizeLexicographicCompare types from the Functional:: namespace are now replaced by a single wrapper of the std::lexicographical() functional in the itkLexicographic.h file. ** Make seldom used direct access to public member function names accross the 3 classes match. This greatly facilitated identifying unnecessary differences in the implementations of these 3 classes. m_Index -> m_InteralArray m_Size -> m_InternalArray m_Offset -> m_InternalArray A review of Slicer, BRAINSTools, all ITK Remote Modules, and ANTs indicated that these public member variables were never accessed in those packages. Provide comprehensive GTest for all aggregate classes (Index, Size, Offset) Change-Id: I02fe8fa32e1fb4587b329bdf4471c72028167f77
- Loading branch information