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
ad22ebb5
Commit
ad22ebb5
authored
6 years ago
by
Nadeem Shehzad
Browse files
Options
Downloads
Patches
Plain Diff
added: some more doxy comments and intorduction page for exception handling.
parent
9bfd0feb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/DeviceModule.h
+32
-2
32 additions, 2 deletions
include/DeviceModule.h
with
32 additions
and
2 deletions
include/DeviceModule.h
+
32
−
2
View file @
ad22ebb5
/*!
* \author Nadeem Shehzad (DESY)
* \date 21.02.2019
* \page excpetiondoc Exception Handling
* \section Introduction
*
* To handle expection, the current simple implementation includes two error state variables:
* - "state" (boolean flag if error occurred)
* - "message" (string with error message)
*
* These variables are placed together in a VariableGroup called "DeviceError".
* They are connected to the contorlsystem in this format
* - /Devices.{AliasName}/DeviceError/message
* - /Devices.{AliasName}/DeviceError/status.
*
* In this implementation a user/application can report an exception
* by calling reportException of DeviceModule with an exception string.
* The reportException packs the exception in a queue and the blocks the thread.
* This queue is processed by an internal function handleException which
* updates the DeviceError variables (status=1 and message= YourExceptionString)
* and tries to open the device. Once device can be opened the DeviceError
* variables are updated (status=0 and message="") and blocking threads
* are notified to continue. It must be noted that whatever operation which
* lead to exception e.g., read or write, should be repeated after the exception
* is handled.
*
* Checkout testExceptionTest.cc under tests/executables_src to see how it works.
*/
/*
* DeviceModule.h
*
...
...
@@ -70,6 +99,7 @@ class DeviceModule : public Module {
ModuleType
getModuleType
()
const
override
{
return
ModuleType
::
Device
;
}
/** Use this function to report an exception*/
void
reportException
(
std
::
string
errMsg
);
void
run
()
override
;
...
...
@@ -83,7 +113,7 @@ class DeviceModule : public Module {
}
VersionNumber
currentVersionNumber
;
/*This function connects DeviceError Variable
Group to
cs
*/
/*
*
This function connects DeviceError VariableGroup to
ContolSystem
*/
void
defineConnections
()
override
;
protected
:
// populate virtualisedModuleFromCatalog based on the information in the device's catalogue
...
...
@@ -98,7 +128,7 @@ class DeviceModule : public Module {
// thus does not change the logical state of this module
mutable
std
::
map
<
std
::
string
,
DeviceModule
>
subModules
;
/* A VariableGroup for exception status and message*/
/*
*
A VariableGroup for exception status and message*/
public
:
struct
DeviceError
:
public
VariableGroup
{
using
VariableGroup
::
VariableGroup
;
...
...
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