Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cumbia-tango
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cs
lib
cumbia
cumbia-tango
Commits
c20ce8ab
Commit
c20ce8ab
authored
3 months ago
by
Giacomo Strangolino
Browse files
Options
Downloads
Patches
Plain Diff
CuTangoSource class for sync reads (useful in python bindings)
parent
52ac8c0e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/cutangosource.cpp
+45
-0
45 additions, 0 deletions
lib/cutangosource.cpp
lib/cutangosource.h
+21
-0
21 additions, 0 deletions
lib/cutangosource.h
with
66 additions
and
0 deletions
lib/cutangosource.cpp
0 → 100644
+
45
−
0
View file @
c20ce8ab
#include
"cutangosource.h"
#include
"tdevice.h"
#include
"tsource.h"
#include
"cutango-world.h"
#include
<string>
class
CuTangoSourceP
{
public:
CuTangoSourceP
(
const
std
::
string
&
s
)
:
dev
(
nullptr
),
src
(
TSource
(
s
))
{}
TDevice
*
dev
;
TSource
src
;
CuTangoWorld
w
;
};
CuTangoSource
::
CuTangoSource
(
const
std
::
string
&
src
)
{
d
=
new
CuTangoSourceP
(
src
);
if
(
d
->
src
.
getDeviceName
().
size
()
>
0
)
d
->
dev
=
new
TDevice
(
d
->
src
.
getDeviceName
());
}
CuTangoSource
::~
CuTangoSource
()
{
if
(
d
->
dev
)
delete
d
->
dev
;
delete
d
;
}
CuData
CuTangoSource
::
read
()
const
{
CuData
res
;
Tango
::
DeviceProxy
*
dev
=
d
->
dev
!=
nullptr
?
d
->
dev
->
getDevice
()
:
nullptr
;
if
(
dev
&&
d
->
src
.
getType
()
==
TSource
::
SrcAttr
)
d
->
w
.
read_att
(
d
->
dev
->
getDevice
(),
d
->
src
.
getPoint
(),
res
,
CuTangoWorld
::
ExtractDefault
);
else
if
(
dev
&&
d
->
src
.
getType
()
==
TSource
::
SrcCmd
)
{
d
->
w
.
get_command_info
(
dev
,
d
->
src
.
getPoint
(),
res
);
const
std
::
vector
<
std
::
string
>
&
argins
=
d
->
src
.
getArgs
();
Tango
::
DeviceData
dd
=
d
->
w
.
toDeviceData
(
argins
,
res
);
bool
has_argout
=
res
[
"out_type"
].
toLongInt
()
!=
Tango
::
DEV_VOID
;
printf
(
"read: command: %s has argout %s
\n
"
,
datos
(
res
),
has_argout
?
"YES"
:
"NO"
);
d
->
w
.
cmd_inout
(
dev
,
d
->
src
.
getPoint
(),
dd
,
has_argout
,
res
);
printf
(
"read: after cmd_io data \e[1;32m%s\e[0m
\n
"
,
datos
(
res
));
}
else
if
(
dev
&&
d
->
src
.
isDbOp
())
{
d
->
w
.
db_get
(
d
->
src
,
res
);
}
return
res
;
}
This diff is collapsed.
Click to expand it.
lib/cutangosource.h
0 → 100644
+
21
−
0
View file @
c20ce8ab
#ifndef CUTANGOSOURCE_H
#define CUTANGOSOURCE_H
class
CuTangoSourceP
;
#include
<string>
#include
<cudata.h>
class
CuTangoSource
{
public:
CuTangoSource
(
const
std
::
string
&
src
);
virtual
~
CuTangoSource
();
CuData
read
()
const
;
private:
CuTangoSourceP
*
d
;
};
#endif // CUTANGOSOURCE_H
This diff is collapsed.
Click to expand it.
Preview
0%
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