There are some .h and .cpp files in the Arduino IDE 1.6.0 that you may find helpful. Go to the folder Arduino-1.6.0+Intel/hardware/i586-uclibc/variants/galileo_fab_g/ in there you’ll find pins_arduino.h, variant.cpp, variant.h. These files are the ones in charge of the control of the muxes and set up the GPIOs and are written in C++. You can use these files as a guide to write your own gpio class or you can use them as long as you import all the dependencies required, but you may need to make some adjustments to make them work. I hope you find this helpful.