Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
SingleShotAO
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software Control System
Tango devices
InputOutput
ADLINK
SingleShotAO
Commits
c725c419
Commit
c725c419
authored
4 months ago
by
Alexandre MALFREYT
Browse files
Options
Downloads
Patches
Plain Diff
refactor: use Tango 8 attr memorization (removed workaround)
parent
d326b572
No related branches found
No related tags found
2 merge requests
!4
develop -> main
,
!2
[CTRLRFC-1594] Apply memorized dynamic attributes at init
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/SingleShotAO.cpp
+3
-11
3 additions, 11 deletions
src/SingleShotAO.cpp
src/SingleShotAO.h
+0
-70
0 additions, 70 deletions
src/SingleShotAO.h
with
3 additions
and
81 deletions
src/SingleShotAO.cpp
+
3
−
11
View file @
c725c419
...
...
@@ -505,9 +505,7 @@ void SingleShotAO::init_device()
std
::
string
attr_name
=
kINITIAL
+
oss
.
str
();
std
::
string
name
=
"__"
+
attr_name
;
// To be activated with Tango 8
//double l_val = yat4tango::PropertyHelper::get_memorized_attribute<double>(this,name);
double
l_val
=
get_memorized_attribute
<
double
>
(
name
);
double
l_val
=
yat4tango
::
PropertyHelper
::
get_memorized_attribute
<
double
>
(
this
,
name
);
m_manager
->
set_initial
(
l_cpt
,
l_val
);
}
catch
(...)
...
...
@@ -896,10 +894,7 @@ void SingleShotAO::write_speed(yat4tango::DynamicAttributeWriteCallbackData & cb
"could not write initial [unknown error]"
,
"SingleShotAO::write_initial"
);
}
// To be activated with Tango 8
//yat4tango::PropertyHelper::set_memorized_attribute(this, l_attr_name, l_val);
std
::
string
name
=
"__"
+
l_attr_name
;
store_value_as_property
(
l_val
,
name
);
yat4tango
::
PropertyHelper
::
set_memorized_attribute
(
this
,
l_attr_name
,
l_val
);
}
...
...
@@ -969,10 +964,7 @@ void SingleShotAO::write_initial(yat4tango::DynamicAttributeWriteCallbackData &
"could not write initial [unknown error]"
,
"SingleShotAO::write_initial"
);
}
// To be activated with Tango 8
//yat4tango::PropertyHelper::set_memorized_attribute(this, l_attr_name, l_val);
std
::
string
name
=
"__"
+
l_attr_name
;
store_value_as_property
(
l_val
,
name
);
yat4tango
::
PropertyHelper
::
set_memorized_attribute
(
this
,
l_attr_name
,
l_val
);
}
...
...
This diff is collapsed.
Click to expand it.
src/SingleShotAO.h
+
0
−
70
View file @
c725c419
...
...
@@ -279,76 +279,6 @@ protected :
//- channel number
unsigned
short
m_nb_chan
;
// To be deleted with Tango 8
//- Template class to store a current value in a Device property.
//- \param value Value to store.
//- \param property_name Name to use.
template
<
class
T
>
void
store_value_as_property
(
T
value
,
std
::
string
property_name
)
{
Tango
::
DbDatum
current_value
(
property_name
);
current_value
<<
value
;
Tango
::
DbData
db_data
;
db_data
.
push_back
(
current_value
);
try
{
get_db_device
()
->
put_property
(
db_data
);
}
catch
(
Tango
::
DevFailed
&
df
)
{
ERROR_STREAM
<<
df
<<
endl
;
RETHROW_DEVFAILED
(
df
,
"SOFTWARE_FAILURE"
,
"Error while storing properties in database"
,
"SingleShotAO::store_value_as_property"
);
}
}
// To be deleted with Tango 8
//- Template class to get a memorized attribute stored as a Device property.
//- \param property_name Name od the property to read.
template
<
class
T
>
T
get_memorized_attribute
(
const
std
::
string
&
property_name
)
{
T
value
;
if
(
!
Tango
::
Util
::
instance
()
->
_UseDb
)
{
//- throw exception
THROW_DEVFAILED
(
"DEVICE_ERROR"
,
"No DATA BASE!"
,
"SingleShotAO::get_memorized_attribute"
);
}
Tango
::
DbData
dev_prop
;
dev_prop
.
push_back
(
Tango
::
DbDatum
(
property_name
));
try
{
get_db_device
()
->
get_property
(
dev_prop
);
}
catch
(
Tango
::
DevFailed
&
df
)
{
//- rethrow exception
RETHROW_DEVFAILED
(
df
,
"DEVICE_ERROR"
,
"could not get Device properties! [caught Tango::DevFailed]"
,
"SingleShotAO::get_memorized_attribute"
);
}
if
(
dev_prop
[
0
].
is_empty
()
==
false
)
{
dev_prop
[
0
]
>>
value
;
}
else
{
//- throw exception
THROW_DEVFAILED
(
"DATA_ERROR"
,
"No property stored in database!"
,
"SingleShotAO::get_memorized_attribute"
);
}
return
value
;
}
};
}
// namespace_ns
...
...
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