This is the first of a series of articles.
As I'm always experimenting and tuning my setup, I'm not sure how many more articles I'll be writing.

A few years ago I began to introduce myself to astrophotography.
I had some fairly nice equipment back then: a SkyWatcher HEQ5 mount, a Meade ACF 8", guide scope and camera, a borrowed reflex, laptop, 12v car battery.

Although this is pretty much entry level equipment, barely sufficient to getting started, it had been already quite expensive (almost 2000€ just for scope and mount, even though the scope was second hand), bulky and heavy. I ended up barely using it, both because of a relatively steep learning curve and because I honestly was getting tired of carrying around 20/30KG of equipment with barely any tangible result.

Then a few things happened: the mount was stolen, I sold the optical tube, and ended up moving to London, where I embraced a new "astronomical philosophy": the lighter, the better.

A very convenient tecnique in c++ programming is the one known with many names: "d-pointer" (found in Qt/KDE contexts), shadow pointer, "pimpl", opaque pointer.
Basically the idea is to hide all the private details of a class in a forward declared private pointer, which will be the only real private member of the class.
Since this member will never change, this will guarantee binary compatibility among different versions of a library.

But there are other advantages in using d-pointers: one is compilation speedup during development (usually if you change a private member of a class, the header changes, and you have to recomplile all units using that header, while with d-pointer you change only the .cpp file), and another is code cleanup: you will have very compact header files, describing your class public interface without private stuff pollution.
Also, sometimes you may want to add your d-pointer definition in a separate header file, ending up with three well defined files:

myclass.h: class declaration, only public stuff, without private stuff

The classical approach is to create a plain raw pointer to a forward declared class, initialize it in the constructor, and delete it on the destructor.
A nice addition is to have the private class be a nested type, so that you can avoid polluting your IDE class list.

It’s been a long time since I last wrote about SkyPlanner development, but I still kept working on it, enabling lots of new features.
The Telescopes page has been redesigned to include also eyepieces and barlow/focal reduces, and therefore has also been renamed to “Optical Instruments” in your settings menu.

Instruments Page

Adding at least a telescope and an eyepiece will show a new panel in the session pages, with all possible combinations, calculating magnification and field of view.
It will also add a new menu when clicking on a DSS preview image, that will show you field of view circles overlay.

<figcaption>Field of View Menu</figcaption>
</figure>

<figcaption>Field of View Overlay</figcaption>
</figure>

Filters have been heavly improved. We have now lots of new filters, and the existing ones were redesigned to offer a better experience.

Now you can filter by object type, by magnitude, time of transit, altitude, constellation, previously observed objects, angular size, catalogue. Filters are available both in the main objects list and in the “Suggested Objects” panel, allowing you to fine tune SkyPlanner suggestions for planning your stargazing night.

The “Suggested Objects” list can now be sorted also by magnitude and time.

A new interesting feature is the post-session report: when reviewing a past session, you can mark as observer each object in your list.

After doing so, a “report” button will appear for that object, allowing you to write an extended description of your observation.

Finally, clicking the “Report” button on the top toolbar will display your report almost ready to be printed. You may wish to click the “Write report” button to write some notes about the whole session, instead of single objects.

Additionally, you can share your report. By default this is disabled, but clicking the “Share” button will make it publicly available.

You can share it with a few options: first, a web address, that you can embedd on your blog/website, or send via email. But you can also one of the predefined buttons for social sharing, on Google+, Facebook, Twitter.

But sharing is now enabled also for the regular session planning: in the “preview with images” section of a planned session you’ll see the same “Share” button.

Lastly, there were a few additions to the objects catalogues, most notably the Barnard catalogue of dark objects.

and so on, which is kinda boring when you have to call lots of API functions in one method.

I have been trying to write some kind of wrapper that can help making this a bit easier.
In a real life example, I’ve been trying to use gphoto2 api in a c++11 application.
Using c++11 lambdas and RAII this is what I’ve been able to do:

I can then declare some variables in the first part of the method, and inside the “gp_api” block i can execute a sequence of operation, each one returning an int value. This value is automatically checked for an error, and if it it’s a success exit code, the next sequence block is executed.
run_last is finally executed if all steps are completed successfully. An optional mutex locker (QMutexLocker) is passed to the gp_api block as the last constructor argument, to automatically lock the c api for multithreading.

The sequence class accepts a list of runs as construction parameters. These are stored as a class field, and sequentially executed at class destruction.
Sequence is a template class: you can define the return value type, the success value, a comparison operator to check each function result code against the success value, and finally a generic RAII_Object, which can be as previously told a mutex locker, or some other kind of resource to unlock after API executions.

The define directive at the end of the code is used to automatically create a run object which already contains a description of the code being executed (stringified).
You get this description in the on_error callback.

Near my gphoto class I also added a typedef to conveniently call the proper sequence template class with correct template parameters:

Which means that gp_api accepts code blocks returning int values, that the “ok” value is GP_OK (0), and that the returned value must be equal or greater than GP_OK to be considered a success run.
It also accepts a QMutexLocker shared pointer for thread locking.
As you can see in my first example I didn’t assign the gp_api object to any variable; this means that it is immediatly created, executed and destructed, for synchronous run.