Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
libcifpp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
libcifpp
Commits
bd3723ee
Unverified
Commit
bd3723ee
authored
Oct 30, 2022
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not crash on empty rows (find result)
parent
7ffda74e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
5 deletions
+21
-5
src/pdb/pdb2cif.cpp
+3
-0
src/row.cpp
+18
-5
No files found.
src/pdb/pdb2cif.cpp
View file @
bd3723ee
...
@@ -5839,6 +5839,9 @@ void PDBFileParser::Parse(std::istream &is, cif::file &result)
...
@@ -5839,6 +5839,9 @@ void PDBFileParser::Parse(std::istream &is, cif::file &result)
auto
a1
=
atom_site
.
find1
(
"label_asym_id"
_key
==
asym1
and
"label_seq_id"
_key
==
seq1
and
"label_atom_id"
_key
==
atom1
);
auto
a1
=
atom_site
.
find1
(
"label_asym_id"
_key
==
asym1
and
"label_seq_id"
_key
==
seq1
and
"label_atom_id"
_key
==
atom1
);
auto
a2
=
atom_site
.
find1
(
"label_asym_id"
_key
==
asym2
and
"label_seq_id"
_key
==
seq2
and
"label_atom_id"
_key
==
atom2
);
auto
a2
=
atom_site
.
find1
(
"label_asym_id"
_key
==
asym2
and
"label_seq_id"
_key
==
seq2
and
"label_atom_id"
_key
==
atom2
);
if
(
not
a1
or
not
a2
)
throw
std
::
runtime_error
(
"cannot find atom"
);
const
auto
&
[
x1
,
y1
,
z1
]
=
a1
.
get
<
float
,
float
,
float
>
(
"cartn_x"
,
"cartn_y"
,
"cartn_z"
);
const
auto
&
[
x1
,
y1
,
z1
]
=
a1
.
get
<
float
,
float
,
float
>
(
"cartn_x"
,
"cartn_y"
,
"cartn_z"
);
const
auto
&
[
x2
,
y2
,
z2
]
=
a2
.
get
<
float
,
float
,
float
>
(
"cartn_x"
,
"cartn_y"
,
"cartn_z"
);
const
auto
&
[
x2
,
y2
,
z2
]
=
a2
.
get
<
float
,
float
,
float
>
(
"cartn_x"
,
"cartn_y"
,
"cartn_z"
);
...
...
src/row.cpp
View file @
bd3723ee
...
@@ -31,30 +31,41 @@ namespace cif
...
@@ -31,30 +31,41 @@ namespace cif
void
row_handle
::
assign
(
size_t
column
,
std
::
string_view
value
,
bool
updateLinked
,
bool
validate
)
void
row_handle
::
assign
(
size_t
column
,
std
::
string_view
value
,
bool
updateLinked
,
bool
validate
)
{
{
assert
(
m_category
);
if
(
not
m_category
)
throw
std
::
runtime_error
(
"uninitialized row"
);
m_category
->
update_value
(
m_row
,
column
,
value
,
updateLinked
,
validate
);
m_category
->
update_value
(
m_row
,
column
,
value
,
updateLinked
,
validate
);
}
}
uint16_t
row_handle
::
get_column_ix
(
std
::
string_view
name
)
const
uint16_t
row_handle
::
get_column_ix
(
std
::
string_view
name
)
const
{
{
assert
(
m_category
);
if
(
not
m_category
)
throw
std
::
runtime_error
(
"uninitialized row"
);
return
m_category
->
get_column_ix
(
name
);
return
m_category
->
get_column_ix
(
name
);
}
}
std
::
string_view
row_handle
::
get_column_name
(
uint16_t
ix
)
const
std
::
string_view
row_handle
::
get_column_name
(
uint16_t
ix
)
const
{
{
assert
(
m_category
);
if
(
not
m_category
)
throw
std
::
runtime_error
(
"uninitialized row"
);
return
m_category
->
get_column_name
(
ix
);
return
m_category
->
get_column_name
(
ix
);
}
}
uint16_t
row_handle
::
add_column
(
std
::
string_view
name
)
uint16_t
row_handle
::
add_column
(
std
::
string_view
name
)
{
{
assert
(
m_category
);
if
(
not
m_category
)
throw
std
::
runtime_error
(
"uninitialized row"
);
return
m_category
->
add_column
(
name
);
return
m_category
->
add_column
(
name
);
}
}
void
row_handle
::
swap
(
size_t
column
,
row_handle
&
b
)
void
row_handle
::
swap
(
size_t
column
,
row_handle
&
b
)
{
{
if
(
not
m_category
)
throw
std
::
runtime_error
(
"uninitialized row"
);
m_category
->
swap_item
(
column
,
*
this
,
b
);
m_category
->
swap_item
(
column
,
*
this
,
b
);
}
}
...
@@ -62,7 +73,9 @@ void row_handle::swap(size_t column, row_handle &b)
...
@@ -62,7 +73,9 @@ void row_handle::swap(size_t column, row_handle &b)
row_initializer
::
row_initializer
(
row_handle
rh
)
row_initializer
::
row_initializer
(
row_handle
rh
)
{
{
assert
(
rh
.
m_category
);
if
(
not
rh
.
m_category
)
throw
std
::
runtime_error
(
"uninitialized row"
);
assert
(
rh
.
m_row
);
assert
(
rh
.
m_row
);
row
*
r
=
rh
.
get_row
();
row
*
r
=
rh
.
get_row
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment