Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

closing GPSDClient #35

Open
JordanMcManus opened this issue Sep 16, 2020 · 1 comment
Open

closing GPSDClient #35

JordanMcManus opened this issue Sep 16, 2020 · 1 comment

Comments

@JordanMcManus
Copy link

In the client.cpp source file for gpsd_client we see this:

void stop() {
      // gpsmm doesn't have a close method? OK ...
    }

The documentation for libgpsmm reads

libgpsmm is a mere wrapper over libgps. Method names are the same as
the analogue C functions. For a detailed description of the functions
please read libgps(3). open() must be called after class constructor
and before any other method (open() is not inside the constructor since
it may fail, however constructors have no return value). The analogue
of the C function gps_close() is in the destructor.

Do you think that simply delete the gps pointer can solve this or is too naive?

void stop() {
      delete gps;
    }
@danthony06
Copy link
Collaborator

I'd have to look a little more closely, but I think I'd prefer to make it a smart pointer so that it automatically goes out of scope and is destroyed when main class is destroyed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants