Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
dynamic-graph-python
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
Container Registry
Model registry
Operate
Environments
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
Stack Of Tasks
dynamic-graph-python
Commits
6d36b1fd
Commit
6d36b1fd
authored
11 years ago
by
Francois Keith
Browse files
Options
Downloads
Patches
Plain Diff
Add a method to test the existence of a signal.
parent
ded79527
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
CMakeLists.txt
+1
-1
1 addition, 1 deletion
CMakeLists.txt
src/dynamic-graph-py.cc
+3
-0
3 additions, 0 deletions
src/dynamic-graph-py.cc
src/dynamic_graph/entity.py
+6
-0
6 additions, 0 deletions
src/dynamic_graph/entity.py
src/entity-py.cc
+34
-1
34 additions, 1 deletion
src/entity-py.cc
with
44 additions
and
2 deletions
CMakeLists.txt
+
1
−
1
View file @
6d36b1fd
...
...
@@ -39,7 +39,7 @@ SET(PKG_CONFIG_ADDITIONAL_VARIABLES plugindir ${PKG_CONFIG_ADDITIONAL_VARIABLES}
SETUP_PROJECT
()
# Trigger dependency to dynamic-graph.
ADD_REQUIRED_DEPENDENCY
(
"dynamic-graph >=
1.0
"
)
ADD_REQUIRED_DEPENDENCY
(
"dynamic-graph >=
2.5.5-6
"
)
# Add dependency toward dynamic graph library in pkg-config file.
PKG_CONFIG_APPEND_LIBS
(
"dynamic-graph-python"
)
...
...
This diff is collapsed.
Click to expand it.
src/dynamic-graph-py.cc
+
3
−
0
View file @
6d36b1fd
...
...
@@ -48,6 +48,7 @@ namespace dynamicgraph {
extern
PyObject
*
display
(
PyObject
*
self
,
PyObject
*
args
);
extern
PyObject
*
display
(
PyObject
*
self
,
PyObject
*
args
);
extern
PyObject
*
getName
(
PyObject
*
self
,
PyObject
*
args
);
extern
PyObject
*
hasSignal
(
PyObject
*
self
,
PyObject
*
args
);
extern
PyObject
*
getSignal
(
PyObject
*
self
,
PyObject
*
args
);
extern
PyObject
*
listSignals
(
PyObject
*
self
,
PyObject
*
args
);
extern
PyObject
*
executeCommand
(
PyObject
*
self
,
PyObject
*
args
);
...
...
@@ -179,6 +180,8 @@ static PyMethodDef dynamicGraphMethods[] = {
"print an Entity C++ object"
},
{
"entity_get_name"
,
dynamicgraph
::
python
::
entity
::
getName
,
METH_VARARGS
,
"get the name of an Entity"
},
{
"entity_has_signal"
,
dynamicgraph
::
python
::
entity
::
hasSignal
,
METH_VARARGS
,
"return True if the entity has a signal with the given name"
},
{
"entity_get_signal"
,
dynamicgraph
::
python
::
entity
::
getSignal
,
METH_VARARGS
,
"get signal by name from an Entity"
},
{
"entity_list_signals"
,
dynamicgraph
::
python
::
entity
::
listSignals
,
...
...
This diff is collapsed.
Click to expand it.
src/dynamic_graph/entity.py
+
6
−
0
View file @
6d36b1fd
...
...
@@ -107,6 +107,12 @@ class Entity (object) :
signalPt
=
wrap
.
entity_get_signal
(
self
.
obj
,
name
)
return
signal_base
.
SignalBase
(
name
=
""
,
obj
=
signalPt
)
def
hasSignal
(
self
,
name
)
:
"""
Indicates if a signal with the given name exists in the entity
"""
return
wrap
.
entity_has_signal
(
self
.
obj
,
name
)
def
displaySignals
(
self
)
:
"""
Print the list of signals into standard output: temporary.
...
...
This diff is collapsed.
Click to expand it.
src/entity-py.cc
+
34
−
1
View file @
6d36b1fd
...
...
@@ -113,7 +113,40 @@ namespace dynamicgraph {
}
/**
\brief Get a signal by name
\brief Check if the entity has a signal with the given name
*/
PyObject
*
hasSignal
(
PyObject
*
/*self*/
,
PyObject
*
args
)
{
char
*
name
=
NULL
;
PyObject
*
object
=
NULL
;
void
*
pointer
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"Os"
,
&
object
,
&
name
))
Py_RETURN_FALSE
;
if
(
!
PyCObject_Check
(
object
))
{
PyErr_SetString
(
PyExc_TypeError
,
"function takes a PyCObject as argument"
);
Py_RETURN_FALSE
;
}
pointer
=
PyCObject_AsVoidPtr
(
object
);
Entity
*
entity
=
(
Entity
*
)
pointer
;
bool
hasSignal
=
false
;
try
{
hasSignal
=
entity
->
hasSignal
(
std
::
string
(
name
));
}
CATCH_ALL_EXCEPTIONS
();
if
(
hasSignal
)
Py_RETURN_TRUE
;
else
Py_RETURN_FALSE
;
}
/**
\brief Get a signal by name
*/
PyObject
*
getSignal
(
PyObject
*
/*self*/
,
PyObject
*
args
)
{
...
...
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