From f3f45b7e351edfc7b6a31ee8b09232edb48fe716 Mon Sep 17 00:00:00 2001 From: Eleftherios Zisis Date: Tue, 7 Jun 2022 15:40:03 +0200 Subject: [PATCH 1/7] Move single lines from readonly section source to header --- include/morphio/section.h | 40 +++++++++++++++++++++++++++++---------- src/section.cpp | 40 --------------------------------------- 2 files changed, 30 insertions(+), 50 deletions(-) diff --git a/include/morphio/section.h b/include/morphio/section.h index c9f04631f..85c382b36 100644 --- a/include/morphio/section.h +++ b/include/morphio/section.h @@ -42,46 +42,66 @@ class Section: public SectionBase
/** Depth first search iterator **/ - depth_iterator depth_begin() const; - depth_iterator depth_end() const; + depth_iterator depth_begin() const { + return depth_iterator(*this); + } + depth_iterator depth_end() const { + return depth_iterator(); + } /** Breadth first search iterator **/ - breadth_iterator breadth_begin() const; - breadth_iterator breadth_end() const; + breadth_iterator breadth_begin() const { + return breadth_iterator(*this); + } + breadth_iterator breadth_end() const { + return breadth_iterator(); + } /** Upstream first search iterator **/ - upstream_iterator upstream_begin() const; - upstream_iterator upstream_end() const; + upstream_iterator upstream_begin() const { + return upstream_iterator(*this); + } + upstream_iterator upstream_end() const { + return upstream_iterator(); + } /** * Return a view (https://github.com/isocpp/CppCoreGuidelines/blob/master/docs/gsl-intro.md#gslspan-what-is-gslspan-and-what-is-it-for) to this section's point coordinates **/ - range points() const; + range points() const { + return get(); + } /** * Return a view (https://github.com/isocpp/CppCoreGuidelines/blob/master/docs/gsl-intro.md#gslspan-what-is-gslspan-and-what-is-it-for) to this section's point diameters **/ - range diameters() const; + range diameters() const { + return get(); + } /** * Return a view (https://github.com/isocpp/CppCoreGuidelines/blob/master/docs/gsl-intro.md#gslspan-what-is-gslspan-and-what-is-it-for) to this section's point perimeters **/ - range perimeters() const; + range perimeters() const { + return get(); + } /** * Return the morphological type of this section (dendrite, axon, ...) */ - SectionType type() const; + SectionType type() const { + return properties_->get()[id_]; + } /** * Return true if the sections of the tree downstream (downstream = true) or upstream diff --git a/src/section.cpp b/src/section.cpp index cf0bd7a8b..1a2da9cff 100644 --- a/src/section.cpp +++ b/src/section.cpp @@ -17,46 +17,6 @@ bool Section::isHeterogeneous(bool downstream) const { return std::any_of(upstream_begin(), upstream_end(), predicate); } -SectionType Section::type() const { - return properties_->get()[id_]; -} - -depth_iterator Section::depth_begin() const { - return depth_iterator(*this); -} - -depth_iterator Section::depth_end() const { - return depth_iterator(); -} - -breadth_iterator Section::breadth_begin() const { - return breadth_iterator(*this); -} - -breadth_iterator Section::breadth_end() const { - return breadth_iterator(); -} - -upstream_iterator Section::upstream_begin() const { - return upstream_iterator(*this); -} - -upstream_iterator Section::upstream_end() const { - return upstream_iterator(); -} - -range Section::points() const { - return get(); -} - -range Section::diameters() const { - return get(); -} - -range Section::perimeters() const { - return get(); -} - bool Section::hasSameShape(const Section& other) const noexcept { return (other.type() == type() && other.diameters() == diameters() && other.points() == points() && other.perimeters() == perimeters()); From e7a74f226c854f7601ab91acbfae039e92e6c50a Mon Sep 17 00:00:00 2001 From: Eleftherios Zisis Date: Tue, 7 Jun 2022 15:40:28 +0200 Subject: [PATCH 2/7] clang --- include/morphio/section.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/morphio/section.h b/include/morphio/section.h index 85c382b36..2e8d75805 100644 --- a/include/morphio/section.h +++ b/include/morphio/section.h @@ -83,7 +83,7 @@ class Section: public SectionBase
(https://github.com/isocpp/CppCoreGuidelines/blob/master/docs/gsl-intro.md#gslspan-what-is-gslspan-and-what-is-it-for) to this section's point diameters **/ - range diameters() const { + range diameters() const { return get(); } From af01b355ecd16bbeae47d4edc32491af97991997 Mon Sep 17 00:00:00 2001 From: Eleftherios Zisis Date: Tue, 7 Jun 2022 15:43:47 +0200 Subject: [PATCH 3/7] Remove unused includes --- src/section.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/section.cpp b/src/section.cpp index 1a2da9cff..de9e8c040 100644 --- a/src/section.cpp +++ b/src/section.cpp @@ -1,11 +1,8 @@ #include // all_of -#include #include -#include -#include -#include "point_utils.h" +#include "point_utils.h" // operator<< namespace morphio { From eb9572e6a03a6c215e63252ec1a702fe9c918988 Mon Sep 17 00:00:00 2001 From: Eleftherios Zisis Date: Tue, 7 Jun 2022 15:53:16 +0200 Subject: [PATCH 4/7] clang --- src/section.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/section.cpp b/src/section.cpp index de9e8c040..0ca1a338b 100644 --- a/src/section.cpp +++ b/src/section.cpp @@ -2,7 +2,7 @@ #include -#include "point_utils.h" // operator<< +#include "point_utils.h" // operator<< namespace morphio { From 5727c192253dc4588e634315b2fc48db7c1b35b2 Mon Sep 17 00:00:00 2001 From: Eleftherios Zisis Date: Tue, 7 Jun 2022 15:55:01 +0200 Subject: [PATCH 5/7] Fix comment for the right include --- src/section.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/section.cpp b/src/section.cpp index 0ca1a338b..b62b5587f 100644 --- a/src/section.cpp +++ b/src/section.cpp @@ -1,4 +1,4 @@ -#include // all_of +#include // any_of #include From 418a7a0bc2151117aaa8b9e8832028886d21aa33 Mon Sep 17 00:00:00 2001 From: Eleftherios Zisis Date: Wed, 8 Jun 2022 09:23:19 +0200 Subject: [PATCH 6/7] Collapse single line comments --- include/morphio/section.h | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/include/morphio/section.h b/include/morphio/section.h index 2e8d75805..b18aeaedc 100644 --- a/include/morphio/section.h +++ b/include/morphio/section.h @@ -39,9 +39,7 @@ class Section: public SectionBase
using PointAttribute = Property::Point; public: - /** - Depth first search iterator - **/ + /// Depth firt search iterator depth_iterator depth_begin() const { return depth_iterator(*this); } @@ -49,9 +47,7 @@ class Section: public SectionBase
return depth_iterator(); } - /** - Breadth first search iterator - **/ + /// Breadth first search iterator breadth_iterator breadth_begin() const { return breadth_iterator(*this); } @@ -59,9 +55,7 @@ class Section: public SectionBase
return breadth_iterator(); } - /** - Upstream first search iterator - **/ + /// Upstream first search iterator upstream_iterator upstream_begin() const { return upstream_iterator(*this); } @@ -96,9 +90,7 @@ class Section: public SectionBase
return get(); } - /** - * Return the morphological type of this section (dendrite, axon, ...) - */ + /// Return the morphological type of this section (dendrite, axon, ...) SectionType type() const { return properties_->get()[id_]; } @@ -109,9 +101,7 @@ class Section: public SectionBase
*/ bool isHeterogeneous(bool downstream = true) const; - /** - * Return true if the both sections have the same points, diameters and perimeters - */ + /// Return true if the both sections have the same points, diameters and perimeters bool hasSameShape(const Section& other) const noexcept; friend class mut::Section; From 99b3e1c900ff5cbf92b10334a4a2f30ce718d256 Mon Sep 17 00:00:00 2001 From: Eleftherios Zisis Date: Wed, 8 Jun 2022 11:01:16 +0200 Subject: [PATCH 7/7] Update comments --- include/morphio/section.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/morphio/section.h b/include/morphio/section.h index b18aeaedc..7083ac425 100644 --- a/include/morphio/section.h +++ b/include/morphio/section.h @@ -39,7 +39,7 @@ class Section: public SectionBase
using PointAttribute = Property::Point; public: - /// Depth firt search iterator + /// Depth first iterator depth_iterator depth_begin() const { return depth_iterator(*this); } @@ -47,7 +47,7 @@ class Section: public SectionBase
return depth_iterator(); } - /// Breadth first search iterator + /// Breadth first iterator breadth_iterator breadth_begin() const { return breadth_iterator(*this); } @@ -55,7 +55,7 @@ class Section: public SectionBase
return breadth_iterator(); } - /// Upstream first search iterator + /// Upstream iterator upstream_iterator upstream_begin() const { return upstream_iterator(*this); }