Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pinocchio
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
pinocchio
Commits
ff0b24d5
Commit
ff0b24d5
authored
6 years ago
by
jcarpent
Browse files
Options
Downloads
Patches
Plain Diff
[Python] Add function to expose constant variables in the current Python scope
parent
fd628c9d
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
bindings/python/CMakeLists.txt
+1
-0
1 addition, 0 deletions
bindings/python/CMakeLists.txt
bindings/python/utils/constant.hpp
+46
-0
46 additions, 0 deletions
bindings/python/utils/constant.hpp
with
47 additions
and
0 deletions
bindings/python/CMakeLists.txt
+
1
−
0
View file @
ff0b24d5
...
...
@@ -44,6 +44,7 @@ ENDFOREACH(dep ${PKG_CONFIG_PYWRAP_REQUIRES})
SET
(
${
PYWRAP
}
_INSTALL_DIR
${
CMAKE_INSTALL_PREFIX
}
/
${
PYTHON_SITELIB
}
/
${
PROJECT_NAME
}
)
SET
(
${
PROJECT_NAME
}
_PYTHON_HEADERS
utils/constant.hpp
utils/eigen_container.hpp
utils/handler.hpp
utils/copyable.hpp
...
...
This diff is collapsed.
Click to expand it.
bindings/python/utils/constant.hpp
0 → 100644
+
46
−
0
View file @
ff0b24d5
//
// Copyright (c) 2018 CNRS
//
// This file is part of Pinocchio
// Pinocchio is free software: you can redistribute it
// and/or modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation, either version
// 3 of the License, or (at your option) any later version.
//
// Pinocchio is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Lesser Public License for more details. You should have
// received a copy of the GNU Lesser General Public License along with
// Pinocchio If not, see
// <http://www.gnu.org/licenses/>.
#ifndef __se3_python_utils_constant_hpp__
#define __se3_python_utils_constant_hpp__
#include
<boost/python/scope.hpp>
namespace
boost
{
namespace
python
{
///
/// \brief Define a constant given its value and a name within the current Boost Python scope.
///
/// \tparam T Type of the constant.
///
/// \param[in] name Name of the constant.
/// \param[in] value Value of the constant.
///
template
<
typename
T
>
void
def_constant
(
const
char
*
name
,
const
T
&
value
)
{
namespace
bp
=
boost
::
python
;
bp
::
scope
().
attr
(
name
)
=
value
;
}
}
// namespace python
}
// namespace boost
#endif // ifndef __se3_python_utils_constant_hpp__
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