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
0caaf237
Unverified
Commit
0caaf237
authored
Jan 12, 2021
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Thread local compound factory, for servers that manipulate the factory.
parent
c5676f1d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
9 deletions
+45
-9
.gitignore
+5
-1
configure
+3
-3
include/cif++/Compound.hpp
+6
-1
src/Compound.cpp
+31
-4
No files found.
.gitignore
View file @
0caaf237
...
@@ -5,7 +5,6 @@ obj/
...
@@ -5,7 +5,6 @@ obj/
.pc/
.pc/
autom4te.cache/
autom4te.cache/
GNUmakefile
GNUmakefile
include/src/Config.hpp
tools/symop-map-generator
tools/symop-map-generator
test/unit-test
test/unit-test
libcifpp.pc
libcifpp.pc
...
@@ -14,3 +13,8 @@ config.status
...
@@ -14,3 +13,8 @@ config.status
config.log
config.log
libtool
libtool
test/pdb2cif-test
test/pdb2cif-test
src/revision.hpp
src/Config.hpp.in~
src/Config.hpp
aclocal.m4
version-info-*.txt
configure
View file @
0caaf237
...
@@ -16964,8 +16964,8 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
...
@@ -16964,8 +16964,8 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
LIBCIF_CURRENT
=
1
LIBCIF_CURRENT
=
1
LIBCIF_REVISION
=
0
LIBCIF_REVISION
=
1
LIBCIF_AGE
=
0
LIBCIF_AGE
=
1
LIBCIF_LT_CURRENT
=
"
${
LIBCIF_CURRENT
}
"
LIBCIF_LT_CURRENT
=
"
${
LIBCIF_CURRENT
}
"
LIBCIF_LT_VERSION
=
"
${
LIBCIF_CURRENT
}
:
${
LIBCIF_REVISION
}
:
${
LIBCIF_AGE
}
"
LIBCIF_LT_VERSION
=
"
${
LIBCIF_CURRENT
}
:
${
LIBCIF_REVISION
}
:
${
LIBCIF_AGE
}
"
...
@@ -16973,7 +16973,7 @@ LIBCIF_LT_VERSION="${LIBCIF_CURRENT}:${LIBCIF_REVISION}:${LIBCIF_AGE}"
...
@@ -16973,7 +16973,7 @@ LIBCIF_LT_VERSION="${LIBCIF_CURRENT}:${LIBCIF_REVISION}:${LIBCIF_AGE}"
LIBCIF_SEMANTIC_VERSION
=
1.
0
.0
LIBCIF_SEMANTIC_VERSION
=
1.
1
.0
...
...
include/cif++/Compound.hpp
View file @
0caaf237
...
@@ -310,7 +310,9 @@ class CompoundFactory
...
@@ -310,7 +310,9 @@ class CompoundFactory
{
{
public
:
public
:
static
void
init
(
bool
useThreadLocalInstanceOnly
);
static
CompoundFactory
&
instance
();
static
CompoundFactory
&
instance
();
static
void
clear
();
void
pushDictionary
(
const
std
::
string
&
inDictFile
);
void
pushDictionary
(
const
std
::
string
&
inDictFile
);
void
popDictionary
();
void
popDictionary
();
...
@@ -326,15 +328,18 @@ class CompoundFactory
...
@@ -326,15 +328,18 @@ class CompoundFactory
const
Link
*
getLink
(
std
::
string
id
);
const
Link
*
getLink
(
std
::
string
id
);
const
Link
*
createLink
(
std
::
string
id
);
const
Link
*
createLink
(
std
::
string
id
);
~
CompoundFactory
();
private
:
private
:
CompoundFactory
();
CompoundFactory
();
~
CompoundFactory
();
CompoundFactory
(
const
CompoundFactory
&
)
=
delete
;
CompoundFactory
(
const
CompoundFactory
&
)
=
delete
;
CompoundFactory
&
operator
=
(
const
CompoundFactory
&
)
=
delete
;
CompoundFactory
&
operator
=
(
const
CompoundFactory
&
)
=
delete
;
static
CompoundFactory
*
sInstance
;
static
CompoundFactory
*
sInstance
;
static
thread_local
std
::
unique_ptr
<
CompoundFactory
>
tlInstance
;
static
bool
sUseThreadLocalInstance
;
class
CompoundFactoryImpl
*
mImpl
;
class
CompoundFactoryImpl
*
mImpl
;
};
};
...
...
src/Compound.cpp
View file @
0caaf237
...
@@ -1247,6 +1247,13 @@ const Link* CompoundFactoryImpl::createLink(std::string id)
...
@@ -1247,6 +1247,13 @@ const Link* CompoundFactoryImpl::createLink(std::string id)
// --------------------------------------------------------------------
// --------------------------------------------------------------------
CompoundFactory
*
CompoundFactory
::
sInstance
;
CompoundFactory
*
CompoundFactory
::
sInstance
;
thread_local
std
::
unique_ptr
<
CompoundFactory
>
CompoundFactory
::
tlInstance
;
bool
CompoundFactory
::
sUseThreadLocalInstance
;
void
CompoundFactory
::
init
(
bool
useThreadLocalInstanceOnly
)
{
sUseThreadLocalInstance
=
useThreadLocalInstanceOnly
;
}
CompoundFactory
::
CompoundFactory
()
CompoundFactory
::
CompoundFactory
()
:
mImpl
(
nullptr
)
:
mImpl
(
nullptr
)
...
@@ -1275,9 +1282,29 @@ CompoundFactory::~CompoundFactory()
...
@@ -1275,9 +1282,29 @@ CompoundFactory::~CompoundFactory()
CompoundFactory
&
CompoundFactory
::
instance
()
CompoundFactory
&
CompoundFactory
::
instance
()
{
{
if
(
sInstance
==
nullptr
)
if
(
sUseThreadLocalInstance
)
sInstance
=
new
CompoundFactory
();
{
return
*
sInstance
;
if
(
not
tlInstance
)
tlInstance
.
reset
(
new
CompoundFactory
());
return
*
tlInstance
;
}
else
{
if
(
sInstance
==
nullptr
)
sInstance
=
new
CompoundFactory
();
return
*
sInstance
;
}
}
void
CompoundFactory
::
clear
()
{
if
(
sUseThreadLocalInstance
)
tlInstance
.
reset
(
nullptr
);
else
{
delete
sInstance
;
sInstance
=
nullptr
;
}
}
}
void
CompoundFactory
::
pushDictionary
(
const
std
::
string
&
inDictFile
)
void
CompoundFactory
::
pushDictionary
(
const
std
::
string
&
inDictFile
)
...
@@ -1340,6 +1367,6 @@ bool CompoundFactory::isKnownBase(const std::string& resName) const
...
@@ -1340,6 +1367,6 @@ bool CompoundFactory::isKnownBase(const std::string& resName) const
std
::
string
CompoundFactory
::
unalias
(
const
std
::
string
&
resName
)
const
std
::
string
CompoundFactory
::
unalias
(
const
std
::
string
&
resName
)
const
{
{
return
mImpl
->
unalias
(
resName
);
return
mImpl
->
unalias
(
resName
);
}
}
}
}
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