Index: src/plugin/Makefile.am
===================================================================
--- src/plugin/Makefile.am	(revision 13)
+++ src/plugin/Makefile.am	(revision 13)
@@ -0,0 +1,1 @@
+SUBDIRS=src
Index: src/plugin/Makefile.am
===================================================================
--- src/plugin/Makefile.am	(revision 13)
+++ 	(revision )
@@ -1,1 +1,0 @@
-SUBDIRS=src
Index: src/plugin/bootstrap.sh
===================================================================
--- src/plugin/bootstrap.sh	(revision 13)
+++ src/plugin/bootstrap.sh	(revision 13)
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+set -e -u
+
+scriptdir=`dirname $0`
+
+cd "${scriptdir}"
+
+#libtoolize
+aclocal -I $1
+automake -a
+autoconf
Index: src/plugin/bootstrap.sh
===================================================================
--- src/plugin/bootstrap.sh	(revision 13)
+++ 	(revision )
@@ -1,12 +1,0 @@
-#!/bin/sh
-
-set -e -u
-
-scriptdir=`dirname $0`
-
-cd "${scriptdir}"
-
-#libtoolize
-aclocal -I $1
-automake -a
-autoconf
Index: src/plugin/configure.ac
===================================================================
--- src/plugin/configure.ac	(revision 85)
+++ src/plugin/configure.ac	(revision 85)
@@ -0,0 +1,50 @@
+AC_INIT(xplra-plugin, 0.1, ivaradi@gmail.com)
+AM_INIT_AUTOMAKE([foreign no-exeext])
+
+AC_PROG_CC
+AC_PROG_CXX
+
+PKG_PROG_PKG_CONFIG
+
+AM_VSCPL_TARGET_API
+
+AC_MSG_CHECKING([where to find the X-Plane Plugin SDK])
+AC_ARG_WITH(xpsdk,
+            AC_HELP_STRING([--with-xpsdk=DIR],
+                           [use the X-Plane Plugin SDK in DIR]),
+            [
+                if test -r $withval/CHeaders/XPLM/XPLMPlugin.h; then
+                    AC_MSG_RESULT([$withval])
+                    XPSDK_INCLUDES="-I$withval/CHeaders/XPLM -I$withval/CHeaders/Wrappers -I$withval/CHeaders/Widgets"
+                    if test $_target_win32 -eq 0; then
+                        XPSDK_LDFLAGS="-L$withval/Libraries/Win"
+                    else
+                        XPSDK_LDFLAGS=""
+                    fi
+                else
+                    AC_MSG_FAILURE([not found in $withval])
+                fi
+            ],
+            [
+                 AC_MSG_FAILURE([please, specify])
+            ])
+
+AC_ARG_ENABLE(xplane9,
+              AC_HELP_STRING([--enable-xplane9],
+                             [compile the plugin for X-Plane 9]),
+              [AM_CONDITIONAL([XPLANE_9], test "$enableval" = "yes")],
+              [AM_CONDITIONAL([XPLANE_9], false)])
+
+AC_SUBST(XPSDK_INCLUDES)
+AC_SUBST(XPSDK_LDFLAGS)
+
+AM_VSCPL
+PKG_CHECK_MODULES([LIBXPLCOMMON], [libxplcommon >= 0.1])
+
+AC_CONFIG_FILES([
+        Makefile
+        src/Makefile
+        src/xplra/Makefile
+])
+
+AC_OUTPUT()
Index: src/plugin/configure.ac
===================================================================
--- src/plugin/configure.ac	(revision 85)
+++ 	(revision )
@@ -1,50 +1,0 @@
-AC_INIT(xplra-plugin, 0.1, ivaradi@gmail.com)
-AM_INIT_AUTOMAKE([foreign no-exeext])
-
-AC_PROG_CC
-AC_PROG_CXX
-
-PKG_PROG_PKG_CONFIG
-
-AM_VSCPL_TARGET_API
-
-AC_MSG_CHECKING([where to find the X-Plane Plugin SDK])
-AC_ARG_WITH(xpsdk,
-            AC_HELP_STRING([--with-xpsdk=DIR],
-                           [use the X-Plane Plugin SDK in DIR]),
-            [
-                if test -r $withval/CHeaders/XPLM/XPLMPlugin.h; then
-                    AC_MSG_RESULT([$withval])
-                    XPSDK_INCLUDES="-I$withval/CHeaders/XPLM -I$withval/CHeaders/Wrappers -I$withval/CHeaders/Widgets"
-                    if test $_target_win32 -eq 0; then
-                        XPSDK_LDFLAGS="-L$withval/Libraries/Win"
-                    else
-                        XPSDK_LDFLAGS=""
-                    fi
-                else
-                    AC_MSG_FAILURE([not found in $withval])
-                fi
-            ],
-            [
-                 AC_MSG_FAILURE([please, specify])
-            ])
-
-AC_ARG_ENABLE(xplane9,
-              AC_HELP_STRING([--enable-xplane9],
-                             [compile the plugin for X-Plane 9]),
-              [AM_CONDITIONAL([XPLANE_9], test "$enableval" = "yes")],
-              [AM_CONDITIONAL([XPLANE_9], false)])
-
-AC_SUBST(XPSDK_INCLUDES)
-AC_SUBST(XPSDK_LDFLAGS)
-
-AM_VSCPL
-PKG_CHECK_MODULES([LIBXPLCOMMON], [libxplcommon >= 0.1])
-
-AC_CONFIG_FILES([
-        Makefile
-        src/Makefile
-        src/xplra/Makefile
-])
-
-AC_OUTPUT()
Index: src/plugin/src/Makefile.am
===================================================================
--- src/plugin/src/Makefile.am	(revision 13)
+++ src/plugin/src/Makefile.am	(revision 13)
@@ -0,0 +1,1 @@
+SUBDIRS=xplra
Index: src/plugin/src/Makefile.am
===================================================================
--- src/plugin/src/Makefile.am	(revision 13)
+++ 	(revision )
@@ -1,1 +1,0 @@
-SUBDIRS=xplra
Index: src/plugin/src/xplra/.copyright
===================================================================
--- src/plugin/src/xplra/.copyright	(revision 13)
+++ src/plugin/src/xplra/.copyright	(revision 13)
@@ -0,0 +1,23 @@
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
Index: src/plugin/src/xplra/.copyright
===================================================================
--- src/plugin/src/xplra/.copyright	(revision 13)
+++ 	(revision )
@@ -1,23 +1,0 @@
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
Index: src/plugin/src/xplra/.namespace
===================================================================
--- src/plugin/src/xplra/.namespace	(revision 13)
+++ src/plugin/src/xplra/.namespace	(revision 13)
@@ -0,0 +1,1 @@
+xplra
Index: src/plugin/src/xplra/.namespace
===================================================================
--- src/plugin/src/xplra/.namespace	(revision 13)
+++ 	(revision )
@@ -1,1 +1,0 @@
-xplra
Index: src/plugin/src/xplra/.srcmessage
===================================================================
--- src/plugin/src/xplra/.srcmessage	(revision 13)
+++ src/plugin/src/xplra/.srcmessage	(revision 13)
@@ -0,0 +1,1 @@
+// This file is part of XPLRA, a remote-access plugin for X-Plane
Index: src/plugin/src/xplra/.srcmessage
===================================================================
--- src/plugin/src/xplra/.srcmessage	(revision 13)
+++ 	(revision )
@@ -1,1 +1,0 @@
-// This file is part of XPLRA, a remote-access plugin for X-Plane
Index: src/plugin/src/xplra/DataRefTask.cc
===================================================================
--- src/plugin/src/xplra/DataRefTask.cc	(revision 13)
+++ src/plugin/src/xplra/DataRefTask.cc	(revision 13)
@@ -0,0 +1,61 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include "DataRefTask.h"
+
+#include "hu/varadiistvan/xplcommon/Util.h"
+
+//------------------------------------------------------------------------------
+
+using xplra::DataRefTask;
+
+using hu::varadiistvan::xplcommon::Util;
+
+//------------------------------------------------------------------------------
+
+void DataRefTask::perform()
+{
+    if (dataRef==0) {
+        // Util::debug("DataRefTask::perform: name='%s'\n", name.c_str());
+        dataRef = XPLMFindDataRef(name.c_str());
+        // Util::debug("DataRefTask::perform: dataRef=%p\n", dataRef);
+    }
+    if (dataRef!=0) {
+        process();
+    }
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/DataRefTask.cc
===================================================================
--- src/plugin/src/xplra/DataRefTask.cc	(revision 13)
+++ 	(revision )
@@ -1,61 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "DataRefTask.h"
-
-#include "hu/varadiistvan/xplcommon/Util.h"
-
-//------------------------------------------------------------------------------
-
-using xplra::DataRefTask;
-
-using hu::varadiistvan::xplcommon::Util;
-
-//------------------------------------------------------------------------------
-
-void DataRefTask::perform()
-{
-    if (dataRef==0) {
-        // Util::debug("DataRefTask::perform: name='%s'\n", name.c_str());
-        dataRef = XPLMFindDataRef(name.c_str());
-        // Util::debug("DataRefTask::perform: dataRef=%p\n", dataRef);
-    }
-    if (dataRef!=0) {
-        process();
-    }
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/plugin/src/xplra/DataRefTask.h
===================================================================
--- src/plugin/src/xplra/DataRefTask.h	(revision 13)
+++ src/plugin/src/xplra/DataRefTask.h	(revision 13)
@@ -0,0 +1,155 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef XPLRA_DATAREFTASK_H
+#define XPLRA_DATAREFTASK_H
+//------------------------------------------------------------------------------
+
+#include "Task.h"
+
+#include <XPLMDataAccess.h>
+
+#include <string>
+
+//------------------------------------------------------------------------------
+
+namespace xplra {
+
+//------------------------------------------------------------------------------
+
+/**
+ * A task that works with some dataref. This base class
+ * performs the mapping from dataref name to dataref value. The actual
+ * operation is performed by the subclasses.
+ */
+class DataRefTask : public Task
+{
+private:
+    /**
+     * The name of the dataref.
+     */
+    std::string name;
+
+    /**
+     * The dataref.
+     */
+    XPLMDataRef dataRef;
+
+protected:
+    /**
+     * Construct the dataref task for the dataref with the given name.
+     */
+    DataRefTask(const std::string& name);
+
+    /**
+     * Construct the dataref task for the given dataref.
+     */
+    DataRefTask(XPLMDataRef dataRef);
+
+public:
+    /**
+     * Determine if the task is valid, which is so, if the dataref is
+     * not 0.
+     */
+    bool isValid() const;
+
+    /**
+     * Get the name of the dataref.
+     */
+    const std::string& getName() const;
+
+    /**
+     * Get the dataref.
+     */
+    XPLMDataRef getDataRef() const;
+
+protected:
+    /**
+     * Perform the task. If the dataref is not valid yet, it will be
+     * queried. If the query is successful, the process() function is
+     * called.
+     */
+    virtual void perform();
+
+    /**
+     * Process the dataref. When this function is called, the dataref
+     * is valid.
+     */
+    virtual void process() = 0;
+};
+
+//------------------------------------------------------------------------------
+// Inline definitions
+//------------------------------------------------------------------------------
+
+inline DataRefTask::DataRefTask(const std::string& name) :
+    name(name),
+    dataRef(0)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline DataRefTask::DataRefTask(XPLMDataRef dataRef) :
+    dataRef(dataRef)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline bool DataRefTask::isValid() const
+{
+    return dataRef!=0;
+}
+
+//------------------------------------------------------------------------------
+
+inline const std::string& DataRefTask::getName() const
+{
+    return name;
+}
+
+//------------------------------------------------------------------------------
+
+inline XPLMDataRef DataRefTask::getDataRef() const
+{
+    return dataRef;
+}
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplra */
+
+//------------------------------------------------------------------------------
+#endif // XPLRA_DATAREFTASK_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/DataRefTask.h
===================================================================
--- src/plugin/src/xplra/DataRefTask.h	(revision 13)
+++ 	(revision )
@@ -1,155 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLRA_DATAREFTASK_H
-#define XPLRA_DATAREFTASK_H
-//------------------------------------------------------------------------------
-
-#include "Task.h"
-
-#include <XPLMDataAccess.h>
-
-#include <string>
-
-//------------------------------------------------------------------------------
-
-namespace xplra {
-
-//------------------------------------------------------------------------------
-
-/**
- * A task that works with some dataref. This base class
- * performs the mapping from dataref name to dataref value. The actual
- * operation is performed by the subclasses.
- */
-class DataRefTask : public Task
-{
-private:
-    /**
-     * The name of the dataref.
-     */
-    std::string name;
-
-    /**
-     * The dataref.
-     */
-    XPLMDataRef dataRef;
-
-protected:
-    /**
-     * Construct the dataref task for the dataref with the given name.
-     */
-    DataRefTask(const std::string& name);
-
-    /**
-     * Construct the dataref task for the given dataref.
-     */
-    DataRefTask(XPLMDataRef dataRef);
-
-public:
-    /**
-     * Determine if the task is valid, which is so, if the dataref is
-     * not 0.
-     */
-    bool isValid() const;
-
-    /**
-     * Get the name of the dataref.
-     */
-    const std::string& getName() const;
-
-    /**
-     * Get the dataref.
-     */
-    XPLMDataRef getDataRef() const;
-
-protected:
-    /**
-     * Perform the task. If the dataref is not valid yet, it will be
-     * queried. If the query is successful, the process() function is
-     * called.
-     */
-    virtual void perform();
-
-    /**
-     * Process the dataref. When this function is called, the dataref
-     * is valid.
-     */
-    virtual void process() = 0;
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline DataRefTask::DataRefTask(const std::string& name) :
-    name(name),
-    dataRef(0)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline DataRefTask::DataRefTask(XPLMDataRef dataRef) :
-    dataRef(dataRef)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline bool DataRefTask::isValid() const
-{
-    return dataRef!=0;
-}
-
-//------------------------------------------------------------------------------
-
-inline const std::string& DataRefTask::getName() const
-{
-    return name;
-}
-
-//------------------------------------------------------------------------------
-
-inline XPLMDataRef DataRefTask::getDataRef() const
-{
-    return dataRef;
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplra */
-
-//------------------------------------------------------------------------------
-#endif // XPLRA_DATAREFTASK_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/plugin/src/xplra/GetDataRefTask.cc
===================================================================
--- src/plugin/src/xplra/GetDataRefTask.cc	(revision 13)
+++ src/plugin/src/xplra/GetDataRefTask.cc	(revision 13)
@@ -0,0 +1,125 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include "GetDataRefTask.h"
+#include "Protocol.h"
+
+#include "hu/varadiistvan/xplcommon/Util.h"
+
+//------------------------------------------------------------------------------
+
+using xplra::GetDataRefTask;
+using xplra::GetIntDataRefTask;
+using xplra::GetFloatDataRefTask;
+using xplra::GetDoubleDataRefTask;
+
+using hu::varadiistvan::scpl::io::DataStream;
+using hu::varadiistvan::xplcommon::Util;
+
+using std::string;
+
+//------------------------------------------------------------------------------
+
+GetDataRefTask* GetDataRefTask::create(uint8_t& result, DataStream& stream)
+{
+    result = Protocol::RESULT_OK;
+
+    string name = stream.readString();
+    uint8_t type = stream.readU8();
+    if (!stream) return 0;
+
+    // Util::debug("hu.varadiistvan.xplra.GetDataRefTask::execute: name='%s', type=0x%02x\n",
+    //             name.c_str(), type);
+
+    if (type==Protocol::TYPE_INT) {
+        return new GetIntDataRefTask(name);
+    } else if (type==Protocol::TYPE_FLOAT) {
+        return new GetFloatDataRefTask(name);
+    } else if (type==Protocol::TYPE_DOUBLE) {
+        return new GetDoubleDataRefTask(name);
+    } else if (type==Protocol::TYPE_FLOAT_ARRAY ||
+               type==Protocol::TYPE_INT_ARRAY ||
+               type==Protocol::TYPE_BYTE_ARRAY)
+    {
+        int length = stream.readS32();
+        int offset = stream.readS32();
+        if (!stream) return 0;
+
+        if (length>Protocol::MAX_LENGTH) {
+            result = Protocol::RESULT_INVALID_LENGTH;
+            return 0;
+        }
+        if (offset<0) {
+            result = Protocol::RESULT_INVALID_OFFSET;
+            return 0;
+        }
+
+        if (type==Protocol::TYPE_FLOAT_ARRAY) {
+            return new GetFloatArrayDataRefTask(name, length, offset);
+        } else if (type==Protocol::TYPE_INT_ARRAY) {
+            return new GetIntArrayDataRefTask(name, length, offset);
+        } else {
+            return new GetByteArrayDataRefTask(name, length, offset);
+        }
+    } else {
+        result = Protocol::RESULT_INVALID_TYPE;
+        return 0;
+    }
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+void GetIntDataRefTask::writeValue(DataStream& stream)
+{
+    stream.writeS32(getValue());
+}
+
+//------------------------------------------------------------------------------
+
+void GetFloatDataRefTask::writeValue(DataStream& stream)
+{
+    stream.writeFloat(getValue());
+}
+
+//------------------------------------------------------------------------------
+
+void GetDoubleDataRefTask::writeValue(DataStream& stream)
+{
+    stream.writeDouble(getValue());
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/GetDataRefTask.cc
===================================================================
--- src/plugin/src/xplra/GetDataRefTask.cc	(revision 13)
+++ 	(revision )
@@ -1,125 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "GetDataRefTask.h"
-#include "Protocol.h"
-
-#include "hu/varadiistvan/xplcommon/Util.h"
-
-//------------------------------------------------------------------------------
-
-using xplra::GetDataRefTask;
-using xplra::GetIntDataRefTask;
-using xplra::GetFloatDataRefTask;
-using xplra::GetDoubleDataRefTask;
-
-using hu::varadiistvan::scpl::io::DataStream;
-using hu::varadiistvan::xplcommon::Util;
-
-using std::string;
-
-//------------------------------------------------------------------------------
-
-GetDataRefTask* GetDataRefTask::create(uint8_t& result, DataStream& stream)
-{
-    result = Protocol::RESULT_OK;
-
-    string name = stream.readString();
-    uint8_t type = stream.readU8();
-    if (!stream) return 0;
-
-    // Util::debug("hu.varadiistvan.xplra.GetDataRefTask::execute: name='%s', type=0x%02x\n",
-    //             name.c_str(), type);
-
-    if (type==Protocol::TYPE_INT) {
-        return new GetIntDataRefTask(name);
-    } else if (type==Protocol::TYPE_FLOAT) {
-        return new GetFloatDataRefTask(name);
-    } else if (type==Protocol::TYPE_DOUBLE) {
-        return new GetDoubleDataRefTask(name);
-    } else if (type==Protocol::TYPE_FLOAT_ARRAY ||
-               type==Protocol::TYPE_INT_ARRAY ||
-               type==Protocol::TYPE_BYTE_ARRAY)
-    {
-        int length = stream.readS32();
-        int offset = stream.readS32();
-        if (!stream) return 0;
-
-        if (length>Protocol::MAX_LENGTH) {
-            result = Protocol::RESULT_INVALID_LENGTH;
-            return 0;
-        }
-        if (offset<0) {
-            result = Protocol::RESULT_INVALID_OFFSET;
-            return 0;
-        }
-
-        if (type==Protocol::TYPE_FLOAT_ARRAY) {
-            return new GetFloatArrayDataRefTask(name, length, offset);
-        } else if (type==Protocol::TYPE_INT_ARRAY) {
-            return new GetIntArrayDataRefTask(name, length, offset);
-        } else {
-            return new GetByteArrayDataRefTask(name, length, offset);
-        }
-    } else {
-        result = Protocol::RESULT_INVALID_TYPE;
-        return 0;
-    }
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-void GetIntDataRefTask::writeValue(DataStream& stream)
-{
-    stream.writeS32(getValue());
-}
-
-//------------------------------------------------------------------------------
-
-void GetFloatDataRefTask::writeValue(DataStream& stream)
-{
-    stream.writeFloat(getValue());
-}
-
-//------------------------------------------------------------------------------
-
-void GetDoubleDataRefTask::writeValue(DataStream& stream)
-{
-    stream.writeDouble(getValue());
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/plugin/src/xplra/GetDataRefTask.h
===================================================================
--- src/plugin/src/xplra/GetDataRefTask.h	(revision 66)
+++ src/plugin/src/xplra/GetDataRefTask.h	(revision 66)
@@ -0,0 +1,739 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef XPLRA_GETDATAREFTASK_H
+#define XPLRA_GETDATAREFTASK_H
+//------------------------------------------------------------------------------
+
+#include "DataRefTask.h"
+
+#include <hu/varadiistvan/scpl/io/DataStream.h>
+
+//------------------------------------------------------------------------------
+
+namespace xplra {
+
+//------------------------------------------------------------------------------
+
+/**
+ * Base class for tasks that query the value of some dataref.
+ */
+class GetDataRefTask : public DataRefTask
+{
+public:
+    /**
+     * Read a dataref query specification and create the appropriate
+     * GetDataRefTask instance.
+     *
+     * @return the new instance, or 0 on error. In that case the given
+     * result reference variable will be filled with the error code,
+     * unless the stream failed, in which case it remains RESULT_OK.
+     */
+    static GetDataRefTask* create(uint8_t& result,
+                                  hu::varadiistvan::scpl::io::DataStream& stream);
+
+    /**
+     * Construct the task for the dataref with the given name.
+     */
+    GetDataRefTask(const std::string& name);
+
+    /**
+     * Construct the task for the given dataref.
+     */
+    GetDataRefTask(XPLMDataRef dataRef);
+
+    /**
+     * Write the value into the given stream.
+     */
+    virtual void writeValue(hu::varadiistvan::scpl::io::DataStream& stream) = 0;
+};
+
+//------------------------------------------------------------------------------
+
+/**
+ * Base class for dataref querying tasks that query some scalar value.
+ *
+ * ConcreteClass is the actual child class. It should have a function
+ * called queryData, which wraps the corresponding function in XPLM.
+ */
+template <typename T, class ConcreteClass>
+class GetScalarDataRefTask : public GetDataRefTask
+{
+private:
+    /**
+     * The value retrieved.
+     */
+    T value;
+
+public:
+    /**
+     * Construct the task for the dataref with the given name.
+     */
+    GetScalarDataRefTask(const std::string& name);
+
+    /**
+     * Construct the task for the given dataref.
+     */
+    GetScalarDataRefTask(XPLMDataRef dataRef);
+
+    /**
+     * Get the value
+     */
+    T getValue() const;
+
+protected:
+    /**
+     * Perform the actual operation.
+     */
+    virtual void process();
+};
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+/**
+ * A dataref task which retrieves the value of an integer.
+ */
+class GetIntDataRefTask :
+        public GetScalarDataRefTask<int, GetIntDataRefTask>
+{
+public:
+    /**
+     * Query the value from XPLM
+     */
+    static int queryData(XPLMDataRef dataRef);
+
+    /**
+     * Construct the task for the dataref with the given name.
+     */
+    GetIntDataRefTask(const std::string& name);
+
+    /**
+     * Construct the task for the given dataref.
+     */
+    GetIntDataRefTask(XPLMDataRef dataRef);
+
+    /**
+     * Write the value into the given stream.
+     */
+    virtual void writeValue(hu::varadiistvan::scpl::io::DataStream& stream);
+};
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+/**
+ * A dataref task which retrieves the value of a single-precision
+ * floating point data.
+ */
+class GetFloatDataRefTask :
+        public GetScalarDataRefTask<float, GetFloatDataRefTask>
+{
+public:
+    /**
+     * Query the value from XPLM
+     */
+    static float queryData(XPLMDataRef dataRef);
+
+    /**
+     * Construct the task for the dataref with the given name.
+     */
+    GetFloatDataRefTask(const std::string& name);
+
+    /**
+     * Construct the task for the given dataref.
+     */
+    GetFloatDataRefTask(XPLMDataRef dataRef);
+
+    /**
+     * Write the value into the given stream.
+     */
+    virtual void writeValue(hu::varadiistvan::scpl::io::DataStream& stream);
+};
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+/**
+ * A dataref task which retrieves the value of a double-precision
+ * floating point data.
+ */
+class GetDoubleDataRefTask :
+        public GetScalarDataRefTask<double, GetDoubleDataRefTask>
+{
+public:
+    /**
+     * Query the value from XPLM
+     */
+    static double queryData(XPLMDataRef dataRef);
+
+    /**
+     * Construct the task for the dataref with the given name.
+     */
+    GetDoubleDataRefTask(const std::string& name);
+
+    /**
+     * Construct the task for the given dataref.
+     */
+    GetDoubleDataRefTask(XPLMDataRef dataRef);
+
+    /**
+     * Write the value into the given stream.
+     */
+    virtual void writeValue(hu::varadiistvan::scpl::io::DataStream& stream);
+};
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+/**
+ * Base class for dataref querying tasks that query some array.
+ *
+ * ConcreteClass is the actual child class. It should have a function
+ * called queryData, which wraps the corresponding function in XPLM.
+ */
+template <typename T, class ConcreteClass>
+class GetArrayDataRefTask : public GetDataRefTask
+{
+private:
+    /**
+     * The maximal number of data items returned.
+     */
+    int maxCount;
+
+    /**
+     * The offset within the dataref's value to start the query from.
+     */
+    int offset;
+
+    /**
+     * The data.
+     */
+    T* data;
+
+    /**
+     * The actual length of the data retrieved.
+     */
+    int length;
+
+protected:
+    /**
+     * Construct the task for the dataref with the given name.
+     *
+     * @param name the name of the dataref
+     * @param maxCount the maximal number of items to retrieve. If <0,
+     * the function will perform an extra query to retrieve the size of
+     * of the dataref's data, which it will store in the task, so
+     * later on it can be reused.
+     * @param offset the offset from which to query the array
+     */
+    GetArrayDataRefTask(const std::string& name,
+                        int maxCount = -1, int offset = 0);
+
+    /**
+     * Construct the task for the given dataref
+     *
+     * @param dataRef the dataref
+     * @param maxCount the maximal number of items to retrieve. If <0,
+     * the function will perform an extra query to retrieve the size
+     * of the dataref's data, which it will store in the task, so
+     * later on it can be reused.
+     * @param offset the offset from which to query the array
+     */
+    GetArrayDataRefTask(XPLMDataRef dataRef,
+                        int maxCount = -1, int offset = 0);
+
+public:
+    /**
+     * Destroy the object.
+     */
+    virtual ~GetArrayDataRefTask();
+
+    /**
+     * Get the data.
+     */
+    const T* getData() const;
+
+    /**
+     * Get the length of the data.
+     */
+    int getLength() const;
+
+protected:
+    /**
+     * Process the dataref by querying its value.
+     */
+    virtual void process();
+
+    /**
+     * Write the value into the given stream.
+     */
+    virtual void writeValue(hu::varadiistvan::scpl::io::DataStream& stream);
+};
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+/**
+ * A dataref task which retrieves the value of a float array.
+ */
+class GetFloatArrayDataRefTask :
+        public GetArrayDataRefTask<float, GetFloatArrayDataRefTask>
+{
+public:
+    /**
+     * Get the data via XPLM
+     */
+    static int queryData(XPLMDataRef dataRef, float* dest,
+                         int offset, int count);
+
+public:
+    /**
+     * Construct the task for the dataref with the given name.
+     *
+     * @param name the name of the dataref
+     * @param maxCount the maximal number of data items to
+     * retrieve. If <0, the function will perform an extra query to
+     * retrieve the size of the dataref's data, which it will store in
+     * the task, so later on it can be reused.
+     * @param offset the offset from which to query the array
+     */
+    GetFloatArrayDataRefTask(const std::string& name,
+                            int maxCount = -1, int offset = 0);
+
+    /**
+     * Construct the task for the given dataref
+     *
+     * @param dataRef the dataref
+     * @param maxCount the maximal number of data items to
+     * retrieve. If <0, the function will perform an extra query to
+     * retrieve the size of the dataref's data, which it will store in
+     * the task, so later on it can be reused.
+     * @param offset the offset from which to query the array
+     */
+    GetFloatArrayDataRefTask(XPLMDataRef dataRef,
+                             int maxCount = -1, int offset = 0);
+};
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+/**
+ * A dataref task which retrieves the value of an integer array.
+ */
+class GetIntArrayDataRefTask :
+        public GetArrayDataRefTask<int, GetIntArrayDataRefTask>
+{
+public:
+    /**
+     * Get the data via XPLM
+     */
+    static int queryData(XPLMDataRef dataRef, int* dest,
+                         int offset, int count);
+
+public:
+    /**
+     * Construct the task for the dataref with the given name.
+     *
+     * @param name the name of the dataref
+     * @param maxCount the maximal number of data items to
+     * retrieve. If <0, the function will perform an extra query to
+     * retrieve the size of the dataref's data, which it will store in
+     * the task, so later on it can be reused.
+     * @param offset the offset from which to query the array
+     */
+    GetIntArrayDataRefTask(const std::string& name,
+                           int maxCount = -1, int offset = 0);
+
+    /**
+     * Construct the task for the given dataref
+     *
+     * @param dataRef the dataref
+     * @param maxCount the maximal number of data items to
+     * retrieve. If <0, the function will perform an extra query to
+     * retrieve the size of the dataref's data, which it will store in
+     * the task, so later on it can be reused.
+     * @param offset the offset from which to query the array
+     */
+    GetIntArrayDataRefTask(XPLMDataRef dataRef,
+                           int maxCount = -1, int offset = 0);
+};
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+/**
+ * A dataref task which retrieves the value of a byte array.
+ */
+class GetByteArrayDataRefTask :
+        public GetArrayDataRefTask<unsigned char, GetByteArrayDataRefTask>
+{
+public:
+    /**
+     * Get the data via XPLM
+     */
+    static int queryData(XPLMDataRef dataRef, void* dest,
+                         int offset, int count);
+
+public:
+    /**
+     * Construct the task for the dataref with the given name.
+     *
+     * @param name the name of the dataref
+     * @param maxBytes the maximal number of bytes to retrieve. If <0,
+     * the function will perform an extra query to retrieve the size
+     * of the dataref's data, which it will store in the task, so
+     * later on it can be reused.
+     * @param offset the offset from which to query the array
+     */
+    GetByteArrayDataRefTask(const std::string& name,
+                            int maxBytes = -1, int offset = 0);
+
+    /**
+     * Construct the task for the given dataref
+     *
+     * @param dataRef the dataref
+     * @param maxBytes the maximal number of bytes to retrieve. If <0,
+     * the function will perform an extra query to retrieve the size
+     * of the dataref's data, which it will store in the task, so
+     * later on it can be reused.
+     * @param offset the offset from which to query the array
+     */
+    GetByteArrayDataRefTask(XPLMDataRef dataRef,
+                            int maxBytes = -1, int offset = 0);
+};
+
+//------------------------------------------------------------------------------
+// Template definitions
+//------------------------------------------------------------------------------
+
+template <typename T, class ConcreteClass>
+inline GetScalarDataRefTask<T, ConcreteClass>::
+GetScalarDataRefTask(const std::string& name) :
+    GetDataRefTask(name),
+    value(0)
+{
+}
+
+//------------------------------------------------------------------------------
+
+template <typename T, class ConcreteClass>
+inline GetScalarDataRefTask<T, ConcreteClass>::
+GetScalarDataRefTask(XPLMDataRef dataRef) :
+    GetDataRefTask(dataRef),
+    value(0)
+{
+}
+
+//------------------------------------------------------------------------------
+
+template <typename T, class ConcreteClass>
+inline T GetScalarDataRefTask<T, ConcreteClass>::getValue() const
+{
+    return value;
+}
+
+//------------------------------------------------------------------------------
+
+template <typename T, class ConcreteClass>
+void GetScalarDataRefTask<T, ConcreteClass>::process()
+{
+    value = ConcreteClass::queryData(getDataRef());
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+template <typename T, class ConcreteClass>
+inline GetArrayDataRefTask<T, ConcreteClass>::
+GetArrayDataRefTask(const std::string& name, int maxCount, int offset) :
+    GetDataRefTask(name),
+    maxCount(maxCount),
+    offset(offset),
+    data( (maxCount>0) ? new T[maxCount] : 0 ),
+    length(-1)
+{
+}
+
+//------------------------------------------------------------------------------
+
+template <typename T, class ConcreteClass>
+inline GetArrayDataRefTask<T, ConcreteClass>::
+GetArrayDataRefTask(XPLMDataRef dataRef, int maxCount, int offset) :
+    GetDataRefTask(dataRef),
+    maxCount(maxCount),
+    offset(offset),
+    data( (maxCount>0) ? new T[maxCount] : 0),
+    length(-1)
+{
+}
+
+//------------------------------------------------------------------------------
+
+template <typename T, class ConcreteClass>
+inline GetArrayDataRefTask<T, ConcreteClass>::~GetArrayDataRefTask()
+{
+    delete [] data;
+}
+
+//------------------------------------------------------------------------------
+
+template <typename T, class ConcreteClass>
+inline const T* GetArrayDataRefTask<T, ConcreteClass>::getData() const
+{
+    return data;
+}
+
+//------------------------------------------------------------------------------
+
+template <typename T, class ConcreteClass>
+inline int GetArrayDataRefTask<T, ConcreteClass>::getLength() const
+{
+    return length;
+}
+
+//------------------------------------------------------------------------------
+
+template <typename T, class ConcreteClass>
+void GetArrayDataRefTask<T, ConcreteClass>::process()
+{
+    if (maxCount<0) {
+        maxCount = ConcreteClass::queryData(getDataRef(), 0, 0, 0);
+
+        if (maxCount>0) {
+            maxCount -= offset;
+        }
+
+        if (maxCount>0) {
+            data = new T[maxCount];
+        } else {
+            maxCount = 0;
+        }
+    }
+
+    // Util::debug("GetByteArrayDataRefTask::process: dataRef=%p, maxBytes=%d, data=%p, offset\n",
+    //             getDataRef(), maxBytes, data, offset);
+    if (maxCount>0) {
+        length = ConcreteClass::queryData(getDataRef(), data, offset, maxCount);
+    } else {
+        length = maxCount;
+    }
+}
+
+//------------------------------------------------------------------------------
+
+template <typename T, class ConcreteClass>
+void GetArrayDataRefTask<T, ConcreteClass>::
+writeValue(hu::varadiistvan::scpl::io::DataStream& stream)
+{
+    stream.writeS32(length);
+    if (length>0) {
+        stream.write(data, length * sizeof(T));
+    }
+}
+
+//------------------------------------------------------------------------------
+// Inline definitions
+//------------------------------------------------------------------------------
+
+inline GetDataRefTask::GetDataRefTask(const std::string& name) :
+    DataRefTask(name)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline GetDataRefTask::GetDataRefTask(XPLMDataRef dataRef) :
+    DataRefTask(dataRef)
+{
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+inline int GetIntDataRefTask::queryData(XPLMDataRef dataRef)
+{
+    return XPLMGetDatai(dataRef);
+}
+
+//------------------------------------------------------------------------------
+
+inline GetIntDataRefTask::GetIntDataRefTask(const std::string& name) :
+    GetScalarDataRefTask<int, GetIntDataRefTask>(name)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline GetIntDataRefTask::GetIntDataRefTask(XPLMDataRef dataRef) :
+    GetScalarDataRefTask<int, GetIntDataRefTask>(dataRef)
+{
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+inline float GetFloatDataRefTask::queryData(XPLMDataRef dataRef)
+{
+    return XPLMGetDataf(dataRef);
+}
+
+//------------------------------------------------------------------------------
+
+inline GetFloatDataRefTask::GetFloatDataRefTask(const std::string& name) :
+    GetScalarDataRefTask<float, GetFloatDataRefTask>(name)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline GetFloatDataRefTask::GetFloatDataRefTask(XPLMDataRef dataRef) :
+    GetScalarDataRefTask<float, GetFloatDataRefTask>(dataRef)
+{
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+inline double GetDoubleDataRefTask::queryData(XPLMDataRef dataRef)
+{
+    return XPLMGetDatad(dataRef);
+}
+
+//------------------------------------------------------------------------------
+
+inline GetDoubleDataRefTask::GetDoubleDataRefTask(const std::string& name) :
+    GetScalarDataRefTask<double, GetDoubleDataRefTask>(name)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline GetDoubleDataRefTask::GetDoubleDataRefTask(XPLMDataRef dataRef) :
+    GetScalarDataRefTask<double, GetDoubleDataRefTask>(dataRef)
+{
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+inline int GetFloatArrayDataRefTask::queryData(XPLMDataRef dataRef, float* dest,
+                                               int offset, int count)
+{
+    return XPLMGetDatavf(dataRef, dest, offset, count);
+}
+
+//------------------------------------------------------------------------------
+
+inline
+GetFloatArrayDataRefTask::GetFloatArrayDataRefTask(const std::string& name,
+                                                   int maxCount, int offset) :
+    GetArrayDataRefTask<float, GetFloatArrayDataRefTask>(name, maxCount, offset)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline
+GetFloatArrayDataRefTask::GetFloatArrayDataRefTask(XPLMDataRef dataRef,
+                                                 int maxCount, int offset) :
+    GetArrayDataRefTask<float, GetFloatArrayDataRefTask>(dataRef,
+                                                         maxCount, offset)
+{
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+inline int GetIntArrayDataRefTask::queryData(XPLMDataRef dataRef, int* dest,
+                                             int offset, int count)
+{
+    return XPLMGetDatavi(dataRef, dest, offset, count);
+}
+
+//------------------------------------------------------------------------------
+
+inline
+GetIntArrayDataRefTask::GetIntArrayDataRefTask(const std::string& name,
+                                                   int maxCount, int offset) :
+    GetArrayDataRefTask<int, GetIntArrayDataRefTask>(name, maxCount, offset)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline
+GetIntArrayDataRefTask::GetIntArrayDataRefTask(XPLMDataRef dataRef,
+                                               int maxCount, int offset) :
+    GetArrayDataRefTask<int, GetIntArrayDataRefTask>(dataRef,
+                                                     maxCount, offset)
+{
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+inline int GetByteArrayDataRefTask::queryData(XPLMDataRef dataRef, void* dest,
+                                              int offset, int count)
+{
+    return XPLMGetDatab(dataRef, dest, offset, count);
+}
+
+//------------------------------------------------------------------------------
+
+inline
+GetByteArrayDataRefTask::GetByteArrayDataRefTask(const std::string& name,
+                                                 int maxBytes, int offset) :
+    GetArrayDataRefTask<unsigned char, GetByteArrayDataRefTask>(name, maxBytes,
+                                                                offset)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline
+GetByteArrayDataRefTask::GetByteArrayDataRefTask(XPLMDataRef dataRef,
+                                                 int maxBytes, int offset) :
+    GetArrayDataRefTask<unsigned char, GetByteArrayDataRefTask>(dataRef,
+                                                                maxBytes,
+                                                                offset)
+{
+}
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplra */
+
+//------------------------------------------------------------------------------
+#endif // XPLRA_GETDATAREFTASK_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/GetDataRefTask.h
===================================================================
--- src/plugin/src/xplra/GetDataRefTask.h	(revision 66)
+++ 	(revision )
@@ -1,739 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLRA_GETDATAREFTASK_H
-#define XPLRA_GETDATAREFTASK_H
-//------------------------------------------------------------------------------
-
-#include "DataRefTask.h"
-
-#include <hu/varadiistvan/scpl/io/DataStream.h>
-
-//------------------------------------------------------------------------------
-
-namespace xplra {
-
-//------------------------------------------------------------------------------
-
-/**
- * Base class for tasks that query the value of some dataref.
- */
-class GetDataRefTask : public DataRefTask
-{
-public:
-    /**
-     * Read a dataref query specification and create the appropriate
-     * GetDataRefTask instance.
-     *
-     * @return the new instance, or 0 on error. In that case the given
-     * result reference variable will be filled with the error code,
-     * unless the stream failed, in which case it remains RESULT_OK.
-     */
-    static GetDataRefTask* create(uint8_t& result,
-                                  hu::varadiistvan::scpl::io::DataStream& stream);
-
-    /**
-     * Construct the task for the dataref with the given name.
-     */
-    GetDataRefTask(const std::string& name);
-
-    /**
-     * Construct the task for the given dataref.
-     */
-    GetDataRefTask(XPLMDataRef dataRef);
-
-    /**
-     * Write the value into the given stream.
-     */
-    virtual void writeValue(hu::varadiistvan::scpl::io::DataStream& stream) = 0;
-};
-
-//------------------------------------------------------------------------------
-
-/**
- * Base class for dataref querying tasks that query some scalar value.
- *
- * ConcreteClass is the actual child class. It should have a function
- * called queryData, which wraps the corresponding function in XPLM.
- */
-template <typename T, class ConcreteClass>
-class GetScalarDataRefTask : public GetDataRefTask
-{
-private:
-    /**
-     * The value retrieved.
-     */
-    T value;
-
-public:
-    /**
-     * Construct the task for the dataref with the given name.
-     */
-    GetScalarDataRefTask(const std::string& name);
-
-    /**
-     * Construct the task for the given dataref.
-     */
-    GetScalarDataRefTask(XPLMDataRef dataRef);
-
-    /**
-     * Get the value
-     */
-    T getValue() const;
-
-protected:
-    /**
-     * Perform the actual operation.
-     */
-    virtual void process();
-};
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-/**
- * A dataref task which retrieves the value of an integer.
- */
-class GetIntDataRefTask :
-        public GetScalarDataRefTask<int, GetIntDataRefTask>
-{
-public:
-    /**
-     * Query the value from XPLM
-     */
-    static int queryData(XPLMDataRef dataRef);
-
-    /**
-     * Construct the task for the dataref with the given name.
-     */
-    GetIntDataRefTask(const std::string& name);
-
-    /**
-     * Construct the task for the given dataref.
-     */
-    GetIntDataRefTask(XPLMDataRef dataRef);
-
-    /**
-     * Write the value into the given stream.
-     */
-    virtual void writeValue(hu::varadiistvan::scpl::io::DataStream& stream);
-};
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-/**
- * A dataref task which retrieves the value of a single-precision
- * floating point data.
- */
-class GetFloatDataRefTask :
-        public GetScalarDataRefTask<float, GetFloatDataRefTask>
-{
-public:
-    /**
-     * Query the value from XPLM
-     */
-    static float queryData(XPLMDataRef dataRef);
-
-    /**
-     * Construct the task for the dataref with the given name.
-     */
-    GetFloatDataRefTask(const std::string& name);
-
-    /**
-     * Construct the task for the given dataref.
-     */
-    GetFloatDataRefTask(XPLMDataRef dataRef);
-
-    /**
-     * Write the value into the given stream.
-     */
-    virtual void writeValue(hu::varadiistvan::scpl::io::DataStream& stream);
-};
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-/**
- * A dataref task which retrieves the value of a double-precision
- * floating point data.
- */
-class GetDoubleDataRefTask :
-        public GetScalarDataRefTask<double, GetDoubleDataRefTask>
-{
-public:
-    /**
-     * Query the value from XPLM
-     */
-    static double queryData(XPLMDataRef dataRef);
-
-    /**
-     * Construct the task for the dataref with the given name.
-     */
-    GetDoubleDataRefTask(const std::string& name);
-
-    /**
-     * Construct the task for the given dataref.
-     */
-    GetDoubleDataRefTask(XPLMDataRef dataRef);
-
-    /**
-     * Write the value into the given stream.
-     */
-    virtual void writeValue(hu::varadiistvan::scpl::io::DataStream& stream);
-};
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-/**
- * Base class for dataref querying tasks that query some array.
- *
- * ConcreteClass is the actual child class. It should have a function
- * called queryData, which wraps the corresponding function in XPLM.
- */
-template <typename T, class ConcreteClass>
-class GetArrayDataRefTask : public GetDataRefTask
-{
-private:
-    /**
-     * The maximal number of data items returned.
-     */
-    int maxCount;
-
-    /**
-     * The offset within the dataref's value to start the query from.
-     */
-    int offset;
-
-    /**
-     * The data.
-     */
-    T* data;
-
-    /**
-     * The actual length of the data retrieved.
-     */
-    int length;
-
-protected:
-    /**
-     * Construct the task for the dataref with the given name.
-     *
-     * @param name the name of the dataref
-     * @param maxCount the maximal number of items to retrieve. If <0,
-     * the function will perform an extra query to retrieve the size of
-     * of the dataref's data, which it will store in the task, so
-     * later on it can be reused.
-     * @param offset the offset from which to query the array
-     */
-    GetArrayDataRefTask(const std::string& name,
-                        int maxCount = -1, int offset = 0);
-
-    /**
-     * Construct the task for the given dataref
-     *
-     * @param dataRef the dataref
-     * @param maxCount the maximal number of items to retrieve. If <0,
-     * the function will perform an extra query to retrieve the size
-     * of the dataref's data, which it will store in the task, so
-     * later on it can be reused.
-     * @param offset the offset from which to query the array
-     */
-    GetArrayDataRefTask(XPLMDataRef dataRef,
-                        int maxCount = -1, int offset = 0);
-
-public:
-    /**
-     * Destroy the object.
-     */
-    virtual ~GetArrayDataRefTask();
-
-    /**
-     * Get the data.
-     */
-    const T* getData() const;
-
-    /**
-     * Get the length of the data.
-     */
-    int getLength() const;
-
-protected:
-    /**
-     * Process the dataref by querying its value.
-     */
-    virtual void process();
-
-    /**
-     * Write the value into the given stream.
-     */
-    virtual void writeValue(hu::varadiistvan::scpl::io::DataStream& stream);
-};
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-/**
- * A dataref task which retrieves the value of a float array.
- */
-class GetFloatArrayDataRefTask :
-        public GetArrayDataRefTask<float, GetFloatArrayDataRefTask>
-{
-public:
-    /**
-     * Get the data via XPLM
-     */
-    static int queryData(XPLMDataRef dataRef, float* dest,
-                         int offset, int count);
-
-public:
-    /**
-     * Construct the task for the dataref with the given name.
-     *
-     * @param name the name of the dataref
-     * @param maxCount the maximal number of data items to
-     * retrieve. If <0, the function will perform an extra query to
-     * retrieve the size of the dataref's data, which it will store in
-     * the task, so later on it can be reused.
-     * @param offset the offset from which to query the array
-     */
-    GetFloatArrayDataRefTask(const std::string& name,
-                            int maxCount = -1, int offset = 0);
-
-    /**
-     * Construct the task for the given dataref
-     *
-     * @param dataRef the dataref
-     * @param maxCount the maximal number of data items to
-     * retrieve. If <0, the function will perform an extra query to
-     * retrieve the size of the dataref's data, which it will store in
-     * the task, so later on it can be reused.
-     * @param offset the offset from which to query the array
-     */
-    GetFloatArrayDataRefTask(XPLMDataRef dataRef,
-                             int maxCount = -1, int offset = 0);
-};
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-/**
- * A dataref task which retrieves the value of an integer array.
- */
-class GetIntArrayDataRefTask :
-        public GetArrayDataRefTask<int, GetIntArrayDataRefTask>
-{
-public:
-    /**
-     * Get the data via XPLM
-     */
-    static int queryData(XPLMDataRef dataRef, int* dest,
-                         int offset, int count);
-
-public:
-    /**
-     * Construct the task for the dataref with the given name.
-     *
-     * @param name the name of the dataref
-     * @param maxCount the maximal number of data items to
-     * retrieve. If <0, the function will perform an extra query to
-     * retrieve the size of the dataref's data, which it will store in
-     * the task, so later on it can be reused.
-     * @param offset the offset from which to query the array
-     */
-    GetIntArrayDataRefTask(const std::string& name,
-                           int maxCount = -1, int offset = 0);
-
-    /**
-     * Construct the task for the given dataref
-     *
-     * @param dataRef the dataref
-     * @param maxCount the maximal number of data items to
-     * retrieve. If <0, the function will perform an extra query to
-     * retrieve the size of the dataref's data, which it will store in
-     * the task, so later on it can be reused.
-     * @param offset the offset from which to query the array
-     */
-    GetIntArrayDataRefTask(XPLMDataRef dataRef,
-                           int maxCount = -1, int offset = 0);
-};
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-/**
- * A dataref task which retrieves the value of a byte array.
- */
-class GetByteArrayDataRefTask :
-        public GetArrayDataRefTask<unsigned char, GetByteArrayDataRefTask>
-{
-public:
-    /**
-     * Get the data via XPLM
-     */
-    static int queryData(XPLMDataRef dataRef, void* dest,
-                         int offset, int count);
-
-public:
-    /**
-     * Construct the task for the dataref with the given name.
-     *
-     * @param name the name of the dataref
-     * @param maxBytes the maximal number of bytes to retrieve. If <0,
-     * the function will perform an extra query to retrieve the size
-     * of the dataref's data, which it will store in the task, so
-     * later on it can be reused.
-     * @param offset the offset from which to query the array
-     */
-    GetByteArrayDataRefTask(const std::string& name,
-                            int maxBytes = -1, int offset = 0);
-
-    /**
-     * Construct the task for the given dataref
-     *
-     * @param dataRef the dataref
-     * @param maxBytes the maximal number of bytes to retrieve. If <0,
-     * the function will perform an extra query to retrieve the size
-     * of the dataref's data, which it will store in the task, so
-     * later on it can be reused.
-     * @param offset the offset from which to query the array
-     */
-    GetByteArrayDataRefTask(XPLMDataRef dataRef,
-                            int maxBytes = -1, int offset = 0);
-};
-
-//------------------------------------------------------------------------------
-// Template definitions
-//------------------------------------------------------------------------------
-
-template <typename T, class ConcreteClass>
-inline GetScalarDataRefTask<T, ConcreteClass>::
-GetScalarDataRefTask(const std::string& name) :
-    GetDataRefTask(name),
-    value(0)
-{
-}
-
-//------------------------------------------------------------------------------
-
-template <typename T, class ConcreteClass>
-inline GetScalarDataRefTask<T, ConcreteClass>::
-GetScalarDataRefTask(XPLMDataRef dataRef) :
-    GetDataRefTask(dataRef),
-    value(0)
-{
-}
-
-//------------------------------------------------------------------------------
-
-template <typename T, class ConcreteClass>
-inline T GetScalarDataRefTask<T, ConcreteClass>::getValue() const
-{
-    return value;
-}
-
-//------------------------------------------------------------------------------
-
-template <typename T, class ConcreteClass>
-void GetScalarDataRefTask<T, ConcreteClass>::process()
-{
-    value = ConcreteClass::queryData(getDataRef());
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-template <typename T, class ConcreteClass>
-inline GetArrayDataRefTask<T, ConcreteClass>::
-GetArrayDataRefTask(const std::string& name, int maxCount, int offset) :
-    GetDataRefTask(name),
-    maxCount(maxCount),
-    offset(offset),
-    data( (maxCount>0) ? new T[maxCount] : 0 ),
-    length(-1)
-{
-}
-
-//------------------------------------------------------------------------------
-
-template <typename T, class ConcreteClass>
-inline GetArrayDataRefTask<T, ConcreteClass>::
-GetArrayDataRefTask(XPLMDataRef dataRef, int maxCount, int offset) :
-    GetDataRefTask(dataRef),
-    maxCount(maxCount),
-    offset(offset),
-    data( (maxCount>0) ? new T[maxCount] : 0),
-    length(-1)
-{
-}
-
-//------------------------------------------------------------------------------
-
-template <typename T, class ConcreteClass>
-inline GetArrayDataRefTask<T, ConcreteClass>::~GetArrayDataRefTask()
-{
-    delete [] data;
-}
-
-//------------------------------------------------------------------------------
-
-template <typename T, class ConcreteClass>
-inline const T* GetArrayDataRefTask<T, ConcreteClass>::getData() const
-{
-    return data;
-}
-
-//------------------------------------------------------------------------------
-
-template <typename T, class ConcreteClass>
-inline int GetArrayDataRefTask<T, ConcreteClass>::getLength() const
-{
-    return length;
-}
-
-//------------------------------------------------------------------------------
-
-template <typename T, class ConcreteClass>
-void GetArrayDataRefTask<T, ConcreteClass>::process()
-{
-    if (maxCount<0) {
-        maxCount = ConcreteClass::queryData(getDataRef(), 0, 0, 0);
-
-        if (maxCount>0) {
-            maxCount -= offset;
-        }
-
-        if (maxCount>0) {
-            data = new T[maxCount];
-        } else {
-            maxCount = 0;
-        }
-    }
-
-    // Util::debug("GetByteArrayDataRefTask::process: dataRef=%p, maxBytes=%d, data=%p, offset\n",
-    //             getDataRef(), maxBytes, data, offset);
-    if (maxCount>0) {
-        length = ConcreteClass::queryData(getDataRef(), data, offset, maxCount);
-    } else {
-        length = maxCount;
-    }
-}
-
-//------------------------------------------------------------------------------
-
-template <typename T, class ConcreteClass>
-void GetArrayDataRefTask<T, ConcreteClass>::
-writeValue(hu::varadiistvan::scpl::io::DataStream& stream)
-{
-    stream.writeS32(length);
-    if (length>0) {
-        stream.write(data, length * sizeof(T));
-    }
-}
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline GetDataRefTask::GetDataRefTask(const std::string& name) :
-    DataRefTask(name)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline GetDataRefTask::GetDataRefTask(XPLMDataRef dataRef) :
-    DataRefTask(dataRef)
-{
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-inline int GetIntDataRefTask::queryData(XPLMDataRef dataRef)
-{
-    return XPLMGetDatai(dataRef);
-}
-
-//------------------------------------------------------------------------------
-
-inline GetIntDataRefTask::GetIntDataRefTask(const std::string& name) :
-    GetScalarDataRefTask<int, GetIntDataRefTask>(name)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline GetIntDataRefTask::GetIntDataRefTask(XPLMDataRef dataRef) :
-    GetScalarDataRefTask<int, GetIntDataRefTask>(dataRef)
-{
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-inline float GetFloatDataRefTask::queryData(XPLMDataRef dataRef)
-{
-    return XPLMGetDataf(dataRef);
-}
-
-//------------------------------------------------------------------------------
-
-inline GetFloatDataRefTask::GetFloatDataRefTask(const std::string& name) :
-    GetScalarDataRefTask<float, GetFloatDataRefTask>(name)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline GetFloatDataRefTask::GetFloatDataRefTask(XPLMDataRef dataRef) :
-    GetScalarDataRefTask<float, GetFloatDataRefTask>(dataRef)
-{
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-inline double GetDoubleDataRefTask::queryData(XPLMDataRef dataRef)
-{
-    return XPLMGetDatad(dataRef);
-}
-
-//------------------------------------------------------------------------------
-
-inline GetDoubleDataRefTask::GetDoubleDataRefTask(const std::string& name) :
-    GetScalarDataRefTask<double, GetDoubleDataRefTask>(name)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline GetDoubleDataRefTask::GetDoubleDataRefTask(XPLMDataRef dataRef) :
-    GetScalarDataRefTask<double, GetDoubleDataRefTask>(dataRef)
-{
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-inline int GetFloatArrayDataRefTask::queryData(XPLMDataRef dataRef, float* dest,
-                                               int offset, int count)
-{
-    return XPLMGetDatavf(dataRef, dest, offset, count);
-}
-
-//------------------------------------------------------------------------------
-
-inline
-GetFloatArrayDataRefTask::GetFloatArrayDataRefTask(const std::string& name,
-                                                   int maxCount, int offset) :
-    GetArrayDataRefTask<float, GetFloatArrayDataRefTask>(name, maxCount, offset)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline
-GetFloatArrayDataRefTask::GetFloatArrayDataRefTask(XPLMDataRef dataRef,
-                                                 int maxCount, int offset) :
-    GetArrayDataRefTask<float, GetFloatArrayDataRefTask>(dataRef,
-                                                         maxCount, offset)
-{
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-inline int GetIntArrayDataRefTask::queryData(XPLMDataRef dataRef, int* dest,
-                                             int offset, int count)
-{
-    return XPLMGetDatavi(dataRef, dest, offset, count);
-}
-
-//------------------------------------------------------------------------------
-
-inline
-GetIntArrayDataRefTask::GetIntArrayDataRefTask(const std::string& name,
-                                                   int maxCount, int offset) :
-    GetArrayDataRefTask<int, GetIntArrayDataRefTask>(name, maxCount, offset)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline
-GetIntArrayDataRefTask::GetIntArrayDataRefTask(XPLMDataRef dataRef,
-                                               int maxCount, int offset) :
-    GetArrayDataRefTask<int, GetIntArrayDataRefTask>(dataRef,
-                                                     maxCount, offset)
-{
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-inline int GetByteArrayDataRefTask::queryData(XPLMDataRef dataRef, void* dest,
-                                              int offset, int count)
-{
-    return XPLMGetDatab(dataRef, dest, offset, count);
-}
-
-//------------------------------------------------------------------------------
-
-inline
-GetByteArrayDataRefTask::GetByteArrayDataRefTask(const std::string& name,
-                                                 int maxBytes, int offset) :
-    GetArrayDataRefTask<unsigned char, GetByteArrayDataRefTask>(name, maxBytes,
-                                                                offset)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline
-GetByteArrayDataRefTask::GetByteArrayDataRefTask(XPLMDataRef dataRef,
-                                                 int maxBytes, int offset) :
-    GetArrayDataRefTask<unsigned char, GetByteArrayDataRefTask>(dataRef,
-                                                                maxBytes,
-                                                                offset)
-{
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplra */
-
-//------------------------------------------------------------------------------
-#endif // XPLRA_GETDATAREFTASK_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/plugin/src/xplra/GetMultiDataRefRequest.cc
===================================================================
--- src/plugin/src/xplra/GetMultiDataRefRequest.cc	(revision 13)
+++ src/plugin/src/xplra/GetMultiDataRefRequest.cc	(revision 13)
@@ -0,0 +1,96 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include "GetMultiDataRefRequest.h"
+
+#include "Protocol.h"
+
+#include <hu/varadiistvan/xplcommon/Util.h>
+
+//------------------------------------------------------------------------------
+
+using xplra::GetMultiDataRefRequest;
+
+using hu::varadiistvan::scpl::io::DataStream;
+using hu::varadiistvan::xplcommon::Util;
+
+//------------------------------------------------------------------------------
+
+GetMultiDataRefRequest::GetMultiDataRefRequest(uint8_t& result,
+                                               DataStream& stream)
+{
+    result = Protocol::RESULT_OK;
+
+    uint32_t numTasks = stream.readU32();
+    if (!stream) return;
+    if (numTasks==0 || numTasks>Protocol::MAX_MULTI_COUNT) {
+        result = Protocol::RESULT_INVALID_COUNT;
+        return;
+    }
+
+    for(size_t i = 0;
+        i<numTasks && result==Protocol::RESULT_OK && stream; ++i)
+    {
+        GetDataRefTask* task = GetDataRefTask::create(result, stream);
+        if (task!=0) addTask(task);
+    }
+}
+
+//------------------------------------------------------------------------------
+
+void GetMultiDataRefRequest::writeResult(DataStream& stream) const
+{
+    // Util::debug("hu.varadiistvan.xplra.GetMultiDataRefRequest[%p]::writeResult\n", this);
+    size_t numTasks = getNumTasks();
+    for(size_t i = 0; i<numTasks; ++i) {
+        GetDataRefTask* task = getTask(i);
+        // Util::debug("hu.varadiistvan.xplra.GetMultiDataRefRequest[%p]::writeResult: task[%zu]: %d @ %p\n",
+        //             this, i, task->isValid(), task);
+        if (!task->isValid()) {
+            stream.writeU8(Protocol::RESULT_UNKNOWN_DATAREF);
+            stream.writeU32(i);
+            return;
+        }
+    }
+
+    stream.writeU8(Protocol::RESULT_OK);
+    for(size_t i = 0; i<numTasks; ++i) {
+        GetDataRefTask* task = getTask(i);
+        task->writeValue(stream);
+    }
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/GetMultiDataRefRequest.cc
===================================================================
--- src/plugin/src/xplra/GetMultiDataRefRequest.cc	(revision 13)
+++ 	(revision )
@@ -1,96 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "GetMultiDataRefRequest.h"
-
-#include "Protocol.h"
-
-#include <hu/varadiistvan/xplcommon/Util.h>
-
-//------------------------------------------------------------------------------
-
-using xplra::GetMultiDataRefRequest;
-
-using hu::varadiistvan::scpl::io::DataStream;
-using hu::varadiistvan::xplcommon::Util;
-
-//------------------------------------------------------------------------------
-
-GetMultiDataRefRequest::GetMultiDataRefRequest(uint8_t& result,
-                                               DataStream& stream)
-{
-    result = Protocol::RESULT_OK;
-
-    uint32_t numTasks = stream.readU32();
-    if (!stream) return;
-    if (numTasks==0 || numTasks>Protocol::MAX_MULTI_COUNT) {
-        result = Protocol::RESULT_INVALID_COUNT;
-        return;
-    }
-
-    for(size_t i = 0;
-        i<numTasks && result==Protocol::RESULT_OK && stream; ++i)
-    {
-        GetDataRefTask* task = GetDataRefTask::create(result, stream);
-        if (task!=0) addTask(task);
-    }
-}
-
-//------------------------------------------------------------------------------
-
-void GetMultiDataRefRequest::writeResult(DataStream& stream) const
-{
-    // Util::debug("hu.varadiistvan.xplra.GetMultiDataRefRequest[%p]::writeResult\n", this);
-    size_t numTasks = getNumTasks();
-    for(size_t i = 0; i<numTasks; ++i) {
-        GetDataRefTask* task = getTask(i);
-        // Util::debug("hu.varadiistvan.xplra.GetMultiDataRefRequest[%p]::writeResult: task[%zu]: %d @ %p\n",
-        //             this, i, task->isValid(), task);
-        if (!task->isValid()) {
-            stream.writeU8(Protocol::RESULT_UNKNOWN_DATAREF);
-            stream.writeU32(i);
-            return;
-        }
-    }
-
-    stream.writeU8(Protocol::RESULT_OK);
-    for(size_t i = 0; i<numTasks; ++i) {
-        GetDataRefTask* task = getTask(i);
-        task->writeValue(stream);
-    }
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/plugin/src/xplra/GetMultiDataRefRequest.h
===================================================================
--- src/plugin/src/xplra/GetMultiDataRefRequest.h	(revision 13)
+++ src/plugin/src/xplra/GetMultiDataRefRequest.h	(revision 13)
@@ -0,0 +1,78 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef XPLRA_GETMULTIDATAREFREQUEST_H
+#define XPLRA_GETMULTIDATAREFREQUEST_H
+//------------------------------------------------------------------------------
+
+#include "MultiTaskRequest.h"
+#include "GetDataRefTask.h"
+
+//------------------------------------------------------------------------------
+
+namespace xplra {
+
+//------------------------------------------------------------------------------
+
+/**
+ * A request containing several dataref query tasks.
+ */
+class GetMultiDataRefRequest : public MultiTaskRequestTemplate<GetDataRefTask>
+{
+public:
+    /**
+     * Construct the request by reading the given number of task
+     * specifications from the given stream.
+     */
+    GetMultiDataRefRequest(uint8_t& result, hu::varadiistvan::scpl::io::DataStream& stream);
+
+    /**
+     * Write the result of an execution.
+     *
+     * If there is at least one invalid dataref, the result will be
+     * RESULT_UNKNOWN_DATAREF followed by a 32-bit unsigned value with
+     * the index of the first unknown dataref.
+     *
+     * Otherwise the result is RESULT_OK, followed by the values of
+     * the datarefs queried.
+     */
+    void writeResult(hu::varadiistvan::scpl::io::DataStream& stream) const;
+};
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplra */
+
+//------------------------------------------------------------------------------
+#endif // XPLRA_GETMULTIDATAREFREQUEST_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/GetMultiDataRefRequest.h
===================================================================
--- src/plugin/src/xplra/GetMultiDataRefRequest.h	(revision 13)
+++ 	(revision )
@@ -1,78 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLRA_GETMULTIDATAREFREQUEST_H
-#define XPLRA_GETMULTIDATAREFREQUEST_H
-//------------------------------------------------------------------------------
-
-#include "MultiTaskRequest.h"
-#include "GetDataRefTask.h"
-
-//------------------------------------------------------------------------------
-
-namespace xplra {
-
-//------------------------------------------------------------------------------
-
-/**
- * A request containing several dataref query tasks.
- */
-class GetMultiDataRefRequest : public MultiTaskRequestTemplate<GetDataRefTask>
-{
-public:
-    /**
-     * Construct the request by reading the given number of task
-     * specifications from the given stream.
-     */
-    GetMultiDataRefRequest(uint8_t& result, hu::varadiistvan::scpl::io::DataStream& stream);
-
-    /**
-     * Write the result of an execution.
-     *
-     * If there is at least one invalid dataref, the result will be
-     * RESULT_UNKNOWN_DATAREF followed by a 32-bit unsigned value with
-     * the index of the first unknown dataref.
-     *
-     * Otherwise the result is RESULT_OK, followed by the values of
-     * the datarefs queried.
-     */
-    void writeResult(hu::varadiistvan::scpl::io::DataStream& stream) const;
-};
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplra */
-
-//------------------------------------------------------------------------------
-#endif // XPLRA_GETMULTIDATAREFREQUEST_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/plugin/src/xplra/Globals.cc
===================================================================
--- src/plugin/src/xplra/Globals.cc	(revision 44)
+++ src/plugin/src/xplra/Globals.cc	(revision 44)
@@ -0,0 +1,54 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include "Globals.h"
+
+#include <XPLMUtilities.h>
+
+//------------------------------------------------------------------------------
+
+using xplra::Globals;
+
+//------------------------------------------------------------------------------
+
+Globals::Globals() :
+    menu(messageWindow)
+{
+    XPLMHostApplicationID hostID = 0;
+    XPLMGetVersions(&xplaneVersion, &xplmVersion, &hostID);
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/Globals.cc
===================================================================
--- src/plugin/src/xplra/Globals.cc	(revision 44)
+++ 	(revision )
@@ -1,54 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "Globals.h"
-
-#include <XPLMUtilities.h>
-
-//------------------------------------------------------------------------------
-
-using xplra::Globals;
-
-//------------------------------------------------------------------------------
-
-Globals::Globals() :
-    menu(messageWindow)
-{
-    XPLMHostApplicationID hostID = 0;
-    XPLMGetVersions(&xplaneVersion, &xplmVersion, &hostID);
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/plugin/src/xplra/Globals.h
===================================================================
--- src/plugin/src/xplra/Globals.h	(revision 45)
+++ src/plugin/src/xplra/Globals.h	(revision 45)
@@ -0,0 +1,132 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef XPLRA_GLOBALS_H
+#define XPLRA_GLOBALS_H
+//------------------------------------------------------------------------------
+
+#include "MessageWindow.h"
+#include "Menu.h"
+#include "HotkeyHandler.h"
+
+//------------------------------------------------------------------------------
+
+namespace xplra {
+
+//------------------------------------------------------------------------------
+
+/**
+ * Class containing the globals for the enabled instance of the
+ * plugin.
+ */
+class Globals
+{
+private:
+    /**
+     * The version of X-Plane.
+     */
+    int xplaneVersion;
+
+    /**
+     * The version of the XPLM library.
+     */
+    int xplmVersion;
+
+    /**
+     * The message window.
+     */
+    MessageWindow messageWindow;
+
+    /**
+     * The menu.
+     */
+    Menu menu;
+
+    /**
+     * The hotkey handler.
+     */
+    HotkeyHandler hotkeyHandler;
+
+public:
+    /**
+     * Construct the globals.
+     */
+    Globals();
+
+    /**
+     * Get the versions.
+     */
+    void getVersions(int& xplaneV, int& xplmV) const;
+
+    /**
+     * Get the message window.
+     */
+    MessageWindow& getMessageWindow();
+
+    /**
+     * Get the hotkey handler.
+     */
+    HotkeyHandler& getHotkeyHandler();
+};
+
+//------------------------------------------------------------------------------
+// Inline definitions
+//------------------------------------------------------------------------------
+
+inline void Globals::getVersions(int& xplaneV, int& xplmV) const
+{
+    xplaneV = xplaneVersion;
+    xplmV = xplmVersion;
+}
+
+//------------------------------------------------------------------------------
+
+inline MessageWindow& Globals::getMessageWindow()
+{
+    return messageWindow;
+}
+
+//------------------------------------------------------------------------------
+
+inline HotkeyHandler& Globals::getHotkeyHandler()
+{
+    return hotkeyHandler;
+}
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplra */
+
+//------------------------------------------------------------------------------
+#endif // XPLRA_GLOBALS_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/Globals.h
===================================================================
--- src/plugin/src/xplra/Globals.h	(revision 45)
+++ 	(revision )
@@ -1,132 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLRA_GLOBALS_H
-#define XPLRA_GLOBALS_H
-//------------------------------------------------------------------------------
-
-#include "MessageWindow.h"
-#include "Menu.h"
-#include "HotkeyHandler.h"
-
-//------------------------------------------------------------------------------
-
-namespace xplra {
-
-//------------------------------------------------------------------------------
-
-/**
- * Class containing the globals for the enabled instance of the
- * plugin.
- */
-class Globals
-{
-private:
-    /**
-     * The version of X-Plane.
-     */
-    int xplaneVersion;
-
-    /**
-     * The version of the XPLM library.
-     */
-    int xplmVersion;
-
-    /**
-     * The message window.
-     */
-    MessageWindow messageWindow;
-
-    /**
-     * The menu.
-     */
-    Menu menu;
-
-    /**
-     * The hotkey handler.
-     */
-    HotkeyHandler hotkeyHandler;
-
-public:
-    /**
-     * Construct the globals.
-     */
-    Globals();
-
-    /**
-     * Get the versions.
-     */
-    void getVersions(int& xplaneV, int& xplmV) const;
-
-    /**
-     * Get the message window.
-     */
-    MessageWindow& getMessageWindow();
-
-    /**
-     * Get the hotkey handler.
-     */
-    HotkeyHandler& getHotkeyHandler();
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline void Globals::getVersions(int& xplaneV, int& xplmV) const
-{
-    xplaneV = xplaneVersion;
-    xplmV = xplmVersion;
-}
-
-//------------------------------------------------------------------------------
-
-inline MessageWindow& Globals::getMessageWindow()
-{
-    return messageWindow;
-}
-
-//------------------------------------------------------------------------------
-
-inline HotkeyHandler& Globals::getHotkeyHandler()
-{
-    return hotkeyHandler;
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplra */
-
-//------------------------------------------------------------------------------
-#endif // XPLRA_GLOBALS_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/plugin/src/xplra/HotkeyHandler.cc
===================================================================
--- src/plugin/src/xplra/HotkeyHandler.cc	(revision 46)
+++ src/plugin/src/xplra/HotkeyHandler.cc	(revision 46)
@@ -0,0 +1,166 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include "HotkeyHandler.h"
+
+#include "Protocol.h"
+
+#include <hu/varadiistvan/xplcommon/Util.h>
+
+#include <hu/varadiistvan/scpl/io/DataStream.h>
+
+#include <XPLMDisplay.h>
+
+//------------------------------------------------------------------------------
+
+using xplra::HotkeyHandler;
+
+using hu::varadiistvan::xplcommon::Util;
+
+using hu::varadiistvan::scpl::io::DataStream;
+
+//------------------------------------------------------------------------------
+
+HotkeyHandler::Hotkeys::Hotkeys(size_t numHotkeys, DataStream& stream) :
+    numHotkeys(numHotkeys),
+    hotkeys(new uint16_t[numHotkeys]),
+    pressed(0)
+{
+    if (stream.read(hotkeys, sizeof(uint16_t)*numHotkeys)) {
+        pressed = new uint8_t[numHotkeys];
+        memset(pressed, 0, sizeof(uint8_t)*numHotkeys);
+    } else {
+        delete hotkeys; hotkeys = 0;
+    }
+}
+
+//------------------------------------------------------------------------------
+
+HotkeyHandler::Hotkeys::~Hotkeys()
+{
+    delete [] pressed;
+    delete [] hotkeys;
+}
+
+//------------------------------------------------------------------------------
+
+bool HotkeyHandler::Hotkeys::handleKey(uint16_t code)
+{
+    for(size_t i = 0; i<numHotkeys; ++i) {
+        if (hotkeys[i]==code) {
+            pressed[i] = 1;
+            return true;
+        }
+    }
+    return false;
+}
+
+//------------------------------------------------------------------------------
+
+void HotkeyHandler::Hotkeys::writePressed(DataStream& stream)
+{
+    uint8_t pressed1[numHotkeys];
+
+    for(size_t i = 0; i<numHotkeys; ++i) {
+        pressed1[i] = __sync_val_compare_and_swap(pressed + i, 1, 0);
+    }
+
+    stream.writeU32(numHotkeys);
+    stream.write(pressed1, sizeof(pressed1));
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+int HotkeyHandler::keyCallback(char c, XPLMKeyFlags flags, char virtualKey,
+                               void* refCon)
+{
+    HotkeyHandler* hotkeyHandler = reinterpret_cast<HotkeyHandler*>(refCon);
+    return hotkeyHandler->handleKey(c, flags, virtualKey) ? 0 : 1;
+}
+
+//------------------------------------------------------------------------------
+
+HotkeyHandler::HotkeyHandler()
+{
+    XPLMRegisterKeySniffer(&keyCallback, 0, this);
+}
+
+//------------------------------------------------------------------------------
+
+void HotkeyHandler::registerHotkeys(Hotkeys* hotkeys)
+{
+    mutex.lock();
+    hotkeySets.push_back(hotkeys);
+    mutex.unlock();
+}
+
+//------------------------------------------------------------------------------
+
+void HotkeyHandler::unregisterHotkeys(Hotkeys* hotkeys)
+{
+    mutex.lock();
+    hotkeySets.remove(hotkeys);
+    mutex.unlock();
+}
+
+//------------------------------------------------------------------------------
+
+bool HotkeyHandler::handleKey(char /*c*/, XPLMKeyFlags flags, char virtualKey)
+{
+    if ( (flags&xplm_DownFlag)==0 ) return false;
+
+    uint16_t code = static_cast<uint16_t>(virtualKey);
+    if ( (flags&xplm_ShiftFlag)!=0 ) code |= Protocol::HOTKEY_MODIFIER_SHIFT;
+    if ( (flags&xplm_ControlFlag)!=0 ) code |= Protocol::HOTKEY_MODIFIER_CONTROL;
+
+    bool handled = false;
+
+    mutex.lock();
+    for(hotkeySets_t::iterator i = hotkeySets.begin(); i!=hotkeySets.end();
+        ++i)
+    {
+        Hotkeys* hotkeys = *i;
+        if (hotkeys->handleKey(code)) {
+            handled = true;
+        }
+    }
+    mutex.unlock();
+
+    return handled;
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/HotkeyHandler.cc
===================================================================
--- src/plugin/src/xplra/HotkeyHandler.cc	(revision 46)
+++ 	(revision )
@@ -1,166 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "HotkeyHandler.h"
-
-#include "Protocol.h"
-
-#include <hu/varadiistvan/xplcommon/Util.h>
-
-#include <hu/varadiistvan/scpl/io/DataStream.h>
-
-#include <XPLMDisplay.h>
-
-//------------------------------------------------------------------------------
-
-using xplra::HotkeyHandler;
-
-using hu::varadiistvan::xplcommon::Util;
-
-using hu::varadiistvan::scpl::io::DataStream;
-
-//------------------------------------------------------------------------------
-
-HotkeyHandler::Hotkeys::Hotkeys(size_t numHotkeys, DataStream& stream) :
-    numHotkeys(numHotkeys),
-    hotkeys(new uint16_t[numHotkeys]),
-    pressed(0)
-{
-    if (stream.read(hotkeys, sizeof(uint16_t)*numHotkeys)) {
-        pressed = new uint8_t[numHotkeys];
-        memset(pressed, 0, sizeof(uint8_t)*numHotkeys);
-    } else {
-        delete hotkeys; hotkeys = 0;
-    }
-}
-
-//------------------------------------------------------------------------------
-
-HotkeyHandler::Hotkeys::~Hotkeys()
-{
-    delete [] pressed;
-    delete [] hotkeys;
-}
-
-//------------------------------------------------------------------------------
-
-bool HotkeyHandler::Hotkeys::handleKey(uint16_t code)
-{
-    for(size_t i = 0; i<numHotkeys; ++i) {
-        if (hotkeys[i]==code) {
-            pressed[i] = 1;
-            return true;
-        }
-    }
-    return false;
-}
-
-//------------------------------------------------------------------------------
-
-void HotkeyHandler::Hotkeys::writePressed(DataStream& stream)
-{
-    uint8_t pressed1[numHotkeys];
-
-    for(size_t i = 0; i<numHotkeys; ++i) {
-        pressed1[i] = __sync_val_compare_and_swap(pressed + i, 1, 0);
-    }
-
-    stream.writeU32(numHotkeys);
-    stream.write(pressed1, sizeof(pressed1));
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-int HotkeyHandler::keyCallback(char c, XPLMKeyFlags flags, char virtualKey,
-                               void* refCon)
-{
-    HotkeyHandler* hotkeyHandler = reinterpret_cast<HotkeyHandler*>(refCon);
-    return hotkeyHandler->handleKey(c, flags, virtualKey) ? 0 : 1;
-}
-
-//------------------------------------------------------------------------------
-
-HotkeyHandler::HotkeyHandler()
-{
-    XPLMRegisterKeySniffer(&keyCallback, 0, this);
-}
-
-//------------------------------------------------------------------------------
-
-void HotkeyHandler::registerHotkeys(Hotkeys* hotkeys)
-{
-    mutex.lock();
-    hotkeySets.push_back(hotkeys);
-    mutex.unlock();
-}
-
-//------------------------------------------------------------------------------
-
-void HotkeyHandler::unregisterHotkeys(Hotkeys* hotkeys)
-{
-    mutex.lock();
-    hotkeySets.remove(hotkeys);
-    mutex.unlock();
-}
-
-//------------------------------------------------------------------------------
-
-bool HotkeyHandler::handleKey(char /*c*/, XPLMKeyFlags flags, char virtualKey)
-{
-    if ( (flags&xplm_DownFlag)==0 ) return false;
-
-    uint16_t code = static_cast<uint16_t>(virtualKey);
-    if ( (flags&xplm_ShiftFlag)!=0 ) code |= Protocol::HOTKEY_MODIFIER_SHIFT;
-    if ( (flags&xplm_ControlFlag)!=0 ) code |= Protocol::HOTKEY_MODIFIER_CONTROL;
-
-    bool handled = false;
-
-    mutex.lock();
-    for(hotkeySets_t::iterator i = hotkeySets.begin(); i!=hotkeySets.end();
-        ++i)
-    {
-        Hotkeys* hotkeys = *i;
-        if (hotkeys->handleKey(code)) {
-            handled = true;
-        }
-    }
-    mutex.unlock();
-
-    return handled;
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/plugin/src/xplra/HotkeyHandler.h
===================================================================
--- src/plugin/src/xplra/HotkeyHandler.h	(revision 45)
+++ src/plugin/src/xplra/HotkeyHandler.h	(revision 45)
@@ -0,0 +1,185 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef XPLRA_HOTKEYHANDLER_H
+#define XPLRA_HOTKEYHANDLER_H
+//------------------------------------------------------------------------------
+
+#include <hu/varadiistvan/scpl/Mutex.h>
+
+#include <XPLMDefs.h>
+
+#include <list>
+
+#include <inttypes.h>
+
+//------------------------------------------------------------------------------
+
+namespace hu { namespace varadiistvan { namespace scpl { namespace io {
+
+class DataStream;
+
+} } } }
+
+//------------------------------------------------------------------------------
+
+namespace xplra {
+
+//------------------------------------------------------------------------------
+
+/**
+ * The handler for hotkeys.
+ */
+class HotkeyHandler
+{
+public:
+    /**
+     * A set of hotkeys for a client.
+     */
+    class Hotkeys
+    {
+    private:
+        /**
+         * The number of hotkeys.
+         */
+        size_t numHotkeys;
+
+        /**
+         * The hotkey codes.
+         */
+        uint16_t* hotkeys;
+
+        /**
+         * The array of indicators whether the hotkey at the given
+         * index in the array of codes has been pressed.
+         */
+        uint8_t* pressed;
+
+    public:
+        /**
+         * Construct the set of hotkeys by reading the data from the
+         * given data stream.
+         */
+        Hotkeys(size_t numHotkeys, hu::varadiistvan::scpl::io::DataStream& stream);
+
+        /**
+         * Destroy the set of hotkeys.
+         */
+        ~Hotkeys();
+
+        /**
+         * Determine if this hotkey set is valid.
+         */
+        bool isValid() const;
+
+        /**
+         * Handle the hotkey with the given code. If it matches any of
+         * the codes registered, the corresponding value in the
+         * pressed array will be set atomically.
+         *
+         * @return whether the hotkey was handled or not.
+         */
+        bool handleKey(uint16_t code);
+
+        /**
+         * Write the pressed indicators into the given stream. It also
+         * clears the indicators.
+         */
+        void writePressed(hu::varadiistvan::scpl::io::DataStream& stream);
+    };
+
+    friend class Hotkeys;
+
+private:
+    /**
+     * Type for the the list of hotkey sets.
+     */
+    typedef std::list<Hotkeys*> hotkeySets_t;
+
+    /**
+     * The callback function receiving the keypresses.
+     */
+    static int keyCallback(char c, XPLMKeyFlags flags, char virtualKey,
+                           void* refCon);
+
+    /**
+     * Mutex to protect some common data structures.
+     */
+    hu::varadiistvan::scpl::Mutex mutex;
+
+    /**
+     * The list of hotkey sets.
+     */
+    hotkeySets_t hotkeySets;
+
+public:
+    /**
+     * Construct the hotkey handler.
+     */
+    HotkeyHandler();
+
+    /**
+     * Register the given set of hotkeys.
+     */
+    void registerHotkeys(Hotkeys* hotkeys);
+
+    /**
+     * Unregister the given set of hotkeys.
+     */
+    void unregisterHotkeys(Hotkeys* hotkeys);
+
+protected:
+    /**
+     * Handle the given hotkey code.
+     *
+     * @return true if the hotkey was handled, false otherwise.
+     */
+    bool handleKey(char c, XPLMKeyFlags flags, char virtualKey);
+};
+
+//------------------------------------------------------------------------------
+// Inline definitions
+//------------------------------------------------------------------------------
+
+inline bool HotkeyHandler::Hotkeys::isValid() const
+{
+    return hotkeys!=0;
+}
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplra */
+
+//------------------------------------------------------------------------------
+#endif // XPLRA_HOTKEYHANDLER_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/HotkeyHandler.h
===================================================================
--- src/plugin/src/xplra/HotkeyHandler.h	(revision 45)
+++ 	(revision )
@@ -1,185 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLRA_HOTKEYHANDLER_H
-#define XPLRA_HOTKEYHANDLER_H
-//------------------------------------------------------------------------------
-
-#include <hu/varadiistvan/scpl/Mutex.h>
-
-#include <XPLMDefs.h>
-
-#include <list>
-
-#include <inttypes.h>
-
-//------------------------------------------------------------------------------
-
-namespace hu { namespace varadiistvan { namespace scpl { namespace io {
-
-class DataStream;
-
-} } } }
-
-//------------------------------------------------------------------------------
-
-namespace xplra {
-
-//------------------------------------------------------------------------------
-
-/**
- * The handler for hotkeys.
- */
-class HotkeyHandler
-{
-public:
-    /**
-     * A set of hotkeys for a client.
-     */
-    class Hotkeys
-    {
-    private:
-        /**
-         * The number of hotkeys.
-         */
-        size_t numHotkeys;
-
-        /**
-         * The hotkey codes.
-         */
-        uint16_t* hotkeys;
-
-        /**
-         * The array of indicators whether the hotkey at the given
-         * index in the array of codes has been pressed.
-         */
-        uint8_t* pressed;
-
-    public:
-        /**
-         * Construct the set of hotkeys by reading the data from the
-         * given data stream.
-         */
-        Hotkeys(size_t numHotkeys, hu::varadiistvan::scpl::io::DataStream& stream);
-
-        /**
-         * Destroy the set of hotkeys.
-         */
-        ~Hotkeys();
-
-        /**
-         * Determine if this hotkey set is valid.
-         */
-        bool isValid() const;
-
-        /**
-         * Handle the hotkey with the given code. If it matches any of
-         * the codes registered, the corresponding value in the
-         * pressed array will be set atomically.
-         *
-         * @return whether the hotkey was handled or not.
-         */
-        bool handleKey(uint16_t code);
-
-        /**
-         * Write the pressed indicators into the given stream. It also
-         * clears the indicators.
-         */
-        void writePressed(hu::varadiistvan::scpl::io::DataStream& stream);
-    };
-
-    friend class Hotkeys;
-
-private:
-    /**
-     * Type for the the list of hotkey sets.
-     */
-    typedef std::list<Hotkeys*> hotkeySets_t;
-
-    /**
-     * The callback function receiving the keypresses.
-     */
-    static int keyCallback(char c, XPLMKeyFlags flags, char virtualKey,
-                           void* refCon);
-
-    /**
-     * Mutex to protect some common data structures.
-     */
-    hu::varadiistvan::scpl::Mutex mutex;
-
-    /**
-     * The list of hotkey sets.
-     */
-    hotkeySets_t hotkeySets;
-
-public:
-    /**
-     * Construct the hotkey handler.
-     */
-    HotkeyHandler();
-
-    /**
-     * Register the given set of hotkeys.
-     */
-    void registerHotkeys(Hotkeys* hotkeys);
-
-    /**
-     * Unregister the given set of hotkeys.
-     */
-    void unregisterHotkeys(Hotkeys* hotkeys);
-
-protected:
-    /**
-     * Handle the given hotkey code.
-     *
-     * @return true if the hotkey was handled, false otherwise.
-     */
-    bool handleKey(char c, XPLMKeyFlags flags, char virtualKey);
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline bool HotkeyHandler::Hotkeys::isValid() const
-{
-    return hotkeys!=0;
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplra */
-
-//------------------------------------------------------------------------------
-#endif // XPLRA_HOTKEYHANDLER_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/plugin/src/xplra/ListenThread.cc
===================================================================
--- src/plugin/src/xplra/ListenThread.cc	(revision 61)
+++ src/plugin/src/xplra/ListenThread.cc	(revision 61)
@@ -0,0 +1,76 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include "ListenThread.h"
+
+#include "ServerThread.h"
+
+#include <hu/varadiistvan/scpl/io/LocalServerSocket.h>
+#include <hu/varadiistvan/scpl/io/LocalAcceptor.h>
+#include <hu/varadiistvan/xplcommon/Util.h>
+
+//------------------------------------------------------------------------------
+
+using xplra::ListenThread;
+
+using hu::varadiistvan::scpl::io::LocalServerSocket;
+using hu::varadiistvan::scpl::io::LocalAcceptor;
+using hu::varadiistvan::xplcommon::Util;
+
+//------------------------------------------------------------------------------
+
+void ListenThread::run()
+{
+    Util::debug("xplra::ListenThread::run: started\n");
+
+    LocalServerSocket socket("xplra", &waiter);
+    LocalAcceptor& acceptor = socket.getAcceptor();
+    while(!quitEvent.check() && !quitEvent.failed() && !acceptor.failed()) {
+        while (acceptor.accept()) {
+            ServerThread* serverThread = new ServerThread(*this,
+                                                          requestQueue,
+                                                          acceptor);
+            serverThread->start();
+        }
+        waiter.wait();
+    }
+
+    ServerThread::quitAll();
+
+    Util::debug("xplra::ListenThread::run: quitting\n");
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/ListenThread.cc
===================================================================
--- src/plugin/src/xplra/ListenThread.cc	(revision 61)
+++ 	(revision )
@@ -1,76 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "ListenThread.h"
-
-#include "ServerThread.h"
-
-#include <hu/varadiistvan/scpl/io/LocalServerSocket.h>
-#include <hu/varadiistvan/scpl/io/LocalAcceptor.h>
-#include <hu/varadiistvan/xplcommon/Util.h>
-
-//------------------------------------------------------------------------------
-
-using xplra::ListenThread;
-
-using hu::varadiistvan::scpl::io::LocalServerSocket;
-using hu::varadiistvan::scpl::io::LocalAcceptor;
-using hu::varadiistvan::xplcommon::Util;
-
-//------------------------------------------------------------------------------
-
-void ListenThread::run()
-{
-    Util::debug("xplra::ListenThread::run: started\n");
-
-    LocalServerSocket socket("xplra", &waiter);
-    LocalAcceptor& acceptor = socket.getAcceptor();
-    while(!quitEvent.check() && !quitEvent.failed() && !acceptor.failed()) {
-        while (acceptor.accept()) {
-            ServerThread* serverThread = new ServerThread(*this,
-                                                          requestQueue,
-                                                          acceptor);
-            serverThread->start();
-        }
-        waiter.wait();
-    }
-
-    ServerThread::quitAll();
-
-    Util::debug("xplra::ListenThread::run: quitting\n");
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/plugin/src/xplra/ListenThread.h
===================================================================
--- src/plugin/src/xplra/ListenThread.h	(revision 46)
+++ src/plugin/src/xplra/ListenThread.h	(revision 46)
@@ -0,0 +1,138 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef XPLRA_LISTENTHREAD_H
+#define XPLRA_LISTENTHREAD_H
+//------------------------------------------------------------------------------
+
+#include <hu/varadiistvan/scpl/Thread.h>
+
+#include "RequestQueue.h"
+
+#include <hu/varadiistvan/scpl/io/Waiter.h>
+#include <hu/varadiistvan/scpl/io/WaitableEvent.h>
+
+//------------------------------------------------------------------------------
+
+namespace xplra {
+
+//------------------------------------------------------------------------------
+
+class Globals;
+
+//------------------------------------------------------------------------------
+
+/**
+ * The thread that listens to incoming connections and starts the
+ * client serving threads.
+ *
+ * This is a detached thread, to allow it to quit automatically.
+ */
+class ListenThread : public hu::varadiistvan::scpl::Thread
+{
+private:
+    /**
+     * The global objects.
+     */
+    Globals& globals;
+
+    /**
+     * The waiter used in the thread.
+     */
+    hu::varadiistvan::scpl::io::Waiter waiter;
+
+    /**
+     * The event that can be fired to notify the thread that it should
+     * quit.
+     */
+    hu::varadiistvan::scpl::io::WaitableEvent quitEvent;
+
+    /**
+     * The queue for the requests.
+     */
+    RequestQueue requestQueue;
+
+public:
+    /**
+     * Construct the thread.
+     */
+    ListenThread(Globals& globals);
+
+    /**
+     * Get the globals
+     */
+    Globals& getGlobals();
+
+    /**
+     * Notify the thread to quit.
+     */
+    void quit();
+
+    /**
+     * Perform the thread's operation.
+     */
+    virtual void run();
+};
+
+//------------------------------------------------------------------------------
+// Inline definitions
+//------------------------------------------------------------------------------
+
+inline ListenThread::ListenThread(Globals& globals) :
+    globals(globals),
+    quitEvent(&waiter)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline Globals& ListenThread::getGlobals()
+{
+    return globals;
+}
+
+//------------------------------------------------------------------------------
+
+inline void ListenThread::quit()
+{
+    requestQueue.disable();
+    quitEvent.fire();
+}
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplra */
+
+//------------------------------------------------------------------------------
+#endif // XPLRA_LISTENTHREAD_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/ListenThread.h
===================================================================
--- src/plugin/src/xplra/ListenThread.h	(revision 46)
+++ 	(revision )
@@ -1,138 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLRA_LISTENTHREAD_H
-#define XPLRA_LISTENTHREAD_H
-//------------------------------------------------------------------------------
-
-#include <hu/varadiistvan/scpl/Thread.h>
-
-#include "RequestQueue.h"
-
-#include <hu/varadiistvan/scpl/io/Waiter.h>
-#include <hu/varadiistvan/scpl/io/WaitableEvent.h>
-
-//------------------------------------------------------------------------------
-
-namespace xplra {
-
-//------------------------------------------------------------------------------
-
-class Globals;
-
-//------------------------------------------------------------------------------
-
-/**
- * The thread that listens to incoming connections and starts the
- * client serving threads.
- *
- * This is a detached thread, to allow it to quit automatically.
- */
-class ListenThread : public hu::varadiistvan::scpl::Thread
-{
-private:
-    /**
-     * The global objects.
-     */
-    Globals& globals;
-
-    /**
-     * The waiter used in the thread.
-     */
-    hu::varadiistvan::scpl::io::Waiter waiter;
-
-    /**
-     * The event that can be fired to notify the thread that it should
-     * quit.
-     */
-    hu::varadiistvan::scpl::io::WaitableEvent quitEvent;
-
-    /**
-     * The queue for the requests.
-     */
-    RequestQueue requestQueue;
-
-public:
-    /**
-     * Construct the thread.
-     */
-    ListenThread(Globals& globals);
-
-    /**
-     * Get the globals
-     */
-    Globals& getGlobals();
-
-    /**
-     * Notify the thread to quit.
-     */
-    void quit();
-
-    /**
-     * Perform the thread's operation.
-     */
-    virtual void run();
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline ListenThread::ListenThread(Globals& globals) :
-    globals(globals),
-    quitEvent(&waiter)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline Globals& ListenThread::getGlobals()
-{
-    return globals;
-}
-
-//------------------------------------------------------------------------------
-
-inline void ListenThread::quit()
-{
-    requestQueue.disable();
-    quitEvent.fire();
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplra */
-
-//------------------------------------------------------------------------------
-#endif // XPLRA_LISTENTHREAD_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/plugin/src/xplra/Makefile.am
===================================================================
--- src/plugin/src/xplra/Makefile.am	(revision 91)
+++ src/plugin/src/xplra/Makefile.am	(revision 91)
@@ -0,0 +1,83 @@
+AM_CPPFLAGS=@XPSDK_INCLUDES@
+
+AM_CXXFLAGS=$(VSCPL_CFLAGS) $(LIBXPLCOMMON_CFLAGS)
+
+if XPLANE_9
+XPLMDEFINES=-DXPLM100
+else
+XPLMDEFINES=-DXPLM200 -DXPLM210
+endif
+
+AM_CPPFLAGS+=$(XPLMDEFINES)
+
+SRCS= \
+	plugin.cc			\
+	ListenThread.cc			\
+	RequestQueue.cc			\
+	ServerThread.cc			\
+	TaskRequest.cc			\
+	DataRefTask.cc			\
+	GetDataRefTask.cc		\
+	SetDataRefTask.cc		\
+	MultiTaskRequest.cc		\
+	GetMultiDataRefRequest.cc	\
+	SetMultiDataRefRequest.cc	\
+	ReloadPluginsRequest.cc		\
+	Globals.cc			\
+	MessageWindow.cc		\
+	MessageRequest.cc		\
+	Menu.cc				\
+	HotkeyHandler.cc
+
+if !XPLANE_9
+SRCS+=SaveSituationRequest.cc
+endif
+
+noinst_HEADERS= \
+	ListenThread.h			\
+	Request.h			\
+	RequestQueue.h			\
+	Protocol.h			\
+	ServerThread.h			\
+	Task.h				\
+	TaskRequest.h			\
+	DataRefTask.h			\
+	GetDataRefTask.h		\
+	SetDataRefTask.h		\
+	MultiTaskRequest.h		\
+	GetMultiDataRefRequest.h	\
+	SetMultiDataRefRequest.h	\
+	ReloadPluginsRequest.h		\
+	SaveSituationRequest.h		\
+	Globals.h			\
+	MessageWindow.h			\
+	MessageRequest.h		\
+	Menu.h				\
+	HotkeyHandler.h
+
+if TARGET_API_POSIX
+AM_CPPFLAGS+=-DLIN
+AM_CXXFLAGS+=-fPIC -fno-stack-protector
+AM_LDFLAGS=-shared -rdynamic -nodefaultlibs -undefined_warning -Wl,-version-script=$(srcdir)/version.ldscript -Wl,-Bstatic
+noinst_PROGRAMS=lin.xpl
+lin_xpl_SOURCES=$(SRCS)
+lin_xpl_LDADD=$(VSCPL_LIBS) $(LIBXPLCOMMON_LIBS)
+endif
+
+if TARGET_API_WIN32
+AM_CPPFLAGS+=-DIBM
+AM_LDFLAGS=-shared -Wl,--enable-auto-image-base -static -static-libgcc -static-libstdc++
+
+noinst_PROGRAMS=win.xpl
+win_xpl_SOURCES=$(SRCS)
+
+win_xpl_LDADD=$(LIBXPLCOMMON_LIBS) $(VSCPL_LIBS)
+win_xpl_LDADD+=@XPSDK_LDFLAGS@
+if TARGET_API_WIN64
+win_xpl_LDADD+=-lXPLM_64
+else
+win_xpl_LDADD+=-lXPLM
+endif
+endif
+
+EXTRA_DIST=version.ldscript
Index: src/plugin/src/xplra/Makefile.am
===================================================================
--- src/plugin/src/xplra/Makefile.am	(revision 91)
+++ 	(revision )
@@ -1,83 +1,0 @@
-AM_CPPFLAGS=@XPSDK_INCLUDES@
-
-AM_CXXFLAGS=$(VSCPL_CFLAGS) $(LIBXPLCOMMON_CFLAGS)
-
-if XPLANE_9
-XPLMDEFINES=-DXPLM100
-else
-XPLMDEFINES=-DXPLM200 -DXPLM210
-endif
-
-AM_CPPFLAGS+=$(XPLMDEFINES)
-
-SRCS= \
-	plugin.cc			\
-	ListenThread.cc			\
-	RequestQueue.cc			\
-	ServerThread.cc			\
-	TaskRequest.cc			\
-	DataRefTask.cc			\
-	GetDataRefTask.cc		\
-	SetDataRefTask.cc		\
-	MultiTaskRequest.cc		\
-	GetMultiDataRefRequest.cc	\
-	SetMultiDataRefRequest.cc	\
-	ReloadPluginsRequest.cc		\
-	Globals.cc			\
-	MessageWindow.cc		\
-	MessageRequest.cc		\
-	Menu.cc				\
-	HotkeyHandler.cc
-
-if !XPLANE_9
-SRCS+=SaveSituationRequest.cc
-endif
-
-noinst_HEADERS= \
-	ListenThread.h			\
-	Request.h			\
-	RequestQueue.h			\
-	Protocol.h			\
-	ServerThread.h			\
-	Task.h				\
-	TaskRequest.h			\
-	DataRefTask.h			\
-	GetDataRefTask.h		\
-	SetDataRefTask.h		\
-	MultiTaskRequest.h		\
-	GetMultiDataRefRequest.h	\
-	SetMultiDataRefRequest.h	\
-	ReloadPluginsRequest.h		\
-	SaveSituationRequest.h		\
-	Globals.h			\
-	MessageWindow.h			\
-	MessageRequest.h		\
-	Menu.h				\
-	HotkeyHandler.h
-
-if TARGET_API_POSIX
-AM_CPPFLAGS+=-DLIN
-AM_CXXFLAGS+=-fPIC -fno-stack-protector
-AM_LDFLAGS=-shared -rdynamic -nodefaultlibs -undefined_warning -Wl,-version-script=$(srcdir)/version.ldscript -Wl,-Bstatic
-noinst_PROGRAMS=lin.xpl
-lin_xpl_SOURCES=$(SRCS)
-lin_xpl_LDADD=$(VSCPL_LIBS) $(LIBXPLCOMMON_LIBS)
-endif
-
-if TARGET_API_WIN32
-AM_CPPFLAGS+=-DIBM
-AM_LDFLAGS=-shared -Wl,--enable-auto-image-base -static -static-libgcc -static-libstdc++
-
-noinst_PROGRAMS=win.xpl
-win_xpl_SOURCES=$(SRCS)
-
-win_xpl_LDADD=$(LIBXPLCOMMON_LIBS) $(VSCPL_LIBS)
-win_xpl_LDADD+=@XPSDK_LDFLAGS@
-if TARGET_API_WIN64
-win_xpl_LDADD+=-lXPLM_64
-else
-win_xpl_LDADD+=-lXPLM
-endif
-endif
-
-EXTRA_DIST=version.ldscript
Index: src/plugin/src/xplra/Menu.cc
===================================================================
--- src/plugin/src/xplra/Menu.cc	(revision 47)
+++ src/plugin/src/xplra/Menu.cc	(revision 47)
@@ -0,0 +1,96 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include "Menu.h"
+
+#include "MessageWindow.h"
+
+//------------------------------------------------------------------------------
+
+using xplra::Menu;
+
+//------------------------------------------------------------------------------
+
+void* const Menu::showMessageAreaRef = reinterpret_cast<void*>(1);
+
+void* const Menu::resetMessageAreaRef = reinterpret_cast<void*>(2);
+
+//------------------------------------------------------------------------------
+
+void Menu::menuHandlerCallback(void* menuRef, void* itemRef)
+{
+    Menu* menu = reinterpret_cast<Menu*>(menuRef);
+    menu->handleMenu(itemRef);
+}
+
+//------------------------------------------------------------------------------
+
+Menu::Menu(MessageWindow& messageWindow) :
+    messageWindow(messageWindow),
+    menuID(0),
+    showMessageAreaIndex(-1)
+{
+    XPLMMenuID pluginsMenuID = XPLMFindPluginsMenu();
+
+    int menuIndex = XPLMAppendMenuItem(pluginsMenuID, "Remote Access", 0, 1);
+    menuID = XPLMCreateMenu("Remote Access", pluginsMenuID, menuIndex,
+                            &menuHandlerCallback, this);
+    showMessageAreaIndex = XPLMAppendMenuItem(menuID, "Show message area",
+                                              showMessageAreaRef, 1);
+    XPLMCheckMenuItem(menuID, showMessageAreaIndex, xplm_Menu_Unchecked);
+    XPLMAppendMenuItem(menuID, "Reset message area", resetMessageAreaRef, 1);
+}
+
+//------------------------------------------------------------------------------
+
+void Menu::handleMenu(void* itemRef)
+{
+    if (itemRef==showMessageAreaRef) {
+        XPLMMenuCheck checked = xplm_Menu_NoCheck;
+        XPLMCheckMenuItemState(menuID, showMessageAreaIndex, &checked);
+        if (checked==xplm_Menu_Unchecked) {
+            XPLMCheckMenuItem(menuID, showMessageAreaIndex, xplm_Menu_Checked);
+            messageWindow.show();
+        } else if (checked==xplm_Menu_Checked) {
+            XPLMCheckMenuItem(menuID, showMessageAreaIndex, xplm_Menu_Unchecked);
+            messageWindow.hide();
+        }
+    } else if (itemRef==resetMessageAreaRef) {
+        messageWindow.reset();
+    }
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/Menu.cc
===================================================================
--- src/plugin/src/xplra/Menu.cc	(revision 47)
+++ 	(revision )
@@ -1,96 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "Menu.h"
-
-#include "MessageWindow.h"
-
-//------------------------------------------------------------------------------
-
-using xplra::Menu;
-
-//------------------------------------------------------------------------------
-
-void* const Menu::showMessageAreaRef = reinterpret_cast<void*>(1);
-
-void* const Menu::resetMessageAreaRef = reinterpret_cast<void*>(2);
-
-//------------------------------------------------------------------------------
-
-void Menu::menuHandlerCallback(void* menuRef, void* itemRef)
-{
-    Menu* menu = reinterpret_cast<Menu*>(menuRef);
-    menu->handleMenu(itemRef);
-}
-
-//------------------------------------------------------------------------------
-
-Menu::Menu(MessageWindow& messageWindow) :
-    messageWindow(messageWindow),
-    menuID(0),
-    showMessageAreaIndex(-1)
-{
-    XPLMMenuID pluginsMenuID = XPLMFindPluginsMenu();
-
-    int menuIndex = XPLMAppendMenuItem(pluginsMenuID, "Remote Access", 0, 1);
-    menuID = XPLMCreateMenu("Remote Access", pluginsMenuID, menuIndex,
-                            &menuHandlerCallback, this);
-    showMessageAreaIndex = XPLMAppendMenuItem(menuID, "Show message area",
-                                              showMessageAreaRef, 1);
-    XPLMCheckMenuItem(menuID, showMessageAreaIndex, xplm_Menu_Unchecked);
-    XPLMAppendMenuItem(menuID, "Reset message area", resetMessageAreaRef, 1);
-}
-
-//------------------------------------------------------------------------------
-
-void Menu::handleMenu(void* itemRef)
-{
-    if (itemRef==showMessageAreaRef) {
-        XPLMMenuCheck checked = xplm_Menu_NoCheck;
-        XPLMCheckMenuItemState(menuID, showMessageAreaIndex, &checked);
-        if (checked==xplm_Menu_Unchecked) {
-            XPLMCheckMenuItem(menuID, showMessageAreaIndex, xplm_Menu_Checked);
-            messageWindow.show();
-        } else if (checked==xplm_Menu_Checked) {
-            XPLMCheckMenuItem(menuID, showMessageAreaIndex, xplm_Menu_Unchecked);
-            messageWindow.hide();
-        }
-    } else if (itemRef==resetMessageAreaRef) {
-        messageWindow.reset();
-    }
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/plugin/src/xplra/Menu.h
===================================================================
--- src/plugin/src/xplra/Menu.h	(revision 47)
+++ src/plugin/src/xplra/Menu.h	(revision 47)
@@ -0,0 +1,106 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef XPLRA_MENU_H
+#define XPLRA_MENU_H
+//------------------------------------------------------------------------------
+
+#include <XPLMMenus.h>
+
+//------------------------------------------------------------------------------
+
+namespace xplra {
+
+//------------------------------------------------------------------------------
+
+class MessageWindow;
+
+//------------------------------------------------------------------------------
+
+/**
+ * The menu handler.
+ */
+class Menu
+{
+private:
+    /**
+     * The menu handler callback.
+     */
+    static void menuHandlerCallback(void* menuRef, void* itemRef);
+
+    /**
+     * Item reference for the show message area menu item.
+     */
+    static void* const showMessageAreaRef;
+
+    /**
+     * Item reference for the show message area menu item.
+     */
+    static void* const resetMessageAreaRef;
+
+    /**
+     * Reference to the message window.
+     */
+    MessageWindow& messageWindow;
+
+    /**
+     * The menu ID.
+     */
+    XPLMMenuID menuID;
+
+    /**
+     * The index of the "Show Message Area" menu item.
+     */
+    int showMessageAreaIndex;
+
+public:
+    /**
+     * Construct the menu. It creates the menu for the plugin under
+     * the Plugins menu
+     */
+    Menu(MessageWindow& messageWindow);
+
+protected:
+    /**
+     * Handle the menu clicks.
+     */
+    void handleMenu(void* itemRef);
+};
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplra */
+
+//------------------------------------------------------------------------------
+#endif // XPLRA_MENU_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/Menu.h
===================================================================
--- src/plugin/src/xplra/Menu.h	(revision 47)
+++ 	(revision )
@@ -1,106 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLRA_MENU_H
-#define XPLRA_MENU_H
-//------------------------------------------------------------------------------
-
-#include <XPLMMenus.h>
-
-//------------------------------------------------------------------------------
-
-namespace xplra {
-
-//------------------------------------------------------------------------------
-
-class MessageWindow;
-
-//------------------------------------------------------------------------------
-
-/**
- * The menu handler.
- */
-class Menu
-{
-private:
-    /**
-     * The menu handler callback.
-     */
-    static void menuHandlerCallback(void* menuRef, void* itemRef);
-
-    /**
-     * Item reference for the show message area menu item.
-     */
-    static void* const showMessageAreaRef;
-
-    /**
-     * Item reference for the show message area menu item.
-     */
-    static void* const resetMessageAreaRef;
-
-    /**
-     * Reference to the message window.
-     */
-    MessageWindow& messageWindow;
-
-    /**
-     * The menu ID.
-     */
-    XPLMMenuID menuID;
-
-    /**
-     * The index of the "Show Message Area" menu item.
-     */
-    int showMessageAreaIndex;
-
-public:
-    /**
-     * Construct the menu. It creates the menu for the plugin under
-     * the Plugins menu
-     */
-    Menu(MessageWindow& messageWindow);
-
-protected:
-    /**
-     * Handle the menu clicks.
-     */
-    void handleMenu(void* itemRef);
-};
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplra */
-
-//------------------------------------------------------------------------------
-#endif // XPLRA_MENU_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/plugin/src/xplra/MessageRequest.cc
===================================================================
--- src/plugin/src/xplra/MessageRequest.cc	(revision 38)
+++ src/plugin/src/xplra/MessageRequest.cc	(revision 38)
@@ -0,0 +1,52 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include "MessageRequest.h"
+
+#include "MessageWindow.h"
+
+//------------------------------------------------------------------------------
+
+using xplra::MessageRequest;
+
+//------------------------------------------------------------------------------
+
+void MessageRequest::execute()
+{
+    messageWindow.setNewMessage(message, duration);
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/MessageRequest.cc
===================================================================
--- src/plugin/src/xplra/MessageRequest.cc	(revision 38)
+++ 	(revision )
@@ -1,52 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "MessageRequest.h"
-
-#include "MessageWindow.h"
-
-//------------------------------------------------------------------------------
-
-using xplra::MessageRequest;
-
-//------------------------------------------------------------------------------
-
-void MessageRequest::execute()
-{
-    messageWindow.setNewMessage(message, duration);
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/plugin/src/xplra/MessageRequest.h
===================================================================
--- src/plugin/src/xplra/MessageRequest.h	(revision 38)
+++ src/plugin/src/xplra/MessageRequest.h	(revision 38)
@@ -0,0 +1,106 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef XPLRA_MESSAGEREQUEST_H
+#define XPLRA_MESSAGEREQUEST_H
+//------------------------------------------------------------------------------
+
+#include "Request.h"
+
+#include <string>
+
+//------------------------------------------------------------------------------
+
+namespace xplra {
+
+//------------------------------------------------------------------------------
+
+class MessageWindow;
+
+//------------------------------------------------------------------------------
+
+/**
+ * A request that sets up a new message to be displayed in the message window.
+ */
+class MessageRequest : public Request
+{
+private:
+    /**
+     * The message window to use.
+     */
+    MessageWindow& messageWindow;
+
+    /**
+     * The message.
+     */
+    std::string message;
+
+    /**
+     * The duration.
+     */
+    float duration;
+
+public:
+    /**
+     * Construct the request.
+     */
+    MessageRequest(MessageWindow& messageWindow,
+                   const std::string& message, float duration);
+
+protected:
+    /**
+     * Execute the request by
+     */
+    virtual void execute();
+};
+
+//------------------------------------------------------------------------------
+// Inline definitions
+//------------------------------------------------------------------------------
+
+inline MessageRequest::MessageRequest(MessageWindow& messageWindow,
+                                      const std::string& message,
+                                      float duration) :
+    messageWindow(messageWindow),
+    message(message),
+    duration(duration)
+{
+}
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplra */
+
+//------------------------------------------------------------------------------
+#endif // XPLRA_MESSAGEREQUEST_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/MessageRequest.h
===================================================================
--- src/plugin/src/xplra/MessageRequest.h	(revision 38)
+++ 	(revision )
@@ -1,106 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLRA_MESSAGEREQUEST_H
-#define XPLRA_MESSAGEREQUEST_H
-//------------------------------------------------------------------------------
-
-#include "Request.h"
-
-#include <string>
-
-//------------------------------------------------------------------------------
-
-namespace xplra {
-
-//------------------------------------------------------------------------------
-
-class MessageWindow;
-
-//------------------------------------------------------------------------------
-
-/**
- * A request that sets up a new message to be displayed in the message window.
- */
-class MessageRequest : public Request
-{
-private:
-    /**
-     * The message window to use.
-     */
-    MessageWindow& messageWindow;
-
-    /**
-     * The message.
-     */
-    std::string message;
-
-    /**
-     * The duration.
-     */
-    float duration;
-
-public:
-    /**
-     * Construct the request.
-     */
-    MessageRequest(MessageWindow& messageWindow,
-                   const std::string& message, float duration);
-
-protected:
-    /**
-     * Execute the request by
-     */
-    virtual void execute();
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline MessageRequest::MessageRequest(MessageWindow& messageWindow,
-                                      const std::string& message,
-                                      float duration) :
-    messageWindow(messageWindow),
-    message(message),
-    duration(duration)
-{
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplra */
-
-//------------------------------------------------------------------------------
-#endif // XPLRA_MESSAGEREQUEST_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/plugin/src/xplra/MessageWindow.cc
===================================================================
--- src/plugin/src/xplra/MessageWindow.cc	(revision 51)
+++ src/plugin/src/xplra/MessageWindow.cc	(revision 51)
@@ -0,0 +1,315 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include "MessageWindow.h"
+
+#include <hu/varadiistvan/xplcommon/Util.h>
+
+#include <XPLMProcessing.h>
+#include <XPLMGraphics.h>
+
+//------------------------------------------------------------------------------
+
+using xplra::MessageWindow;
+
+using hu::varadiistvan::xplcommon::Util;
+
+using std::string;
+using std::min;
+using std::max;
+
+//------------------------------------------------------------------------------
+
+void MessageWindow::drawWindowCallback(XPLMWindowID /*windowID*/, void* refCon)
+{
+    MessageWindow* messageWindow = reinterpret_cast<MessageWindow*>(refCon);
+    messageWindow->drawWindow();
+}
+
+//------------------------------------------------------------------------------
+
+void MessageWindow::handleKeyCallback(XPLMWindowID /*windowID*/, char key,
+                                      XPLMKeyFlags flags, char virtualKey,
+                                      void* refCon, int losingFocus)
+{
+    MessageWindow* messageWindow = reinterpret_cast<MessageWindow*>(refCon);
+    messageWindow->handleKey(key, flags, virtualKey, losingFocus!=0);
+}
+
+//------------------------------------------------------------------------------
+
+int MessageWindow::handleMouseClickCallback(XPLMWindowID /*windowID*/,
+                                            int x, int y,
+                                            XPLMMouseStatus mouse, void* refCon)
+{
+    MessageWindow* messageWindow = reinterpret_cast<MessageWindow*>(refCon);
+    return messageWindow->handleMouseClick(x, y, mouse) ? 1 : 0;
+}
+
+//------------------------------------------------------------------------------
+
+MessageWindow::MessageWindow() :
+    maxMessageLength(0),
+    showForced(false),
+    showTime(0.0),
+    hideTime(0.0),
+    clickedX(-1),
+    clickedY(-1),
+    clickedLeft(-1),
+    clickedTop(-1),
+    clickedRight(-1),
+    clickedBottom(-1),
+    duration(0.0)
+{
+    widthDataRef = XPLMFindDataRef("sim/graphics/view/window_width");
+    heightDataRef = XPLMFindDataRef("sim/graphics/view/window_height");
+
+    int digitsOnly = 0;
+    XPLMGetFontDimensions(xplmFont_Basic, &fontWidth, &fontHeight, &digitsOnly);
+
+    Util::debug("hu.varadiistvan.xplra.MessageWindow: fontWidth=%d, fontHeight=%d\n",
+                fontWidth, fontHeight);
+
+    resetLocation();
+
+    windowID = XPLMCreateWindow(left, top, right, bottom, 0,
+                                &drawWindowCallback,
+                                &handleKeyCallback,
+                                &handleMouseClickCallback, this);
+}
+
+//------------------------------------------------------------------------------
+
+MessageWindow::~MessageWindow()
+{
+    XPLMSetWindowIsVisible(windowID, 0);
+    XPLMDestroyWindow(windowID);
+}
+
+//------------------------------------------------------------------------------
+
+void MessageWindow::show()
+{
+    showForced = true;
+    XPLMSetWindowIsVisible(windowID, 1);
+}
+
+//------------------------------------------------------------------------------
+
+void MessageWindow::hide()
+{
+    showForced = false;
+}
+
+//------------------------------------------------------------------------------
+
+void MessageWindow::reset()
+{
+    resetLocation();
+    XPLMSetWindowGeometry(windowID, left, top, right, bottom);
+}
+
+//------------------------------------------------------------------------------
+
+void MessageWindow::drawWindow()
+{
+    static float colour[3] = { 0.2, 1.0, 0.65 };
+
+    float now = XPLMGetElapsedTime();
+
+    float d = getNewMessage(displayedMessage);
+    if (d>0.0) {
+        showTime = now;
+        hideTime = now + d;
+    }
+
+    if (now>=hideTime) hideTime = 0.0;
+
+    if (hideTime==0.0 && !showForced) {
+        XPLMSetWindowIsVisible(windowID, 0);
+    } else {
+        XPLMDrawTranslucentDarkBox(left, top, right, bottom);
+        if (hideTime!=0.0) {
+            size_t offset = 0;
+            if  (displayedMessage.size()>maxMessageLength &&
+                 now > (showTime + scrollTimeout) )
+            {
+                offset = (now - showTime - scrollTimeout) /
+                    scrollInterval;
+                offset = min(offset,
+                             displayedMessage.size() - maxMessageLength);
+            }
+
+            string dm(displayedMessage, offset, maxMessageLength);
+
+            XPLMDrawString(colour,
+                           left + horizontalMarginSize,
+                           bottom + verticalMarginSize + baseLineSize,
+                           const_cast<char*>(dm.c_str()), 0,
+                           xplmFont_Basic);
+        }
+    }
+}
+
+//------------------------------------------------------------------------------
+
+void MessageWindow::handleKey(char key, XPLMKeyFlags flags, char virtualKey,
+                              bool losingFocus)
+{
+    Util::debug("hu.varadiistvan.xplra.MessageWindow.handleKey: key=0x%02d (%c), flags=0x%04x, virtualKey=0x%02d (%c), losingFocus=%d\n",
+                key, key, flags, virtualKey, virtualKey, losingFocus);
+}
+
+//------------------------------------------------------------------------------
+
+bool MessageWindow::handleMouseClick(int x, int y, XPLMMouseStatus mouse)
+{
+    if (mouse==xplm_MouseDown) {
+        if (x <= (left + resizeArea) ) {
+            mouseMode = MOUSE_RESIZE_LEFT;
+        } else if (x > (right-resizeArea) ) {
+            mouseMode = MOUSE_RESIZE_RIGHT;
+        } else {
+            mouseMode = MOUSE_MOVE;
+        }
+        clickedX = x;
+        clickedY = y;
+        clickedLeft = left;
+        clickedTop = top;
+        clickedRight = right;
+        clickedBottom = bottom;
+    } else if (mouse==xplm_MouseDrag) {
+        int xDiff = x - clickedX;
+
+        if (mouseMode==MOUSE_MOVE) {
+            int newLeft = clickedLeft + xDiff;
+            int newRight = clickedRight + xDiff;
+
+            int screenWidth = XPLMGetDatai(widthDataRef);
+            if (newLeft>=0 && newRight<screenWidth) {
+                left = newLeft;
+                right = newRight;
+            }
+
+            int yDiff = y - clickedY;
+            int newTop = clickedTop + yDiff;
+            int newBottom = clickedBottom + yDiff;
+
+            int screenHeight = XPLMGetDatai(heightDataRef);
+            if (newTop<screenHeight && newBottom>=0) {
+                top = newTop;
+                bottom = newBottom;
+            }
+        } else if (mouseMode==MOUSE_RESIZE_LEFT) {
+            int newLeft = clickedLeft + xDiff;
+            if (newLeft>=0 && (right-newLeft)>=minimalWidth) {
+                left = newLeft;
+                recalculateMaxMessageLength();
+            }
+        } else if (mouseMode==MOUSE_RESIZE_RIGHT) {
+            int newRight = clickedRight + xDiff;
+            int screenWidth = XPLMGetDatai(widthDataRef);
+            if (newRight<screenWidth && (newRight-left)>=minimalWidth) {
+                right = newRight;
+                recalculateMaxMessageLength();
+            }
+        }
+
+        XPLMSetWindowGeometry(windowID, left, top, right, bottom);
+    }
+
+    return true;
+}
+
+//------------------------------------------------------------------------------
+
+float MessageWindow::getNewMessage(std::string& dest)
+{
+    mutex.lock();
+
+    float d = duration;
+    if (d>0.0) {
+        dest = message;
+
+        message.clear();
+        duration = 0.0;
+    }
+
+    mutex.unlock();
+
+    return d;
+}
+
+//------------------------------------------------------------------------------
+
+void MessageWindow::setNewMessage(const std::string& msg, float d)
+{
+    mutex.lock();
+    message = msg;
+    duration = d;
+    mutex.unlock();
+
+    XPLMSetWindowIsVisible(windowID, 1);
+}
+
+//------------------------------------------------------------------------------
+
+void MessageWindow::resetLocation()
+{
+    int screenWidth = XPLMGetDatai(widthDataRef);
+    int screenHeight = XPLMGetDatai(heightDataRef);
+
+    // Util::debug("hu.varadiistvan.xplra.MessageWindow: screenWidth=%d, screenHeight=%d\n",
+    //             screenWidth, screenHeight);
+
+    left = 50;
+    right = screenWidth - left;
+
+    top = screenHeight * 9 / 10;
+    bottom = top - fontHeight - 2*verticalMarginSize;
+
+    recalculateMaxMessageLength();
+}
+
+//------------------------------------------------------------------------------
+
+void MessageWindow::recalculateMaxMessageLength()
+{
+    maxMessageLength = (right + 1 - left) - 2 * horizontalMarginSize;
+    maxMessageLength /= fontWidth;
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/MessageWindow.cc
===================================================================
--- src/plugin/src/xplra/MessageWindow.cc	(revision 51)
+++ 	(revision )
@@ -1,315 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "MessageWindow.h"
-
-#include <hu/varadiistvan/xplcommon/Util.h>
-
-#include <XPLMProcessing.h>
-#include <XPLMGraphics.h>
-
-//------------------------------------------------------------------------------
-
-using xplra::MessageWindow;
-
-using hu::varadiistvan::xplcommon::Util;
-
-using std::string;
-using std::min;
-using std::max;
-
-//------------------------------------------------------------------------------
-
-void MessageWindow::drawWindowCallback(XPLMWindowID /*windowID*/, void* refCon)
-{
-    MessageWindow* messageWindow = reinterpret_cast<MessageWindow*>(refCon);
-    messageWindow->drawWindow();
-}
-
-//------------------------------------------------------------------------------
-
-void MessageWindow::handleKeyCallback(XPLMWindowID /*windowID*/, char key,
-                                      XPLMKeyFlags flags, char virtualKey,
-                                      void* refCon, int losingFocus)
-{
-    MessageWindow* messageWindow = reinterpret_cast<MessageWindow*>(refCon);
-    messageWindow->handleKey(key, flags, virtualKey, losingFocus!=0);
-}
-
-//------------------------------------------------------------------------------
-
-int MessageWindow::handleMouseClickCallback(XPLMWindowID /*windowID*/,
-                                            int x, int y,
-                                            XPLMMouseStatus mouse, void* refCon)
-{
-    MessageWindow* messageWindow = reinterpret_cast<MessageWindow*>(refCon);
-    return messageWindow->handleMouseClick(x, y, mouse) ? 1 : 0;
-}
-
-//------------------------------------------------------------------------------
-
-MessageWindow::MessageWindow() :
-    maxMessageLength(0),
-    showForced(false),
-    showTime(0.0),
-    hideTime(0.0),
-    clickedX(-1),
-    clickedY(-1),
-    clickedLeft(-1),
-    clickedTop(-1),
-    clickedRight(-1),
-    clickedBottom(-1),
-    duration(0.0)
-{
-    widthDataRef = XPLMFindDataRef("sim/graphics/view/window_width");
-    heightDataRef = XPLMFindDataRef("sim/graphics/view/window_height");
-
-    int digitsOnly = 0;
-    XPLMGetFontDimensions(xplmFont_Basic, &fontWidth, &fontHeight, &digitsOnly);
-
-    Util::debug("hu.varadiistvan.xplra.MessageWindow: fontWidth=%d, fontHeight=%d\n",
-                fontWidth, fontHeight);
-
-    resetLocation();
-
-    windowID = XPLMCreateWindow(left, top, right, bottom, 0,
-                                &drawWindowCallback,
-                                &handleKeyCallback,
-                                &handleMouseClickCallback, this);
-}
-
-//------------------------------------------------------------------------------
-
-MessageWindow::~MessageWindow()
-{
-    XPLMSetWindowIsVisible(windowID, 0);
-    XPLMDestroyWindow(windowID);
-}
-
-//------------------------------------------------------------------------------
-
-void MessageWindow::show()
-{
-    showForced = true;
-    XPLMSetWindowIsVisible(windowID, 1);
-}
-
-//------------------------------------------------------------------------------
-
-void MessageWindow::hide()
-{
-    showForced = false;
-}
-
-//------------------------------------------------------------------------------
-
-void MessageWindow::reset()
-{
-    resetLocation();
-    XPLMSetWindowGeometry(windowID, left, top, right, bottom);
-}
-
-//------------------------------------------------------------------------------
-
-void MessageWindow::drawWindow()
-{
-    static float colour[3] = { 0.2, 1.0, 0.65 };
-
-    float now = XPLMGetElapsedTime();
-
-    float d = getNewMessage(displayedMessage);
-    if (d>0.0) {
-        showTime = now;
-        hideTime = now + d;
-    }
-
-    if (now>=hideTime) hideTime = 0.0;
-
-    if (hideTime==0.0 && !showForced) {
-        XPLMSetWindowIsVisible(windowID, 0);
-    } else {
-        XPLMDrawTranslucentDarkBox(left, top, right, bottom);
-        if (hideTime!=0.0) {
-            size_t offset = 0;
-            if  (displayedMessage.size()>maxMessageLength &&
-                 now > (showTime + scrollTimeout) )
-            {
-                offset = (now - showTime - scrollTimeout) /
-                    scrollInterval;
-                offset = min(offset,
-                             displayedMessage.size() - maxMessageLength);
-            }
-
-            string dm(displayedMessage, offset, maxMessageLength);
-
-            XPLMDrawString(colour,
-                           left + horizontalMarginSize,
-                           bottom + verticalMarginSize + baseLineSize,
-                           const_cast<char*>(dm.c_str()), 0,
-                           xplmFont_Basic);
-        }
-    }
-}
-
-//------------------------------------------------------------------------------
-
-void MessageWindow::handleKey(char key, XPLMKeyFlags flags, char virtualKey,
-                              bool losingFocus)
-{
-    Util::debug("hu.varadiistvan.xplra.MessageWindow.handleKey: key=0x%02d (%c), flags=0x%04x, virtualKey=0x%02d (%c), losingFocus=%d\n",
-                key, key, flags, virtualKey, virtualKey, losingFocus);
-}
-
-//------------------------------------------------------------------------------
-
-bool MessageWindow::handleMouseClick(int x, int y, XPLMMouseStatus mouse)
-{
-    if (mouse==xplm_MouseDown) {
-        if (x <= (left + resizeArea) ) {
-            mouseMode = MOUSE_RESIZE_LEFT;
-        } else if (x > (right-resizeArea) ) {
-            mouseMode = MOUSE_RESIZE_RIGHT;
-        } else {
-            mouseMode = MOUSE_MOVE;
-        }
-        clickedX = x;
-        clickedY = y;
-        clickedLeft = left;
-        clickedTop = top;
-        clickedRight = right;
-        clickedBottom = bottom;
-    } else if (mouse==xplm_MouseDrag) {
-        int xDiff = x - clickedX;
-
-        if (mouseMode==MOUSE_MOVE) {
-            int newLeft = clickedLeft + xDiff;
-            int newRight = clickedRight + xDiff;
-
-            int screenWidth = XPLMGetDatai(widthDataRef);
-            if (newLeft>=0 && newRight<screenWidth) {
-                left = newLeft;
-                right = newRight;
-            }
-
-            int yDiff = y - clickedY;
-            int newTop = clickedTop + yDiff;
-            int newBottom = clickedBottom + yDiff;
-
-            int screenHeight = XPLMGetDatai(heightDataRef);
-            if (newTop<screenHeight && newBottom>=0) {
-                top = newTop;
-                bottom = newBottom;
-            }
-        } else if (mouseMode==MOUSE_RESIZE_LEFT) {
-            int newLeft = clickedLeft + xDiff;
-            if (newLeft>=0 && (right-newLeft)>=minimalWidth) {
-                left = newLeft;
-                recalculateMaxMessageLength();
-            }
-        } else if (mouseMode==MOUSE_RESIZE_RIGHT) {
-            int newRight = clickedRight + xDiff;
-            int screenWidth = XPLMGetDatai(widthDataRef);
-            if (newRight<screenWidth && (newRight-left)>=minimalWidth) {
-                right = newRight;
-                recalculateMaxMessageLength();
-            }
-        }
-
-        XPLMSetWindowGeometry(windowID, left, top, right, bottom);
-    }
-
-    return true;
-}
-
-//------------------------------------------------------------------------------
-
-float MessageWindow::getNewMessage(std::string& dest)
-{
-    mutex.lock();
-
-    float d = duration;
-    if (d>0.0) {
-        dest = message;
-
-        message.clear();
-        duration = 0.0;
-    }
-
-    mutex.unlock();
-
-    return d;
-}
-
-//------------------------------------------------------------------------------
-
-void MessageWindow::setNewMessage(const std::string& msg, float d)
-{
-    mutex.lock();
-    message = msg;
-    duration = d;
-    mutex.unlock();
-
-    XPLMSetWindowIsVisible(windowID, 1);
-}
-
-//------------------------------------------------------------------------------
-
-void MessageWindow::resetLocation()
-{
-    int screenWidth = XPLMGetDatai(widthDataRef);
-    int screenHeight = XPLMGetDatai(heightDataRef);
-
-    // Util::debug("hu.varadiistvan.xplra.MessageWindow: screenWidth=%d, screenHeight=%d\n",
-    //             screenWidth, screenHeight);
-
-    left = 50;
-    right = screenWidth - left;
-
-    top = screenHeight * 9 / 10;
-    bottom = top - fontHeight - 2*verticalMarginSize;
-
-    recalculateMaxMessageLength();
-}
-
-//------------------------------------------------------------------------------
-
-void MessageWindow::recalculateMaxMessageLength()
-{
-    maxMessageLength = (right + 1 - left) - 2 * horizontalMarginSize;
-    maxMessageLength /= fontWidth;
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/plugin/src/xplra/MessageWindow.h
===================================================================
--- src/plugin/src/xplra/MessageWindow.h	(revision 92)
+++ src/plugin/src/xplra/MessageWindow.h	(revision 92)
@@ -0,0 +1,325 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef XPLRA_MESSAGEWINDOW_H
+#define XPLRA_MESSAGEWINDOW_H
+//------------------------------------------------------------------------------
+
+#include <hu/varadiistvan/scpl/Mutex.h>
+
+#include <string>
+
+#include <XPLMDataAccess.h>
+#include <XPLMDisplay.h>
+
+//------------------------------------------------------------------------------
+
+namespace xplra {
+
+//------------------------------------------------------------------------------
+
+/**
+ * Class to handle the activities related to the message window.
+ */
+class MessageWindow
+{
+private:
+    /**
+     * Window drawing callback.
+     */
+    static void drawWindowCallback(XPLMWindowID windowID, void* refCon);
+
+    /**
+     * Handle the keypresses.
+     */
+    static void handleKeyCallback(XPLMWindowID windowID, char key,
+                                  XPLMKeyFlags flags, char virtualKey,
+                                  void* refCon, int losingFocus);
+
+    /**
+     * Handle the mouse clicks.
+     */
+    static int handleMouseClickCallback(XPLMWindowID windowID, int x, int y,
+                                        XPLMMouseStatus mouse, void* refCon);
+
+
+    /**
+     * The minimal width of the message area.
+     */
+    static const int minimalWidth = 150;
+
+    /**
+     * The size of the resize sensitivity area.
+     */
+    static const int resizeArea = 50;
+
+    /**
+     * The size of the margins at each side of the window.
+     */
+    static const int horizontalMarginSize = 25;
+
+    /**
+     * The size of the margins at the top and the bottom of the window.
+     */
+    static const int verticalMarginSize = 5;
+
+    /**
+     * The size for the baseline above the bottom of the letters.
+     */
+    static const int baseLineSize = 2;
+
+    /**
+     * The amount of time in seconds after which the message is
+     * started to be scrolled, if it should be scrolled.
+     */
+    static constexpr float scrollTimeout = 1.0;
+
+    /**
+     * The amount of time in seconds between each character step.
+     */
+    static constexpr float scrollInterval = 0.1;
+
+private:
+    /**
+     * The dataref containing the width of the program's window.
+     */
+    XPLMDataRef widthDataRef;
+
+    /**
+     * The dataref containing the height of the program's window.
+     */
+    XPLMDataRef heightDataRef;
+
+    /**
+     * The width of one character of the font.
+     */
+    int fontWidth;
+
+    /**
+     * The height of one character of the font.
+     */
+    int fontHeight;
+
+    /**
+     * The window ID.
+     */
+    XPLMWindowID windowID;
+
+    /**
+     * The X-coordinate of the left side of the window.
+     */
+    int left;
+
+    /**
+     * The Y-coordinate of the top of the window.
+     */
+    int top;
+
+    /**
+     * The X-coordinate of the right side of the window.
+     */
+    int right;
+
+    /**
+     * The Y-coordinate of the bottom of the window.
+     */
+    int bottom;
+
+    /**
+     * The maximal message length.
+     */
+    size_t maxMessageLength;
+
+    /**
+     * Indicate if the message window should be shown
+     */
+    bool showForced;
+
+    /**
+     * The currently displayed message.
+     */
+    std::string displayedMessage;
+
+    /**
+     * The time the current message was shown.
+     */
+    float showTime;
+
+    /**
+     * The time to hide the current message. If not positive, no
+     * message is currently shown.
+     */
+    float hideTime;
+
+    /**
+     * The mouse mode
+     */
+    enum {
+        // Move the message area
+        MOUSE_MOVE,
+
+        // Resize the message area from the left
+        MOUSE_RESIZE_LEFT,
+
+        // Resize the message area from the right.
+        MOUSE_RESIZE_RIGHT
+    } mouseMode;
+
+    /**
+     * The X-coordinate where the window was clicked.
+     */
+    int clickedX;
+
+    /**
+     * The Y-coordinate where the window was clicked.
+     */
+    int clickedY;
+
+    /**
+     * The left coordinate of the window when it was clicked.
+     */
+    int clickedLeft;
+
+    /**
+     * The top coordinate of the window when it was clicked.
+     */
+    int clickedTop;
+
+    /**
+     * The right coordinate of the window when it was clicked.
+     */
+    int clickedRight;
+
+    /**
+     * The bottom coordinate of the window when it was clicked.
+     */
+    int clickedBottom;
+
+    /**
+     * The mutex protecting some of the data structures that are used
+     * from both the simulator loop and the server thread.
+     */
+    hu::varadiistvan::scpl::Mutex mutex;
+
+    /**
+     * The message to show.
+     */
+    std::string message;
+
+    /**
+     * The number of seconds for which the message should be shown. If
+     * positive, there is a new message.
+     */
+    float duration;
+
+public:
+    /**
+     * Construct the message window. It creates the X-Plane window and
+     * registers the callback functions. The window is hidden
+     * initially.
+     */
+    MessageWindow();
+
+    /**
+     * Destroy the message window. It destroys the X-Plane window.
+     */
+    ~MessageWindow();
+
+    /**
+     * Force showing the message window.
+     */
+    void show();
+
+    /**
+     * Hide the message window if it does not have to display an
+     * actual message.
+     */
+    void hide();
+
+    /**
+     * Reset the location of the message window.
+     */
+    void reset();
+
+private:
+    /**
+     * Called from the window drawing callback.
+     */
+    void drawWindow();
+
+    /**
+     * Called from the key handling callback.
+     */
+    void handleKey(char key, XPLMKeyFlags flags, char virtualKey,
+                   bool losingFocus);
+
+    /**
+     * Called from the mouse click handling callback.
+     *
+     * @return true if the click is consumed, false otherwise.
+     */
+    bool handleMouseClick(int x, int y, XPLMMouseStatus mouse);
+
+    /**
+     * Get the new message, if any.
+     *
+     * @return the duration of the message, or 0.0 if there is no new
+     * message. The message will be cleared.
+     */
+    float getNewMessage(std::string& dest);
+
+    /**
+     * Set the new message, if any.
+     */
+    void setNewMessage(const std::string& msg, float d);
+
+    /**
+     * Reset the location of the message window.
+     */
+    void resetLocation();
+
+    /**
+     * Recalculate the maximal message length.
+     */
+    void recalculateMaxMessageLength();
+
+    friend class MessageRequest;
+};
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplra */
+
+//------------------------------------------------------------------------------
+#endif // XPLRA_MESSAGEWINDOW_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/MessageWindow.h
===================================================================
--- src/plugin/src/xplra/MessageWindow.h	(revision 51)
+++ 	(revision )
@@ -1,325 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLRA_MESSAGEWINDOW_H
-#define XPLRA_MESSAGEWINDOW_H
-//------------------------------------------------------------------------------
-
-#include <hu/varadiistvan/scpl/Mutex.h>
-
-#include <string>
-
-#include <XPLMDataAccess.h>
-#include <XPLMDisplay.h>
-
-//------------------------------------------------------------------------------
-
-namespace xplra {
-
-//------------------------------------------------------------------------------
-
-/**
- * Class to handle the activities related to the message window.
- */
-class MessageWindow
-{
-private:
-    /**
-     * Window drawing callback.
-     */
-    static void drawWindowCallback(XPLMWindowID windowID, void* refCon);
-
-    /**
-     * Handle the keypresses.
-     */
-    static void handleKeyCallback(XPLMWindowID windowID, char key,
-                                  XPLMKeyFlags flags, char virtualKey,
-                                  void* refCon, int losingFocus);
-
-    /**
-     * Handle the mouse clicks.
-     */
-    static int handleMouseClickCallback(XPLMWindowID windowID, int x, int y,
-                                        XPLMMouseStatus mouse, void* refCon);
-
-
-    /**
-     * The minimal width of the message area.
-     */
-    static const int minimalWidth = 150;
-
-    /**
-     * The size of the resize sensitivity area.
-     */
-    static const int resizeArea = 50;
-
-    /**
-     * The size of the margins at each side of the window.
-     */
-    static const int horizontalMarginSize = 25;
-
-    /**
-     * The size of the margins at the top and the bottom of the window.
-     */
-    static const int verticalMarginSize = 5;
-
-    /**
-     * The size for the baseline above the bottom of the letters.
-     */
-    static const int baseLineSize = 2;
-
-    /**
-     * The amount of time in seconds after which the message is
-     * started to be scrolled, if it should be scrolled.
-     */
-    static const float scrollTimeout = 1.0;
-
-    /**
-     * The amount of time in seconds between each character step.
-     */
-    static const float scrollInterval = 0.1;
-
-private:
-    /**
-     * The dataref containing the width of the program's window.
-     */
-    XPLMDataRef widthDataRef;
-
-    /**
-     * The dataref containing the height of the program's window.
-     */
-    XPLMDataRef heightDataRef;
-
-    /**
-     * The width of one character of the font.
-     */
-    int fontWidth;
-
-    /**
-     * The height of one character of the font.
-     */
-    int fontHeight;
-
-    /**
-     * The window ID.
-     */
-    XPLMWindowID windowID;
-
-    /**
-     * The X-coordinate of the left side of the window.
-     */
-    int left;
-
-    /**
-     * The Y-coordinate of the top of the window.
-     */
-    int top;
-
-    /**
-     * The X-coordinate of the right side of the window.
-     */
-    int right;
-
-    /**
-     * The Y-coordinate of the bottom of the window.
-     */
-    int bottom;
-
-    /**
-     * The maximal message length.
-     */
-    size_t maxMessageLength;
-
-    /**
-     * Indicate if the message window should be shown
-     */
-    bool showForced;
-
-    /**
-     * The currently displayed message.
-     */
-    std::string displayedMessage;
-
-    /**
-     * The time the current message was shown.
-     */
-    float showTime;
-
-    /**
-     * The time to hide the current message. If not positive, no
-     * message is currently shown.
-     */
-    float hideTime;
-
-    /**
-     * The mouse mode
-     */
-    enum {
-        // Move the message area
-        MOUSE_MOVE,
-
-        // Resize the message area from the left
-        MOUSE_RESIZE_LEFT,
-
-        // Resize the message area from the right.
-        MOUSE_RESIZE_RIGHT
-    } mouseMode;
-
-    /**
-     * The X-coordinate where the window was clicked.
-     */
-    int clickedX;
-
-    /**
-     * The Y-coordinate where the window was clicked.
-     */
-    int clickedY;
-
-    /**
-     * The left coordinate of the window when it was clicked.
-     */
-    int clickedLeft;
-
-    /**
-     * The top coordinate of the window when it was clicked.
-     */
-    int clickedTop;
-
-    /**
-     * The right coordinate of the window when it was clicked.
-     */
-    int clickedRight;
-
-    /**
-     * The bottom coordinate of the window when it was clicked.
-     */
-    int clickedBottom;
-
-    /**
-     * The mutex protecting some of the data structures that are used
-     * from both the simulator loop and the server thread.
-     */
-    hu::varadiistvan::scpl::Mutex mutex;
-
-    /**
-     * The message to show.
-     */
-    std::string message;
-
-    /**
-     * The number of seconds for which the message should be shown. If
-     * positive, there is a new message.
-     */
-    float duration;
-
-public:
-    /**
-     * Construct the message window. It creates the X-Plane window and
-     * registers the callback functions. The window is hidden
-     * initially.
-     */
-    MessageWindow();
-
-    /**
-     * Destroy the message window. It destroys the X-Plane window.
-     */
-    ~MessageWindow();
-
-    /**
-     * Force showing the message window.
-     */
-    void show();
-
-    /**
-     * Hide the message window if it does not have to display an
-     * actual message.
-     */
-    void hide();
-
-    /**
-     * Reset the location of the message window.
-     */
-    void reset();
-
-private:
-    /**
-     * Called from the window drawing callback.
-     */
-    void drawWindow();
-
-    /**
-     * Called from the key handling callback.
-     */
-    void handleKey(char key, XPLMKeyFlags flags, char virtualKey,
-                   bool losingFocus);
-
-    /**
-     * Called from the mouse click handling callback.
-     *
-     * @return true if the click is consumed, false otherwise.
-     */
-    bool handleMouseClick(int x, int y, XPLMMouseStatus mouse);
-
-    /**
-     * Get the new message, if any.
-     *
-     * @return the duration of the message, or 0.0 if there is no new
-     * message. The message will be cleared.
-     */
-    float getNewMessage(std::string& dest);
-
-    /**
-     * Set the new message, if any.
-     */
-    void setNewMessage(const std::string& msg, float d);
-
-    /**
-     * Reset the location of the message window.
-     */
-    void resetLocation();
-
-    /**
-     * Recalculate the maximal message length.
-     */
-    void recalculateMaxMessageLength();
-
-    friend class MessageRequest;
-};
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplra */
-
-//------------------------------------------------------------------------------
-#endif // XPLRA_MESSAGEWINDOW_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/plugin/src/xplra/MultiTaskRequest.cc
===================================================================
--- src/plugin/src/xplra/MultiTaskRequest.cc	(revision 13)
+++ src/plugin/src/xplra/MultiTaskRequest.cc	(revision 13)
@@ -0,0 +1,70 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include "MultiTaskRequest.h"
+
+#include "Task.h"
+
+#include <hu/varadiistvan/xplcommon/Util.h>
+
+//------------------------------------------------------------------------------
+
+using xplra::MultiTaskRequest;
+
+using hu::varadiistvan::xplcommon::Util;
+
+//------------------------------------------------------------------------------
+
+MultiTaskRequest::~MultiTaskRequest()
+{
+    for(tasks_t::iterator i = tasks.begin(); i!=tasks.end(); ++i) {
+        delete *i;
+    }
+}
+
+//------------------------------------------------------------------------------
+
+void MultiTaskRequest::execute()
+{
+    // Util::debug("hu.varadiistvan.xplra.MultiTaskRequest[%p]::execute\n", this);
+    for(tasks_t::iterator i = tasks.begin(); i!=tasks.end(); ++i) {
+        // Util::debug("hu.varadiistvan.xplra.MultiTaskRequest[%p]::execute: task=%p\n",
+        //             this, *i);
+        (*i)->perform();
+    }
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/MultiTaskRequest.cc
===================================================================
--- src/plugin/src/xplra/MultiTaskRequest.cc	(revision 13)
+++ 	(revision )
@@ -1,70 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "MultiTaskRequest.h"
-
-#include "Task.h"
-
-#include <hu/varadiistvan/xplcommon/Util.h>
-
-//------------------------------------------------------------------------------
-
-using xplra::MultiTaskRequest;
-
-using hu::varadiistvan::xplcommon::Util;
-
-//------------------------------------------------------------------------------
-
-MultiTaskRequest::~MultiTaskRequest()
-{
-    for(tasks_t::iterator i = tasks.begin(); i!=tasks.end(); ++i) {
-        delete *i;
-    }
-}
-
-//------------------------------------------------------------------------------
-
-void MultiTaskRequest::execute()
-{
-    // Util::debug("hu.varadiistvan.xplra.MultiTaskRequest[%p]::execute\n", this);
-    for(tasks_t::iterator i = tasks.begin(); i!=tasks.end(); ++i) {
-        // Util::debug("hu.varadiistvan.xplra.MultiTaskRequest[%p]::execute: task=%p\n",
-        //             this, *i);
-        (*i)->perform();
-    }
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/plugin/src/xplra/MultiTaskRequest.h
===================================================================
--- src/plugin/src/xplra/MultiTaskRequest.h	(revision 13)
+++ src/plugin/src/xplra/MultiTaskRequest.h	(revision 13)
@@ -0,0 +1,170 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef XPLRA_MULTITASKREQUEST_H
+#define XPLRA_MULTITASKREQUEST_H
+//------------------------------------------------------------------------------
+
+#include "Request.h"
+
+#include <vector>
+
+#include <cstdlib>
+
+//------------------------------------------------------------------------------
+
+namespace xplra {
+
+//------------------------------------------------------------------------------
+
+class Task;
+
+//------------------------------------------------------------------------------
+
+/**
+ * A request containing several tasks which it performs one-by-one
+ * when executing the request. It owns the tasks, which get deleted
+ * when the request object is deleted.
+ */
+class MultiTaskRequest : public Request
+{
+private:
+    /**
+     * Type for the vector of the tasks.
+     */
+    typedef std::vector<Task*> tasks_t;
+
+    /**
+     * The tasks.
+     */
+    tasks_t tasks;
+
+public:
+    /**
+     * Destroy the request by deleting the tasks.
+     */
+    virtual ~MultiTaskRequest();
+
+    /**
+     * Add a task to the request.
+     */
+    void addTask(Task* task);
+
+    /**
+     * Get the number of tasks.
+     */
+    size_t getNumTasks() const;
+
+    /**
+     * Get the task at the given index.
+     */
+    Task* getTask(size_t index) const;
+
+protected:
+    /**
+     * Perform the tasks one-by-one.
+     */
+    virtual void execute();
+};
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+/**
+ * A templated version of MultiTaskRequest, which accepts and returns
+ * tasks of a given type only.
+ */
+template <class TaskClass>
+class MultiTaskRequestTemplate : public MultiTaskRequest
+{
+public:
+    /**
+     * Add the given task.
+     */
+    void addTask(TaskClass* task);
+
+    /**
+     * Get the task at the given index.
+     */
+    TaskClass* getTask(size_t index) const;
+};
+
+//------------------------------------------------------------------------------
+// Inline definitions
+//------------------------------------------------------------------------------
+
+inline void MultiTaskRequest::addTask(Task* task)
+{
+    tasks.push_back(task);
+}
+
+//------------------------------------------------------------------------------
+
+inline size_t MultiTaskRequest::getNumTasks() const
+{
+    return tasks.size();
+}
+
+//------------------------------------------------------------------------------
+
+inline Task* MultiTaskRequest::getTask(size_t index) const
+{
+    return tasks[index];
+}
+
+//------------------------------------------------------------------------------
+// Template definitions
+//------------------------------------------------------------------------------
+
+template <class TaskClass>
+inline void MultiTaskRequestTemplate<TaskClass>::addTask(TaskClass* task)
+{
+    MultiTaskRequest::addTask(task);
+}
+
+//------------------------------------------------------------------------------
+
+template <class TaskClass>
+inline TaskClass*
+MultiTaskRequestTemplate<TaskClass>::getTask(size_t index) const
+{
+    return static_cast<TaskClass*>(MultiTaskRequest::getTask(index));
+}
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplra */
+
+//------------------------------------------------------------------------------
+#endif // XPLRA_MULTITASKREQUEST_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/MultiTaskRequest.h
===================================================================
--- src/plugin/src/xplra/MultiTaskRequest.h	(revision 13)
+++ 	(revision )
@@ -1,170 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLRA_MULTITASKREQUEST_H
-#define XPLRA_MULTITASKREQUEST_H
-//------------------------------------------------------------------------------
-
-#include "Request.h"
-
-#include <vector>
-
-#include <cstdlib>
-
-//------------------------------------------------------------------------------
-
-namespace xplra {
-
-//------------------------------------------------------------------------------
-
-class Task;
-
-//------------------------------------------------------------------------------
-
-/**
- * A request containing several tasks which it performs one-by-one
- * when executing the request. It owns the tasks, which get deleted
- * when the request object is deleted.
- */
-class MultiTaskRequest : public Request
-{
-private:
-    /**
-     * Type for the vector of the tasks.
-     */
-    typedef std::vector<Task*> tasks_t;
-
-    /**
-     * The tasks.
-     */
-    tasks_t tasks;
-
-public:
-    /**
-     * Destroy the request by deleting the tasks.
-     */
-    virtual ~MultiTaskRequest();
-
-    /**
-     * Add a task to the request.
-     */
-    void addTask(Task* task);
-
-    /**
-     * Get the number of tasks.
-     */
-    size_t getNumTasks() const;
-
-    /**
-     * Get the task at the given index.
-     */
-    Task* getTask(size_t index) const;
-
-protected:
-    /**
-     * Perform the tasks one-by-one.
-     */
-    virtual void execute();
-};
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-/**
- * A templated version of MultiTaskRequest, which accepts and returns
- * tasks of a given type only.
- */
-template <class TaskClass>
-class MultiTaskRequestTemplate : public MultiTaskRequest
-{
-public:
-    /**
-     * Add the given task.
-     */
-    void addTask(TaskClass* task);
-
-    /**
-     * Get the task at the given index.
-     */
-    TaskClass* getTask(size_t index) const;
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline void MultiTaskRequest::addTask(Task* task)
-{
-    tasks.push_back(task);
-}
-
-//------------------------------------------------------------------------------
-
-inline size_t MultiTaskRequest::getNumTasks() const
-{
-    return tasks.size();
-}
-
-//------------------------------------------------------------------------------
-
-inline Task* MultiTaskRequest::getTask(size_t index) const
-{
-    return tasks[index];
-}
-
-//------------------------------------------------------------------------------
-// Template definitions
-//------------------------------------------------------------------------------
-
-template <class TaskClass>
-inline void MultiTaskRequestTemplate<TaskClass>::addTask(TaskClass* task)
-{
-    MultiTaskRequest::addTask(task);
-}
-
-//------------------------------------------------------------------------------
-
-template <class TaskClass>
-inline TaskClass*
-MultiTaskRequestTemplate<TaskClass>::getTask(size_t index) const
-{
-    return static_cast<TaskClass*>(MultiTaskRequest::getTask(index));
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplra */
-
-//------------------------------------------------------------------------------
-#endif // XPLRA_MULTITASKREQUEST_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/plugin/src/xplra/Protocol.h
===================================================================
--- src/plugin/src/xplra/Protocol.h	(revision 92)
+++ src/plugin/src/xplra/Protocol.h	(revision 92)
@@ -0,0 +1,286 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef XPLRA_PROTOCOL_H
+#define XPLRA_PROTOCOL_H
+//------------------------------------------------------------------------------
+
+namespace xplra {
+
+//------------------------------------------------------------------------------
+
+/**
+ * Constants and helpers for the protocol.
+ */
+class Protocol
+{
+public:
+    /**
+     * Command: get the value of a single dataref.
+     */
+    static const uint8_t COMMAND_GET_SINGLE = 0x01;
+
+    /**
+     * Command: set the value of a single dataref.
+     */
+    static const uint8_t COMMAND_SET_SINGLE = 0x02;
+
+    /**
+     * Command: get the value of a multiple datarefs.
+     */
+    static const uint8_t COMMAND_GET_MULTI = 0x03;
+
+    /**
+     * Command: set the value of a multiple datarefs.
+     */
+    static const uint8_t COMMAND_SET_MULTI = 0x04;
+
+    /**
+     * Command: register a multiple-data query request
+     */
+    static const uint8_t COMMAND_REGISTER_GET_MULTI = 0x11;
+
+    /**
+     * Command: unregister a multiple-data query request
+     */
+    static const uint8_t COMMAND_UNREGISTER_GET_MULTI = 0x12;
+
+    /**
+     * Command: execute a registered multiple-data query request
+     */
+    static const uint8_t COMMAND_EXECUTE_GET_MULTI = 0x13;
+
+    /**
+     * Command: register a multiple-data update request
+     */
+    static const uint8_t COMMAND_REGISTER_SET_MULTI = 0x21;
+
+    /**
+     * Command: unregister a multiple-data update request
+     */
+    static const uint8_t COMMAND_UNREGISTER_SET_MULTI = 0x22;
+
+    /**
+     * Command: execute a registered multiple-data update request
+     */
+    static const uint8_t COMMAND_EXECUTE_SET_MULTI = 0x23;
+
+    /**
+     * Command: get the versions of the simulator
+     */
+    static const uint8_t COMMAND_GET_VERSIONS = 0x31;
+
+    /**
+     * Command: reload the plugins
+     */
+    static const uint8_t COMMAND_RELOAD_PLUGINS = 0x32;
+
+    /**
+     * Command: save the current situation.
+     *
+     * Followed by a string containing the path of the file to save
+     * relative to the X-System directory.
+     */
+    static const uint8_t COMMAND_SAVE_SITUATION = 0x33;
+
+    /**
+     * Command: show a message in the message window.
+     */
+    static const uint8_t COMMAND_SHOW_MESSAGE = 0x41;
+
+    /**
+     * Command: register a set of hotkeys for the client. Old hotkeys,
+     * if any, are forgotten.
+     *
+     * The command is followed by the following data:
+     * - The number of the hotkeys defined (U32).
+     * - The code of the hotkeys (U16*number of the hotkeys).
+     *   The lower byte is the same as the X-Plane virtual key code
+     *   (the same as the ASCII code for numbers and upper-case letters),
+     *   the upper one is a logical OR of the HOTKEY_MODIFIER_XXX
+     *   codes.
+     *
+     * The reply consists of a result code only. It may fail with an
+     * invalid length code if the number of hotkeys is too large.
+     */
+    static const uint8_t COMMAND_REGISTER_HOTKEYS = 0x51;
+
+    /**
+     * Command: query the hotkeys.
+     *
+     * The reply consists of a result code, followed by the following
+     * data, if the result code is RESULT_OK:
+     * - The number of hotkeys defined (U32).
+     * - An array of U8 values each being 0 or 1 depending on whether
+     *   the corresponding hotkey has been pressed since the last
+     *   query (or the registration, whichever is later). The value at
+     *   index i corresponds to the hotkey code at index i in the
+     *   array passed with COMMAND_REGISTER_HOTKEYS.
+     *
+     * If not hotkey has been registered, the number of hotkeys is
+     * returned as 0.
+     */
+    static const uint8_t COMMAND_QUERY_HOTKEYS = 0x52;
+
+    /**
+     * Command: unregister the previously registered hotkeys.
+     *
+     * The reply is a result code.
+     */
+    static const uint8_t COMMAND_UNREGISTER_HOTKEYS = 0x53;
+
+    /**
+     * Data type: int
+     */
+    static const uint8_t TYPE_INT = 0x01;
+
+    /**
+     * Data type: float
+     */
+    static const uint8_t TYPE_FLOAT = 0x02;
+
+    /**
+     * Data type: double
+     */
+    static const uint8_t TYPE_DOUBLE = 0x03;
+
+    /**
+     * Data type: float array
+     */
+    static const uint8_t TYPE_FLOAT_ARRAY = 0x11;
+
+    /**
+     * Data type: int array
+     */
+    static const uint8_t TYPE_INT_ARRAY = 0x12;
+
+    /**
+     * Data type: byte array
+     */
+    static const uint8_t TYPE_BYTE_ARRAY = 0x13;
+
+    /**
+     * Result code: no error, everything is OK.
+     */
+    static const uint8_t RESULT_OK = 0x00;
+
+    /**
+     * Result code: invalid command
+     */
+    static const uint8_t RESULT_INVALID_COMMAND = 0x01;
+
+    /**
+     * Result code: unknown dataref
+     */
+    static const uint8_t RESULT_UNKNOWN_DATAREF = 0x02;
+
+    /**
+     * Result code: invalid type
+     */
+    static const uint8_t RESULT_INVALID_TYPE = 0x03;
+
+    /**
+     * Result code: invalid length
+     */
+    static const uint8_t RESULT_INVALID_LENGTH = 0x04;
+
+    /**
+     * Result code: invalid offset
+     */
+    static const uint8_t RESULT_INVALID_OFFSET = 0x05;
+
+    /**
+     * Result code: invalid count
+     */
+    static const uint8_t RESULT_INVALID_COUNT = 0x06;
+
+    /**
+     * Result code: invalid ID
+     */
+    static const uint8_t RESULT_INVALID_ID = 0x07;
+
+    /**
+     * Result code: invalid duration
+     */
+    static const uint8_t RESULT_INVALID_DURATION = 0x08;
+
+    /**
+     * Result code: other error
+     */
+    static const uint8_t RESULT_OTHER_ERROR = 0xff;
+
+    /**
+     * Hotkey modifier: shift
+     */
+    static const uint16_t HOTKEY_MODIFIER_SHIFT = 0x0100;
+
+    /**
+     * Hotkey modifier: control
+     */
+    static const uint16_t HOTKEY_MODIFIER_CONTROL = 0x0200;
+
+    /**
+     * The maximal length we accept (in order to protect ourselves).
+     */
+    static const int MAX_LENGTH = 2048;
+
+    /**
+     * The maximal count of requests in a multiple-data query or
+     * update.
+     */
+    static const size_t MAX_MULTI_COUNT = 1024;
+
+    /**
+     * The maximal message duration
+     */
+    static constexpr float MAX_MESSAGE_DURATION = 5*60;
+
+    /**
+     * The maximal number of hotkeys that can be registered for a
+     * client.
+     */
+    static const size_t MAX_HOTKEY_COUNT = 128;
+
+    /**
+     * The version of the plugin.
+     */
+    static const int version = 10;
+};
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplra */
+
+//------------------------------------------------------------------------------
+#endif // XPLRA_PROTOCOL_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/Protocol.h
===================================================================
--- src/plugin/src/xplra/Protocol.h	(revision 81)
+++ 	(revision )
@@ -1,286 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLRA_PROTOCOL_H
-#define XPLRA_PROTOCOL_H
-//------------------------------------------------------------------------------
-
-namespace xplra {
-
-//------------------------------------------------------------------------------
-
-/**
- * Constants and helpers for the protocol.
- */
-class Protocol
-{
-public:
-    /**
-     * Command: get the value of a single dataref.
-     */
-    static const uint8_t COMMAND_GET_SINGLE = 0x01;
-
-    /**
-     * Command: set the value of a single dataref.
-     */
-    static const uint8_t COMMAND_SET_SINGLE = 0x02;
-
-    /**
-     * Command: get the value of a multiple datarefs.
-     */
-    static const uint8_t COMMAND_GET_MULTI = 0x03;
-
-    /**
-     * Command: set the value of a multiple datarefs.
-     */
-    static const uint8_t COMMAND_SET_MULTI = 0x04;
-
-    /**
-     * Command: register a multiple-data query request
-     */
-    static const uint8_t COMMAND_REGISTER_GET_MULTI = 0x11;
-
-    /**
-     * Command: unregister a multiple-data query request
-     */
-    static const uint8_t COMMAND_UNREGISTER_GET_MULTI = 0x12;
-
-    /**
-     * Command: execute a registered multiple-data query request
-     */
-    static const uint8_t COMMAND_EXECUTE_GET_MULTI = 0x13;
-
-    /**
-     * Command: register a multiple-data update request
-     */
-    static const uint8_t COMMAND_REGISTER_SET_MULTI = 0x21;
-
-    /**
-     * Command: unregister a multiple-data update request
-     */
-    static const uint8_t COMMAND_UNREGISTER_SET_MULTI = 0x22;
-
-    /**
-     * Command: execute a registered multiple-data update request
-     */
-    static const uint8_t COMMAND_EXECUTE_SET_MULTI = 0x23;
-
-    /**
-     * Command: get the versions of the simulator
-     */
-    static const uint8_t COMMAND_GET_VERSIONS = 0x31;
-
-    /**
-     * Command: reload the plugins
-     */
-    static const uint8_t COMMAND_RELOAD_PLUGINS = 0x32;
-
-    /**
-     * Command: save the current situation.
-     *
-     * Followed by a string containing the path of the file to save
-     * relative to the X-System directory.
-     */
-    static const uint8_t COMMAND_SAVE_SITUATION = 0x33;
-
-    /**
-     * Command: show a message in the message window.
-     */
-    static const uint8_t COMMAND_SHOW_MESSAGE = 0x41;
-
-    /**
-     * Command: register a set of hotkeys for the client. Old hotkeys,
-     * if any, are forgotten.
-     *
-     * The command is followed by the following data:
-     * - The number of the hotkeys defined (U32).
-     * - The code of the hotkeys (U16*number of the hotkeys).
-     *   The lower byte is the same as the X-Plane virtual key code
-     *   (the same as the ASCII code for numbers and upper-case letters),
-     *   the upper one is a logical OR of the HOTKEY_MODIFIER_XXX
-     *   codes.
-     *
-     * The reply consists of a result code only. It may fail with an
-     * invalid length code if the number of hotkeys is too large.
-     */
-    static const uint8_t COMMAND_REGISTER_HOTKEYS = 0x51;
-
-    /**
-     * Command: query the hotkeys.
-     *
-     * The reply consists of a result code, followed by the following
-     * data, if the result code is RESULT_OK:
-     * - The number of hotkeys defined (U32).
-     * - An array of U8 values each being 0 or 1 depending on whether
-     *   the corresponding hotkey has been pressed since the last
-     *   query (or the registration, whichever is later). The value at
-     *   index i corresponds to the hotkey code at index i in the
-     *   array passed with COMMAND_REGISTER_HOTKEYS.
-     *
-     * If not hotkey has been registered, the number of hotkeys is
-     * returned as 0.
-     */
-    static const uint8_t COMMAND_QUERY_HOTKEYS = 0x52;
-
-    /**
-     * Command: unregister the previously registered hotkeys.
-     *
-     * The reply is a result code.
-     */
-    static const uint8_t COMMAND_UNREGISTER_HOTKEYS = 0x53;
-
-    /**
-     * Data type: int
-     */
-    static const uint8_t TYPE_INT = 0x01;
-
-    /**
-     * Data type: float
-     */
-    static const uint8_t TYPE_FLOAT = 0x02;
-
-    /**
-     * Data type: double
-     */
-    static const uint8_t TYPE_DOUBLE = 0x03;
-
-    /**
-     * Data type: float array
-     */
-    static const uint8_t TYPE_FLOAT_ARRAY = 0x11;
-
-    /**
-     * Data type: int array
-     */
-    static const uint8_t TYPE_INT_ARRAY = 0x12;
-
-    /**
-     * Data type: byte array
-     */
-    static const uint8_t TYPE_BYTE_ARRAY = 0x13;
-
-    /**
-     * Result code: no error, everything is OK.
-     */
-    static const uint8_t RESULT_OK = 0x00;
-
-    /**
-     * Result code: invalid command
-     */
-    static const uint8_t RESULT_INVALID_COMMAND = 0x01;
-
-    /**
-     * Result code: unknown dataref
-     */
-    static const uint8_t RESULT_UNKNOWN_DATAREF = 0x02;
-
-    /**
-     * Result code: invalid type
-     */
-    static const uint8_t RESULT_INVALID_TYPE = 0x03;
-
-    /**
-     * Result code: invalid length
-     */
-    static const uint8_t RESULT_INVALID_LENGTH = 0x04;
-
-    /**
-     * Result code: invalid offset
-     */
-    static const uint8_t RESULT_INVALID_OFFSET = 0x05;
-
-    /**
-     * Result code: invalid count
-     */
-    static const uint8_t RESULT_INVALID_COUNT = 0x06;
-
-    /**
-     * Result code: invalid ID
-     */
-    static const uint8_t RESULT_INVALID_ID = 0x07;
-
-    /**
-     * Result code: invalid duration
-     */
-    static const uint8_t RESULT_INVALID_DURATION = 0x08;
-
-    /**
-     * Result code: other error
-     */
-    static const uint8_t RESULT_OTHER_ERROR = 0xff;
-
-    /**
-     * Hotkey modifier: shift
-     */
-    static const uint16_t HOTKEY_MODIFIER_SHIFT = 0x0100;
-
-    /**
-     * Hotkey modifier: control
-     */
-    static const uint16_t HOTKEY_MODIFIER_CONTROL = 0x0200;
-
-    /**
-     * The maximal length we accept (in order to protect ourselves).
-     */
-    static const int MAX_LENGTH = 2048;
-
-    /**
-     * The maximal count of requests in a multiple-data query or
-     * update.
-     */
-    static const size_t MAX_MULTI_COUNT = 1024;
-
-    /**
-     * The maximal message duration
-     */
-    static const float MAX_MESSAGE_DURATION = 5*60;
-
-    /**
-     * The maximal number of hotkeys that can be registered for a
-     * client.
-     */
-    static const size_t MAX_HOTKEY_COUNT = 128;
-
-    /**
-     * The version of the plugin.
-     */
-    static const int version = 10;
-};
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplra */
-
-//------------------------------------------------------------------------------
-#endif // XPLRA_PROTOCOL_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/plugin/src/xplra/ReloadPluginsRequest.cc
===================================================================
--- src/plugin/src/xplra/ReloadPluginsRequest.cc	(revision 39)
+++ src/plugin/src/xplra/ReloadPluginsRequest.cc	(revision 39)
@@ -0,0 +1,52 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include "ReloadPluginsRequest.h"
+
+#include <XPLMPlugin.h>
+
+//------------------------------------------------------------------------------
+
+using xplra::ReloadPluginsRequest;
+
+//------------------------------------------------------------------------------
+
+void ReloadPluginsRequest::execute()
+{
+    XPLMReloadPlugins();
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/ReloadPluginsRequest.cc
===================================================================
--- src/plugin/src/xplra/ReloadPluginsRequest.cc	(revision 39)
+++ 	(revision )
@@ -1,52 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "ReloadPluginsRequest.h"
-
-#include <XPLMPlugin.h>
-
-//------------------------------------------------------------------------------
-
-using xplra::ReloadPluginsRequest;
-
-//------------------------------------------------------------------------------
-
-void ReloadPluginsRequest::execute()
-{
-    XPLMReloadPlugins();
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/plugin/src/xplra/ReloadPluginsRequest.h
===================================================================
--- src/plugin/src/xplra/ReloadPluginsRequest.h	(revision 39)
+++ src/plugin/src/xplra/ReloadPluginsRequest.h	(revision 39)
@@ -0,0 +1,64 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef XPLRA_RELOADPLUGINSREQUEST_H
+#define XPLRA_RELOADPLUGINSREQUEST_H
+//------------------------------------------------------------------------------
+
+#include "Request.h"
+
+//------------------------------------------------------------------------------
+
+namespace xplra {
+
+//------------------------------------------------------------------------------
+
+/**
+ * A request that simply reloads all plugins.
+ */
+class ReloadPluginsRequest : public Request
+{
+protected:
+    /**
+     * Execute the request.
+     */
+    virtual void execute();
+};
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplra */
+
+//------------------------------------------------------------------------------
+#endif // XPLRA_RELOADPLUGINSREQUEST_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/ReloadPluginsRequest.h
===================================================================
--- src/plugin/src/xplra/ReloadPluginsRequest.h	(revision 39)
+++ 	(revision )
@@ -1,64 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLRA_RELOADPLUGINSREQUEST_H
-#define XPLRA_RELOADPLUGINSREQUEST_H
-//------------------------------------------------------------------------------
-
-#include "Request.h"
-
-//------------------------------------------------------------------------------
-
-namespace xplra {
-
-//------------------------------------------------------------------------------
-
-/**
- * A request that simply reloads all plugins.
- */
-class ReloadPluginsRequest : public Request
-{
-protected:
-    /**
-     * Execute the request.
-     */
-    virtual void execute();
-};
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplra */
-
-//------------------------------------------------------------------------------
-#endif // XPLRA_RELOADPLUGINSREQUEST_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/plugin/src/xplra/Request.h
===================================================================
--- src/plugin/src/xplra/Request.h	(revision 13)
+++ src/plugin/src/xplra/Request.h	(revision 13)
@@ -0,0 +1,95 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef XPLRA_REQUEST_H
+#define XPLRA_REQUEST_H
+//------------------------------------------------------------------------------
+
+namespace xplra {
+
+//------------------------------------------------------------------------------
+
+/**
+ * Base class for requests. A request is something that is executed in
+ * the flight loop.
+ */
+class Request
+{
+private:
+    /**
+     * Indicate that the request is completed.
+     */
+    volatile bool completed;
+
+public:
+    /**
+     * Construct the request.
+     */
+    Request();
+
+    /**
+     * Virtual destructor.
+     */
+    virtual ~Request();
+
+protected:
+    /**
+     * Execute the request. Make this very fast!
+     */
+    virtual void execute() = 0;
+
+    friend class RequestQueue;
+};
+
+//------------------------------------------------------------------------------
+// Inline definitions
+//------------------------------------------------------------------------------
+
+inline Request::Request() :
+    completed(false)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline Request::~Request()
+{
+}
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplra */
+
+//------------------------------------------------------------------------------
+#endif // XPLRA_REQUEST_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/Request.h
===================================================================
--- src/plugin/src/xplra/Request.h	(revision 13)
+++ 	(revision )
@@ -1,95 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLRA_REQUEST_H
-#define XPLRA_REQUEST_H
-//------------------------------------------------------------------------------
-
-namespace xplra {
-
-//------------------------------------------------------------------------------
-
-/**
- * Base class for requests. A request is something that is executed in
- * the flight loop.
- */
-class Request
-{
-private:
-    /**
-     * Indicate that the request is completed.
-     */
-    volatile bool completed;
-
-public:
-    /**
-     * Construct the request.
-     */
-    Request();
-
-    /**
-     * Virtual destructor.
-     */
-    virtual ~Request();
-
-protected:
-    /**
-     * Execute the request. Make this very fast!
-     */
-    virtual void execute() = 0;
-
-    friend class RequestQueue;
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline Request::Request() :
-    completed(false)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline Request::~Request()
-{
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplra */
-
-//------------------------------------------------------------------------------
-#endif // XPLRA_REQUEST_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/plugin/src/xplra/RequestQueue.cc
===================================================================
--- src/plugin/src/xplra/RequestQueue.cc	(revision 13)
+++ src/plugin/src/xplra/RequestQueue.cc	(revision 13)
@@ -0,0 +1,156 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include "RequestQueue.h"
+
+#include "Request.h"
+
+#include <hu/varadiistvan/xplcommon/Util.h>
+
+//------------------------------------------------------------------------------
+
+using xplra::RequestQueue;
+
+using hu::varadiistvan::xplcommon::Util;
+
+//------------------------------------------------------------------------------
+
+float RequestQueue::flightLoop(float /*inElapsedSinceLastCall*/,
+                               float /*inElapsedTimeSinceLastFlightLoop*/,
+                               int /*inCounter*/, void* inRefCon)
+{
+    RequestQueue* requestQueue = reinterpret_cast<RequestQueue*>(inRefCon);
+    requestQueue->run();
+#if USE_SCHEDULE_FLIGHTLOOP
+    return 0.0;
+#else
+    return flightLoopInterval;
+#endif
+}
+
+//------------------------------------------------------------------------------
+
+RequestQueue::RequestQueue() :
+    enabled(true)
+{
+#if USE_SCHEDULE_FLIGHTLOOP
+    XPLMCreateFlightLoop_t createFL;
+
+    createFL.structSize = sizeof(createFL);
+    createFL.phase = xplm_FlightLoop_Phase_AfterFlightModel;
+    createFL.callbackFunc = &flightLoop;
+    createFL.refcon = this;
+
+    flightLoopID = XPLMCreateFlightLoop(&createFL);
+#else
+    XPLMRegisterFlightLoopCallback(&flightLoop, flightLoopInterval, this);
+#endif
+}
+
+//------------------------------------------------------------------------------
+
+bool RequestQueue::execute(Request* request)
+{
+    mutex.lock();
+    if (!enabled) {
+        mutex.unlock();
+        return false;
+    }
+
+    request->completed = false;
+    requests.push_back(request);
+
+#if USE_SCHEDULE_FLIGHTLOOP
+    if (requests.size()==1) {
+        XPLMScheduleFlightLoop(flightLoopID, -2.0, true);
+    }
+#endif
+
+    while(enabled && !request->completed) {
+        requestsDone.wait(mutex);
+    }
+
+    bool result = request->completed;
+
+    mutex.unlock();
+
+    return result;
+}
+
+//------------------------------------------------------------------------------
+
+void RequestQueue::disable()
+{
+    mutex.lock();
+    enabled = false;
+    mutex.unlock();
+    requestsDone.broadcast();
+#if USE_SCHEDULE_FLIGHTLOOP
+    XPLMDestroyFlightLoop(flightLoopID);
+#else
+    XPLMUnregisterFlightLoopCallback(&flightLoop, this);
+#endif
+}
+
+//------------------------------------------------------------------------------
+
+void RequestQueue::run()
+{
+    requests_t queuedRequests;
+
+    mutex.lock();
+    requests.swap(queuedRequests);
+    mutex.unlock();
+
+    if (queuedRequests.empty()) return;
+
+    for(requests_t::const_iterator i = queuedRequests.begin();
+        i!=queuedRequests.end(); ++i)
+    {
+        (*i)->execute();
+    }
+
+    mutex.lock();
+    for(requests_t::const_iterator i = queuedRequests.begin();
+        i!=queuedRequests.end(); ++i)
+    {
+        (*i)->completed = true;
+    }
+    mutex.unlock();
+    requestsDone.broadcast();
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/RequestQueue.cc
===================================================================
--- src/plugin/src/xplra/RequestQueue.cc	(revision 13)
+++ 	(revision )
@@ -1,156 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "RequestQueue.h"
-
-#include "Request.h"
-
-#include <hu/varadiistvan/xplcommon/Util.h>
-
-//------------------------------------------------------------------------------
-
-using xplra::RequestQueue;
-
-using hu::varadiistvan::xplcommon::Util;
-
-//------------------------------------------------------------------------------
-
-float RequestQueue::flightLoop(float /*inElapsedSinceLastCall*/,
-                               float /*inElapsedTimeSinceLastFlightLoop*/,
-                               int /*inCounter*/, void* inRefCon)
-{
-    RequestQueue* requestQueue = reinterpret_cast<RequestQueue*>(inRefCon);
-    requestQueue->run();
-#if USE_SCHEDULE_FLIGHTLOOP
-    return 0.0;
-#else
-    return flightLoopInterval;
-#endif
-}
-
-//------------------------------------------------------------------------------
-
-RequestQueue::RequestQueue() :
-    enabled(true)
-{
-#if USE_SCHEDULE_FLIGHTLOOP
-    XPLMCreateFlightLoop_t createFL;
-
-    createFL.structSize = sizeof(createFL);
-    createFL.phase = xplm_FlightLoop_Phase_AfterFlightModel;
-    createFL.callbackFunc = &flightLoop;
-    createFL.refcon = this;
-
-    flightLoopID = XPLMCreateFlightLoop(&createFL);
-#else
-    XPLMRegisterFlightLoopCallback(&flightLoop, flightLoopInterval, this);
-#endif
-}
-
-//------------------------------------------------------------------------------
-
-bool RequestQueue::execute(Request* request)
-{
-    mutex.lock();
-    if (!enabled) {
-        mutex.unlock();
-        return false;
-    }
-
-    request->completed = false;
-    requests.push_back(request);
-
-#if USE_SCHEDULE_FLIGHTLOOP
-    if (requests.size()==1) {
-        XPLMScheduleFlightLoop(flightLoopID, -2.0, true);
-    }
-#endif
-
-    while(enabled && !request->completed) {
-        requestsDone.wait(mutex);
-    }
-
-    bool result = request->completed;
-
-    mutex.unlock();
-
-    return result;
-}
-
-//------------------------------------------------------------------------------
-
-void RequestQueue::disable()
-{
-    mutex.lock();
-    enabled = false;
-    mutex.unlock();
-    requestsDone.broadcast();
-#if USE_SCHEDULE_FLIGHTLOOP
-    XPLMDestroyFlightLoop(flightLoopID);
-#else
-    XPLMUnregisterFlightLoopCallback(&flightLoop, this);
-#endif
-}
-
-//------------------------------------------------------------------------------
-
-void RequestQueue::run()
-{
-    requests_t queuedRequests;
-
-    mutex.lock();
-    requests.swap(queuedRequests);
-    mutex.unlock();
-
-    if (queuedRequests.empty()) return;
-
-    for(requests_t::const_iterator i = queuedRequests.begin();
-        i!=queuedRequests.end(); ++i)
-    {
-        (*i)->execute();
-    }
-
-    mutex.lock();
-    for(requests_t::const_iterator i = queuedRequests.begin();
-        i!=queuedRequests.end(); ++i)
-    {
-        (*i)->completed = true;
-    }
-    mutex.unlock();
-    requestsDone.broadcast();
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/plugin/src/xplra/RequestQueue.h
===================================================================
--- src/plugin/src/xplra/RequestQueue.h	(revision 92)
+++ src/plugin/src/xplra/RequestQueue.h	(revision 92)
@@ -0,0 +1,168 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef XPLRA_REQUESTQUEUE_H
+#define XPLRA_REQUESTQUEUE_H
+//------------------------------------------------------------------------------
+
+#include <hu/varadiistvan/scpl/Mutex.h>
+#include <hu/varadiistvan/scpl/CondVar.h>
+
+#include <XPLMProcessing.h>
+
+#include <vector>
+
+//------------------------------------------------------------------------------
+
+// Define to 1, if the new XPLMScheduleFlightLoop function should be
+// used to schedule the flight loop only on-demand
+#define USE_SCHEDULE_FLIGHTLOOP 0
+
+//------------------------------------------------------------------------------
+
+namespace xplra {
+
+//------------------------------------------------------------------------------
+
+class Request;
+
+//------------------------------------------------------------------------------
+
+/**
+ * The queue of the requests. Client serving threads can add requests
+ * to the queue. The queue provides a flight loop callback, which it
+ * automatically schedules if a request is added to it, unless we are
+ * already disabled.
+ *
+ * An instance of the queue should be created in the plugin enable
+ * callback. The disable callback should disable the queue, so that it
+ * will not accept any further requests.
+ */
+class RequestQueue
+{
+private:
+    /**
+     * Type for the collection of the queued requests.
+     */
+    typedef std::vector<Request*> requests_t;
+
+#if !USE_SCHEDULE_FLIGHTLOOP
+    /**
+     * The interval of the flight loop.
+     */
+    static constexpr float flightLoopInterval = 0.1;
+#endif
+
+    /**
+     * The flight loop function.
+     */
+    static float flightLoop(float inElapsedSinceLastCall,
+                            float inElapsedTimeSinceLastFlightLoop,
+                            int inCounter, void* inRefCon);
+
+#if USE_SCHEDULE_FLIGHTLOOP
+    /**
+     * The ID of the flight loop running the queue.
+     */
+    XPLMFlightLoopID flightLoopID;
+#endif
+
+    /**
+     * The mutex protecting the queue.
+     */
+    hu::varadiistvan::scpl::Mutex mutex;
+
+    /**
+     * A conditional variable to notify the threads waiting for their
+     * request to be executed.
+     */
+    hu::varadiistvan::scpl::CondVar requestsDone;
+
+    /**
+     * Indicate if the queue is enabled or not.
+     */
+    volatile bool enabled;
+
+    /**
+     * The vector of the queued requests.
+     */
+    requests_t requests;
+
+public:
+    /**
+     * Construct the queue. It creates the flight loop, so it should
+     * be called from a plugin callback.
+     */
+    RequestQueue();
+
+    /**
+     * Execute the given request. It will be enqueued, and then this
+     * function will wait until the request is executed or the request
+     * queue is disabled.
+     *
+     * If the queue is already disabled when calling this function, it
+     * returns immediately with false.
+     *
+     * @return if the request was executed
+     */
+    bool execute(Request* request);
+
+    /**
+     * Disable the queue. It sets the flag indicating that the queue
+     * is disabled, and wakes up all waiters waiting on the
+     * conditional variable. It should be called from a plugin
+     * callback, as it also destroys the flight loop.
+     */
+    void disable();
+
+private:
+    /**
+     * Run the queue.
+     *
+     * It locks the mutex, swaps the vector of requests with an empty
+     * one, unlocks the mutex and runs the requests one by one. When
+     * all requests are executed, it wakes up all waiters waiting on
+     * the conditional variable.
+     *
+     * It is called from the flight loop function.
+     */
+    void run();
+};
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplra */
+
+//------------------------------------------------------------------------------
+#endif // XPLRA_REQUESTQUEUE_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/RequestQueue.h
===================================================================
--- src/plugin/src/xplra/RequestQueue.h	(revision 13)
+++ 	(revision )
@@ -1,168 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLRA_REQUESTQUEUE_H
-#define XPLRA_REQUESTQUEUE_H
-//------------------------------------------------------------------------------
-
-#include <hu/varadiistvan/scpl/Mutex.h>
-#include <hu/varadiistvan/scpl/CondVar.h>
-
-#include <XPLMProcessing.h>
-
-#include <vector>
-
-//------------------------------------------------------------------------------
-
-// Define to 1, if the new XPLMScheduleFlightLoop function should be
-// used to schedule the flight loop only on-demand
-#define USE_SCHEDULE_FLIGHTLOOP 0
-
-//------------------------------------------------------------------------------
-
-namespace xplra {
-
-//------------------------------------------------------------------------------
-
-class Request;
-
-//------------------------------------------------------------------------------
-
-/**
- * The queue of the requests. Client serving threads can add requests
- * to the queue. The queue provides a flight loop callback, which it
- * automatically schedules if a request is added to it, unless we are
- * already disabled.
- *
- * An instance of the queue should be created in the plugin enable
- * callback. The disable callback should disable the queue, so that it
- * will not accept any further requests.
- */
-class RequestQueue
-{
-private:
-    /**
-     * Type for the collection of the queued requests.
-     */
-    typedef std::vector<Request*> requests_t;
-
-#if !USE_SCHEDULE_FLIGHTLOOP
-    /**
-     * The interval of the flight loop.
-     */
-    static const float flightLoopInterval = 0.1;
-#endif
-
-    /**
-     * The flight loop function.
-     */
-    static float flightLoop(float inElapsedSinceLastCall,
-                            float inElapsedTimeSinceLastFlightLoop,
-                            int inCounter, void* inRefCon);
-
-#if USE_SCHEDULE_FLIGHTLOOP
-    /**
-     * The ID of the flight loop running the queue.
-     */
-    XPLMFlightLoopID flightLoopID;
-#endif
-
-    /**
-     * The mutex protecting the queue.
-     */
-    hu::varadiistvan::scpl::Mutex mutex;
-
-    /**
-     * A conditional variable to notify the threads waiting for their
-     * request to be executed.
-     */
-    hu::varadiistvan::scpl::CondVar requestsDone;
-
-    /**
-     * Indicate if the queue is enabled or not.
-     */
-    volatile bool enabled;
-
-    /**
-     * The vector of the queued requests.
-     */
-    requests_t requests;
-
-public:
-    /**
-     * Construct the queue. It creates the flight loop, so it should
-     * be called from a plugin callback.
-     */
-    RequestQueue();
-
-    /**
-     * Execute the given request. It will be enqueued, and then this
-     * function will wait until the request is executed or the request
-     * queue is disabled.
-     *
-     * If the queue is already disabled when calling this function, it
-     * returns immediately with false.
-     *
-     * @return if the request was executed
-     */
-    bool execute(Request* request);
-
-    /**
-     * Disable the queue. It sets the flag indicating that the queue
-     * is disabled, and wakes up all waiters waiting on the
-     * conditional variable. It should be called from a plugin
-     * callback, as it also destroys the flight loop.
-     */
-    void disable();
-
-private:
-    /**
-     * Run the queue.
-     *
-     * It locks the mutex, swaps the vector of requests with an empty
-     * one, unlocks the mutex and runs the requests one by one. When
-     * all requests are executed, it wakes up all waiters waiting on
-     * the conditional variable.
-     *
-     * It is called from the flight loop function.
-     */
-    void run();
-};
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplra */
-
-//------------------------------------------------------------------------------
-#endif // XPLRA_REQUESTQUEUE_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/plugin/src/xplra/SaveSituationRequest.cc
===================================================================
--- src/plugin/src/xplra/SaveSituationRequest.cc	(revision 81)
+++ src/plugin/src/xplra/SaveSituationRequest.cc	(revision 81)
@@ -0,0 +1,61 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include "SaveSituationRequest.h"
+
+#include <hu/varadiistvan/xplcommon/Util.h>
+
+#include <XPLMUtilities.h>
+
+//------------------------------------------------------------------------------
+
+using xplra::SaveSituationRequest;
+
+using hu::varadiistvan::xplcommon::Util;
+
+//------------------------------------------------------------------------------
+
+void SaveSituationRequest::execute()
+{
+    int result = XPLMSaveDataFile(xplm_DataFile_Situation,
+                                  path.c_str());
+    success = result==1;
+    if (!success) {
+        Util::debug("xplra::SaveSituationRequest::execute: result=%d\n", result);
+    }
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/SaveSituationRequest.cc
===================================================================
--- src/plugin/src/xplra/SaveSituationRequest.cc	(revision 81)
+++ 	(revision )
@@ -1,61 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "SaveSituationRequest.h"
-
-#include <hu/varadiistvan/xplcommon/Util.h>
-
-#include <XPLMUtilities.h>
-
-//------------------------------------------------------------------------------
-
-using xplra::SaveSituationRequest;
-
-using hu::varadiistvan::xplcommon::Util;
-
-//------------------------------------------------------------------------------
-
-void SaveSituationRequest::execute()
-{
-    int result = XPLMSaveDataFile(xplm_DataFile_Situation,
-                                  path.c_str());
-    success = result==1;
-    if (!success) {
-        Util::debug("xplra::SaveSituationRequest::execute: result=%d\n", result);
-    }
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/plugin/src/xplra/SaveSituationRequest.h
===================================================================
--- src/plugin/src/xplra/SaveSituationRequest.h	(revision 81)
+++ src/plugin/src/xplra/SaveSituationRequest.h	(revision 81)
@@ -0,0 +1,105 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef XPLRA_SAVESITUATIONREQUEST_H
+#define XPLRA_SAVESITUATIONREQUEST_H
+//------------------------------------------------------------------------------
+
+#include "Request.h"
+
+#include <string>
+
+//------------------------------------------------------------------------------
+
+namespace xplra {
+
+//------------------------------------------------------------------------------
+
+/**
+ * A request that saves the current situation into a file.
+ */
+class SaveSituationRequest : public Request
+{
+private:
+    /**
+     * The path to save the situation into.
+     */
+    std::string path;
+
+    /**
+     * Indicate the success.
+     */
+    bool success;
+
+public:
+    /**
+     * Construct the request.
+     */
+    SaveSituationRequest(const std::string& path);
+
+    /**
+     * Get the result.
+     */
+    bool getSuccess() const;
+
+protected:
+    /**
+     * Execute the request.
+     */
+    virtual void execute();
+};
+
+//------------------------------------------------------------------------------
+// Inline definitions
+//------------------------------------------------------------------------------
+
+inline SaveSituationRequest::SaveSituationRequest(const std::string& path) :
+    path(path),
+    success(false)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline bool SaveSituationRequest::getSuccess() const
+{
+    return success;
+}
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplra */
+
+//------------------------------------------------------------------------------
+#endif // XPLRA_SAVESITUATIONREQUEST_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/SaveSituationRequest.h
===================================================================
--- src/plugin/src/xplra/SaveSituationRequest.h	(revision 81)
+++ 	(revision )
@@ -1,105 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLRA_SAVESITUATIONREQUEST_H
-#define XPLRA_SAVESITUATIONREQUEST_H
-//------------------------------------------------------------------------------
-
-#include "Request.h"
-
-#include <string>
-
-//------------------------------------------------------------------------------
-
-namespace xplra {
-
-//------------------------------------------------------------------------------
-
-/**
- * A request that saves the current situation into a file.
- */
-class SaveSituationRequest : public Request
-{
-private:
-    /**
-     * The path to save the situation into.
-     */
-    std::string path;
-
-    /**
-     * Indicate the success.
-     */
-    bool success;
-
-public:
-    /**
-     * Construct the request.
-     */
-    SaveSituationRequest(const std::string& path);
-
-    /**
-     * Get the result.
-     */
-    bool getSuccess() const;
-
-protected:
-    /**
-     * Execute the request.
-     */
-    virtual void execute();
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline SaveSituationRequest::SaveSituationRequest(const std::string& path) :
-    path(path),
-    success(false)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline bool SaveSituationRequest::getSuccess() const
-{
-    return success;
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplra */
-
-//------------------------------------------------------------------------------
-#endif // XPLRA_SAVESITUATIONREQUEST_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/plugin/src/xplra/ServerThread.cc
===================================================================
--- src/plugin/src/xplra/ServerThread.cc	(revision 81)
+++ src/plugin/src/xplra/ServerThread.cc	(revision 81)
@@ -0,0 +1,546 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include "ServerThread.h"
+
+#include "ListenThread.h"
+#include "RequestQueue.h"
+#include "Protocol.h"
+#include "GetDataRefTask.h"
+#include "SetDataRefTask.h"
+#include "TaskRequest.h"
+#include "GetMultiDataRefRequest.h"
+#include "SetMultiDataRefRequest.h"
+#include "ReloadPluginsRequest.h"
+#ifdef XPLM200
+#include "SaveSituationRequest.h"
+#endif
+#include "MessageRequest.h"
+#include "Globals.h"
+
+#include <hu/varadiistvan/xplcommon/Util.h>
+
+#include <cstdio>
+
+//------------------------------------------------------------------------------
+
+using xplra::ServerThread;
+
+using hu::varadiistvan::scpl::io::LocalAcceptor;
+using hu::varadiistvan::scpl::Mutex;
+using hu::varadiistvan::xplcommon::Util;
+
+using std::string;
+
+//------------------------------------------------------------------------------
+
+Mutex ServerThread::instancesMutex;
+
+ServerThread::instances_t ServerThread::instances;
+
+//------------------------------------------------------------------------------
+
+void ServerThread::quitAll()
+{
+    instancesMutex.lock();
+    for(instances_t::iterator i = instances.begin(); i!=instances.end(); ++i) {
+        ServerThread* thread = *i;
+        thread->quit();
+        thread->join();
+        delete thread;
+    }
+    instances.clear();
+    instancesMutex.unlock();
+}
+
+//------------------------------------------------------------------------------
+
+inline bool ServerThread::destroyHotkeys()
+{
+    if (hotkeys!=0) {
+        listenThread.getGlobals().getHotkeyHandler().unregisterHotkeys(hotkeys);
+        delete hotkeys; hotkeys = 0;
+        return true;
+    } else {
+        return false;
+    }
+}
+
+//------------------------------------------------------------------------------
+
+ServerThread::ServerThread(ListenThread& listenThread,
+                           RequestQueue& requestQueue, LocalAcceptor& acceptor) :
+    listenThread(listenThread),
+    requestQueue(requestQueue),
+    bufferedStream(acceptor.getSocket(&waiter)),
+    stream(*bufferedStream),
+    nextGetMultiRequestID(1),
+    nextSetMultiRequestID(1),
+    hotkeys(0)
+{
+    instancesMutex.lock();
+    instances.insert(this);
+    instancesMutex.unlock();
+}
+
+//------------------------------------------------------------------------------
+
+ServerThread::~ServerThread()
+{
+    delete bufferedStream;
+
+    for(getMultiRequests_t::iterator i = getMultiRequests.begin();
+        i!=getMultiRequests.end(); ++i)
+    {
+        delete i->second;
+    }
+
+    for(setMultiRequests_t::iterator i = setMultiRequests.begin();
+        i!=setMultiRequests.end(); ++i)
+    {
+        delete i->second;
+    }
+}
+
+//------------------------------------------------------------------------------
+
+void ServerThread::quit()
+{
+    stream.interrupt();
+}
+
+//------------------------------------------------------------------------------
+
+void ServerThread::run()
+{
+    Util::debug("hu.varadiistvan.xplra.ServerThread[%p]::run\n", this);
+    while(stream) {
+        uint8_t command = stream.readU8();
+        if (!stream) continue;
+
+        // Util::debug("hu.varadiistvan.xplra.ServerThread[%p]::run: command=0x%02x\n",
+        //             this, command);
+
+        if (command==Protocol::COMMAND_GET_SINGLE) {
+            if (!handleGetSingle()) break;
+        } else if (command==Protocol::COMMAND_SET_SINGLE) {
+            if (!handleSetSingle()) break;
+        } else if (command==Protocol::COMMAND_GET_MULTI) {
+            if (!handleGetMulti()) break;
+        } else if (command==Protocol::COMMAND_SET_MULTI) {
+            if (!handleSetMulti()) break;
+        } else if (command==Protocol::COMMAND_REGISTER_GET_MULTI) {
+            if (!handleRegisterGetMulti()) break;
+        } else if (command==Protocol::COMMAND_UNREGISTER_GET_MULTI) {
+            if (!handleUnregisterGetMulti()) break;
+        } else if (command==Protocol::COMMAND_EXECUTE_GET_MULTI) {
+            if (!handleExecuteGetMulti()) break;
+        } else if (command==Protocol::COMMAND_REGISTER_SET_MULTI) {
+            if (!handleRegisterSetMulti()) break;
+        } else if (command==Protocol::COMMAND_UNREGISTER_SET_MULTI) {
+            if (!handleUnregisterSetMulti()) break;
+        } else if (command==Protocol::COMMAND_EXECUTE_SET_MULTI) {
+            if (!handleExecuteSetMulti()) break;
+        } else if (command==Protocol::COMMAND_GET_VERSIONS) {
+            if (!handleGetVersions()) break;
+        } else if (command==Protocol::COMMAND_RELOAD_PLUGINS) {
+            if (!handleReloadPlugins()) break;
+#ifdef XPLM200
+        } else if (command==Protocol::COMMAND_SAVE_SITUATION) {
+            if (!handleSaveSituation()) break;
+#endif
+        } else if (command==Protocol::COMMAND_SHOW_MESSAGE) {
+            if (!handleShowMessage()) break;
+        } else if (command==Protocol::COMMAND_REGISTER_HOTKEYS) {
+            if (!handleRegisterHotkeys()) break;
+        } else if (command==Protocol::COMMAND_QUERY_HOTKEYS) {
+            if (!handleQueryHotkeys()) break;
+        } else if (command==Protocol::COMMAND_UNREGISTER_HOTKEYS) {
+            if (!handleUnregisterHotkeys()) break;
+        } else {
+            stream.writeU8(Protocol::RESULT_INVALID_COMMAND);
+        }
+        stream.flush();
+    }
+
+    destroyHotkeys();
+
+    Util::debug("hu.varadiistvan.xplra.ServerThread[%p]::run: quitting\n", this);
+}
+
+//------------------------------------------------------------------------------
+
+bool ServerThread::handleGetSingle()
+{
+    uint8_t result = Protocol::RESULT_OK;
+    GetDataRefTask* task = GetDataRefTask::create(result, stream);
+
+    if (!stream) {
+        return false;
+    } else if (task==0) {
+        stream.writeU8(result);
+        return true;
+    }
+
+    TaskRequest request(task);
+    if (!requestQueue.execute(&request)) return false;
+
+    if (task->isValid()) {
+        stream.writeU8(Protocol::RESULT_OK);
+        task->writeValue(stream);
+    } else {
+        stream.writeU8(Protocol::RESULT_UNKNOWN_DATAREF);
+    }
+
+    return true;
+}
+
+//------------------------------------------------------------------------------
+
+bool ServerThread::handleSetSingle()
+{
+    uint8_t result = Protocol::RESULT_OK;
+    SetDataRefTask* task = SetDataRefTask::create(result, stream);
+
+    if (!stream) {
+        return false;
+    } else if (task==0) {
+        stream.writeU8(result);
+        return true;
+    }
+
+    task->readValue(stream);
+    if (!stream) {
+        delete task;
+        return false;
+    }
+
+    TaskRequest request(task);
+    if (!requestQueue.execute(&request)) return false;
+
+    stream.writeU8(task->isValid() ? Protocol::RESULT_OK :
+                   Protocol::RESULT_UNKNOWN_DATAREF);
+    return true;
+}
+
+//------------------------------------------------------------------------------
+
+bool ServerThread::handleGetMulti()
+{
+    uint8_t result = Protocol::RESULT_OK;
+    GetMultiDataRefRequest* request =
+        new GetMultiDataRefRequest(result, stream);
+    if (result!=Protocol::RESULT_OK || !stream) {
+        delete request;
+        stream.writeU8(result);
+        return stream;
+    }
+
+    bool isOK = requestQueue.execute(request);
+
+    if (isOK) {
+        request->writeResult(stream);
+    }
+
+    delete request;
+
+    return isOK;
+}
+
+//------------------------------------------------------------------------------
+
+bool ServerThread::handleSetMulti()
+{
+    uint8_t result = Protocol::RESULT_OK;
+    SetMultiDataRefRequest* request =
+        new SetMultiDataRefRequest(result, stream, true);
+    if (result!=Protocol::RESULT_OK || !stream) {
+        delete request;
+        stream.writeU8(result);
+        return stream;
+    }
+
+    bool isOK = requestQueue.execute(request);
+
+    if (isOK) {
+        request->writeResult(stream);
+    }
+
+    delete request;
+
+    return isOK;
+}
+
+//------------------------------------------------------------------------------
+
+bool ServerThread::handleRegisterGetMulti()
+{
+    uint8_t result = Protocol::RESULT_OK;
+    GetMultiDataRefRequest* request =
+        new GetMultiDataRefRequest(result, stream);
+    if (result!=Protocol::RESULT_OK || !stream) {
+        delete request;
+        stream.writeU8(result);
+        return stream;
+    }
+
+    size_t id = nextGetMultiRequestID++;
+    getMultiRequests[id] = request;
+
+    stream.writeU8(Protocol::RESULT_OK);
+    stream.writeU32(id);
+
+    return true;
+}
+
+//------------------------------------------------------------------------------
+
+bool ServerThread::handleUnregisterGetMulti()
+{
+    uint32_t id = stream.readU32();
+    if (!stream) return false;
+
+    getMultiRequests_t::iterator i = getMultiRequests.find(id);
+    if (i==getMultiRequests.end()) {
+        stream.writeU8(Protocol::RESULT_INVALID_ID);
+    } else {
+        GetMultiDataRefRequest* request = i->second;
+        getMultiRequests.erase(i);
+        delete request;
+        stream.writeU8(Protocol::RESULT_OK);
+    }
+
+    return true;
+}
+
+//------------------------------------------------------------------------------
+
+bool ServerThread::handleExecuteGetMulti()
+{
+    uint32_t id = stream.readU32();
+    if (!stream) return false;
+
+    getMultiRequests_t::iterator i = getMultiRequests.find(id);
+    if (i==getMultiRequests.end()) {
+        stream.writeU8(Protocol::RESULT_INVALID_ID);
+    } else {
+        GetMultiDataRefRequest* request = i->second;
+        if (!requestQueue.execute(request)) return false;
+        request->writeResult(stream);
+    }
+
+    return true;
+}
+
+//------------------------------------------------------------------------------
+
+bool ServerThread::handleRegisterSetMulti()
+{
+    uint8_t result = Protocol::RESULT_OK;
+    SetMultiDataRefRequest* request =
+        new SetMultiDataRefRequest(result, stream, false);
+    if (result!=Protocol::RESULT_OK || !stream) {
+        delete request;
+        stream.writeU8(result);
+        return stream;
+    }
+
+    size_t id = nextSetMultiRequestID++;
+    setMultiRequests[id] = request;
+
+    stream.writeU8(Protocol::RESULT_OK);
+    stream.writeU32(id);
+
+    return true;
+}
+
+//------------------------------------------------------------------------------
+
+bool ServerThread::handleUnregisterSetMulti()
+{
+    uint32_t id = stream.readU32();
+    if (!stream) return false;
+
+    setMultiRequests_t::iterator i = setMultiRequests.find(id);
+    if (i==setMultiRequests.end()) {
+        stream.writeU8(Protocol::RESULT_INVALID_ID);
+    } else {
+        SetMultiDataRefRequest* request = i->second;
+        setMultiRequests.erase(i);
+        delete request;
+        stream.writeU8(Protocol::RESULT_OK);
+    }
+
+    return true;
+}
+
+//------------------------------------------------------------------------------
+
+bool ServerThread::handleExecuteSetMulti()
+{
+    uint32_t id = stream.readU32();
+    if (!stream) return false;
+
+    setMultiRequests_t::iterator i = setMultiRequests.find(id);
+    if (i==setMultiRequests.end()) {
+        stream.writeU8(Protocol::RESULT_INVALID_ID);
+    } else {
+        SetMultiDataRefRequest* request = i->second;
+        request->readValues(stream);
+        if (!stream || !requestQueue.execute(request)) return false;
+        request->writeResult(stream);
+    }
+
+    return true;
+}
+
+//------------------------------------------------------------------------------
+
+bool ServerThread::handleGetVersions()
+{
+    int xplaneVersion = 0;
+    int xplmVersion = 0;
+
+    listenThread.getGlobals().getVersions(xplaneVersion, xplmVersion);
+
+    stream.writeU8(Protocol::RESULT_OK);
+    stream.writeS32(xplaneVersion);
+    stream.writeS32(xplmVersion);
+    stream.writeS32(Protocol::version);
+
+    return true;
+}
+
+//------------------------------------------------------------------------------
+
+bool ServerThread::handleReloadPlugins()
+{
+    ReloadPluginsRequest request;
+    if (!requestQueue.execute(&request)) return false;
+
+    stream.writeU8(Protocol::RESULT_OK);
+
+    return true;
+}
+
+//------------------------------------------------------------------------------
+
+#ifdef XPLM200
+
+bool ServerThread::handleSaveSituation()
+{
+    string path = stream.readString();
+    SaveSituationRequest request(path);
+    if (!requestQueue.execute(&request)) return false;
+
+    stream.writeU8(request.getSuccess() ? Protocol::RESULT_OK :
+                   Protocol::RESULT_OTHER_ERROR);
+
+    return true;
+}
+
+#endif
+
+//------------------------------------------------------------------------------
+
+bool ServerThread::handleShowMessage()
+{
+    string message = stream.readString();
+    float duration = stream.readFloat();
+    if (!stream) return false;
+
+    if (duration>Protocol::MAX_MESSAGE_DURATION) {
+        stream.writeU8(Protocol::RESULT_INVALID_DURATION);
+    } else {
+        MessageRequest request(listenThread.getGlobals().getMessageWindow(),
+                               message, duration);
+        if (!requestQueue.execute(&request)) return false;
+
+        stream.writeU8(Protocol::RESULT_OK);
+    }
+
+    return true;
+}
+
+//------------------------------------------------------------------------------
+
+bool ServerThread::handleRegisterHotkeys()
+{
+    size_t numHotkeys = stream.readU32();
+    if (!stream) return false;
+
+    if (numHotkeys>Protocol::MAX_HOTKEY_COUNT) {
+        stream.writeU8(Protocol::RESULT_INVALID_LENGTH);
+    } else {
+        HotkeyHandler::Hotkeys* newHotkeys =
+            new HotkeyHandler::Hotkeys(numHotkeys, stream);
+        if (newHotkeys->isValid()) {
+            destroyHotkeys();
+            hotkeys = newHotkeys;
+            listenThread.getGlobals().getHotkeyHandler().registerHotkeys(hotkeys);
+            stream.writeU8(Protocol::RESULT_OK);
+        } else {
+            delete newHotkeys;
+            return false;
+        }
+    }
+
+    return true;
+}
+
+//------------------------------------------------------------------------------
+
+bool ServerThread::handleQueryHotkeys()
+{
+    stream.writeU8(Protocol::RESULT_OK);
+    if (hotkeys==0) {
+        stream.writeU32(0);
+    } else {
+        hotkeys->writePressed(stream);
+    }
+    return true;
+}
+
+//------------------------------------------------------------------------------
+
+bool ServerThread::handleUnregisterHotkeys()
+{
+    destroyHotkeys();
+    stream.writeU8(Protocol::RESULT_OK);
+    return true;
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/ServerThread.cc
===================================================================
--- src/plugin/src/xplra/ServerThread.cc	(revision 81)
+++ 	(revision )
@@ -1,546 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "ServerThread.h"
-
-#include "ListenThread.h"
-#include "RequestQueue.h"
-#include "Protocol.h"
-#include "GetDataRefTask.h"
-#include "SetDataRefTask.h"
-#include "TaskRequest.h"
-#include "GetMultiDataRefRequest.h"
-#include "SetMultiDataRefRequest.h"
-#include "ReloadPluginsRequest.h"
-#ifdef XPLM200
-#include "SaveSituationRequest.h"
-#endif
-#include "MessageRequest.h"
-#include "Globals.h"
-
-#include <hu/varadiistvan/xplcommon/Util.h>
-
-#include <cstdio>
-
-//------------------------------------------------------------------------------
-
-using xplra::ServerThread;
-
-using hu::varadiistvan::scpl::io::LocalAcceptor;
-using hu::varadiistvan::scpl::Mutex;
-using hu::varadiistvan::xplcommon::Util;
-
-using std::string;
-
-//------------------------------------------------------------------------------
-
-Mutex ServerThread::instancesMutex;
-
-ServerThread::instances_t ServerThread::instances;
-
-//------------------------------------------------------------------------------
-
-void ServerThread::quitAll()
-{
-    instancesMutex.lock();
-    for(instances_t::iterator i = instances.begin(); i!=instances.end(); ++i) {
-        ServerThread* thread = *i;
-        thread->quit();
-        thread->join();
-        delete thread;
-    }
-    instances.clear();
-    instancesMutex.unlock();
-}
-
-//------------------------------------------------------------------------------
-
-inline bool ServerThread::destroyHotkeys()
-{
-    if (hotkeys!=0) {
-        listenThread.getGlobals().getHotkeyHandler().unregisterHotkeys(hotkeys);
-        delete hotkeys; hotkeys = 0;
-        return true;
-    } else {
-        return false;
-    }
-}
-
-//------------------------------------------------------------------------------
-
-ServerThread::ServerThread(ListenThread& listenThread,
-                           RequestQueue& requestQueue, LocalAcceptor& acceptor) :
-    listenThread(listenThread),
-    requestQueue(requestQueue),
-    bufferedStream(acceptor.getSocket(&waiter)),
-    stream(*bufferedStream),
-    nextGetMultiRequestID(1),
-    nextSetMultiRequestID(1),
-    hotkeys(0)
-{
-    instancesMutex.lock();
-    instances.insert(this);
-    instancesMutex.unlock();
-}
-
-//------------------------------------------------------------------------------
-
-ServerThread::~ServerThread()
-{
-    delete bufferedStream;
-
-    for(getMultiRequests_t::iterator i = getMultiRequests.begin();
-        i!=getMultiRequests.end(); ++i)
-    {
-        delete i->second;
-    }
-
-    for(setMultiRequests_t::iterator i = setMultiRequests.begin();
-        i!=setMultiRequests.end(); ++i)
-    {
-        delete i->second;
-    }
-}
-
-//------------------------------------------------------------------------------
-
-void ServerThread::quit()
-{
-    stream.interrupt();
-}
-
-//------------------------------------------------------------------------------
-
-void ServerThread::run()
-{
-    Util::debug("hu.varadiistvan.xplra.ServerThread[%p]::run\n", this);
-    while(stream) {
-        uint8_t command = stream.readU8();
-        if (!stream) continue;
-
-        // Util::debug("hu.varadiistvan.xplra.ServerThread[%p]::run: command=0x%02x\n",
-        //             this, command);
-
-        if (command==Protocol::COMMAND_GET_SINGLE) {
-            if (!handleGetSingle()) break;
-        } else if (command==Protocol::COMMAND_SET_SINGLE) {
-            if (!handleSetSingle()) break;
-        } else if (command==Protocol::COMMAND_GET_MULTI) {
-            if (!handleGetMulti()) break;
-        } else if (command==Protocol::COMMAND_SET_MULTI) {
-            if (!handleSetMulti()) break;
-        } else if (command==Protocol::COMMAND_REGISTER_GET_MULTI) {
-            if (!handleRegisterGetMulti()) break;
-        } else if (command==Protocol::COMMAND_UNREGISTER_GET_MULTI) {
-            if (!handleUnregisterGetMulti()) break;
-        } else if (command==Protocol::COMMAND_EXECUTE_GET_MULTI) {
-            if (!handleExecuteGetMulti()) break;
-        } else if (command==Protocol::COMMAND_REGISTER_SET_MULTI) {
-            if (!handleRegisterSetMulti()) break;
-        } else if (command==Protocol::COMMAND_UNREGISTER_SET_MULTI) {
-            if (!handleUnregisterSetMulti()) break;
-        } else if (command==Protocol::COMMAND_EXECUTE_SET_MULTI) {
-            if (!handleExecuteSetMulti()) break;
-        } else if (command==Protocol::COMMAND_GET_VERSIONS) {
-            if (!handleGetVersions()) break;
-        } else if (command==Protocol::COMMAND_RELOAD_PLUGINS) {
-            if (!handleReloadPlugins()) break;
-#ifdef XPLM200
-        } else if (command==Protocol::COMMAND_SAVE_SITUATION) {
-            if (!handleSaveSituation()) break;
-#endif
-        } else if (command==Protocol::COMMAND_SHOW_MESSAGE) {
-            if (!handleShowMessage()) break;
-        } else if (command==Protocol::COMMAND_REGISTER_HOTKEYS) {
-            if (!handleRegisterHotkeys()) break;
-        } else if (command==Protocol::COMMAND_QUERY_HOTKEYS) {
-            if (!handleQueryHotkeys()) break;
-        } else if (command==Protocol::COMMAND_UNREGISTER_HOTKEYS) {
-            if (!handleUnregisterHotkeys()) break;
-        } else {
-            stream.writeU8(Protocol::RESULT_INVALID_COMMAND);
-        }
-        stream.flush();
-    }
-
-    destroyHotkeys();
-
-    Util::debug("hu.varadiistvan.xplra.ServerThread[%p]::run: quitting\n", this);
-}
-
-//------------------------------------------------------------------------------
-
-bool ServerThread::handleGetSingle()
-{
-    uint8_t result = Protocol::RESULT_OK;
-    GetDataRefTask* task = GetDataRefTask::create(result, stream);
-
-    if (!stream) {
-        return false;
-    } else if (task==0) {
-        stream.writeU8(result);
-        return true;
-    }
-
-    TaskRequest request(task);
-    if (!requestQueue.execute(&request)) return false;
-
-    if (task->isValid()) {
-        stream.writeU8(Protocol::RESULT_OK);
-        task->writeValue(stream);
-    } else {
-        stream.writeU8(Protocol::RESULT_UNKNOWN_DATAREF);
-    }
-
-    return true;
-}
-
-//------------------------------------------------------------------------------
-
-bool ServerThread::handleSetSingle()
-{
-    uint8_t result = Protocol::RESULT_OK;
-    SetDataRefTask* task = SetDataRefTask::create(result, stream);
-
-    if (!stream) {
-        return false;
-    } else if (task==0) {
-        stream.writeU8(result);
-        return true;
-    }
-
-    task->readValue(stream);
-    if (!stream) {
-        delete task;
-        return false;
-    }
-
-    TaskRequest request(task);
-    if (!requestQueue.execute(&request)) return false;
-
-    stream.writeU8(task->isValid() ? Protocol::RESULT_OK :
-                   Protocol::RESULT_UNKNOWN_DATAREF);
-    return true;
-}
-
-//------------------------------------------------------------------------------
-
-bool ServerThread::handleGetMulti()
-{
-    uint8_t result = Protocol::RESULT_OK;
-    GetMultiDataRefRequest* request =
-        new GetMultiDataRefRequest(result, stream);
-    if (result!=Protocol::RESULT_OK || !stream) {
-        delete request;
-        stream.writeU8(result);
-        return stream;
-    }
-
-    bool isOK = requestQueue.execute(request);
-
-    if (isOK) {
-        request->writeResult(stream);
-    }
-
-    delete request;
-
-    return isOK;
-}
-
-//------------------------------------------------------------------------------
-
-bool ServerThread::handleSetMulti()
-{
-    uint8_t result = Protocol::RESULT_OK;
-    SetMultiDataRefRequest* request =
-        new SetMultiDataRefRequest(result, stream, true);
-    if (result!=Protocol::RESULT_OK || !stream) {
-        delete request;
-        stream.writeU8(result);
-        return stream;
-    }
-
-    bool isOK = requestQueue.execute(request);
-
-    if (isOK) {
-        request->writeResult(stream);
-    }
-
-    delete request;
-
-    return isOK;
-}
-
-//------------------------------------------------------------------------------
-
-bool ServerThread::handleRegisterGetMulti()
-{
-    uint8_t result = Protocol::RESULT_OK;
-    GetMultiDataRefRequest* request =
-        new GetMultiDataRefRequest(result, stream);
-    if (result!=Protocol::RESULT_OK || !stream) {
-        delete request;
-        stream.writeU8(result);
-        return stream;
-    }
-
-    size_t id = nextGetMultiRequestID++;
-    getMultiRequests[id] = request;
-
-    stream.writeU8(Protocol::RESULT_OK);
-    stream.writeU32(id);
-
-    return true;
-}
-
-//------------------------------------------------------------------------------
-
-bool ServerThread::handleUnregisterGetMulti()
-{
-    uint32_t id = stream.readU32();
-    if (!stream) return false;
-
-    getMultiRequests_t::iterator i = getMultiRequests.find(id);
-    if (i==getMultiRequests.end()) {
-        stream.writeU8(Protocol::RESULT_INVALID_ID);
-    } else {
-        GetMultiDataRefRequest* request = i->second;
-        getMultiRequests.erase(i);
-        delete request;
-        stream.writeU8(Protocol::RESULT_OK);
-    }
-
-    return true;
-}
-
-//------------------------------------------------------------------------------
-
-bool ServerThread::handleExecuteGetMulti()
-{
-    uint32_t id = stream.readU32();
-    if (!stream) return false;
-
-    getMultiRequests_t::iterator i = getMultiRequests.find(id);
-    if (i==getMultiRequests.end()) {
-        stream.writeU8(Protocol::RESULT_INVALID_ID);
-    } else {
-        GetMultiDataRefRequest* request = i->second;
-        if (!requestQueue.execute(request)) return false;
-        request->writeResult(stream);
-    }
-
-    return true;
-}
-
-//------------------------------------------------------------------------------
-
-bool ServerThread::handleRegisterSetMulti()
-{
-    uint8_t result = Protocol::RESULT_OK;
-    SetMultiDataRefRequest* request =
-        new SetMultiDataRefRequest(result, stream, false);
-    if (result!=Protocol::RESULT_OK || !stream) {
-        delete request;
-        stream.writeU8(result);
-        return stream;
-    }
-
-    size_t id = nextSetMultiRequestID++;
-    setMultiRequests[id] = request;
-
-    stream.writeU8(Protocol::RESULT_OK);
-    stream.writeU32(id);
-
-    return true;
-}
-
-//------------------------------------------------------------------------------
-
-bool ServerThread::handleUnregisterSetMulti()
-{
-    uint32_t id = stream.readU32();
-    if (!stream) return false;
-
-    setMultiRequests_t::iterator i = setMultiRequests.find(id);
-    if (i==setMultiRequests.end()) {
-        stream.writeU8(Protocol::RESULT_INVALID_ID);
-    } else {
-        SetMultiDataRefRequest* request = i->second;
-        setMultiRequests.erase(i);
-        delete request;
-        stream.writeU8(Protocol::RESULT_OK);
-    }
-
-    return true;
-}
-
-//------------------------------------------------------------------------------
-
-bool ServerThread::handleExecuteSetMulti()
-{
-    uint32_t id = stream.readU32();
-    if (!stream) return false;
-
-    setMultiRequests_t::iterator i = setMultiRequests.find(id);
-    if (i==setMultiRequests.end()) {
-        stream.writeU8(Protocol::RESULT_INVALID_ID);
-    } else {
-        SetMultiDataRefRequest* request = i->second;
-        request->readValues(stream);
-        if (!stream || !requestQueue.execute(request)) return false;
-        request->writeResult(stream);
-    }
-
-    return true;
-}
-
-//------------------------------------------------------------------------------
-
-bool ServerThread::handleGetVersions()
-{
-    int xplaneVersion = 0;
-    int xplmVersion = 0;
-
-    listenThread.getGlobals().getVersions(xplaneVersion, xplmVersion);
-
-    stream.writeU8(Protocol::RESULT_OK);
-    stream.writeS32(xplaneVersion);
-    stream.writeS32(xplmVersion);
-    stream.writeS32(Protocol::version);
-
-    return true;
-}
-
-//------------------------------------------------------------------------------
-
-bool ServerThread::handleReloadPlugins()
-{
-    ReloadPluginsRequest request;
-    if (!requestQueue.execute(&request)) return false;
-
-    stream.writeU8(Protocol::RESULT_OK);
-
-    return true;
-}
-
-//------------------------------------------------------------------------------
-
-#ifdef XPLM200
-
-bool ServerThread::handleSaveSituation()
-{
-    string path = stream.readString();
-    SaveSituationRequest request(path);
-    if (!requestQueue.execute(&request)) return false;
-
-    stream.writeU8(request.getSuccess() ? Protocol::RESULT_OK :
-                   Protocol::RESULT_OTHER_ERROR);
-
-    return true;
-}
-
-#endif
-
-//------------------------------------------------------------------------------
-
-bool ServerThread::handleShowMessage()
-{
-    string message = stream.readString();
-    float duration = stream.readFloat();
-    if (!stream) return false;
-
-    if (duration>Protocol::MAX_MESSAGE_DURATION) {
-        stream.writeU8(Protocol::RESULT_INVALID_DURATION);
-    } else {
-        MessageRequest request(listenThread.getGlobals().getMessageWindow(),
-                               message, duration);
-        if (!requestQueue.execute(&request)) return false;
-
-        stream.writeU8(Protocol::RESULT_OK);
-    }
-
-    return true;
-}
-
-//------------------------------------------------------------------------------
-
-bool ServerThread::handleRegisterHotkeys()
-{
-    size_t numHotkeys = stream.readU32();
-    if (!stream) return false;
-
-    if (numHotkeys>Protocol::MAX_HOTKEY_COUNT) {
-        stream.writeU8(Protocol::RESULT_INVALID_LENGTH);
-    } else {
-        HotkeyHandler::Hotkeys* newHotkeys =
-            new HotkeyHandler::Hotkeys(numHotkeys, stream);
-        if (newHotkeys->isValid()) {
-            destroyHotkeys();
-            hotkeys = newHotkeys;
-            listenThread.getGlobals().getHotkeyHandler().registerHotkeys(hotkeys);
-            stream.writeU8(Protocol::RESULT_OK);
-        } else {
-            delete newHotkeys;
-            return false;
-        }
-    }
-
-    return true;
-}
-
-//------------------------------------------------------------------------------
-
-bool ServerThread::handleQueryHotkeys()
-{
-    stream.writeU8(Protocol::RESULT_OK);
-    if (hotkeys==0) {
-        stream.writeU32(0);
-    } else {
-        hotkeys->writePressed(stream);
-    }
-    return true;
-}
-
-//------------------------------------------------------------------------------
-
-bool ServerThread::handleUnregisterHotkeys()
-{
-    destroyHotkeys();
-    stream.writeU8(Protocol::RESULT_OK);
-    return true;
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/plugin/src/xplra/ServerThread.h
===================================================================
--- src/plugin/src/xplra/ServerThread.h	(revision 81)
+++ src/plugin/src/xplra/ServerThread.h	(revision 81)
@@ -0,0 +1,318 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef XPLRA_SERVERTHREAD_H
+#define XPLRA_SERVERTHREAD_H
+//------------------------------------------------------------------------------
+
+#include "HotkeyHandler.h"
+
+#include <hu/varadiistvan/scpl/Thread.h>
+
+#include <hu/varadiistvan/scpl/io/Waiter.h>
+#include <hu/varadiistvan/scpl/io/BufferedStream.h>
+#include <hu/varadiistvan/scpl/io/DataStream.h>
+#include <hu/varadiistvan/scpl/io/LocalAcceptor.h>
+
+#include <hu/varadiistvan/scpl/Mutex.h>
+
+#include <set>
+#include <map>
+
+//------------------------------------------------------------------------------
+
+namespace xplra {
+
+//------------------------------------------------------------------------------
+
+class ListenThread;
+
+class RequestQueue;
+
+class GetMultiDataRefRequest;
+class SetMultiDataRefRequest;
+
+//------------------------------------------------------------------------------
+
+/**
+ * A thread serving a client.
+ */
+class ServerThread : public hu::varadiistvan::scpl::Thread
+{
+private:
+    /**
+     * Type for the set of server thread instances.
+     */
+    typedef std::set<ServerThread*> instances_t;
+
+    /**
+     * Type for the registered multiple-data query requests.
+     */
+    typedef std::map<size_t, GetMultiDataRefRequest*> getMultiRequests_t;
+
+    /**
+     * Type for the registered multiple-data update requests.
+     */
+    typedef std::map<size_t, SetMultiDataRefRequest*> setMultiRequests_t;
+
+    /**
+     * A mutex to protect the collection of server threads.
+     */
+    static hu::varadiistvan::scpl::Mutex instancesMutex;
+
+    /**
+     * The instances of this class.
+     */
+    static instances_t instances;
+
+public:
+    /**
+     * Call quit() an all threads.
+     */
+    static void quitAll();
+
+private:
+    /**
+     * The listen thread this server was started by.
+     */
+    ListenThread& listenThread;
+
+    /**
+     * The request queue to use.
+     */
+    RequestQueue& requestQueue;
+
+    /**
+     * Our waiter.
+     */
+    hu::varadiistvan::scpl::io::Waiter waiter;
+
+    /**
+     * The buffered stream to use for communication at the low-level.
+     */
+    hu::varadiistvan::scpl::io::BufferedStream* bufferedStream;
+
+    /**
+     * The data stream being used for communication.
+     */
+    hu::varadiistvan::scpl::io::DataStream stream;
+
+    /**
+     * The ID of the next multiple-data query request.
+     */
+    size_t nextGetMultiRequestID;
+
+    /**
+     * The registered multiple-data query requests.
+     */
+    getMultiRequests_t getMultiRequests;
+
+    /**
+     * The ID of the next multiple-data update request.
+     */
+    size_t nextSetMultiRequestID;
+
+    /**
+     * The registered multiple-data query requests.
+     */
+    setMultiRequests_t setMultiRequests;
+
+    /**
+     * The set of hotkeys currently being handled.
+     */
+    HotkeyHandler::Hotkeys* hotkeys;
+
+public:
+    /**
+     * Construct the thread by using a LocalSocket returned by the
+     * given acceptor.
+     */
+    ServerThread(ListenThread& listenThread, RequestQueue& requestQueue,
+                 hu::varadiistvan::scpl::io::LocalAcceptor& acceptor);
+
+    /**
+     * Destroy the thread.
+     */
+    virtual ~ServerThread();
+
+    /**
+     * Quit the thread. It interrupts the blocking stream.
+     */
+    void quit();
+
+    /**
+     * Perform the thread's operation.
+     */
+    virtual void run();
+
+private:
+    /**
+     * Handle the COMMAND_GET_SINGLE command
+     *
+     * @return true, if we can continue, false if the thread should quit
+     */
+    bool handleGetSingle();
+
+    /**
+     * Handle the COMMAND_SET_SINGLE command
+     *
+     * @return true, if we can continue, false if the thread should quit
+     */
+    bool handleSetSingle();
+
+    /**
+     * Handle the COMMAND_GET_MULTI command
+     *
+     * @return true, if we can continue, false if the thread should quit
+     */
+    bool handleGetMulti();
+
+    /**
+     * Handle the COMMAND_SET_MULTI command
+     *
+     * @return true, if we can continue, false if the thread should quit
+     */
+    bool handleSetMulti();
+
+    /**
+     * Handle the COMMAND_REGISTER_GET_MULTI command
+     *
+     * @return true, if we can continue, false if the thread should quit
+     */
+    bool handleRegisterGetMulti();
+
+    /**
+     * Handle the COMMAND_UNREGISTER_GET_MULTI command
+     *
+     * @return true, if we can continue, false if the thread should quit
+     */
+    bool handleUnregisterGetMulti();
+
+    /**
+     * Handle the COMMAND_EXECUTE_GET_MULTI command
+     *
+     * @return true, if we can continue, false if the thread should quit
+     */
+    bool handleExecuteGetMulti();
+
+    /**
+     * Handle the COMMAND_REGISTER_SET_MULTI command
+     *
+     * @return true, if we can continue, false if the thread should quit
+     */
+    bool handleRegisterSetMulti();
+
+    /**
+     * Handle the COMMAND_UNREGISTER_SET_MULTI command
+     *
+     * @return true, if we can continue, false if the thread should quit
+     */
+    bool handleUnregisterSetMulti();
+
+    /**
+     * Handle the COMMAND_EXECUTE_SET_MULTI command
+     *
+     * @return true, if we can continue, false if the thread should quit
+     */
+    bool handleExecuteSetMulti();
+
+    /**
+     * Handle the COMMAND_GET_VERSIONS command
+     *
+     * @return true, if we can continue, false if the thread should quit
+     */
+    bool handleGetVersions();
+
+    /**
+     * Handle the COMMAND_RELOAD_PLUGINS command.
+     *
+     * @return true, if we can continue, false if the thread should quit
+     */
+    bool handleReloadPlugins();
+
+#ifdef XPLM200
+    /**
+     * Handle the COMMAND_SAVE_SITUATION command.
+     *
+     * @return true, if we can continue, false if the thread should quit
+     */
+    bool handleSaveSituation();
+#endif
+
+    /**
+     * Handle the COMMAND_SHOW_MESSAGE command
+     *
+     * @return true, if we can continue, false if the thread should quit
+     */
+    bool handleShowMessage();
+
+    /**
+     * Handle the COMMAND_REGISTER_HOTKEYS command.
+     *
+     * @return true if we can continue, false if the thread should
+     * quit.
+     */
+    bool handleRegisterHotkeys();
+
+    /**
+     * Handle the COMMAND_QUERY_HOTKEYS command.
+     *
+     * @return true if we can continue, false if the thread should
+     * quit.
+     */
+    bool handleQueryHotkeys();
+
+    /**
+     * Handle the COMMAND_UNREGISTER_HOTKEYS command.
+     *
+     * @return true if we can continue, false if the thread should
+     * quit.
+     */
+    bool handleUnregisterHotkeys();
+
+private:
+    /**
+     * Destroy the current set of hotkeys, if any.
+     *
+     * @return whether there were any hotkeys or not.
+     */
+    bool destroyHotkeys();
+};
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplra */
+
+//------------------------------------------------------------------------------
+#endif // XPLRA_SERVERTHREAD_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/ServerThread.h
===================================================================
--- src/plugin/src/xplra/ServerThread.h	(revision 81)
+++ 	(revision )
@@ -1,318 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLRA_SERVERTHREAD_H
-#define XPLRA_SERVERTHREAD_H
-//------------------------------------------------------------------------------
-
-#include "HotkeyHandler.h"
-
-#include <hu/varadiistvan/scpl/Thread.h>
-
-#include <hu/varadiistvan/scpl/io/Waiter.h>
-#include <hu/varadiistvan/scpl/io/BufferedStream.h>
-#include <hu/varadiistvan/scpl/io/DataStream.h>
-#include <hu/varadiistvan/scpl/io/LocalAcceptor.h>
-
-#include <hu/varadiistvan/scpl/Mutex.h>
-
-#include <set>
-#include <map>
-
-//------------------------------------------------------------------------------
-
-namespace xplra {
-
-//------------------------------------------------------------------------------
-
-class ListenThread;
-
-class RequestQueue;
-
-class GetMultiDataRefRequest;
-class SetMultiDataRefRequest;
-
-//------------------------------------------------------------------------------
-
-/**
- * A thread serving a client.
- */
-class ServerThread : public hu::varadiistvan::scpl::Thread
-{
-private:
-    /**
-     * Type for the set of server thread instances.
-     */
-    typedef std::set<ServerThread*> instances_t;
-
-    /**
-     * Type for the registered multiple-data query requests.
-     */
-    typedef std::map<size_t, GetMultiDataRefRequest*> getMultiRequests_t;
-
-    /**
-     * Type for the registered multiple-data update requests.
-     */
-    typedef std::map<size_t, SetMultiDataRefRequest*> setMultiRequests_t;
-
-    /**
-     * A mutex to protect the collection of server threads.
-     */
-    static hu::varadiistvan::scpl::Mutex instancesMutex;
-
-    /**
-     * The instances of this class.
-     */
-    static instances_t instances;
-
-public:
-    /**
-     * Call quit() an all threads.
-     */
-    static void quitAll();
-
-private:
-    /**
-     * The listen thread this server was started by.
-     */
-    ListenThread& listenThread;
-
-    /**
-     * The request queue to use.
-     */
-    RequestQueue& requestQueue;
-
-    /**
-     * Our waiter.
-     */
-    hu::varadiistvan::scpl::io::Waiter waiter;
-
-    /**
-     * The buffered stream to use for communication at the low-level.
-     */
-    hu::varadiistvan::scpl::io::BufferedStream* bufferedStream;
-
-    /**
-     * The data stream being used for communication.
-     */
-    hu::varadiistvan::scpl::io::DataStream stream;
-
-    /**
-     * The ID of the next multiple-data query request.
-     */
-    size_t nextGetMultiRequestID;
-
-    /**
-     * The registered multiple-data query requests.
-     */
-    getMultiRequests_t getMultiRequests;
-
-    /**
-     * The ID of the next multiple-data update request.
-     */
-    size_t nextSetMultiRequestID;
-
-    /**
-     * The registered multiple-data query requests.
-     */
-    setMultiRequests_t setMultiRequests;
-
-    /**
-     * The set of hotkeys currently being handled.
-     */
-    HotkeyHandler::Hotkeys* hotkeys;
-
-public:
-    /**
-     * Construct the thread by using a LocalSocket returned by the
-     * given acceptor.
-     */
-    ServerThread(ListenThread& listenThread, RequestQueue& requestQueue,
-                 hu::varadiistvan::scpl::io::LocalAcceptor& acceptor);
-
-    /**
-     * Destroy the thread.
-     */
-    virtual ~ServerThread();
-
-    /**
-     * Quit the thread. It interrupts the blocking stream.
-     */
-    void quit();
-
-    /**
-     * Perform the thread's operation.
-     */
-    virtual void run();
-
-private:
-    /**
-     * Handle the COMMAND_GET_SINGLE command
-     *
-     * @return true, if we can continue, false if the thread should quit
-     */
-    bool handleGetSingle();
-
-    /**
-     * Handle the COMMAND_SET_SINGLE command
-     *
-     * @return true, if we can continue, false if the thread should quit
-     */
-    bool handleSetSingle();
-
-    /**
-     * Handle the COMMAND_GET_MULTI command
-     *
-     * @return true, if we can continue, false if the thread should quit
-     */
-    bool handleGetMulti();
-
-    /**
-     * Handle the COMMAND_SET_MULTI command
-     *
-     * @return true, if we can continue, false if the thread should quit
-     */
-    bool handleSetMulti();
-
-    /**
-     * Handle the COMMAND_REGISTER_GET_MULTI command
-     *
-     * @return true, if we can continue, false if the thread should quit
-     */
-    bool handleRegisterGetMulti();
-
-    /**
-     * Handle the COMMAND_UNREGISTER_GET_MULTI command
-     *
-     * @return true, if we can continue, false if the thread should quit
-     */
-    bool handleUnregisterGetMulti();
-
-    /**
-     * Handle the COMMAND_EXECUTE_GET_MULTI command
-     *
-     * @return true, if we can continue, false if the thread should quit
-     */
-    bool handleExecuteGetMulti();
-
-    /**
-     * Handle the COMMAND_REGISTER_SET_MULTI command
-     *
-     * @return true, if we can continue, false if the thread should quit
-     */
-    bool handleRegisterSetMulti();
-
-    /**
-     * Handle the COMMAND_UNREGISTER_SET_MULTI command
-     *
-     * @return true, if we can continue, false if the thread should quit
-     */
-    bool handleUnregisterSetMulti();
-
-    /**
-     * Handle the COMMAND_EXECUTE_SET_MULTI command
-     *
-     * @return true, if we can continue, false if the thread should quit
-     */
-    bool handleExecuteSetMulti();
-
-    /**
-     * Handle the COMMAND_GET_VERSIONS command
-     *
-     * @return true, if we can continue, false if the thread should quit
-     */
-    bool handleGetVersions();
-
-    /**
-     * Handle the COMMAND_RELOAD_PLUGINS command.
-     *
-     * @return true, if we can continue, false if the thread should quit
-     */
-    bool handleReloadPlugins();
-
-#ifdef XPLM200
-    /**
-     * Handle the COMMAND_SAVE_SITUATION command.
-     *
-     * @return true, if we can continue, false if the thread should quit
-     */
-    bool handleSaveSituation();
-#endif
-
-    /**
-     * Handle the COMMAND_SHOW_MESSAGE command
-     *
-     * @return true, if we can continue, false if the thread should quit
-     */
-    bool handleShowMessage();
-
-    /**
-     * Handle the COMMAND_REGISTER_HOTKEYS command.
-     *
-     * @return true if we can continue, false if the thread should
-     * quit.
-     */
-    bool handleRegisterHotkeys();
-
-    /**
-     * Handle the COMMAND_QUERY_HOTKEYS command.
-     *
-     * @return true if we can continue, false if the thread should
-     * quit.
-     */
-    bool handleQueryHotkeys();
-
-    /**
-     * Handle the COMMAND_UNREGISTER_HOTKEYS command.
-     *
-     * @return true if we can continue, false if the thread should
-     * quit.
-     */
-    bool handleUnregisterHotkeys();
-
-private:
-    /**
-     * Destroy the current set of hotkeys, if any.
-     *
-     * @return whether there were any hotkeys or not.
-     */
-    bool destroyHotkeys();
-};
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplra */
-
-//------------------------------------------------------------------------------
-#endif // XPLRA_SERVERTHREAD_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/plugin/src/xplra/SetDataRefTask.cc
===================================================================
--- src/plugin/src/xplra/SetDataRefTask.cc	(revision 13)
+++ src/plugin/src/xplra/SetDataRefTask.cc	(revision 13)
@@ -0,0 +1,122 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include "SetDataRefTask.h"
+
+#include "Protocol.h"
+
+//------------------------------------------------------------------------------
+
+using xplra::SetDataRefTask;
+using xplra::SetIntDataRefTask;
+using xplra::SetFloatDataRefTask;
+using xplra::SetDoubleDataRefTask;
+
+using hu::varadiistvan::scpl::io::DataStream;
+
+using std::string;
+
+//------------------------------------------------------------------------------
+
+SetDataRefTask* SetDataRefTask::create(uint8_t& result, DataStream& stream)
+{
+    result = Protocol::RESULT_OK;
+
+    string name = stream.readString();
+    uint8_t type = stream.readU8();
+    if (!stream) return 0;
+
+    if (type==Protocol::TYPE_INT) {
+        return new SetIntDataRefTask(name);
+    } else if (type==Protocol::TYPE_FLOAT) {
+        return new SetFloatDataRefTask(name);
+    } else if (type==Protocol::TYPE_DOUBLE) {
+        return new SetDoubleDataRefTask(name);
+    } else if (type==Protocol::TYPE_FLOAT_ARRAY ||
+               type==Protocol::TYPE_INT_ARRAY ||
+               type==Protocol::TYPE_BYTE_ARRAY)
+    {
+        int length = stream.readS32();
+        int offset = stream.readS32();
+        if (!stream) return 0;
+        if (length<=0 || length>Protocol::MAX_LENGTH) {
+            result = Protocol::RESULT_INVALID_LENGTH;
+            return 0;
+        }
+        if (offset<0) {
+            result = Protocol::RESULT_INVALID_OFFSET;
+            return 0;
+        }
+
+        if (type==Protocol::TYPE_INT_ARRAY) {
+            return new SetIntArrayDataRefTask(name, length, offset);
+        } else if (type==Protocol::TYPE_FLOAT_ARRAY) {
+            return new SetFloatArrayDataRefTask(name, length, offset);
+        } else {
+            return new SetByteArrayDataRefTask(name, length, offset);
+        }
+    } else {
+        result = Protocol::RESULT_INVALID_TYPE;
+    }
+
+    return 0;
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+void SetIntDataRefTask::readValue(DataStream& stream)
+{
+    value = stream.readS32();
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+void SetFloatDataRefTask::readValue(DataStream& stream)
+{
+    value = stream.readFloat();
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+void SetDoubleDataRefTask::readValue(DataStream& stream)
+{
+    value = stream.readDouble();
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/SetDataRefTask.cc
===================================================================
--- src/plugin/src/xplra/SetDataRefTask.cc	(revision 13)
+++ 	(revision )
@@ -1,122 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "SetDataRefTask.h"
-
-#include "Protocol.h"
-
-//------------------------------------------------------------------------------
-
-using xplra::SetDataRefTask;
-using xplra::SetIntDataRefTask;
-using xplra::SetFloatDataRefTask;
-using xplra::SetDoubleDataRefTask;
-
-using hu::varadiistvan::scpl::io::DataStream;
-
-using std::string;
-
-//------------------------------------------------------------------------------
-
-SetDataRefTask* SetDataRefTask::create(uint8_t& result, DataStream& stream)
-{
-    result = Protocol::RESULT_OK;
-
-    string name = stream.readString();
-    uint8_t type = stream.readU8();
-    if (!stream) return 0;
-
-    if (type==Protocol::TYPE_INT) {
-        return new SetIntDataRefTask(name);
-    } else if (type==Protocol::TYPE_FLOAT) {
-        return new SetFloatDataRefTask(name);
-    } else if (type==Protocol::TYPE_DOUBLE) {
-        return new SetDoubleDataRefTask(name);
-    } else if (type==Protocol::TYPE_FLOAT_ARRAY ||
-               type==Protocol::TYPE_INT_ARRAY ||
-               type==Protocol::TYPE_BYTE_ARRAY)
-    {
-        int length = stream.readS32();
-        int offset = stream.readS32();
-        if (!stream) return 0;
-        if (length<=0 || length>Protocol::MAX_LENGTH) {
-            result = Protocol::RESULT_INVALID_LENGTH;
-            return 0;
-        }
-        if (offset<0) {
-            result = Protocol::RESULT_INVALID_OFFSET;
-            return 0;
-        }
-
-        if (type==Protocol::TYPE_INT_ARRAY) {
-            return new SetIntArrayDataRefTask(name, length, offset);
-        } else if (type==Protocol::TYPE_FLOAT_ARRAY) {
-            return new SetFloatArrayDataRefTask(name, length, offset);
-        } else {
-            return new SetByteArrayDataRefTask(name, length, offset);
-        }
-    } else {
-        result = Protocol::RESULT_INVALID_TYPE;
-    }
-
-    return 0;
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-void SetIntDataRefTask::readValue(DataStream& stream)
-{
-    value = stream.readS32();
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-void SetFloatDataRefTask::readValue(DataStream& stream)
-{
-    value = stream.readFloat();
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-void SetDoubleDataRefTask::readValue(DataStream& stream)
-{
-    value = stream.readDouble();
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/plugin/src/xplra/SetDataRefTask.h
===================================================================
--- src/plugin/src/xplra/SetDataRefTask.h	(revision 66)
+++ src/plugin/src/xplra/SetDataRefTask.h	(revision 66)
@@ -0,0 +1,616 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef XPLRA_SETDATAREFTASK_H
+#define XPLRA_SETDATAREFTASK_H
+//------------------------------------------------------------------------------
+
+#include "DataRefTask.h"
+
+#include <hu/varadiistvan/scpl/io/DataStream.h>
+
+//------------------------------------------------------------------------------
+
+namespace xplra {
+
+//------------------------------------------------------------------------------
+
+/**
+ * Base class for dataref tasks that set the value of some data
+ * referenced by a dataref.
+ *
+ * Since XPLM provides no feedback on whether the setting is
+ * successful, we detect only if the dataref is valid or not. So the
+ * isValid() function provides the only feedback if the task executed
+ * successfully or not. (We could use XPLMCanWriteDataRef, but for
+ * efficiency reasons we refrain from it. A separate task may be
+ * created for this purpose.)
+ */
+class SetDataRefTask : public DataRefTask
+{
+public:
+    /**
+     * Read a dataref setting specification and create the appropriate
+     * SetDataRefTask instance.
+     *
+     * @param result will contain the result of the operation. It
+     * signifies an error only, if some wrong data is read. If the
+     * stream fails, it will indicate RESULT_OK.
+     * @param stream the stream to read from
+     *
+     * @return the new instance or 0 on error.
+     */
+    static SetDataRefTask* create(uint8_t& result, hu::varadiistvan::scpl::io::DataStream& stream);
+
+    /**
+     * Construct the task for the dataref with the given name.
+     */
+    SetDataRefTask(const std::string& name);
+
+    /**
+     * Construct the task for the given dataref.
+     */
+    SetDataRefTask(XPLMDataRef dataRef);
+
+    /**
+     * Read and set the value to update from the given stream
+     */
+    virtual void readValue(hu::varadiistvan::scpl::io::DataStream& stream) = 0;
+};
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+/**
+ * Base class for dataref setting tasks that set a single scalar
+ * value.
+ *
+ * ConcreteClass is the actual child class. It should have a function
+ * name setData() which performs the actual setting.
+ */
+template <typename T, class ConcreteClass>
+class SetScalarDataRefTask : public SetDataRefTask
+{
+protected:
+    /**
+     * The value to set.
+     */
+    T value;
+
+public:
+    /**
+     * Construct the task for setting the data referenced by the
+     * dataref with the given name.
+     */
+    SetScalarDataRefTask(const std::string& name);
+
+    /**
+     * Construct the task for setting the data referenced by the given
+     * dataref.
+     */
+    SetScalarDataRefTask(XPLMDataRef dataRef);
+
+protected:
+    /**
+     * Perform the actual operation.
+     */
+    virtual void process();
+};
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+/**
+ * Task to set the value of an integer data.
+ */
+class SetIntDataRefTask :
+        public SetScalarDataRefTask<int, SetIntDataRefTask>
+{
+public:
+    /**
+     * Set the given dataref's value to the given value.
+     */
+    static void setData(XPLMDataRef dataRef, int value);
+
+    /**
+     * Construct the task for the dataref with the given name.
+     */
+    SetIntDataRefTask(const std::string& name);
+
+    /**
+     * Construct the task for the given dataref.
+     */
+    SetIntDataRefTask(XPLMDataRef dataRef);
+
+    /**
+     * Read and set the value to update from the given stream
+     */
+    virtual void readValue(hu::varadiistvan::scpl::io::DataStream& stream);
+};
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+/**
+ * Task to set the value of a single-precision floating point data.
+ */
+class SetFloatDataRefTask :
+        public SetScalarDataRefTask<float, SetFloatDataRefTask>
+{
+public:
+    /**
+     * Set the given dataref's value to the given value.
+     */
+    static void setData(XPLMDataRef dataRef, float value);
+
+    /**
+     * Construct the task for the dataref with the given name.
+     */
+    SetFloatDataRefTask(const std::string& name);
+
+    /**
+     * Construct the task for the given dataref.
+     */
+    SetFloatDataRefTask(XPLMDataRef dataRef);
+
+    /**
+     * Read and set the value to update from the given stream
+     */
+    virtual void readValue(hu::varadiistvan::scpl::io::DataStream& stream);
+};
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+/**
+ * Task to set the value of a double-precision floating point data.
+ */
+class SetDoubleDataRefTask :
+        public SetScalarDataRefTask<double, SetDoubleDataRefTask>
+{
+public:
+    /**
+     * Set the given dataref's value to the given value.
+     */
+    static void setData(XPLMDataRef dataRef, double value);
+
+    /**
+     * Construct the task for the dataref with the given name.
+     */
+    SetDoubleDataRefTask(const std::string& name);
+
+    /**
+     * Construct the task for the given dataref.
+     */
+    SetDoubleDataRefTask(XPLMDataRef dataRef);
+
+    /**
+     * Read and set the value to update from the given stream
+     */
+    virtual void readValue(hu::varadiistvan::scpl::io::DataStream& stream);
+};
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+/**
+ * Base class for dataref setting tasks that set the values of an
+ * array.
+ *
+ * ConcreteClass is the actual child class. It should have a function
+ * name setData() which performs the actual setting.
+ */
+template <typename T, class ConcreteClass>
+class SetArrayDataRefTask : public SetDataRefTask
+{
+private:
+    /**
+     * The number of data items in the value.
+     */
+    int count;
+
+    /**
+     * The offset starting with which the data should be set.
+     */
+    int offset;
+
+    /**
+     * The value to set.
+     */
+    T* value;
+
+public:
+    /**
+     * Construct the data setting task for the dataref with the given
+     * name.
+     *
+     * The value array will be allocated, but not filled with
+     * data. Thus count should be positive!
+     */
+    SetArrayDataRefTask(const std::string& name, int count, int offset = 0);
+
+    /**
+     * Construct the data setting task for the given dataref.
+     *
+     * The value array will be allocated, but not filled with
+     * data. Thus count should be positive!
+     */
+    SetArrayDataRefTask(XPLMDataRef dataRef, int count, int offset = 0);
+
+    /**
+     * Destroy the task.
+     */
+    virtual ~SetArrayDataRefTask();
+
+    /**
+     * Read and set the value to update from the given stream
+     */
+    virtual void readValue(hu::varadiistvan::scpl::io::DataStream& stream);
+
+protected:
+    /**
+     * Perform the actual operation.
+     */
+    virtual void process();
+};
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+/**
+ * A dataref setting task which sets an array of integers.
+ */
+class SetIntArrayDataRefTask :
+    public SetArrayDataRefTask<int, SetIntArrayDataRefTask>
+{
+public:
+    /**
+     * Perform the actual setting.
+     */
+    static void setData(XPLMDataRef dataRef, int* value, int count, int offset);
+
+    /**
+     * Construct the task for the dataref with the given name.
+     */
+    SetIntArrayDataRefTask(const std::string& name, int count, int offset = 0);
+
+    /**
+     * Construct the task for the given dataref.
+     */
+    SetIntArrayDataRefTask(XPLMDataRef dataRef, int count, int offset = 0);
+};
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+/**
+ * A dataref setting task which sets an array of single-precision
+ * floating-point values.
+ */
+class SetFloatArrayDataRefTask :
+    public SetArrayDataRefTask<float, SetFloatArrayDataRefTask>
+{
+public:
+    /**
+     * Perform the actual setting.
+     */
+    static void setData(XPLMDataRef dataRef, float* value, int count, int offset);
+
+    /**
+     * Construct the task for the dataref with the given name.
+     */
+    SetFloatArrayDataRefTask(const std::string& name, int count, int offset = 0);
+
+    /**
+     * Construct the task for the given dataref.
+     */
+    SetFloatArrayDataRefTask(XPLMDataRef dataRef, int count, int offset = 0);
+};
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+/**
+ * A dataref setting task which sets an array of bytes.
+ */
+class SetByteArrayDataRefTask :
+    public SetArrayDataRefTask<unsigned char, SetByteArrayDataRefTask>
+{
+public:
+    /**
+     * Perform the actual setting.
+     */
+    static void setData(XPLMDataRef dataRef, unsigned char* value,
+                        int count, int offset);
+
+    /**
+     * Construct the task for the dataref with the given name.
+     */
+    SetByteArrayDataRefTask(const std::string& name, int count, int offset = 0);
+
+    /**
+     * Construct the task for the given dataref.
+     */
+    SetByteArrayDataRefTask(XPLMDataRef dataRef, int count, int offset = 0);
+};
+
+//------------------------------------------------------------------------------
+// Template definitions
+//------------------------------------------------------------------------------
+
+template <typename T, class ConcreteClass>
+inline SetScalarDataRefTask<T, ConcreteClass>::
+SetScalarDataRefTask(const std::string& name) :
+    SetDataRefTask(name)
+{
+}
+
+//------------------------------------------------------------------------------
+
+template <typename T, class ConcreteClass>
+inline SetScalarDataRefTask<T, ConcreteClass>::
+SetScalarDataRefTask(XPLMDataRef dataRef) :
+    SetDataRefTask(dataRef)
+{
+}
+
+//------------------------------------------------------------------------------
+
+template <typename T, class ConcreteClass>
+void SetScalarDataRefTask<T, ConcreteClass>::process()
+{
+    ConcreteClass::setData(getDataRef(), value);
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+template <typename T, class ConcreteClass>
+inline SetArrayDataRefTask<T, ConcreteClass>::
+SetArrayDataRefTask(const std::string& name, int count, int offset) :
+    SetDataRefTask(name),
+    count(count),
+    offset(offset),
+    value(new T[count])
+{
+}
+
+//------------------------------------------------------------------------------
+
+template <typename T, class ConcreteClass>
+inline SetArrayDataRefTask<T, ConcreteClass>::
+SetArrayDataRefTask(XPLMDataRef dataRef, int count, int offset) :
+    SetDataRefTask(dataRef),
+    count(count),
+    offset(offset),
+    value(new T[count])
+{
+}
+
+//------------------------------------------------------------------------------
+
+template <typename T, class ConcreteClass>
+inline SetArrayDataRefTask<T, ConcreteClass>::~SetArrayDataRefTask()
+{
+    delete [] value;
+}
+
+//------------------------------------------------------------------------------
+
+template <typename T, class ConcreteClass>
+void SetArrayDataRefTask<T, ConcreteClass>::
+readValue(hu::varadiistvan::scpl::io::DataStream& stream)
+{
+    stream.read(value, count * sizeof(T));
+}
+
+//------------------------------------------------------------------------------
+
+template <typename T, class ConcreteClass>
+void SetArrayDataRefTask<T, ConcreteClass>::process()
+{
+    ConcreteClass::setData(getDataRef(), value, count, offset);
+}
+
+//------------------------------------------------------------------------------
+// Inline definitions
+//------------------------------------------------------------------------------
+
+inline SetDataRefTask::SetDataRefTask(const std::string& name) :
+    DataRefTask(name)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline SetDataRefTask::SetDataRefTask(XPLMDataRef dataRef) :
+    DataRefTask(dataRef)
+{
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+inline void SetIntDataRefTask::setData(XPLMDataRef dataRef, int value)
+{
+    XPLMSetDatai(dataRef, value);
+}
+
+//------------------------------------------------------------------------------
+
+inline SetIntDataRefTask::SetIntDataRefTask(const std::string& name) :
+    SetScalarDataRefTask<int, SetIntDataRefTask>(name)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline SetIntDataRefTask::SetIntDataRefTask(XPLMDataRef dataRef) :
+    SetScalarDataRefTask<int, SetIntDataRefTask>(dataRef)
+{
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+inline void SetFloatDataRefTask::setData(XPLMDataRef dataRef, float value)
+{
+    XPLMSetDatai(dataRef, value);
+}
+
+//------------------------------------------------------------------------------
+
+inline SetFloatDataRefTask::SetFloatDataRefTask(const std::string& name) :
+    SetScalarDataRefTask<float, SetFloatDataRefTask>(name)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline SetFloatDataRefTask::SetFloatDataRefTask(XPLMDataRef dataRef) :
+    SetScalarDataRefTask<float, SetFloatDataRefTask>(dataRef)
+{
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+inline void SetDoubleDataRefTask::setData(XPLMDataRef dataRef, double value)
+{
+    XPLMSetDatai(dataRef, value);
+}
+
+//------------------------------------------------------------------------------
+
+inline SetDoubleDataRefTask::SetDoubleDataRefTask(const std::string& name) :
+    SetScalarDataRefTask<double, SetDoubleDataRefTask>(name)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline SetDoubleDataRefTask::SetDoubleDataRefTask(XPLMDataRef dataRef) :
+    SetScalarDataRefTask<double, SetDoubleDataRefTask>(dataRef)
+{
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+inline void SetIntArrayDataRefTask::setData(XPLMDataRef dataRef, int* value,
+                                            int count, int offset)
+{
+    XPLMSetDatavi(dataRef, value, offset, count);
+}
+
+//------------------------------------------------------------------------------
+
+inline SetIntArrayDataRefTask::SetIntArrayDataRefTask(const std::string& name,
+                                                      int count, int offset) :
+    SetArrayDataRefTask<int, SetIntArrayDataRefTask>(name, count, offset)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline SetIntArrayDataRefTask::SetIntArrayDataRefTask(XPLMDataRef dataRef,
+                                                      int count, int offset) :
+    SetArrayDataRefTask<int, SetIntArrayDataRefTask>(dataRef, count, offset)
+{
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+inline void SetFloatArrayDataRefTask::setData(XPLMDataRef dataRef,
+                                              float* value,
+                                              int count, int offset)
+{
+    XPLMSetDatavf(dataRef, value, offset, count);
+}
+
+//------------------------------------------------------------------------------
+
+inline
+SetFloatArrayDataRefTask::SetFloatArrayDataRefTask(const std::string& name,
+                                                   int count, int offset) :
+    SetArrayDataRefTask<float, SetFloatArrayDataRefTask>(name, count, offset)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline
+SetFloatArrayDataRefTask::SetFloatArrayDataRefTask(XPLMDataRef dataRef,
+                                                   int count, int offset) :
+    SetArrayDataRefTask<float, SetFloatArrayDataRefTask>(dataRef, count, offset)
+{
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+inline void SetByteArrayDataRefTask::setData(XPLMDataRef dataRef,
+                                             unsigned char* value,
+                                             int count, int offset)
+{
+    XPLMSetDatab(dataRef, value, offset, count);
+}
+
+//------------------------------------------------------------------------------
+
+inline
+SetByteArrayDataRefTask::SetByteArrayDataRefTask(const std::string& name,
+                                                 int count, int offset) :
+    SetArrayDataRefTask<unsigned char, SetByteArrayDataRefTask>(name,
+                                                                count, offset)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline
+SetByteArrayDataRefTask::SetByteArrayDataRefTask(XPLMDataRef dataRef,
+                                                 int count, int offset) :
+    SetArrayDataRefTask<unsigned char, SetByteArrayDataRefTask>(dataRef,
+                                                                count, offset)
+{
+}
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplra */
+
+//------------------------------------------------------------------------------
+#endif // XPLRA_SETDATAREFTASK_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/SetDataRefTask.h
===================================================================
--- src/plugin/src/xplra/SetDataRefTask.h	(revision 66)
+++ 	(revision )
@@ -1,616 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLRA_SETDATAREFTASK_H
-#define XPLRA_SETDATAREFTASK_H
-//------------------------------------------------------------------------------
-
-#include "DataRefTask.h"
-
-#include <hu/varadiistvan/scpl/io/DataStream.h>
-
-//------------------------------------------------------------------------------
-
-namespace xplra {
-
-//------------------------------------------------------------------------------
-
-/**
- * Base class for dataref tasks that set the value of some data
- * referenced by a dataref.
- *
- * Since XPLM provides no feedback on whether the setting is
- * successful, we detect only if the dataref is valid or not. So the
- * isValid() function provides the only feedback if the task executed
- * successfully or not. (We could use XPLMCanWriteDataRef, but for
- * efficiency reasons we refrain from it. A separate task may be
- * created for this purpose.)
- */
-class SetDataRefTask : public DataRefTask
-{
-public:
-    /**
-     * Read a dataref setting specification and create the appropriate
-     * SetDataRefTask instance.
-     *
-     * @param result will contain the result of the operation. It
-     * signifies an error only, if some wrong data is read. If the
-     * stream fails, it will indicate RESULT_OK.
-     * @param stream the stream to read from
-     *
-     * @return the new instance or 0 on error.
-     */
-    static SetDataRefTask* create(uint8_t& result, hu::varadiistvan::scpl::io::DataStream& stream);
-
-    /**
-     * Construct the task for the dataref with the given name.
-     */
-    SetDataRefTask(const std::string& name);
-
-    /**
-     * Construct the task for the given dataref.
-     */
-    SetDataRefTask(XPLMDataRef dataRef);
-
-    /**
-     * Read and set the value to update from the given stream
-     */
-    virtual void readValue(hu::varadiistvan::scpl::io::DataStream& stream) = 0;
-};
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-/**
- * Base class for dataref setting tasks that set a single scalar
- * value.
- *
- * ConcreteClass is the actual child class. It should have a function
- * name setData() which performs the actual setting.
- */
-template <typename T, class ConcreteClass>
-class SetScalarDataRefTask : public SetDataRefTask
-{
-protected:
-    /**
-     * The value to set.
-     */
-    T value;
-
-public:
-    /**
-     * Construct the task for setting the data referenced by the
-     * dataref with the given name.
-     */
-    SetScalarDataRefTask(const std::string& name);
-
-    /**
-     * Construct the task for setting the data referenced by the given
-     * dataref.
-     */
-    SetScalarDataRefTask(XPLMDataRef dataRef);
-
-protected:
-    /**
-     * Perform the actual operation.
-     */
-    virtual void process();
-};
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-/**
- * Task to set the value of an integer data.
- */
-class SetIntDataRefTask :
-        public SetScalarDataRefTask<int, SetIntDataRefTask>
-{
-public:
-    /**
-     * Set the given dataref's value to the given value.
-     */
-    static void setData(XPLMDataRef dataRef, int value);
-
-    /**
-     * Construct the task for the dataref with the given name.
-     */
-    SetIntDataRefTask(const std::string& name);
-
-    /**
-     * Construct the task for the given dataref.
-     */
-    SetIntDataRefTask(XPLMDataRef dataRef);
-
-    /**
-     * Read and set the value to update from the given stream
-     */
-    virtual void readValue(hu::varadiistvan::scpl::io::DataStream& stream);
-};
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-/**
- * Task to set the value of a single-precision floating point data.
- */
-class SetFloatDataRefTask :
-        public SetScalarDataRefTask<float, SetFloatDataRefTask>
-{
-public:
-    /**
-     * Set the given dataref's value to the given value.
-     */
-    static void setData(XPLMDataRef dataRef, float value);
-
-    /**
-     * Construct the task for the dataref with the given name.
-     */
-    SetFloatDataRefTask(const std::string& name);
-
-    /**
-     * Construct the task for the given dataref.
-     */
-    SetFloatDataRefTask(XPLMDataRef dataRef);
-
-    /**
-     * Read and set the value to update from the given stream
-     */
-    virtual void readValue(hu::varadiistvan::scpl::io::DataStream& stream);
-};
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-/**
- * Task to set the value of a double-precision floating point data.
- */
-class SetDoubleDataRefTask :
-        public SetScalarDataRefTask<double, SetDoubleDataRefTask>
-{
-public:
-    /**
-     * Set the given dataref's value to the given value.
-     */
-    static void setData(XPLMDataRef dataRef, double value);
-
-    /**
-     * Construct the task for the dataref with the given name.
-     */
-    SetDoubleDataRefTask(const std::string& name);
-
-    /**
-     * Construct the task for the given dataref.
-     */
-    SetDoubleDataRefTask(XPLMDataRef dataRef);
-
-    /**
-     * Read and set the value to update from the given stream
-     */
-    virtual void readValue(hu::varadiistvan::scpl::io::DataStream& stream);
-};
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-/**
- * Base class for dataref setting tasks that set the values of an
- * array.
- *
- * ConcreteClass is the actual child class. It should have a function
- * name setData() which performs the actual setting.
- */
-template <typename T, class ConcreteClass>
-class SetArrayDataRefTask : public SetDataRefTask
-{
-private:
-    /**
-     * The number of data items in the value.
-     */
-    int count;
-
-    /**
-     * The offset starting with which the data should be set.
-     */
-    int offset;
-
-    /**
-     * The value to set.
-     */
-    T* value;
-
-public:
-    /**
-     * Construct the data setting task for the dataref with the given
-     * name.
-     *
-     * The value array will be allocated, but not filled with
-     * data. Thus count should be positive!
-     */
-    SetArrayDataRefTask(const std::string& name, int count, int offset = 0);
-
-    /**
-     * Construct the data setting task for the given dataref.
-     *
-     * The value array will be allocated, but not filled with
-     * data. Thus count should be positive!
-     */
-    SetArrayDataRefTask(XPLMDataRef dataRef, int count, int offset = 0);
-
-    /**
-     * Destroy the task.
-     */
-    virtual ~SetArrayDataRefTask();
-
-    /**
-     * Read and set the value to update from the given stream
-     */
-    virtual void readValue(hu::varadiistvan::scpl::io::DataStream& stream);
-
-protected:
-    /**
-     * Perform the actual operation.
-     */
-    virtual void process();
-};
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-/**
- * A dataref setting task which sets an array of integers.
- */
-class SetIntArrayDataRefTask :
-    public SetArrayDataRefTask<int, SetIntArrayDataRefTask>
-{
-public:
-    /**
-     * Perform the actual setting.
-     */
-    static void setData(XPLMDataRef dataRef, int* value, int count, int offset);
-
-    /**
-     * Construct the task for the dataref with the given name.
-     */
-    SetIntArrayDataRefTask(const std::string& name, int count, int offset = 0);
-
-    /**
-     * Construct the task for the given dataref.
-     */
-    SetIntArrayDataRefTask(XPLMDataRef dataRef, int count, int offset = 0);
-};
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-/**
- * A dataref setting task which sets an array of single-precision
- * floating-point values.
- */
-class SetFloatArrayDataRefTask :
-    public SetArrayDataRefTask<float, SetFloatArrayDataRefTask>
-{
-public:
-    /**
-     * Perform the actual setting.
-     */
-    static void setData(XPLMDataRef dataRef, float* value, int count, int offset);
-
-    /**
-     * Construct the task for the dataref with the given name.
-     */
-    SetFloatArrayDataRefTask(const std::string& name, int count, int offset = 0);
-
-    /**
-     * Construct the task for the given dataref.
-     */
-    SetFloatArrayDataRefTask(XPLMDataRef dataRef, int count, int offset = 0);
-};
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-/**
- * A dataref setting task which sets an array of bytes.
- */
-class SetByteArrayDataRefTask :
-    public SetArrayDataRefTask<unsigned char, SetByteArrayDataRefTask>
-{
-public:
-    /**
-     * Perform the actual setting.
-     */
-    static void setData(XPLMDataRef dataRef, unsigned char* value,
-                        int count, int offset);
-
-    /**
-     * Construct the task for the dataref with the given name.
-     */
-    SetByteArrayDataRefTask(const std::string& name, int count, int offset = 0);
-
-    /**
-     * Construct the task for the given dataref.
-     */
-    SetByteArrayDataRefTask(XPLMDataRef dataRef, int count, int offset = 0);
-};
-
-//------------------------------------------------------------------------------
-// Template definitions
-//------------------------------------------------------------------------------
-
-template <typename T, class ConcreteClass>
-inline SetScalarDataRefTask<T, ConcreteClass>::
-SetScalarDataRefTask(const std::string& name) :
-    SetDataRefTask(name)
-{
-}
-
-//------------------------------------------------------------------------------
-
-template <typename T, class ConcreteClass>
-inline SetScalarDataRefTask<T, ConcreteClass>::
-SetScalarDataRefTask(XPLMDataRef dataRef) :
-    SetDataRefTask(dataRef)
-{
-}
-
-//------------------------------------------------------------------------------
-
-template <typename T, class ConcreteClass>
-void SetScalarDataRefTask<T, ConcreteClass>::process()
-{
-    ConcreteClass::setData(getDataRef(), value);
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-template <typename T, class ConcreteClass>
-inline SetArrayDataRefTask<T, ConcreteClass>::
-SetArrayDataRefTask(const std::string& name, int count, int offset) :
-    SetDataRefTask(name),
-    count(count),
-    offset(offset),
-    value(new T[count])
-{
-}
-
-//------------------------------------------------------------------------------
-
-template <typename T, class ConcreteClass>
-inline SetArrayDataRefTask<T, ConcreteClass>::
-SetArrayDataRefTask(XPLMDataRef dataRef, int count, int offset) :
-    SetDataRefTask(dataRef),
-    count(count),
-    offset(offset),
-    value(new T[count])
-{
-}
-
-//------------------------------------------------------------------------------
-
-template <typename T, class ConcreteClass>
-inline SetArrayDataRefTask<T, ConcreteClass>::~SetArrayDataRefTask()
-{
-    delete [] value;
-}
-
-//------------------------------------------------------------------------------
-
-template <typename T, class ConcreteClass>
-void SetArrayDataRefTask<T, ConcreteClass>::
-readValue(hu::varadiistvan::scpl::io::DataStream& stream)
-{
-    stream.read(value, count * sizeof(T));
-}
-
-//------------------------------------------------------------------------------
-
-template <typename T, class ConcreteClass>
-void SetArrayDataRefTask<T, ConcreteClass>::process()
-{
-    ConcreteClass::setData(getDataRef(), value, count, offset);
-}
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline SetDataRefTask::SetDataRefTask(const std::string& name) :
-    DataRefTask(name)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline SetDataRefTask::SetDataRefTask(XPLMDataRef dataRef) :
-    DataRefTask(dataRef)
-{
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-inline void SetIntDataRefTask::setData(XPLMDataRef dataRef, int value)
-{
-    XPLMSetDatai(dataRef, value);
-}
-
-//------------------------------------------------------------------------------
-
-inline SetIntDataRefTask::SetIntDataRefTask(const std::string& name) :
-    SetScalarDataRefTask<int, SetIntDataRefTask>(name)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline SetIntDataRefTask::SetIntDataRefTask(XPLMDataRef dataRef) :
-    SetScalarDataRefTask<int, SetIntDataRefTask>(dataRef)
-{
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-inline void SetFloatDataRefTask::setData(XPLMDataRef dataRef, float value)
-{
-    XPLMSetDatai(dataRef, value);
-}
-
-//------------------------------------------------------------------------------
-
-inline SetFloatDataRefTask::SetFloatDataRefTask(const std::string& name) :
-    SetScalarDataRefTask<float, SetFloatDataRefTask>(name)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline SetFloatDataRefTask::SetFloatDataRefTask(XPLMDataRef dataRef) :
-    SetScalarDataRefTask<float, SetFloatDataRefTask>(dataRef)
-{
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-inline void SetDoubleDataRefTask::setData(XPLMDataRef dataRef, double value)
-{
-    XPLMSetDatai(dataRef, value);
-}
-
-//------------------------------------------------------------------------------
-
-inline SetDoubleDataRefTask::SetDoubleDataRefTask(const std::string& name) :
-    SetScalarDataRefTask<double, SetDoubleDataRefTask>(name)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline SetDoubleDataRefTask::SetDoubleDataRefTask(XPLMDataRef dataRef) :
-    SetScalarDataRefTask<double, SetDoubleDataRefTask>(dataRef)
-{
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-inline void SetIntArrayDataRefTask::setData(XPLMDataRef dataRef, int* value,
-                                            int count, int offset)
-{
-    XPLMSetDatavi(dataRef, value, offset, count);
-}
-
-//------------------------------------------------------------------------------
-
-inline SetIntArrayDataRefTask::SetIntArrayDataRefTask(const std::string& name,
-                                                      int count, int offset) :
-    SetArrayDataRefTask<int, SetIntArrayDataRefTask>(name, count, offset)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline SetIntArrayDataRefTask::SetIntArrayDataRefTask(XPLMDataRef dataRef,
-                                                      int count, int offset) :
-    SetArrayDataRefTask<int, SetIntArrayDataRefTask>(dataRef, count, offset)
-{
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-inline void SetFloatArrayDataRefTask::setData(XPLMDataRef dataRef,
-                                              float* value,
-                                              int count, int offset)
-{
-    XPLMSetDatavf(dataRef, value, offset, count);
-}
-
-//------------------------------------------------------------------------------
-
-inline
-SetFloatArrayDataRefTask::SetFloatArrayDataRefTask(const std::string& name,
-                                                   int count, int offset) :
-    SetArrayDataRefTask<float, SetFloatArrayDataRefTask>(name, count, offset)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline
-SetFloatArrayDataRefTask::SetFloatArrayDataRefTask(XPLMDataRef dataRef,
-                                                   int count, int offset) :
-    SetArrayDataRefTask<float, SetFloatArrayDataRefTask>(dataRef, count, offset)
-{
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-inline void SetByteArrayDataRefTask::setData(XPLMDataRef dataRef,
-                                             unsigned char* value,
-                                             int count, int offset)
-{
-    XPLMSetDatab(dataRef, value, offset, count);
-}
-
-//------------------------------------------------------------------------------
-
-inline
-SetByteArrayDataRefTask::SetByteArrayDataRefTask(const std::string& name,
-                                                 int count, int offset) :
-    SetArrayDataRefTask<unsigned char, SetByteArrayDataRefTask>(name,
-                                                                count, offset)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline
-SetByteArrayDataRefTask::SetByteArrayDataRefTask(XPLMDataRef dataRef,
-                                                 int count, int offset) :
-    SetArrayDataRefTask<unsigned char, SetByteArrayDataRefTask>(dataRef,
-                                                                count, offset)
-{
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplra */
-
-//------------------------------------------------------------------------------
-#endif // XPLRA_SETDATAREFTASK_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/plugin/src/xplra/SetMultiDataRefRequest.cc
===================================================================
--- src/plugin/src/xplra/SetMultiDataRefRequest.cc	(revision 13)
+++ src/plugin/src/xplra/SetMultiDataRefRequest.cc	(revision 13)
@@ -0,0 +1,102 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include "SetMultiDataRefRequest.h"
+
+#include "Protocol.h"
+
+//------------------------------------------------------------------------------
+
+using xplra::SetMultiDataRefRequest;
+
+using hu::varadiistvan::scpl::io::DataStream;
+
+//------------------------------------------------------------------------------
+
+SetMultiDataRefRequest::SetMultiDataRefRequest(uint8_t& result,
+                                               DataStream& stream,
+                                               bool readValues)
+{
+    result = Protocol::RESULT_OK;
+
+    uint32_t numTasks = stream.readU32();
+    if (!stream) return;
+    if (numTasks==0 || numTasks>Protocol::MAX_MULTI_COUNT) {
+        result = Protocol::RESULT_INVALID_COUNT;
+        return;
+    }
+
+    for(size_t i = 0;
+        i<numTasks && result==Protocol::RESULT_OK && stream; ++i) {
+        SetDataRefTask* task = SetDataRefTask::create(result, stream);
+        if (task!=0) {
+            if (readValues) {
+                task->readValue(stream);
+            }
+            addTask(task);
+        }
+    }
+}
+
+//------------------------------------------------------------------------------
+
+void SetMultiDataRefRequest::readValues(DataStream& stream)
+{
+    size_t numTasks = getNumTasks();
+    for(size_t i = 0; i<numTasks && stream; ++i) {
+        SetDataRefTask* task = getTask(i);
+        task->readValue(stream);
+    }
+}
+
+//------------------------------------------------------------------------------
+
+void SetMultiDataRefRequest::writeResult(DataStream& stream) const
+{
+    size_t numTasks = getNumTasks();
+    for(size_t i = 0; i<numTasks; ++i) {
+        SetDataRefTask* task = getTask(i);
+        if (!task->isValid()) {
+            stream.writeU8(Protocol::RESULT_UNKNOWN_DATAREF);
+            stream.writeU32(i);
+            return;
+        }
+    }
+
+    stream.writeU8(Protocol::RESULT_OK);
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/SetMultiDataRefRequest.cc
===================================================================
--- src/plugin/src/xplra/SetMultiDataRefRequest.cc	(revision 13)
+++ 	(revision )
@@ -1,102 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "SetMultiDataRefRequest.h"
-
-#include "Protocol.h"
-
-//------------------------------------------------------------------------------
-
-using xplra::SetMultiDataRefRequest;
-
-using hu::varadiistvan::scpl::io::DataStream;
-
-//------------------------------------------------------------------------------
-
-SetMultiDataRefRequest::SetMultiDataRefRequest(uint8_t& result,
-                                               DataStream& stream,
-                                               bool readValues)
-{
-    result = Protocol::RESULT_OK;
-
-    uint32_t numTasks = stream.readU32();
-    if (!stream) return;
-    if (numTasks==0 || numTasks>Protocol::MAX_MULTI_COUNT) {
-        result = Protocol::RESULT_INVALID_COUNT;
-        return;
-    }
-
-    for(size_t i = 0;
-        i<numTasks && result==Protocol::RESULT_OK && stream; ++i) {
-        SetDataRefTask* task = SetDataRefTask::create(result, stream);
-        if (task!=0) {
-            if (readValues) {
-                task->readValue(stream);
-            }
-            addTask(task);
-        }
-    }
-}
-
-//------------------------------------------------------------------------------
-
-void SetMultiDataRefRequest::readValues(DataStream& stream)
-{
-    size_t numTasks = getNumTasks();
-    for(size_t i = 0; i<numTasks && stream; ++i) {
-        SetDataRefTask* task = getTask(i);
-        task->readValue(stream);
-    }
-}
-
-//------------------------------------------------------------------------------
-
-void SetMultiDataRefRequest::writeResult(DataStream& stream) const
-{
-    size_t numTasks = getNumTasks();
-    for(size_t i = 0; i<numTasks; ++i) {
-        SetDataRefTask* task = getTask(i);
-        if (!task->isValid()) {
-            stream.writeU8(Protocol::RESULT_UNKNOWN_DATAREF);
-            stream.writeU32(i);
-            return;
-        }
-    }
-
-    stream.writeU8(Protocol::RESULT_OK);
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/plugin/src/xplra/SetMultiDataRefRequest.h
===================================================================
--- src/plugin/src/xplra/SetMultiDataRefRequest.h	(revision 13)
+++ src/plugin/src/xplra/SetMultiDataRefRequest.h	(revision 13)
@@ -0,0 +1,84 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef XPLRA_SETMULTIDATAREFREQUEST_H
+#define XPLRA_SETMULTIDATAREFREQUEST_H
+//------------------------------------------------------------------------------
+
+#include "MultiTaskRequest.h"
+#include "SetDataRefTask.h"
+
+//------------------------------------------------------------------------------
+
+namespace xplra {
+
+//------------------------------------------------------------------------------
+
+/**
+ * A request containing several dataref update tasks.
+ */
+class SetMultiDataRefRequest : public MultiTaskRequestTemplate<SetDataRefTask>
+{
+public:
+    /**
+     * Construct the request by reading the task specifications from
+     * the given stream.
+     */
+    SetMultiDataRefRequest(uint8_t& result,
+                           hu::varadiistvan::scpl::io::DataStream& stream,
+                           bool readValues);
+
+    /**
+     * Read the values of all tasks.
+     */
+    void readValues(hu::varadiistvan::scpl::io::DataStream& stream);
+
+    /**
+     * Write the result of an execution.
+     *
+     * If there is at least one invalid dataref, the result will be
+     * RESULT_UNKNOWN_DATAREF followed by a 32-bit unsigned value with
+     * the index of the first unknown dataref.
+     *
+     * Otherwise the result is RESULT_OK.
+     */
+    void writeResult(hu::varadiistvan::scpl::io::DataStream& stream) const;
+};
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplra */
+
+//------------------------------------------------------------------------------
+#endif // XPLRA_SETMULTIDATAREFREQUEST_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/SetMultiDataRefRequest.h
===================================================================
--- src/plugin/src/xplra/SetMultiDataRefRequest.h	(revision 13)
+++ 	(revision )
@@ -1,84 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLRA_SETMULTIDATAREFREQUEST_H
-#define XPLRA_SETMULTIDATAREFREQUEST_H
-//------------------------------------------------------------------------------
-
-#include "MultiTaskRequest.h"
-#include "SetDataRefTask.h"
-
-//------------------------------------------------------------------------------
-
-namespace xplra {
-
-//------------------------------------------------------------------------------
-
-/**
- * A request containing several dataref update tasks.
- */
-class SetMultiDataRefRequest : public MultiTaskRequestTemplate<SetDataRefTask>
-{
-public:
-    /**
-     * Construct the request by reading the task specifications from
-     * the given stream.
-     */
-    SetMultiDataRefRequest(uint8_t& result,
-                           hu::varadiistvan::scpl::io::DataStream& stream,
-                           bool readValues);
-
-    /**
-     * Read the values of all tasks.
-     */
-    void readValues(hu::varadiistvan::scpl::io::DataStream& stream);
-
-    /**
-     * Write the result of an execution.
-     *
-     * If there is at least one invalid dataref, the result will be
-     * RESULT_UNKNOWN_DATAREF followed by a 32-bit unsigned value with
-     * the index of the first unknown dataref.
-     *
-     * Otherwise the result is RESULT_OK.
-     */
-    void writeResult(hu::varadiistvan::scpl::io::DataStream& stream) const;
-};
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplra */
-
-//------------------------------------------------------------------------------
-#endif // XPLRA_SETMULTIDATAREFREQUEST_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/plugin/src/xplra/Task.h
===================================================================
--- src/plugin/src/xplra/Task.h	(revision 13)
+++ src/plugin/src/xplra/Task.h	(revision 13)
@@ -0,0 +1,75 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef XPLRA_TASK_H
+#define XPLRA_TASK_H
+//------------------------------------------------------------------------------
+
+namespace xplra {
+
+//------------------------------------------------------------------------------
+
+/**
+ * A task is like a request, but it cannot be executed directly by the
+ * flight loop callback. Instead, it defines some simple task, of
+ * which potentially many can be added to a single request.
+ */
+class Task
+{
+public:
+    /**
+     * Virtual destructor.
+     */
+    virtual ~Task();
+
+    /**
+     * Perform the task
+     */
+    virtual void perform() = 0;
+};
+
+//------------------------------------------------------------------------------
+// Inline definitions
+//------------------------------------------------------------------------------
+
+inline Task::~Task()
+{
+}
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplra */
+
+//------------------------------------------------------------------------------
+#endif // XPLRA_TASK_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/Task.h
===================================================================
--- src/plugin/src/xplra/Task.h	(revision 13)
+++ 	(revision )
@@ -1,75 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLRA_TASK_H
-#define XPLRA_TASK_H
-//------------------------------------------------------------------------------
-
-namespace xplra {
-
-//------------------------------------------------------------------------------
-
-/**
- * A task is like a request, but it cannot be executed directly by the
- * flight loop callback. Instead, it defines some simple task, of
- * which potentially many can be added to a single request.
- */
-class Task
-{
-public:
-    /**
-     * Virtual destructor.
-     */
-    virtual ~Task();
-
-    /**
-     * Perform the task
-     */
-    virtual void perform() = 0;
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline Task::~Task()
-{
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplra */
-
-//------------------------------------------------------------------------------
-#endif // XPLRA_TASK_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/plugin/src/xplra/TaskRequest.cc
===================================================================
--- src/plugin/src/xplra/TaskRequest.cc	(revision 13)
+++ src/plugin/src/xplra/TaskRequest.cc	(revision 13)
@@ -0,0 +1,50 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include "TaskRequest.h"
+
+//------------------------------------------------------------------------------
+
+using xplra::TaskRequest;
+
+//------------------------------------------------------------------------------
+
+void TaskRequest::execute()
+{
+    task->perform();
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/TaskRequest.cc
===================================================================
--- src/plugin/src/xplra/TaskRequest.cc	(revision 13)
+++ 	(revision )
@@ -1,50 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "TaskRequest.h"
-
-//------------------------------------------------------------------------------
-
-using xplra::TaskRequest;
-
-//------------------------------------------------------------------------------
-
-void TaskRequest::execute()
-{
-    task->perform();
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/plugin/src/xplra/TaskRequest.h
===================================================================
--- src/plugin/src/xplra/TaskRequest.h	(revision 13)
+++ src/plugin/src/xplra/TaskRequest.h	(revision 13)
@@ -0,0 +1,101 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef XPLRA_TASKREQUEST_H
+#define XPLRA_TASKREQUEST_H
+//------------------------------------------------------------------------------
+
+#include "Request.h"
+
+#include "Task.h"
+
+//------------------------------------------------------------------------------
+
+namespace xplra {
+
+//------------------------------------------------------------------------------
+
+/**
+ * A request the performs a task.
+ */
+class TaskRequest : public Request
+{
+private:
+    /**
+     * The task belonging to the request. It is owned by the request,
+     * i.e. deleted when the request is deleted.
+     */
+    Task* task;
+
+public:
+    /**
+     * Construct the request for the given task. The task will become
+     * owned by the request, so it will be deleted when the task is
+     * deleted.
+     */
+    TaskRequest(Task* task);
+
+    /**
+     * Destroy the task request.
+     */
+    virtual ~TaskRequest();
+
+    /**
+     * Execute the request by performing the task.
+     */
+    virtual void execute();
+};
+
+//------------------------------------------------------------------------------
+// Inline definitions
+//------------------------------------------------------------------------------
+
+inline TaskRequest::TaskRequest(Task* task) :
+    task(task)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline TaskRequest::~TaskRequest()
+{
+    delete task;
+}
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplra */
+
+//------------------------------------------------------------------------------
+#endif // XPLRA_TASKREQUEST_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/TaskRequest.h
===================================================================
--- src/plugin/src/xplra/TaskRequest.h	(revision 13)
+++ 	(revision )
@@ -1,101 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLRA_TASKREQUEST_H
-#define XPLRA_TASKREQUEST_H
-//------------------------------------------------------------------------------
-
-#include "Request.h"
-
-#include "Task.h"
-
-//------------------------------------------------------------------------------
-
-namespace xplra {
-
-//------------------------------------------------------------------------------
-
-/**
- * A request the performs a task.
- */
-class TaskRequest : public Request
-{
-private:
-    /**
-     * The task belonging to the request. It is owned by the request,
-     * i.e. deleted when the request is deleted.
-     */
-    Task* task;
-
-public:
-    /**
-     * Construct the request for the given task. The task will become
-     * owned by the request, so it will be deleted when the task is
-     * deleted.
-     */
-    TaskRequest(Task* task);
-
-    /**
-     * Destroy the task request.
-     */
-    virtual ~TaskRequest();
-
-    /**
-     * Execute the request by performing the task.
-     */
-    virtual void execute();
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline TaskRequest::TaskRequest(Task* task) :
-    task(task)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline TaskRequest::~TaskRequest()
-{
-    delete task;
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplra */
-
-//------------------------------------------------------------------------------
-#endif // XPLRA_TASKREQUEST_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/plugin/src/xplra/plugin.cc
===================================================================
--- src/plugin/src/xplra/plugin.cc	(revision 46)
+++ src/plugin/src/xplra/plugin.cc	(revision 46)
@@ -0,0 +1,139 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include "ListenThread.h"
+
+#include "Globals.h"
+
+#include <hu/varadiistvan/xplcommon/Util.h>
+#include <hu/varadiistvan/scpl/config.h>
+
+#include <XPLMDefs.h>
+#include <XPLMProcessing.h>
+#include <XPLMMenus.h>
+
+#include <cstdio>
+#include <cstring>
+#include <cstdarg>
+
+#if TARGET_API_POSIX
+#include <signal.h>
+#endif
+
+//------------------------------------------------------------------------------
+
+using xplra::ListenThread;
+using xplra::Globals;
+
+using hu::varadiistvan::xplcommon::Util;
+
+//------------------------------------------------------------------------------
+
+/**
+ * The global objects.
+ */
+static Globals* globals = 0;
+
+/**
+ * The thread to use to listen for incoming connections.
+ */
+static ListenThread* listenThread = 0;
+
+//------------------------------------------------------------------------------
+
+PLUGIN_API int XPluginStart(char* outName, char* outSignature,
+                            char* outDescription)
+{
+    Util::debug("hu.varadiistvan.xplra called\n");
+
+    strcpy(outName, "X-Plane Remote Access");
+    strcpy(outSignature, "hu.varadiistvan.xplra");
+    strcpy(outDescription, "Provides remote access to datarefs");
+
+#if TARGET_API_POSIX
+    signal(SIGPIPE, SIG_IGN);
+#endif
+
+    return 1;
+}
+
+//------------------------------------------------------------------------------
+
+PLUGIN_API void XPluginEnable(void)
+{
+    Util::debug("hu.varadiistvan.xplra.XPluginEnable called\n");
+    // XPLMRegisterFlightLoopCallback(&callback, 5.0, 0);
+
+    globals = new Globals();
+
+    listenThread = new ListenThread(*globals);
+    listenThread->start();
+}
+
+//------------------------------------------------------------------------------
+
+PLUGIN_API void XPluginReceiveMessage(XPLMPluginID inFrom, long inMessage,
+                                      void* inParam)
+{
+    Util::debug("hu.varadiistvan.xplra.XPluginReceiveMessage called, inFrom=%d, inMessage=%ld, inParam=%p\n",
+          inFrom, inMessage, inParam);
+}
+
+//------------------------------------------------------------------------------
+
+PLUGIN_API void XPluginDisable(void)
+{
+    Util::debug("hu.varadiistvan.xplra.XPluginDisable called\n");
+    // XPLMUnregisterFlightLoopCallback(&callback, 0);
+
+    if (listenThread!=0) {
+        listenThread->quit();
+        listenThread->join();
+        delete listenThread;
+        listenThread = 0;
+    }
+
+    delete globals; globals = 0;
+}
+
+//------------------------------------------------------------------------------
+
+PLUGIN_API void XPluginStop(void)
+{
+    Util::debug("hu.varadiistvan.xplra.XPluginStop called\n");
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/plugin.cc
===================================================================
--- src/plugin/src/xplra/plugin.cc	(revision 46)
+++ 	(revision )
@@ -1,139 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "ListenThread.h"
-
-#include "Globals.h"
-
-#include <hu/varadiistvan/xplcommon/Util.h>
-#include <hu/varadiistvan/scpl/config.h>
-
-#include <XPLMDefs.h>
-#include <XPLMProcessing.h>
-#include <XPLMMenus.h>
-
-#include <cstdio>
-#include <cstring>
-#include <cstdarg>
-
-#if TARGET_API_POSIX
-#include <signal.h>
-#endif
-
-//------------------------------------------------------------------------------
-
-using xplra::ListenThread;
-using xplra::Globals;
-
-using hu::varadiistvan::xplcommon::Util;
-
-//------------------------------------------------------------------------------
-
-/**
- * The global objects.
- */
-static Globals* globals = 0;
-
-/**
- * The thread to use to listen for incoming connections.
- */
-static ListenThread* listenThread = 0;
-
-//------------------------------------------------------------------------------
-
-PLUGIN_API int XPluginStart(char* outName, char* outSignature,
-                            char* outDescription)
-{
-    Util::debug("hu.varadiistvan.xplra called\n");
-
-    strcpy(outName, "X-Plane Remote Access");
-    strcpy(outSignature, "hu.varadiistvan.xplra");
-    strcpy(outDescription, "Provides remote access to datarefs");
-
-#if TARGET_API_POSIX
-    signal(SIGPIPE, SIG_IGN);
-#endif
-
-    return 1;
-}
-
-//------------------------------------------------------------------------------
-
-PLUGIN_API void XPluginEnable(void)
-{
-    Util::debug("hu.varadiistvan.xplra.XPluginEnable called\n");
-    // XPLMRegisterFlightLoopCallback(&callback, 5.0, 0);
-
-    globals = new Globals();
-
-    listenThread = new ListenThread(*globals);
-    listenThread->start();
-}
-
-//------------------------------------------------------------------------------
-
-PLUGIN_API void XPluginReceiveMessage(XPLMPluginID inFrom, long inMessage,
-                                      void* inParam)
-{
-    Util::debug("hu.varadiistvan.xplra.XPluginReceiveMessage called, inFrom=%d, inMessage=%ld, inParam=%p\n",
-          inFrom, inMessage, inParam);
-}
-
-//------------------------------------------------------------------------------
-
-PLUGIN_API void XPluginDisable(void)
-{
-    Util::debug("hu.varadiistvan.xplra.XPluginDisable called\n");
-    // XPLMUnregisterFlightLoopCallback(&callback, 0);
-
-    if (listenThread!=0) {
-        listenThread->quit();
-        listenThread->join();
-        delete listenThread;
-        listenThread = 0;
-    }
-
-    delete globals; globals = 0;
-}
-
-//------------------------------------------------------------------------------
-
-PLUGIN_API void XPluginStop(void)
-{
-    Util::debug("hu.varadiistvan.xplra.XPluginStop called\n");
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/plugin/src/xplra/version.ldscript
===================================================================
--- src/plugin/src/xplra/version.ldscript	(revision 13)
+++ src/plugin/src/xplra/version.ldscript	(revision 13)
@@ -0,0 +1,10 @@
+{
+ global:
+  XPluginStart;
+  XPluginStop;
+  XPluginEnable;
+  XPluginDisable;
+  XPluginReceiveMessage;
+ local:
+   *;
+};
Index: src/plugin/src/xplra/version.ldscript
===================================================================
--- src/plugin/src/xplra/version.ldscript	(revision 13)
+++ 	(revision )
@@ -1,10 +1,0 @@
-{
- global:
-  XPluginStart;
-  XPluginStop;
-  XPluginEnable;
-  XPluginDisable;
-  XPluginReceiveMessage;
- local:
-   *;
-};
