Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ApplicationCore
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ChimeraTK Mirror
ApplicationCore
Commits
d025bb5a
Commit
d025bb5a
authored
4 years ago
by
Martin Killenberg
Browse files
Options
Downloads
Patches
Plain Diff
wip ExceptionHandlingDecorator: Removed transferAllowed. Is now done by TransferElement.
parent
be07560c
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
include/ExceptionHandlingDecorator.h
+0
-8
0 additions, 8 deletions
include/ExceptionHandlingDecorator.h
src/ExceptionHandlingDecorator.cc
+5
-49
5 additions, 49 deletions
src/ExceptionHandlingDecorator.cc
with
5 additions
and
57 deletions
include/ExceptionHandlingDecorator.h
+
0
−
8
View file @
d025bb5a
...
...
@@ -29,12 +29,6 @@ namespace ChimeraTK {
DeviceModule
&
devMod
,
VariableDirection
direction
,
boost
::
shared_ptr
<
ChimeraTK
::
NDRegisterAccessor
<
UserType
>>
recoveryAccessor
=
{
nullptr
});
bool
doWriteTransfer
(
ChimeraTK
::
VersionNumber
versionNumber
)
override
;
bool
doWriteTransferDestructively
(
ChimeraTK
::
VersionNumber
versionNumber
)
override
;
void
doReadTransferSynchronously
()
override
;
void
doPreWrite
(
TransferType
type
,
VersionNumber
versionNumber
)
override
;
void
doPostWrite
(
TransferType
type
,
VersionNumber
versionNumber
)
override
;
...
...
@@ -57,8 +51,6 @@ namespace ChimeraTK {
EntityOwner
*
_owner
=
{
nullptr
};
VariableDirection
_direction
;
bool
transferAllowed
{
false
};
};
DECLARE_TEMPLATE_FOR_CHIMERATK_USER_TYPES
(
ExceptionHandlingDecorator
);
...
...
This diff is collapsed.
Click to expand it.
src/ExceptionHandlingDecorator.cc
+
5
−
49
View file @
d025bb5a
...
...
@@ -33,33 +33,6 @@ namespace ChimeraTK {
}
}
template
<
typename
UserType
>
void
ExceptionHandlingDecorator
<
UserType
>::
doReadTransferSynchronously
()
{
if
(
transferAllowed
)
{
ChimeraTK
::
NDRegisterAccessorDecorator
<
UserType
>::
doReadTransferSynchronously
();
}
}
template
<
typename
UserType
>
bool
ExceptionHandlingDecorator
<
UserType
>::
doWriteTransfer
(
ChimeraTK
::
VersionNumber
versionNumber
)
{
if
(
transferAllowed
)
{
return
ChimeraTK
::
NDRegisterAccessorDecorator
<
UserType
>::
doWriteTransfer
(
versionNumber
);
}
else
{
return
true
;
/* data loss */
}
}
template
<
typename
UserType
>
bool
ExceptionHandlingDecorator
<
UserType
>::
doWriteTransferDestructively
(
ChimeraTK
::
VersionNumber
versionNumber
)
{
if
(
transferAllowed
)
{
return
ChimeraTK
::
NDRegisterAccessorDecorator
<
UserType
>::
doWriteTransferDestructively
(
versionNumber
);
}
else
{
return
true
;
/* data loss */
}
}
template
<
typename
UserType
>
void
ExceptionHandlingDecorator
<
UserType
>::
doPreWrite
(
TransferType
type
,
VersionNumber
versionNumber
)
{
/* For writable accessors, copy data to the recoveryAcessor before perfroming the write.
...
...
@@ -88,7 +61,7 @@ namespace ChimeraTK {
// #138 Phase 1. Change for phase 2
// Starting a transfer is only allowed if the status is running (not in initialisation or shutdown)
transferAllowed
=
(
Application
::
getInstance
().
getLifeCycleState
()
==
LifeCycleState
::
run
);
bool
transferAllowed
=
(
Application
::
getInstance
().
getLifeCycleState
()
==
LifeCycleState
::
run
);
// the waiting is only necessary as a hack for phase 1 because DeviceModule::startTransfer is not there yet
if
(
transferAllowed
)
deviceModule
.
waitForRecovery
();
...
...
@@ -102,9 +75,7 @@ namespace ChimeraTK {
template
<
typename
UserType
>
void
ExceptionHandlingDecorator
<
UserType
>::
doPostWrite
(
TransferType
type
,
VersionNumber
versionNumber
)
{
try
{
if
(
transferAllowed
)
{
ChimeraTK
::
NDRegisterAccessorDecorator
<
UserType
>::
doPostWrite
(
type
,
versionNumber
);
}
ChimeraTK
::
NDRegisterAccessorDecorator
<
UserType
>::
doPostWrite
(
type
,
versionNumber
);
}
catch
(
ChimeraTK
::
runtime_error
&
e
)
{
deviceModule
.
reportException
(
e
.
what
());
...
...
@@ -123,10 +94,7 @@ namespace ChimeraTK {
void
ExceptionHandlingDecorator
<
UserType
>::
doPostRead
(
TransferType
type
,
bool
hasNewData
)
{
bool
hasException
=
false
;
try
{
// preRead has not been called when the transfer was not allowed. Don't call postRead in this case.
if
(
transferAllowed
)
{
this
->
_target
->
postRead
(
type
,
hasNewData
);
}
this
->
_target
->
postRead
(
type
,
hasNewData
);
}
catch
(
ChimeraTK
::
runtime_error
&
e
)
{
deviceModule
.
reportException
(
e
.
what
());
...
...
@@ -136,7 +104,7 @@ namespace ChimeraTK {
setOwnerValidity
(
hasException
);
}
// #138 Phase 2: change if codition here
if
(
hasException
||
!
transferAllowed
)
{
if
(
hasException
)
{
// Try to recover and read until it succeeds.
// We are already behind the delegated postRead, so the transfer in the target is already complemted.
// So we have to use a complete blocking preRead, readTransfer, postRead, i.e. _tagret->read()
...
...
@@ -177,19 +145,7 @@ namespace ChimeraTK {
/* #138 Phase 1. Change this for phase 2 */
/* Hack for phase 1 because DeviceModule::startTransfer is not there yet. */
deviceModule
.
waitForRecovery
();
transferAllowed
=
true
;
// std::cout << "recovered" << std::endl;
// transferAllowed = (Application::getInstance().getLifeCycleState() == LifeCycleState::run);
// auto l = Application::getInstance().getLifeCycleState();
// std::cout << "LifeCycleState: "
// << (l == LifeCycleState::run ? "run" : (l == LifeCycleState::initialisation ? "init" : "shutdown"))
// << std::endl;
// assert(transferAllowed); // not true in phase 2 any more
// only delegate preRead and postRead if the transfer is allowerd
if
(
transferAllowed
)
{
ChimeraTK
::
NDRegisterAccessorDecorator
<
UserType
>::
doPreRead
(
type
);
}
ChimeraTK
::
NDRegisterAccessorDecorator
<
UserType
>::
doPreRead
(
type
);
}
INSTANTIATE_TEMPLATE_FOR_CHIMERATK_USER_TYPES
(
ExceptionHandlingDecorator
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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