Ejemplo n.º 1
0
void PySource::do_export() {

    PyEntityWithMetadata<base::ISource>::do_export("Source");

    class_<Source, bases<base::EntityWithMetadata<base::ISource>>>("Source")
        // Source
        .def("create_source", &Source::createSource)
        .def("_source_count", &Source::sourceCount)
        .def("_has_source_by_id", CHECKER(std::string, Source, hasSource))
        .def("_get_source_by_id", getSourceById)
        .def("_get_source_by_pos", getSourceByPos)
        .def("_delete_source_by_id", REMOVER(std::string, Source, deleteSource))
        // Inverse search
        .add_property("referring_data_arrays", &Source::referringDataArrays)
        .add_property("referring_tags", &Source::referringTags)
        .add_property("referring_multi_tags", &Source::referringMultiTags)
        // Other
        .def("__str__", &toStr<Source>)
        .def("__repr__", &toStr<Source>)
        ;

    to_python_converter<std::vector<Source>, vector_transmogrify<Source>>();
    to_python_converter<boost::optional<Source>, option_transmogrify<Source>>();
    option_transmogrify<Source>::register_from_python();
}
Ejemplo n.º 2
0
void PyMultiTag::do_export() {

    PyEntityWithSources<base::IMultiTag>::do_export("MultiTag");

    class_<MultiTag, bases<base::EntityWithSources<base::IMultiTag>>>("MultiTag")

        .add_property("positions",
                      GETTER(DataArray, MultiTag, positions),
                      REF_SETTER(DataArray, MultiTag, positions),
                      doc::multi_tag_positions)
        .add_property("extents",
                      getExtents,
                      setExtents,
                      doc::multi_tag_extents)
        .add_property("units",
                      GETTER(std::vector<std::string>, MultiTag, units),
                      setUnits,
                      doc::multi_tag_units)

        // References
        .def("_add_reference_by_id", REF_SETTER(std::string, MultiTag, addReference))
        .def("_has_reference_by_id", CHECKER(std::string, MultiTag, hasReference))
        .def("_reference_count", &MultiTag::referenceCount)
        .def("_get_reference_by_id", &getReferenceById)
        .def("_get_reference_by_pos", &getReferenceByPos)
        .def("_delete_reference_by_id", REMOVER(std::string, MultiTag, removeReference))

        // Features
        .def("create_feature", &createNewFeature, doc::multi_tag_create_feature)
        .def("_has_feature_by_id", CHECKER(std::string, MultiTag, hasFeature))
        .def("_feature_count", &MultiTag::featureCount)
        .def("_get_feature_by_id", &getFeatureById)
        .def("_get_feature_by_pos", &getFeatureByPos)
        .def("_delete_feature_by_id", REMOVER(std::string, MultiTag, deleteFeature))

        // Other
        .def("__str__", &toStr<MultiTag>)
        .def("__repr__", &toStr<MultiTag>)
        ;

    to_python_converter<std::vector<MultiTag>, vector_transmogrify<MultiTag>>();
    to_python_converter<boost::optional<MultiTag>, option_transmogrify<MultiTag>>();
}
Ejemplo n.º 3
0
void PyBlock::do_export() {
    PyEntityWithMetadata<base::IBlock>::do_export("Block");

    class_<Block, bases<base::EntityWithMetadata<base::IBlock>>>("Block")
        // DataArray
        .def("_create_data_array", createDataArray)
        .def("_data_array_count", &Block::dataArrayCount)
        .def("_get_data_array_by_id", &getDataArrayById)
        .def("_get_data_array_by_pos", &getDataArrayByPos)
        .def("_delete_data_array_by_id", REMOVER(std::string, nix::Block, deleteDataArray))
        // MultiTag
        .def("create_multi_tag", &Block::createMultiTag, doc::block_create_multi_tag)
        .def("_multi_tag_count", &Block::multiTagCount)
        .def("_get_multi_tag_by_id", &getMultiTagById)
        .def("_get_multi_tag_by_pos", &getMultiTagByPos)
        .def("_delete_multi_tag_by_id", REMOVER(std::string, nix::Block, deleteMultiTag))
        // Tag
        .def("create_tag", &Block::createTag, doc::block_create_tag)
        .def("_tag_count", &Block::tagCount)
        .def("_get_tag_by_id", &getTagById)
        .def("_get_tag_by_pos", &getTagByPos)
        .def("_delete_tag_by_id", REMOVER(std::string, nix::Block, deleteTag))
        // Source
        .def("create_source", &Block::createSource, doc::block_create_source)
        .def("_source_count", &Block::sourceCount)
        .def("_get_source_by_id", &getSourceById)
        .def("_get_source_by_pos", &getSourceByPos)
        .def("_delete_source_by_id", REMOVER(std::string, nix::Block, deleteSource))
        // Group
        .def("create_group", &Block::createGroup, doc::block_create_group)
        .def("_group_count", &Block::groupCount)
        .def("_get_group_by_id", &getGroupById)
        .def("_get_group_by_pos", &getGroupByPos)
        .def("_delete_group_by_id", REMOVER(std::string, nix::Block, deleteGroup))
        // Other
        .def("__str__", &toStr<Block>)
        .def("__repr__", &toStr<Block>)
        ;

    to_python_converter<std::vector<Block>, vector_transmogrify<Block>>();
    to_python_converter<boost::optional<Block>, option_transmogrify<Block>>();
}