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
9c4170d9
Unverified
Commit
9c4170d9
authored
May 03, 2022
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Added more const members
- change PDB writing interface
parent
4a82a8d5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
46 additions
and
8 deletions
+46
-8
CMakeLists.txt
+1
-1
changelog
+4
-0
include/cif++/Cif++.hpp
+13
-0
include/cif++/Cif2PDB.hpp
+6
-6
src/Cif++.cpp
+21
-0
src/Cif2PDB.cpp
+0
-0
src/Structure.cpp
+1
-1
No files found.
CMakeLists.txt
View file @
9c4170d9
...
...
@@ -25,7 +25,7 @@
cmake_minimum_required
(
VERSION 3.16
)
# set the project name
project
(
cifpp VERSION 4.0.
0
LANGUAGES CXX
)
project
(
cifpp VERSION 4.0.
1
LANGUAGES CXX
)
list
(
PREPEND CMAKE_MODULE_PATH
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake"
)
...
...
changelog
View file @
9c4170d9
Version
4.0.1
-
Added
a
bunch
of
const
methods
to
Datablock
and
Category
.
-
Changed
PDB
writing
interface
to
accept
Datablock
instead
of
File
.
Version
4.0.0
-
getResidue
in
mmcif
::
Structure
now
requires
both
a
sequence
ID
and
an
auth
sequence
ID
.
As
a
result
the
code
was
cleaned
...
...
include/cif++/Cif++.hpp
View file @
9c4170d9
...
...
@@ -254,8 +254,15 @@ class Datablock
const_iterator
begin
()
const
{
return
mCategories
.
begin
();
}
const_iterator
end
()
const
{
return
mCategories
.
end
();
}
/// \brief Access to the category with name \a name, will create it if it doesn't exist.
Category
&
operator
[](
std
::
string_view
name
);
// /// \brief Access to the category with name \a name, will throw if it doesn't exist.
// const Category &operator[](std::string_view name) const;
/// \brief Access to the category with name \a name, will return an empty category if is doesn't exist.
const
Category
&
operator
[](
std
::
string_view
name
)
const
;
std
::
tuple
<
iterator
,
bool
>
emplace
(
std
::
string_view
name
);
bool
isValid
();
...
...
@@ -285,6 +292,9 @@ class Datablock
std
::
string
mName
;
const
Validator
*
mValidator
;
Datablock
*
mNext
;
// for returning empty categories in the const operator[]
mutable
std
::
unique_ptr
<
Category
>
mNullCategory
;
};
// --------------------------------------------------------------------
...
...
@@ -1863,6 +1873,9 @@ class Category
Row
front
()
{
return
Row
(
mHead
);
}
Row
back
()
{
return
Row
(
mTail
);
}
const
Row
front
()
const
{
return
Row
(
mHead
);
}
const
Row
back
()
const
{
return
Row
(
mTail
);
}
Row
operator
[](
Condition
&&
cond
);
const
Row
operator
[](
Condition
&&
cond
)
const
;
...
...
include/cif++/Cif2PDB.hpp
View file @
9c4170d9
...
...
@@ -28,12 +28,12 @@
#include "cif++/Cif++.hpp"
void
WritePDBFile
(
std
::
ostream
&
pdbFile
,
cif
::
File
&
cifFile
);
void
WritePDBFile
(
std
::
ostream
&
os
,
const
cif
::
Datablock
&
data
);
/// \brief Just the HEADER, COMPND, SOURCE and AUTHOR lines
void
WritePDBHeaderLines
(
std
::
ostream
&
os
,
cif
::
File
&
cifFile
);
void
WritePDBHeaderLines
(
std
::
ostream
&
os
,
const
cif
::
Datablock
&
data
);
std
::
string
GetPDBHEADERLine
(
c
if
::
File
&
cifFile
,
std
::
string
::
size_type
truncate_at
=
127
);
std
::
string
GetPDBCOMPNDLine
(
c
if
::
File
&
cifFile
,
std
::
string
::
size_type
truncate_at
=
127
);
std
::
string
GetPDBSOURCELine
(
c
if
::
File
&
cifFile
,
std
::
string
::
size_type
truncate_at
=
127
);
std
::
string
GetPDBAUTHORLine
(
c
if
::
File
&
cifFile
,
std
::
string
::
size_type
truncate_at
=
127
);
std
::
string
GetPDBHEADERLine
(
c
onst
cif
::
Datablock
&
data
,
std
::
string
::
size_type
truncate_at
=
127
);
std
::
string
GetPDBCOMPNDLine
(
c
onst
cif
::
Datablock
&
data
,
std
::
string
::
size_type
truncate_at
=
127
);
std
::
string
GetPDBSOURCELine
(
c
onst
cif
::
Datablock
&
data
,
std
::
string
::
size_type
truncate_at
=
127
);
std
::
string
GetPDBAUTHORLine
(
c
onst
cif
::
Datablock
&
data
,
std
::
string
::
size_type
truncate_at
=
127
);
src/Cif++.cpp
View file @
9c4170d9
...
...
@@ -409,6 +409,22 @@ Category &Datablock::operator[](std::string_view name)
return
*
i
;
}
const
Category
&
Datablock
::
operator
[](
std
::
string_view
name
)
const
{
using
namespace
std
::
literals
;
auto
result
=
get
(
name
);
if
(
result
==
nullptr
)
// throw std::out_of_range("The category with name " + std::string(name) + " does not exist");
{
std
::
unique_lock
lock
(
mLock
);
if
(
not
mNullCategory
)
mNullCategory
.
reset
(
new
Category
(
const_cast
<
Datablock
&>
(
*
this
),
"<null>"
,
nullptr
));
result
=
mNullCategory
.
get
();
}
return
*
result
;
}
Category
*
Datablock
::
get
(
std
::
string_view
name
)
{
std
::
shared_lock
lock
(
mLock
);
...
...
@@ -1525,6 +1541,11 @@ void Category::drop(const std::string &field)
}
}
const
Row
Category
::
operator
[](
Condition
&&
cond
)
const
{
return
const_cast
<
Category
*>
(
this
)
->
operator
[](
std
::
forward
<
Condition
>
(
cond
));
}
Row
Category
::
operator
[](
Condition
&&
cond
)
{
Row
result
;
...
...
src/Cif2PDB.cpp
View file @
9c4170d9
This diff is collapsed.
Click to expand it.
src/Structure.cpp
View file @
9c4170d9
...
...
@@ -1380,7 +1380,7 @@ void File::save(const std::filesystem::path &path)
out
.
push
(
outFile
);
if
(
file
.
extension
()
==
".pdb"
)
WritePDBFile
(
out
,
*
this
);
WritePDBFile
(
out
,
data
()
);
else
cif
::
File
::
save
(
out
);
}
...
...
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