-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Started adding python bindings for GNDS 1.9 standard components
- Loading branch information
Showing
4 changed files
with
115 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// system includes | ||
#include <pybind11/pybind11.h> | ||
#include <pybind11/stl.h> | ||
|
||
// other includes | ||
|
||
// namespace aliases | ||
namespace python = pybind11; | ||
|
||
// v1.9 interface declarations | ||
namespace v1_9 { | ||
|
||
// gpdc declarations | ||
namespace gpdc { | ||
|
||
void wrapAxis( python::module& ); | ||
} | ||
|
||
void wrapGeneralPurposeDataContainers( python::module& module ) { | ||
|
||
// create the gpdc submodule | ||
python::module submodule = module.def_submodule( | ||
|
||
"gpdc", | ||
"v1.9 gpdc - GNDS general purpose data containers" | ||
); | ||
|
||
// wrap core components | ||
gpdc::wrapAxis( submodule ); | ||
} | ||
|
||
} // v1_9 namespace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// system includes | ||
#include <pybind11/pybind11.h> | ||
#include <pybind11/stl.h> | ||
|
||
// local includes | ||
#include "GNDStk/v1.9/gpdc/Axis.hpp" | ||
|
||
// namespace aliases | ||
namespace python = pybind11; | ||
|
||
namespace v1_9 { | ||
namespace gpdc { | ||
|
||
void wrapAxis( python::module& module ) { | ||
|
||
// type aliases | ||
using Component = njoy::GNDStk::v1_9::gpdc::Axis; | ||
|
||
// create the component | ||
python::class_< Component > component( | ||
|
||
module, | ||
"Axis", | ||
"Container component - an axis with index, label and unit" | ||
); | ||
|
||
// wrap the component | ||
component | ||
.def( | ||
|
||
python::init< const std::optional<njoy::GNDStk::Integer32>&, | ||
const std::optional<njoy::GNDStk::XMLName>&, | ||
const std::optional<njoy::GNDStk::XMLName>& >(), | ||
python::arg( "index" ), python::arg( "label" ), python::arg( "unit" ), | ||
"Initialise the component\n\n" | ||
"Arguments:\n" | ||
" self the component\n" | ||
" index the axis index\n" | ||
" label the axis label\n" | ||
" unit the axis unit" | ||
) | ||
.def_property_readonly( | ||
|
||
"index", | ||
&Component::index, | ||
"The axis index" | ||
) | ||
.def_property_readonly( | ||
|
||
"label", | ||
&Component::label, | ||
"The axis label" | ||
) | ||
.def_property_readonly( | ||
|
||
"unit", | ||
&Component::unit, | ||
"The unit index" | ||
); | ||
} | ||
|
||
} // namespace gpdc | ||
} // namespace v1_9 |