Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
ControlSystemAdapter-DoocsAdapter
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
ControlSystemAdapter-DoocsAdapter
Commits
ef7ea4eb
Commit
ef7ea4eb
authored
7 years ago
by
Martin Killenberg
Browse files
Options
Downloads
Patches
Plain Diff
VariableMapper is creating spectrum descriptions. Tests running, but not sensitive yet.
parent
de64954b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/VariableMapper.h
+1
-0
1 addition, 0 deletions
include/VariableMapper.h
src/VariableMapper.cc
+36
-0
36 additions, 0 deletions
src/VariableMapper.cc
tests/src/serverTestSpectrumArray.cpp
+3
-3
3 additions, 3 deletions
tests/src/serverTestSpectrumArray.cpp
with
40 additions
and
3 deletions
include/VariableMapper.h
+
1
−
0
View file @
ef7ea4eb
...
...
@@ -53,6 +53,7 @@ namespace ChimeraTK{
void
processLocationNode
(
xmlpp
::
Node
const
*
locationNode
);
void
processPropertyNode
(
xmlpp
::
Node
const
*
propertyNode
,
std
::
string
locationName
);
void
processSpectrumNode
(
xmlpp
::
Node
const
*
node
,
std
::
string
locationName
);
void
processArrayNode
(
xmlpp
::
Node
const
*
node
,
std
::
string
locationName
);
void
processImportNode
(
xmlpp
::
Node
const
*
importNode
,
std
::
string
importLocationName
=
std
::
string
());
void
import
(
std
::
string
importSource
,
std
::
string
importLocationName
,
std
::
string
directory
=
""
);
...
...
This diff is collapsed.
Click to expand it.
src/VariableMapper.cc
+
36
−
0
View file @
ef7ea4eb
...
...
@@ -50,6 +50,8 @@ namespace ChimeraTK{
locationInfo
.
isWriteable
=
evaluateBool
(
getContentString
(
node
));
}
else
if
(
node
->
get_name
()
==
"D_spectrum"
){
processSpectrumNode
(
node
,
locationName
);
}
else
if
(
node
->
get_name
()
==
"D_array"
){
processArrayNode
(
node
,
locationName
);
}
else
{
throw
std
::
invalid_argument
(
std
::
string
(
"Error parsing xml file in location "
)
+
locationName
+
": Unknown node '"
+
node
->
get_name
()
+
"'"
);
}
...
...
@@ -149,6 +151,40 @@ namespace ChimeraTK{
addDescription
(
spectrumDescription
,
absoluteSource
);
}
void
VariableMapper
::
processArrayNode
(
xmlpp
::
Node
const
*
node
,
std
::
string
locationName
){
auto
arrayXml
=
asXmlElement
(
node
);
// the "main source" of a spectum
std
::
string
source
=
getAttributeValue
(
arrayXml
,
"source"
);
std
::
string
name
=
determineName
(
arrayXml
,
source
);
const
xmlpp
::
Attribute
*
typeAttribute
=
arrayXml
->
get_attribute
(
"type"
);
std
::
map
<
std
::
string
,
ArrayDescription
::
DataType
>
dataTypeMap
(
{
{
"auto"
,
ArrayDescription
::
DataType
::
Auto
},
{
"byte"
,
ArrayDescription
::
DataType
::
Byte
},
{
"short"
,
ArrayDescription
::
DataType
::
Short
},
{
"int"
,
ArrayDescription
::
DataType
::
Int
},
{
"long"
,
ArrayDescription
::
DataType
::
Long
},
{
"float"
,
ArrayDescription
::
DataType
::
Float
},
{
"double"
,
ArrayDescription
::
DataType
::
Double
}
});
ArrayDescription
::
DataType
type
;
if
(
typeAttribute
){
type
=
dataTypeMap
[
typeAttribute
->
get_value
()];
}
else
{
type
=
ArrayDescription
::
DataType
::
Auto
;
}
std
::
string
absoluteSource
=
getAbsoluteSource
(
source
,
locationName
);
// prepare the property description
auto
arrayDescription
=
std
::
make_shared
<
ArrayDescription
>
(
absoluteSource
,
locationName
,
name
);
processHistoryAndWritableAttributes
(
arrayDescription
,
arrayXml
,
locationName
);
addDescription
(
arrayDescription
,
absoluteSource
);
}
void
VariableMapper
::
processImportNode
(
xmlpp
::
Node
const
*
importNode
,
std
::
string
importLocationName
){
const
xmlpp
::
Element
*
importElement
=
dynamic_cast
<
const
xmlpp
::
Element
*>
(
importNode
);
std
::
string
directory
;
...
...
This diff is collapsed.
Click to expand it.
tests/src/serverTestSpectrumArray.cpp
+
3
−
3
View file @
ef7ea4eb
...
...
@@ -41,7 +41,7 @@ void testReadWrite(){
// running update now does not change anything, the application has not acted yet
DoocsServerTestHelper
::
runUpdate
();
auto
notIntArray
=
DoocsServerTestHelper
::
doocsGetArray
<
float
>
(
"//INT/
FROM_DEVICE_
ARRAY"
);
auto
notIntArray
=
DoocsServerTestHelper
::
doocsGetArray
<
float
>
(
"//INT/
MY_RENAMED_INT
ARRAY"
);
for
(
auto
val
:
notIntArray
){
BOOST_CHECK
(
std
::
fabs
(
val
)
<
0.001
);
}
...
...
@@ -53,7 +53,7 @@ void testReadWrite(){
// run the application loop. Still no changes until we run the doocs server update
referenceTestApplication
.
runMainLoopOnce
();
notIntArray
=
DoocsServerTestHelper
::
doocsGetArray
<
float
>
(
"//INT/
FROM_DEVICE_
ARRAY"
);
notIntArray
=
DoocsServerTestHelper
::
doocsGetArray
<
float
>
(
"//INT/
MY_RENAMED_INT
ARRAY"
);
for
(
auto
val
:
notIntArray
){
BOOST_CHECK
(
std
::
fabs
(
val
)
<
0.001
);
}
...
...
@@ -65,7 +65,7 @@ void testReadWrite(){
// now finally after the next update we should see the new data in doocs
DoocsServerTestHelper
::
runUpdate
();
notIntArray
=
DoocsServerTestHelper
::
doocsGetArray
<
float
>
(
"//INT/
FROM_DEVICE_
ARRAY"
);
notIntArray
=
DoocsServerTestHelper
::
doocsGetArray
<
float
>
(
"//INT/
MY_RENAMED_INT
ARRAY"
);
int
testVal
=
140
;
for
(
auto
val
:
notIntArray
){
BOOST_CHECK
(
std
::
fabs
(
val
-
testVal
++
)
<
0.001
);
...
...
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