Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
arbor
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Analyze
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
arbor-sim
arbor
Commits
46e017bb
Commit
46e017bb
authored
9 years ago
by
Vasileios Karakasis
Browse files
Options
Downloads
Patches
Plain Diff
Better user interface for cell record ranges.
parent
88095774
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/swcio.hpp
+24
-4
24 additions, 4 deletions
src/swcio.hpp
tests/test_swcio.cpp
+2
-2
2 additions, 2 deletions
tests/test_swcio.cpp
with
26 additions
and
6 deletions
src/swcio.hpp
+
24
−
4
View file @
46e017bb
...
...
@@ -13,14 +13,14 @@ namespace io
{
class
cell_record
class
cell_record
{
public:
using
id_type
=
int
;
// FIXME: enum's are not completely type-safe, since they can accept
// anything that can be casted to their underlying type.
//
//
// More on SWC files: http://research.mssm.edu/cnic/swc.html
enum
kind
{
undefined
=
0
,
...
...
@@ -34,7 +34,7 @@ public:
};
// cell records assume zero-based indexing; root's parent remains -1
cell_record
(
kind
type
,
int
id
,
cell_record
(
kind
type
,
int
id
,
float
x
,
float
y
,
float
z
,
float
r
,
int
parent_id
)
:
type_
(
type
)
...
...
@@ -47,7 +47,7 @@ public:
{
check_consistency
();
}
cell_record
()
:
type_
(
cell_record
::
undefined
)
,
id_
(
0
)
...
...
@@ -212,6 +212,7 @@ std::istream &operator>>(std::istream &is, cell_record &cell);
//
std
::
vector
<
cell_record
>
swc_read_cells
(
std
::
istream
&
is
);
class
cell_record_stream_iterator
:
public
std
::
iterator
<
std
::
forward_iterator_tag
,
cell_record
>
{
...
...
@@ -309,6 +310,25 @@ private:
std
::
istream
&
is_
;
};
class
cell_record_range_clean
{
};
struct
swc_io_raw
{
using
cell_range_type
=
cell_record_range_raw
;
};
struct
swc_io_clean
{
using
cell_range_type
=
cell_record_range_raw
;
};
template
<
typename
T
=
swc_io_clean
>
typename
T
::
cell_range_type
get_cell_records
(
std
::
istream
&
is
)
{
return
typename
T
::
cell_range_type
(
is
);
}
}
// end of nestmc::io
}
// end of nestmc
This diff is collapsed.
Click to expand it.
tests/test_swcio.cpp
+
2
−
2
View file @
46e017bb
...
...
@@ -311,10 +311,10 @@ TEST(cell_record_ranges, raw)
is
<<
"4 1 14.566132 34.873772 7.857000 0.717830 1
\n
"
;
std
::
vector
<
cell_record
>
cells
;
for
(
auto
&&
c
:
cell_record
_range
_raw
(
is
))
{
for
(
auto
c
:
get_
cell_record
s
<
swc_io
_raw
>
(
is
))
{
cells
.
push_back
(
c
);
}
EXPECT_EQ
(
4
,
cells
.
size
());
EXPECT_EQ
(
4
u
,
cells
.
size
());
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment