diff options
author | Simon Dawson <spdawson@gmail.com> | 2013-12-08 11:20:05 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2014-01-03 04:59:07 -0500 |
commit | 07646dda8bda112ef5ffb8425679f7bdb7f23d47 (patch) | |
tree | 6dd3d001e9505ef51860c3e0d728bfab992c0eed /libgpsmm.cpp | |
parent | c31095e1562494a74d56b46fcc01541d1444cd5c (diff) | |
download | gpsd-07646dda8bda112ef5ffb8425679f7bdb7f23d47.tar.gz |
libgpsmm: add is_open method
The gpsmm constructor effectively hides the useful status flag returned
by the underlying gps_open call.
It is extremely useful for client code to be able to check that the
gpsmm constructor was successful. To this end, add a gpsmm::is_open method
which simply checks that the gpsmm::to_user member is non-NULL. A NULL
gpsmm::to_user member can only mean that the constructor was not successful.
Signed-off-by: Simon Dawson <spdawson@gmail.com>
Signed-off-by: Eric S. Raymond <esr@thyrsus.com>
Diffstat (limited to 'libgpsmm.cpp')
-rw-r--r-- | libgpsmm.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libgpsmm.cpp b/libgpsmm.cpp index fa421aa3..2707e44a 100644 --- a/libgpsmm.cpp +++ b/libgpsmm.cpp @@ -83,6 +83,11 @@ void gpsmm::enable_debug(int level, FILE *fp) #endif /* CLIENTDEBUG_ENABLE */ } +bool gpsmm::is_open(void) +{ + return to_user != NULL; +} + gpsmm::~gpsmm() { if ( to_user != NULL ) { |