X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=bindings%2Fcxx%2Fclasses.cpp;h=525e046ddcc168fad28e599345bef3c9e7d53ac7;hb=90e89c2a42ec085658f6c99656195ee4866e34c8;hp=dcbf80217f1b3307b92ffa7c9669b077aeba5cf7;hpb=541c855e1d05a007e996f52639698a7d3881c957;p=libsigrok.git diff --git a/bindings/cxx/classes.cpp b/bindings/cxx/classes.cpp index dcbf8021..525e046d 100644 --- a/bindings/cxx/classes.cpp +++ b/bindings/cxx/classes.cpp @@ -71,9 +71,11 @@ shared_ptr Context::create() } Context::Context() : + UserOwned(structure), session(NULL) { check(sr_init(&structure)); + struct sr_dev_driver **driver_list = sr_driver_list(); if (driver_list) for (int i = 0; driver_list[i]; i++) @@ -533,7 +535,8 @@ vector> ChannelGroup::get_channels() } Trigger::Trigger(shared_ptr context, string name) : - structure(sr_trigger_new(name.c_str())), context(context) + UserOwned(sr_trigger_new(name.c_str())), + context(context) { for (auto stage = structure->stages; stage; stage = stage->next) stages.push_back(new TriggerStage((struct sr_trigger_stage *) stage->data)); @@ -690,6 +693,7 @@ EventSource::~EventSource() } Session::Session(shared_ptr context) : + UserOwned(structure), context(context), saving(false) { check(sr_session_new(&structure)); @@ -697,6 +701,7 @@ Session::Session(shared_ptr context) : } Session::Session(shared_ptr context, string filename) : + UserOwned(structure), context(context), saving(false) { check(sr_session_load(filename.c_str(), &structure)); @@ -936,7 +941,7 @@ void Session::set_trigger(shared_ptr trigger) Packet::Packet(shared_ptr device, const struct sr_datafeed_packet *structure) : - structure(structure), + UserOwned(structure), device(device) { switch (structure->type) @@ -1168,7 +1173,7 @@ shared_ptr InputFormat::create_input( } Input::Input(shared_ptr context, const struct sr_input *structure) : - structure(structure), + UserOwned(structure), context(context), device(nullptr) { @@ -1221,7 +1226,7 @@ shared_ptr InputDevice::get_shared_from_this() Option::Option(const struct sr_option *structure, shared_ptr structure_array) : - structure(structure), + UserOwned(structure), structure_array(structure_array) { } @@ -1299,7 +1304,7 @@ shared_ptr OutputFormat::create_output( Output::Output(shared_ptr format, shared_ptr device, map options) : - structure(sr_output_new(format->structure, + UserOwned(sr_output_new(format->structure, map_to_hash_variant(options), device->structure)), format(format), device(device), options(options) {