Skip to content

Commit

Permalink
adding more doc strings
Browse files Browse the repository at this point in the history
  • Loading branch information
laroque committed Jan 14, 2020
1 parent efc30a4 commit 9bbe599
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 41 deletions.
4 changes: 2 additions & 2 deletions module_bindings/dripline_core/message_pybind.hh
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ namespace dripline_pybind
{return a_req->reply( a_return_code, a_return_message, a_payload.clone() );},
pybind11::arg( "return_code" ) = 0,
pybind11::arg( "return_message" ) = "",
pybind11::arg_v( "payload", scarab::param(), "scarab::param()" )
pybind11::arg_v( "payload", scarab::param(), "scarab::param()" ),
"construct and send a reply message in response to this request"
)
;
Expand Down Expand Up @@ -198,7 +198,7 @@ namespace dripline_pybind
pybind11::arg( "return_code" ) = 0,
pybind11::arg( "return_message" ) = "",
pybind11::arg( "payload" ) = scarab::param(),
pybind11::arg( "msg_request" ) = dripline::message::encoding::json
pybind11::arg( "msg_request" ) = dripline::message::encoding::json,
"create and populate a new MsgReply instance"
)
;
Expand Down
35 changes: 12 additions & 23 deletions module_bindings/dripline_core/service_pybind.hh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include "pybind11/stl.h"
#include "pybind11/iostream.h"


#include "binding_helpers.hh"
#include "service_trampoline.hh"

namespace dripline_pybind
Expand All @@ -17,14 +19,12 @@ namespace dripline_pybind
std::list< std::string > all_items;
all_items.push_back( "Service" );
pybind11::class_< _service,
//dripline::service,
_service_trampoline,
dripline::core,
dripline::endpoint,
dripline::scheduler<>,
scarab::cancelable,
std::shared_ptr< _service >
//std::shared_ptr< dripline::service >
>( mod, "Service", "responsible for dripline-compliant AMQP message sending and receiving" )
.def( pybind11::init< const scarab::param_node&,
const std::string&,
Expand All @@ -33,7 +33,7 @@ namespace dripline_pybind
const std::string&,
const bool
>(),
pybind11::call_guard< pybind11::scoped_ostream_redirect, pybind11::scoped_estream_redirect >(),
DL_BIND_CALL_GUARD_STREAMS,
pybind11::arg_v( "config", scarab::param_node(), "ParamNode()"),
pybind11::arg( "name" ) = "",
pybind11::arg( "broker" ) = "",
Expand All @@ -47,31 +47,20 @@ namespace dripline_pybind
.def_property_readonly( "alerts_exchange", (std::string& (dripline::service::*)()) &dripline::service::alerts_exchange )
.def_property_readonly( "requests_exchange", (std::string& (dripline::service::*)()) &dripline::service::requests_exchange )

.def( "bind_keys", &_service::bind_keys )
.def( "bind_keys", &_service::bind_keys, "overridable method to create all desired key bindings, overrides should still call this version")
.def( "bind_key",
// Note, need to take a service pointer so that we can accept derived types... I think
[](_service* an_obj, std::string& an_exchange, std::string& a_key){return _service::bind_key(an_obj->channel(), an_exchange, an_obj->name(), a_key);},
pybind11::arg( "exchange" ),
pybind11::arg( "key" )
pybind11::arg( "key" ),
"bind the service's message queue to a particular exchange and key"
)
.def( "start", &dripline::service::start,
pybind11::call_guard< pybind11::scoped_ostream_redirect,
pybind11::scoped_estream_redirect,
pybind11::gil_scoped_release >() )
.def( "listen", &dripline::service::listen,
pybind11::call_guard< pybind11::scoped_ostream_redirect,
pybind11::scoped_estream_redirect,
pybind11::gil_scoped_release >() )
.def( "stop", &dripline::service::stop,
pybind11::call_guard< pybind11::scoped_ostream_redirect,
pybind11::scoped_estream_redirect >() )
.def( "add_child", &dripline::service::add_child,
pybind11::call_guard< pybind11::scoped_ostream_redirect,
pybind11::scoped_estream_redirect >() )
.def( "add_async_child", &dripline::service::add_async_child,
pybind11::call_guard< pybind11::scoped_ostream_redirect,
pybind11::scoped_estream_redirect >() )
.def( "noisy_func", []() { pybind11::scoped_ostream_redirect stream(std::cout, pybind11::module::import("sys").attr("stdout"));})
.def( "start", &dripline::service::start, DL_BIND_CALL_GUARD_STREAMS_AND_GIL )
.def( "listen", &dripline::service::listen, DL_BIND_CALL_GUARD_STREAMS_AND_GIL )
.def( "stop", &dripline::service::stop, DL_BIND_CALL_GUARD_STREAMS )
.def( "add_child", &dripline::service::add_child, DL_BIND_CALL_GUARD_STREAMS )
.def( "add_async_child", &dripline::service::add_async_child, DL_BIND_CALL_GUARD_STREAMS )
//.def( "noisy_func", []() { pybind11::scoped_ostream_redirect stream(std::cout, pybind11::module::import("sys").attr("stdout"));})

.def( "on_alert_message", &_service::on_alert_message )
;
Expand Down
1 change: 1 addition & 0 deletions module_bindings/dripline_core/service_trampoline.hh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

namespace dripline_pybind
{
// we need an extra class so that we can make private/protected methods public for binding
class _service : public dripline::service
{
public:
Expand Down
10 changes: 5 additions & 5 deletions module_bindings/dripline_core/specifier_pybind.hh
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ namespace dripline_pybind
{
std::list< std::string > all_items;
all_items.push_back( "Specifier" );
pybind11::class_< dripline::specifier, std::shared_ptr< dripline::specifier > >( mod, "Specifier",
"All routing key content after the first '.' delimiter" )
pybind11::class_< dripline::specifier, std::shared_ptr< dripline::specifier >
>( mod, "Specifier", "All routing key content after the first '.' delimiter" )
.def( pybind11::init< const std::string& >(),
pybind11::arg( "unparsed" ) = "")
.def( "parse", &dripline::specifier::parse )
.def( "reparse", &dripline::specifier::reparse )
.def( "to_string", &dripline::specifier::to_string )
.def( "parse", &dripline::specifier::parse, "parses the specifier and populates internal attributes" )
.def( "reparse", &dripline::specifier::reparse, "reparses and updates internal attributes" )
.def( "to_string", &dripline::specifier::to_string, "converts the routing key elements into a single, bindable, string" )
;
return all_items;
}
Expand Down
11 changes: 0 additions & 11 deletions module_bindings/dripline_core/version_store_pybind.hh
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,6 @@ namespace dripline_pybind
pybind11::arg( "version" ),
"add a scarab.SemanticVersion (version) to the dripline version_store singleton"
);
/*
pybind11::class_< dripline::version_store >( mod, "VersionStore", "Data structure for collection of versions")
//.def( pybind11::init<>() )
.def_static( "get_instance", &dripline::version_store::get_instance)
.def( "add_version",
(void (dripline::version_store::*)(const std::string&, scarab::version_semantic_ptr_t)) &dripline::version_store::add_version,
pybind11::arg( "name" ),
pybind11::arg( "version" ),
"Add a version entry to the store")
;
*/
return all_members;
}
} /* namespace dripline_pybind */
Expand Down

0 comments on commit 9bbe599

Please sign in to comment.