Commit Graph

141 Commits

Author SHA1 Message Date
Uwe Hermann 8141a0325c Rename sr_driver_scan_options() to sr_driver_scan_options_list(). 2015-12-31 19:04:34 +01:00
Uwe Hermann 0c697a4b33 Rename sr_dev_config_capabilities() to sr_dev_config_capabilities_list(). 2015-12-31 19:04:28 +01:00
Martin Ling 36bb818d6f bindings: New configuration enumeration API.
The new methods wrap the new libsigrok C API helper functions and eliminate
the need to pass complex types back to the user and wrap them with SWIG.

Fixes bugs #479 and #480.
2015-12-31 19:00:16 +01:00
Martin Ling 12f2f640cb bindings: Wrap enum sr_configcap as Capability class. 2015-12-31 18:27:56 +01:00
Stefan Brüns 7cccc9155c bindings/cxx: make sure the config value reference is kept
fixes glib warning:
GLib-CRITICAL **: g_variant_unref: assertion 'value->ref_count > 0' failed
2015-12-04 23:18:14 +01:00
Marcus Comstedt 8eb4299c5b bindings: Fix doc extraction for enums
The source file enum.hpp was not found when not building in the source
tree.  Also, extraction of the brief description did not work correctly
when there was additional XML markup inside the <para> element.
2015-12-03 22:01:21 +01:00
Daniel Elstner 014512254a C++: Declare std::default_delete friend as struct
std::default_delete<> is originally defined as struct, not class.
This does not really make much of a difference, but some compilers
complain when the struct/class tag is not consistent across all
declarations of the type.
2015-10-30 15:09:40 +01:00
Daniel Elstner cea8c3124f C++: Suppress deprecation warnings from glibmm
Ignore warnings due to use of std::auto_ptr<> in the glibmm headers.
This should be reverted once glibmm is fixed.
2015-10-30 12:51:16 +01:00
Martin Ling 4aa9a1e569 C++: Catch exceptions from stoi() and stod().
Fixes bug #483.
2015-10-26 07:17:50 +01:00
Martin Ling f2831ab35b java: Usable wrapping of Configurable.config_keys(). 2015-10-26 07:17:01 +01:00
Martin Ling 8fb7efe203 java: Add docstrings for enum constants. 2015-10-26 07:17:01 +01:00
Martin Ling 0bcdeb90c4 C++: Include enum classes when generating documentation. 2015-10-26 07:17:01 +01:00
Martin Ling ace872d529 C++: Declare namespace in enums.hpp so it can be used independently. 2015-10-26 07:17:01 +01:00
Martin Ling e5c22906e8 java: Make enum values available as normal constants. 2015-10-26 07:17:01 +01:00
Daniel Elstner 9e7176bd00 C++: Avoid const ref args to appease Java bindings
The Java bindings currently have some weird problem with function
arguments passed by const reference. Not all types are affected,
but the collection types that involve custom typemaps are.

For now, revert back to pass-by-value for the problematic types.
2015-10-26 07:04:10 +01:00
Daniel Elstner bf03d63565 C++: Use C++98 syntax for default arguments to appease SWIG
Looks like SWIG silently ignores default arguments specified via
aggregate initialization. This is rather unfortunate, especially
if the argument types are complex.
2015-10-26 06:45:56 +01:00
Daniel Elstner a98729a742 C++: Replace custom deleters with std::default_delete
Replace custom Deleter classes with std::default_delete<>, declared
as friend so it can invoke the private destructor. Inexplicably,
std::shared_ptr<> does not use default_delete<> by default, so it
is still necessary to explicitly specify the deleter when creating
shared_ptr instances.

With this, unique_ptr and shared_ptr instances now use the same
default delete mechanism.
2015-10-26 06:45:56 +01:00
Daniel Elstner f17b454655 C++: Use smart pointers instead of manual delete
Make use of std::unique_ptr<> to manage the lifetime of members
or container elements, so that manual invocations of delete can
be avoided. This also provides for exception safety.

