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
Guilhem Saurel
dynamic-graph-python
Commits
ed39db7c
Commit
ed39db7c
authored
7 years ago
by
Olivier Stasse
Browse files
Options
Downloads
Patches
Plain Diff
Implements correctly the list of entities inside the pool.
parent
e2fc6170
No related branches found
No related tags found
No related merge requests found
Pipeline
#7535
failed
5 years ago
Stage: build
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/dynamic-graph-py.cc
+5
-1
5 additions, 1 deletion
src/dynamic-graph-py.cc
src/pool-py.cc
+39
-1
39 additions, 1 deletion
src/pool-py.cc
with
44 additions
and
2 deletions
src/dynamic-graph-py.cc
+
5
−
1
View file @
ed39db7c
...
...
@@ -59,13 +59,13 @@ namespace dynamicgraph {
namespace
factory
{
extern
PyObject
*
getEntityClassList
(
PyObject
*
self
,
PyObject
*
args
);
extern
PyObject
*
getEntityMap
(
PyObject
*
self
,
PyObject
*
args
);
}
namespace
signalCaster
{
extern
PyObject
*
getSignalTypeList
(
PyObject
*
self
,
PyObject
*
args
);
}
namespace
pool
{
extern
PyObject
*
writeGraph
(
PyObject
*
self
,
PyObject
*
args
);
extern
PyObject
*
getEntityList
(
PyObject
*
self
,
PyObject
*
args
);
}
PyObject
*
dgpyError
;
...
...
@@ -216,6 +216,10 @@ static PyMethodDef dynamicGraphMethods[] = {
dynamicgraph
::
python
::
pool
::
writeGraph
,
METH_VARARGS
,
"Write the graph of entities in a filename."
},
{
"get_entity_list"
,
dynamicgraph
::
python
::
pool
::
getEntityList
,
METH_VARARGS
,
"return the list of instanciated entities"
},
{
NULL
,
NULL
,
0
,
NULL
}
/* Sentinel */
};
...
...
This diff is collapsed.
Click to expand it.
src/pool-py.cc
+
39
−
1
View file @
ed39db7c
...
...
@@ -15,7 +15,8 @@
#include
<Python.h>
#include
<dynamic-graph/pool.h>
#include
<dynamic-graph/entity.h>
#include
<vector>
#include
"exception.hh"
namespace
dynamicgraph
{
...
...
@@ -33,6 +34,43 @@ namespace dynamicgraph {
}
CATCH_ALL_EXCEPTIONS
();
return
Py_BuildValue
(
""
);
}
/**
\brief Get list of entities
*/
PyObject
*
getEntityList
(
PyObject
*
/*self*/
,
PyObject
*
args
)
{
if
(
!
PyArg_ParseTuple
(
args
,
""
))
return
NULL
;
std
::
vector
<
std
::
string
>
entityNames
;
try
{
const
PoolStorage
::
Entities
&
listOfEntities
=
dynamicgraph
::
PoolStorage
::
getInstance
()
->
getEntityMap
();
Py_ssize_t
classNumber
=
listOfEntities
.
size
();
// Build a tuple object
PyObject
*
classTuple
=
PyTuple_New
(
classNumber
);
Py_ssize_t
iEntity
=
0
;
for
(
PoolStorage
::
Entities
::
const_iterator
entity_it
=
listOfEntities
.
begin
();
entity_it
!=
listOfEntities
.
end
();
++
entity_it
)
{
const
std
::
string
&
aname
=
entity_it
->
second
->
getName
();
PyObject
*
className
=
Py_BuildValue
(
"s"
,
aname
.
c_str
());
PyTuple_SetItem
(
classTuple
,
iEntity
,
className
);
iEntity
++
;
}
return
Py_BuildValue
(
"O"
,
classTuple
);
}
CATCH_ALL_EXCEPTIONS
();
return
NULL
;
}
}
// python
}
// dynamicgraph
}
// namespace pool
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