Index: src/client/c/hu/varadiistvan/xplra/xplra.cc
===================================================================
--- src/client/c/hu/varadiistvan/xplra/xplra.cc	(revision 25)
+++ src/client/c/hu/varadiistvan/xplra/xplra.cc	(revision 27)
@@ -183,6 +183,7 @@
 
 /**
- * Information about a connection slot in the vector of connections.
+ * Template for handling slots.
  */
+template <class Value>
 struct Slot
 {
@@ -191,5 +192,5 @@
      * The slots.
      */
-    static std::vector<Slot> slots;
+    static std::vector< Slot<Value> > slots;
 
     /**
@@ -200,24 +201,29 @@
 public:
     /**
-     * Add a new connection.
-     */
-    static int addConnection(Connection* connection) throw();
-
-    /**
-     * Get the connection with the given ID.
-     */
-    static Connection* getConnection(int connectionID) throw();
-
-    /**
-     * Clear the connection with the given ID.
-     */
-    static void clearConnection(int connectionID) throw();
-
-    // Indicate if the slot contains a valid connection or not
+     * Add a new value.
+     *
+     * @return the ID of the new value
+     */
+    static int addValue(Value value) throw();
+
+    /**
+     * Get the value with the given ID.
+     */
+    static Value getValue(int valueID) throw();
+
+    /**
+     * Clear the value with the given ID.
+     */
+    static void clearValue(int valueID) throw();
+
+private:
+    /**
+     * Indicate if the slot contains a valid value or not.
+     */
     bool valid;
 
     union {
-        // The connection, if it is a valid connection
-        Connection* connection;
+        // The value, if the slot contains a value
+        Value value;
 
         // The index of the next free slot
@@ -226,21 +232,22 @@
 
     /**
-     * Construct a slot with the given connection
-     */
-    Slot(Connection* connection) throw();
-
-    /**
-     * Set the connection and return the former next free index. It
-     * should be called for a slot with no connection.
-     */
-    int setConnection(Connection* connection) throw();
-
-    /**
-     * Get the connection if this slot contains a connection.
-     */
-    Connection* getConnection() const throw();
-
-    /**
-     * Clear the connection and set the given next free index.
+     * Construct a slot with the given value
+     */
+    Slot(Value value) throw();
+
+    /**
+     * Set the value and return the former next free index. It
+     * should be called for a slot with no value.
+     */
+    int setValue(Value value) throw();
+
+    /**
+     * Get the value if this slot contains a value. Otherwise 0 is
+     * returned (converted to value).
+     */
+    Value getValue() const throw();
+
+    /**
+     * Clear the value and set the given next free index.
      */
     void clear(int nextFreeIndex) throw();
@@ -249,25 +256,27 @@
 //------------------------------------------------------------------------------
 
-vector<Slot> Slot::slots;
-
-//------------------------------------------------------------------------------
-
-int Slot::firstFree = -1;
-
-//------------------------------------------------------------------------------
-
-inline Slot::Slot(Connection* connection) throw() :
+template <class Value> vector< Slot<Value> > Slot<Value>::slots;
+
+//------------------------------------------------------------------------------
+
+template <class Value> int Slot<Value>::firstFree = -1;
+
+//------------------------------------------------------------------------------
+
+template <class Value>
+inline Slot<Value>::Slot(Value value) throw() :
     valid(true)
 {
-    this->connection = connection;
-}
-
-//------------------------------------------------------------------------------
-
-inline int Slot::setConnection(Connection* connection) throw()
+    this->value = value;
+}
+
+//------------------------------------------------------------------------------
+
+template <class Value>
+inline int Slot<Value>::setValue(Value value) throw()
 {
     assert(!valid);
     int nextFreeIndex = this->nextFreeIndex;
-    this->connection = connection;
+    this->value = value;
     valid = true;
     return nextFreeIndex;
@@ -276,12 +285,14 @@
 //------------------------------------------------------------------------------
 
-inline Connection* Slot::getConnection() const throw()
-{
-    return valid ? connection : 0;
-}
-
-//------------------------------------------------------------------------------
-
-inline void Slot::clear(int nextFreeIndex) throw()
+template <class Value>
+inline Value Slot<Value>::getValue() const throw()
+{
+    return valid ? value : static_cast<Value>(0);
+}
+
+//------------------------------------------------------------------------------
+
+template <class Value>
+inline void Slot<Value>::clear(int nextFreeIndex) throw()
 {
     assert(valid);
@@ -292,13 +303,14 @@
 //------------------------------------------------------------------------------
 
-int Slot::addConnection(Connection* connection) throw()
+template <class Value>
+int Slot<Value>::addValue(Value value) throw()
 {
     int id = firstFree;
     if (id<0) {
         id = slots.size();
-        slots.push_back(Slot(connection));
+        slots.push_back(Slot<Value>(value));
     } else {
         Slot& slot = slots[id];
-        firstFree = slot.setConnection(connection);
+        firstFree = slot.setValue(value);
     }
 
@@ -308,15 +320,18 @@
 //------------------------------------------------------------------------------
 
-Connection* Slot::getConnection(int connectionID) throw()
-{
-    size_t index = static_cast<size_t>(connectionID);
-    return (index<slots.size()) ? slots[index].getConnection() : 0;
-}
-
-//------------------------------------------------------------------------------
-
-void Slot::clearConnection(int connectionID) throw()
-{
-    size_t index = static_cast<size_t>(connectionID);
+template <class Value>
+Value Slot<Value>::getValue(int valueID) throw()
+{
+    size_t index = static_cast<size_t>(valueID);
+    return (index<slots.size()) ?
+        slots[index].getValue() : static_cast<Value>(0);
+}
+
+//------------------------------------------------------------------------------
+
+template <class Value>
+void Slot<Value>::clearValue(int valueID) throw()
+{
+    size_t index = static_cast<size_t>(valueID);
     if (index<slots.size()) {
         slots[index].clear(firstFree);
@@ -326,4 +341,12 @@
 
 //------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+/**
+ * Slot for connections.
+ */
+typedef Slot<Connection*> ConnectionSlot;
+
+//------------------------------------------------------------------------------
 
 } /* anonymous namespace */
@@ -333,5 +356,5 @@
 extern "C" int xplra_get_last_error(int connectionID, unsigned long* subCode)
 {
-    Connection* connection = Slot::getConnection(connectionID);
+    Connection* connection = ConnectionSlot::getValue(connectionID);
     return (connection==0) ? -1 : connection->getLastError(subCode);
 }
@@ -341,5 +364,5 @@
 extern "C" const char* xplra_get_last_error_string(int connectionID)
 {
-    Connection* connection = Slot::getConnection(connectionID);
+    Connection* connection = ConnectionSlot::getValue(connectionID);
     return (connection==0) ? 0 : connection->getLastErrorString();
 }
@@ -349,5 +372,5 @@
 extern "C" void xplra_clear_last_error(int connectionID)
 {
-    Connection* connection = Slot::getConnection(connectionID);
+    Connection* connection = ConnectionSlot::getValue(connectionID);
     if (connection!=0) connection->clearLastError();
 }
@@ -360,5 +383,5 @@
         auto_ptr<Connection> connection(new Connection());
         connection->connect();
-        return Slot::addConnection(connection.release());
+        return ConnectionSlot::addValue(connection.release());
     } catch(...) {
         return -1;
@@ -370,5 +393,5 @@
 extern "C" int xplra_get_int(int* value, int connectionID, const char* name)
 {
-    Connection* connection = Slot::getConnection(connectionID);
+    Connection* connection = ConnectionSlot::getValue(connectionID);
     if (connection==0) return -1;
     try {
@@ -385,5 +408,5 @@
 extern "C" int xplra_get_float(float* value, int connectionID, const char* name)
 {
-    Connection* connection = Slot::getConnection(connectionID);
+    Connection* connection = ConnectionSlot::getValue(connectionID);
     if (connection==0) return -1;
     try {
@@ -401,5 +424,5 @@
                                 int connectionID, const char* name)
 {
-    Connection* connection = Slot::getConnection(connectionID);
+    Connection* connection = ConnectionSlot::getValue(connectionID);
     if (connection==0) return -1;
     try {
@@ -417,5 +440,5 @@
                                          int connectionID, const char* name)
 {
-    Connection* connection = Slot::getConnection(connectionID);
+    Connection* connection = ConnectionSlot::getValue(connectionID);
     if (connection==0) return -1;
     try {
@@ -432,5 +455,5 @@
                                             int connectionID, const char* name)
 {
-    Connection* connection = Slot::getConnection(connectionID);
+    Connection* connection = ConnectionSlot::getValue(connectionID);
     if (connection==0) return 0;
     try {
@@ -447,5 +470,5 @@
                                        int connectionID, const char* name)
 {
-    Connection* connection = Slot::getConnection(connectionID);
+    Connection* connection = ConnectionSlot::getValue(connectionID);
     if (connection==0) return -1;
     try {
@@ -462,5 +485,5 @@
                                             int connectionID, const char* name)
 {
-    Connection* connection = Slot::getConnection(connectionID);
+    Connection* connection = ConnectionSlot::getValue(connectionID);
     if (connection==0) return 0;
     try {
@@ -477,5 +500,5 @@
                                         int connectionID, const char* name)
 {
-    Connection* connection = Slot::getConnection(connectionID);
+    Connection* connection = ConnectionSlot::getValue(connectionID);
     if (connection==0) return -1;
     try {
@@ -493,5 +516,5 @@
                                              int connectionID, const char* name)
 {
-    Connection* connection = Slot::getConnection(connectionID);
+    Connection* connection = ConnectionSlot::getValue(connectionID);
     if (connection==0) return 0;
     try {
@@ -507,5 +530,5 @@
 extern "C" int xplra_set_int(int connectionID, const char* name, int value)
 {
-    Connection* connection = Slot::getConnection(connectionID);
+    Connection* connection = ConnectionSlot::getValue(connectionID);
     if (connection==0) return 0;
     try {
@@ -522,5 +545,5 @@
 extern "C" int xplra_set_float(int connectionID, const char* name, float value)
 {
-    Connection* connection = Slot::getConnection(connectionID);
+    Connection* connection = ConnectionSlot::getValue(connectionID);
     if (connection==0) return 0;
     try {
@@ -538,5 +561,5 @@
                                 double value)
 {
-    Connection* connection = Slot::getConnection(connectionID);
+    Connection* connection = ConnectionSlot::getValue(connectionID);
     if (connection==0) return 0;
     try {
@@ -555,5 +578,5 @@
                                      size_t length, size_t offset)
 {
-    Connection* connection = Slot::getConnection(connectionID);
+    Connection* connection = ConnectionSlot::getValue(connectionID);
     if (connection==0) return 0;
     try {
@@ -572,5 +595,5 @@
                                    size_t length, size_t offset)
 {
-    Connection* connection = Slot::getConnection(connectionID);
+    Connection* connection = ConnectionSlot::getValue(connectionID);
     if (connection==0) return 0;
     try {
@@ -589,5 +612,5 @@
                                     size_t length, size_t offset)
 {
-    Connection* connection = Slot::getConnection(connectionID);
+    Connection* connection = ConnectionSlot::getValue(connectionID);
     if (connection==0) return 0;
     try {
@@ -607,5 +630,5 @@
                                 size_t length, size_t offset)
 {
-    Connection* connection = Slot::getConnection(connectionID);
+    Connection* connection = ConnectionSlot::getValue(connectionID);
     if (connection==0) return 0;
     try {
@@ -622,8 +645,8 @@
 extern "C" int xplra_disconnect(int connectionID)
 {
-    Connection* connection = Slot::getConnection(connectionID);
+    Connection* connection = ConnectionSlot::getValue(connectionID);
     if (connection==0) return -1;
 
-    Slot::clearConnection(connectionID);
+    ConnectionSlot::clearValue(connectionID);
     connection->disconnect();
     delete connection;
Index: src/client/c/hu/varadiistvan/xplra/xplra.h
===================================================================
--- src/client/c/hu/varadiistvan/xplra/xplra.h	(revision 25)
+++ src/client/c/hu/varadiistvan/xplra/xplra.h	(revision 27)
@@ -126,4 +126,6 @@
 
 /*----------------------------------------------------------------------------*/
+/* Single dataref support                                                     */
+/*----------------------------------------------------------------------------*/
 
 /**
@@ -315,4 +317,10 @@
 
 /*----------------------------------------------------------------------------*/
+/* Multi-dataref support                                                      */
+/*----------------------------------------------------------------------------*/
+
+
+
+/*----------------------------------------------------------------------------*/
 
 /**