Since std::unique_ptr<> is only movable but not copyable, adapt
the code to avoid copies and assignments of these pointers.
2015-10-26 06:45:56 +01:00
Daniel Elstner d5d7b09eb7 C++: Move C struct pointers out of ownership classes
Reduce needless over-generalization. There is no design need
for the ParentOwned and UserOwned classes to contain the C base
struct pointer. Instead, just make the _structure pointer a
private member of each class that needs one.
2015-10-26 06:45:56 +01:00
Daniel Elstner b6ab954d67 C++: Rename get_shared_pointer() to share_owned_by()
This makes it clearer that this method assigns the parent
(owner) reference.
2015-10-26 06:45:56 +01:00
Daniel Elstner 67b82fc9c9 C++: Use shared_from_this() exclusively on this
Never call shared_from_this() on any object other than "this".
Adapt the API so that it can be made protected.
2015-10-26 06:45:56 +01:00
Daniel Elstner 21d1bec60e C++: Make most members private instead of protected
Use protected only for members which are actually needed by
sub-classes. Declare all the rest private.
2015-10-26 06:45:56 +01:00
Daniel Elstner 15bebf575d C++: Make value get accessors const
Declare accessor methods that return value members const. For now,
skip all cases where constness would have to be applied transitively
to shared objects.
2015-10-26 06:45:56 +01:00
Daniel Elstner a73d492636 C++: Make some methods static to match the C API
Context::package_version() and Context::lib_version() do not access
context state and should be static. However, leave the logging
related methods alone for now, as making them static would entail
making the callback data a global static, since the C API lacks
destroy notification callbacks.
2015-10-26 06:45:56 +01:00
Daniel Elstner 0ab8e5d22b C++: Declare all callbacks invoked from C noexcept
If one of these functions does throw an exception, std::terminate()
will be called. Without this, the behavior is undefined since the C
stack is not prepared to deal with exceptions.
2015-10-26 06:45:56 +01:00
Daniel Elstner 15914cdb0f C++: Use noexcept instead of throw()
Runtime-checked exception specifications via throw() are
deprecated in C++11.
2015-10-26 06:45:56 +01:00
Daniel Elstner 6c11b49607 C++: Make most constructors explicit
Unless implicit conversion is desired, constructors that can be
called with one argument should be marked as "explicit".
2015-10-26 06:45:56 +01:00
Daniel Elstner ce3e1e6132 C++: Do not use C-style casts
Never ever.
2015-10-26 06:45:56 +01:00
Daniel Elstner 58e21229dd C++: Consistently use nullptr instead of NULL 2015-10-26 04:06:12 +01:00
Daniel Elstner d370545d60 C++: Use move() and avoid passing containers by value
Make use of std::move() to transfer arguments passed in by value.
Take complex container arguments by const reference, as passing
those by value is rather unorthodox even for C++11 style code.
2015-10-26 04:06:12 +01:00
Uwe Hermann dd13d47a9e bindings: Use SR_DF_ANALOG, drop SR_DF_ANALOG_OLD support.
All SR_DF_ANALOG_OLD packets are automatically converted to SR_DF_ANALOG
in the session already.
2015-10-21 00:29:29 +02:00
Uwe Hermann 5faebab290 SR_DF_ANALOG_OLD and sr_datafeed_analog_old renames.
Rename SR_DF_ANALOG to SR_DF_ANALOG_OLD, and 'struct sr_datafeed_analog'
to 'struct sr_datafeed_analog_old'.
2015-10-20 23:32:45 +02:00
Daniel Elstner ee9953ef12 session: Make event source injection API private
Also remove the corresponding functionality from the bindings.
2015-10-17 17:40:42 +02:00
Daniel Elstner f91cf612df C++: Add bindings for session stop notification 2015-10-17 17:40:42 +02:00
Daniel Elstner 7f4d69305b C++: Remove leftover Context::begin_save() method 2015-10-04 22:11:39 +02:00
Daniel Elstner e2eaf8580a C++: Wrap resource access API
Introduce a ResourceReader delegate class with virtual methods
corresponding to the C callback functions.
2015-10-01 15:44:55 +02:00
Daniel Elstner 5e1fb33469 session-file: Remove old session save API
Completely remove the old session save code that has been
superseded by the srzip output module. Also refactor a bit,
plug a number of leaks and tighten the error checking.
2015-10-01 15:44:55 +02:00
Daniel Elstner 000f504f24 classes.cpp: Define _XOPEN_SOURCE for isascii()
The GNU libstdc++ headers use isascii(), which is not part of any
POSIX standard. On BSD, this breaks the build. It is however part
of XOPEN, which on Linux is apparently enabled implicitly for C++.

This should fix #649.
2015-09-13 20:12:12 +02:00
Daniel Elstner 6ec6c43b47 Build: Include <config.h> first in all source files
Since Autoconf places some important feature flags only into the
configuration header, it is necessary to include it globally to
guarantee a consistent build.
2015-09-13 18:54:46 +02:00
Daniel Elstner 782b16447b log: Remove sr_log_logdomain_{get,set} from the API
The confusingly named sr_log_logdomain_set() simply set a global
string prefixed to the log message by the default log callback.
This is pretty much useless, misleadingly named, and not used by
either sigrok-cli or PulseView.
2015-09-13 12:08:54 +02:00
Bert Vermeulen 2fb60e2329 Replace sr_config_info with sr_key_info.
The tables defined with this struct can now be used for information
on items other than config keys.

Functions to access these tables have been renamed sr_key_info_[name_]get.
These take an extra argument, keytype, which should be set to SR_KEY_CONFIG
to get the config key tables. Other key types will be added.
2015-08-26 01:08:42 +02:00
Daniel Elstner bc81463bb8 enums.py: Place swig/enums.i into build directory 2015-08-16 18:28:13 +02:00
Daniel Elstner b5f0731971 Build: Use angle brackets for enums.cpp include 2015-08-16 18:28:13 +02:00
Daniel Elstner 8b2a184327 Build: Prefix directory to include of enums.hpp
This fixes a build problem due to the reduced include search paths
introduced by my recent changes.  Also fix a couple of other
includes to use angle brackets.
2015-08-16 18:28:13 +02:00
Daniel Elstner b9eb8e1a8c Consistently use SR_PACKAGE_VERSION instead of VERSION 2015-08-16 18:28:13 +02:00
Soeren Apel 3cd4b38174 Introduce OutputFlag 2015-08-15 23:53:12 +02:00
Soeren Apel 81b3ce374c Add filename field to sr_output and make it accessible
This fixes parts of bug #570.
2015-07-30 19:21:42 +02:00
Martin Ling 2b51d48b38 C++: Change arguments of Input::send() from std::string to data+length. 2015-04-20 10:12:39 +01:00
Uwe Hermann 032da34b78 sr_driver_list() now takes a context pointer.
This requires sr_hw_cleanup_all() and sanity_check_all_drivers()
to also take a context.

The (runtime) generation of the driver list now happens in sr_init()
and sr_driver_list() always returns that pre-generated list. This fixes
a segfault when (correctly) invoking multiple sr_init() and sr_exit()
calls with different contexts (caught by the unit tests).

This fixes bug #565.
2015-04-07 02:09:56 +02:00
Uwe Hermann c879dca3d7 bindings/cxx/classes.cpp: Fix sr_session_load() invocation. 2015-03-26 01:02:40 +01:00