bts: Introduce a singleton for the BTS and use it in the code

Compared to the previous code there will be a branch to get the
global pointer so the code will be slightly slower than the previous
version but it allows us to start creating objects but still use
the code from C. It is best approach I have found so far.

One downside of C++ is that by default talloc will not be used
(unless we override the new operator to use talloc. Right now
we need to memset the C data structure by hand. The benefit of
enforcing a better structure should is more important though.
diff --git a/src/bts.h b/src/bts.h
index f17b3b7..9a5b570 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -31,6 +31,7 @@
 #include <stdint.h>
 
 struct gprs_rlcmac_tbf;
+struct BTS;
 
 /*
  * PDCH instance
@@ -54,7 +55,10 @@
 	struct gprs_rlcmac_tbf *dl_tbf[32]; /* array of DL TBF, by DL TFI */
 };
 
-
+/**
+ * This is the data from C. As soon as our minimal compiler is gcc 4.7
+ * we can start to compile pcu_vty.c with c++ and remove the split.
+ */
 struct gprs_rlcmac_bts {
 	uint8_t bsic;
 	uint8_t fc_interval;
@@ -80,4 +84,37 @@
 	uint32_t alloc_algorithm_curst; /* options to customize algorithm */
 	uint8_t force_two_phase;
 	uint8_t alpha, gamma;
+
+	/**
+	 * Point back to the C++ object. This is used during the transition
+	 * period.
+	 */
+	struct BTS *bts;
 };
+
+#ifdef __cplusplus
+/**
+ * I represent a GSM BTS. I have one or more TRX, I know the current
+ * GSM time and I have controllers that help with allocating resources
+ * on my TRXs.
+ */
+struct BTS {
+public:
+	BTS();
+
+	static BTS* main_bts();
+
+	struct gprs_rlcmac_bts *bts_data();
+
+private:
+	struct gprs_rlcmac_bts m_bts;
+};
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+	struct gprs_rlcmac_bts *bts_main_data();
+#ifdef __cplusplus
+}
+#endif