diff --git a/Documentation/Doxygen/Doxyfile.in b/Documentation/Doxygen/Doxyfile.in index 4606124def0d17e2d212321b379798039e06524a..dacef653aa17b38022d95ab19626356cc67010f0 100644 --- a/Documentation/Doxygen/Doxyfile.in +++ b/Documentation/Doxygen/Doxyfile.in @@ -14,6 +14,7 @@ RECURSIVE = YES SOURCE_BROWSER = YES # INLINE_SOURCES +GENERATE_TREEVIEW = YES CLASS_DIAGRAMS = NO HAVE_DOT = YES diff --git a/Framework/StackInterface/Stack.dox b/Framework/StackInterface/Stack.dox new file mode 100644 index 0000000000000000000000000000000000000000..9624494c0099da3e96be0db59bdfe0d5a4cf4690 --- /dev/null +++ b/Framework/StackInterface/Stack.dox @@ -0,0 +1,7 @@ +/** + @page stack Description of particle stacks + + ... + + +*/ \ No newline at end of file diff --git a/Framework/StackInterface/StackIterator.h b/Framework/StackInterface/StackIterator.h index fed69866539b3566d2595fdc231062b1c7ecc84a..bb0582c00da022a37fff89d6464f25302eb15ec5 100644 --- a/Framework/StackInterface/StackIterator.h +++ b/Framework/StackInterface/StackIterator.h @@ -49,8 +49,7 @@ namespace corsika::stack { template <typename StackData, template <typename> typename ParticleInterface> class StackIteratorInterface - : public ParticleInterface<StackIteratorInterface< - StackData /*typename std::decay<StackData>::type*/, ParticleInterface>> { + : public ParticleInterface<StackIteratorInterface<StackData, ParticleInterface>> { typedef Stack<StackData, ParticleInterface> StackType; /*typedef @@ -60,7 +59,6 @@ namespace corsika::stack { typedef ParticleInterface<StackIteratorInterface<StackData, ParticleInterface>> ParticleInterfaceType; - // friend class ParticleInterface<StackIterator<StackData>>; // to access GetStackData friend class Stack<StackData, ParticleInterface>; // for access to GetIndex friend class ParticleBase<StackIteratorInterface>; // for access to GetStackData @@ -69,25 +67,19 @@ namespace corsika::stack { StackType* fData = 0; // info: Particles and StackIterators become invalid when parent // Stack is copied or deleted! + // it is not allowed to create a "dangling" stack iterator StackIteratorInterface() = delete; public: - /* - StackIteratorInterface(const StackType& data, const int index) - : fIndex(index) - , fData(&data) {}*/ + /** iterator must always point to data, with an index: + @param data reference to the stack + @param index index on stack + */ StackIteratorInterface(StackType& data, const int index) : fIndex(index) , fData(&data) {} - /* - StackIteratorInterface(StackType& data, const int index, typename - std::enable_if<!std::is_const<StackData>::value>::type* = 0) : fIndex(index) , - fData(&data) {} - - StackIteratorInterface(const StackType& data, const int index, typename - std::enable_if<std::is_const<StackData>::value>::type* = 0) : fIndex(index) , - fData(&data) {} - */ + + /// constructor that also sets new values on particle data object template <typename... Args> StackIteratorInterface(StackType& data, const int index, const Args... args) : fIndex(index) @@ -95,6 +87,8 @@ namespace corsika::stack { (**this).SetParticleData(args...); } + /// constructor that also sets new values on particle data object, including reference + /// to parent particle template <typename... Args> StackIteratorInterface(StackType& data, const int index, StackIteratorInterface& parent, const Args... args) @@ -104,6 +98,9 @@ namespace corsika::stack { } public: + /** @name Iterator interface + */ + ///@{ StackIteratorInterface& operator++() { ++fIndex; return *this; @@ -115,40 +112,48 @@ namespace corsika::stack { } bool operator==(const StackIteratorInterface& rhs) { return fIndex == rhs.fIndex; } bool operator!=(const StackIteratorInterface& rhs) { return fIndex != rhs.fIndex; } - + /// Convert to value type ParticleInterfaceType& operator*() { return static_cast<ParticleInterfaceType&>(*this); } + /// Convert to const value type const ParticleInterfaceType& operator*() const { return static_cast<const ParticleInterfaceType&>(*this); } + ///@} protected: + /** @name Stack data access + */ + ///@{ + /// Get current particle index inline int GetIndex() const { return fIndex; } - StackType& GetStack() { return *fData; } - const StackType& GetStack() const { return *fData; } - StackData& /*typename std::decay<StackData>::type&*/ GetStackData() { - return fData->GetStackData(); - } - const StackData& /*typename std::decay<StackData>::type&*/ GetStackData() const { - return fData->GetStackData(); - } + /// Get current particle Stack object + inline StackType& GetStack() { return *fData; } + /// Get current particle const Stack object + inline const StackType& GetStack() const { return *fData; } + /// Get current user particle StackData object + inline StackData& GetStackData() { return fData->GetStackData(); } + /// Get current const user particle StackData object + inline const StackData& GetStackData() const { return fData->GetStackData(); } + ///@} }; // end class StackIterator + /** + @class ConstStackIteratorInterface + + This is the iterator class for const-access to stack data + */ + template <typename StackData, template <typename> typename ParticleInterface> class ConstStackIteratorInterface - : public ParticleInterface<ConstStackIteratorInterface< - StackData /*typename std::decay<StackData>::type*/, ParticleInterface>> { + : public ParticleInterface< + ConstStackIteratorInterface<StackData, ParticleInterface>> { typedef Stack<StackData, ParticleInterface> StackType; - /*typedef - typename std::conditional<std::is_const<StackData>::value, - const Stack<const StackData, ParticleInterface>&, - Stack<StackData, ParticleInterface>&>::type StackType;*/ typedef ParticleInterface<ConstStackIteratorInterface<StackData, ParticleInterface>> ParticleInterfaceType; - // friend class ParticleInterface<StackIterator<StackData>>; // to access GetStackData friend class Stack<StackData, ParticleInterface>; // for access to GetIndex friend class ParticleBase<ConstStackIteratorInterface>; // for access to GetStackData @@ -157,32 +162,18 @@ namespace corsika::stack { const StackType* fData = 0; // info: Particles and StackIterators become invalid when // parent Stack is copied or deleted! + // we don't want to allow dangling iterators to exist ConstStackIteratorInterface() = delete; public: - // StackIteratorInterface(const StackType& data, const int index) - // : fIndex(index) - // , fData(&data) {} ConstStackIteratorInterface(const StackType& data, const int index) : fIndex(index) , fData(&data) {} - /* - StackIteratorInterface(StackType& data, const int index, typename - std::enable_if<!std::is_const<StackData>::value>::type* = 0) : fIndex(index) , - fData(&data) {} - - StackIteratorInterface(const StackType& data, const int index, typename - std::enable_if<std::is_const<StackData>::value>::type* = 0) : fIndex(index) , - fData(&data) {} - */ - template <typename... Args> - ConstStackIteratorInterface(StackType data, const int index, const Args... args) - : fIndex(index) - , fData(data) { - (**this).SetParticleData(args...); - } public: + /** @name Iterator interface + */ + ///@{ ConstStackIteratorInterface& operator++() { ++fIndex; return *this; @@ -199,22 +190,22 @@ namespace corsika::stack { return fIndex != rhs.fIndex; } - ParticleInterfaceType& operator*() { - return static_cast<ParticleInterfaceType&>(*this); - } const ParticleInterfaceType& operator*() const { return static_cast<const ParticleInterfaceType&>(*this); } - + ///@} + protected: - int GetIndex() const { return fIndex; } - // StackType GetStack() { return *fData; } - const StackType& GetStack() const { return *fData; } - // StackData& /*typename std::decay<StackData>::type&*/ GetStackData() { return - // fData->GetStackData(); } - const StackData& /*typename std::decay<StackData>::type&*/ GetStackData() const { + /** @name Stack data access + Only the const versions for read-only access + */ + ///@{ + inline int GetIndex() const { return fIndex; } + inline const StackType& GetStack() const { return *fData; } + inline const StackData& GetStackData() const { return fData->GetStackData(); } + ///@} }; // end class ConstStackIterator } // namespace corsika::stack diff --git a/ThirdParty/ThirdParty.dox b/ThirdParty/ThirdParty.dox index a7e46398fad57d563726578dd734677320785c67..b15d9fdd7b1ec6adbde20778d377785d7c0a3ae4 100644 --- a/ThirdParty/ThirdParty.dox +++ b/ThirdParty/ThirdParty.dox @@ -1,5 +1,5 @@ /** -@page ThirdParty +@page ThirdParty Third party software @tableofcontents In the directory ThirdParty we provide simple dependencies. This diff --git a/corsika.dox b/corsika.dox index 2bcf4de1727cb9d80391d777fe781998a3ad9218..3447fcc5c710570baf7abefd2f2664ef2654374a 100644 --- a/corsika.dox +++ b/corsika.dox @@ -27,4 +27,5 @@ For more information, see also the <a href="https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika/blob/master/README.md">central README.md file</a>. + */