diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/AlignedDynArray.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/AlignedDynArray.h index 5f92878294e378ee709bcfdf4b27aa2e009acd46..aea681e00f1d6ce842911a78676b2a960f2e49a4 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/AlignedDynArray.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/AlignedDynArray.h @@ -13,12 +13,12 @@ #include <cstdlib> #include <memory> namespace GSFUtils { + /* - * GCC and Clang provide) the the attribute - * if we have a std implementing ideas from + * Use GCC and Clang attributes to express that we return aligned ouputs + * If we have a std implementing ideas from * http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0886r0.pdf - * prb we do not need this - * Can be used to express that we return aligned ouputs + * prb we do not need this. */ #if defined(__GNUC__) && !defined(__CLING__) && !defined(__ICC) #define GSF_ALIGN_RETURN(X) __attribute__((assume_aligned(X))) @@ -53,32 +53,41 @@ struct AlignedDynArray typedef std::size_t size_type; typedef std::ptrdiff_t difference_type; /// @} + /// Deleted default constructor AlignedDynArray() = delete; + /// Deleted default copy constructor AlignedDynArray(AlignedDynArray const&) = delete; + /// Deleted default assignment operator AlignedDynArray& operator=(AlignedDynArray const&) = delete; - /// Constructor default initializing elements + /// Constructor with default initializing elements explicit AlignedDynArray(size_type n); + /// Constructor initializing elements to value explicit AlignedDynArray(size_type n, const T& value); /// Move copy constructor AlignedDynArray(AlignedDynArray&&) noexcept; + /// Move assignment operator AlignedDynArray& operator=(AlignedDynArray&&) noexcept; + /// Destructor ~AlignedDynArray(); /// Get the underlying buffer pointer buffer() noexcept GSF_ALIGN_RETURN(ALIGNMENT); - /// Get the underlying buffer + + /// Get the underlying buffer (const) const_pointer buffer() const noexcept GSF_ALIGN_RETURN(ALIGNMENT); - /// index array operators + /// index array operator reference operator[](size_type pos) noexcept; + + /// index array operator (const) const_reference operator[](size_type pos) const noexcept; /// iterator pointing to the first element @@ -101,8 +110,13 @@ struct AlignedDynArray private: + /// Helper method for calling the dtor for the elements void cleanup(); + + ///Pointer to the underlying buffer pointer m_buffer = nullptr; + + ///Num of elements/size size_type m_size = 0; }; diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/AlignedDynArray.icc b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/AlignedDynArray.icc index 5a9cc962e159a13a0700187980ab5230526adf0c..a9b64c6bd030ea6a34e8ccc6489e3549e72f9e72 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/AlignedDynArray.icc +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/AlignedDynArray.icc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /**