From: Martin Ling Date: Sun, 12 Oct 2014 16:53:10 +0000 (+0100) Subject: bindings: Add Session::filename() and corresponding SWIG attribute. X-Git-Tag: libsigrok-0.4.0~857 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=1411f7d8e9fa5d90d8140fc51eb44562dd626b7c;p=libsigrok.git bindings: Add Session::filename() and corresponding SWIG attribute. --- diff --git a/bindings/cxx/classes.cpp b/bindings/cxx/classes.cpp index 9bce464c..1747bdff 100644 --- a/bindings/cxx/classes.cpp +++ b/bindings/cxx/classes.cpp @@ -1071,6 +1071,11 @@ void Session::set_trigger(shared_ptr trigger) _trigger = trigger; } +string Session::filename() +{ + return _filename; +} + Packet::Packet(shared_ptr device, const struct sr_datafeed_packet *structure) : UserOwned(structure), diff --git a/bindings/cxx/include/libsigrok/libsigrok.hpp b/bindings/cxx/include/libsigrok/libsigrok.hpp index 1936d4d5..3e49bd59 100644 --- a/bindings/cxx/include/libsigrok/libsigrok.hpp +++ b/bindings/cxx/include/libsigrok/libsigrok.hpp @@ -672,6 +672,8 @@ public: /** Set trigger setting. * @param trigger Trigger object to use. */ void set_trigger(shared_ptr trigger); + /** Get filename this session was loaded from. */ + string filename(); protected: Session(shared_ptr context); Session(shared_ptr context, string filename); diff --git a/bindings/swig/classes.i b/bindings/swig/classes.i index f4ee3ec4..b688a857 100644 --- a/bindings/swig/classes.i +++ b/bindings/swig/classes.i @@ -257,6 +257,8 @@ typedef std::map %attributestring(sigrok::Session, std::shared_ptr, trigger, trigger, set_trigger); +%attributestring(sigrok::Session, std::string, filename, filename); + %attribute(sigrok::Packet, const sigrok::PacketType *, type, type); %attributestring(sigrok::Packet,