Binary files patched/.CMakeLists.txt.kate-swp and origin/.CMakeLists.txt.kate-swp differ
diff -U 3 -H -d -r -N -x '*.kdev' -x '.svn*' -x 'CVS*' -- patched/CMakeLists.txt origin/CMakeLists.txt
--- patched/CMakeLists.txt	2012-01-16 09:52:45.000000000 +0400
+++ origin/CMakeLists.txt	2011-12-20 11:43:24.000000000 +0400
@@ -78,19 +78,6 @@
 OPTION(ENABLE_TSC_CLOCK
              "Enable the usage of the timestamp counter as clock source (use with care)" OFF)
 
-# Integrated tests raise extra problems on some server configurations (without installed X-server).
-# The build-on-demand approach seems more legit here.
-OPTION(BUILD_TESTS
-             "Build integrated CERTI test - Billard" OFF)
-
-OPTION(RTIA_USE_THREAD
-             "[HLA1516 only] Force thread usage instead of independent RTIA process (default)" ON)
-## It seems to be more legit approach to add this defintions to config.h file.
-## The profit is the correct work of automatic IDE parsers.
-##IF(RTIA_USE_THREAD)
-##	add_definitions(-DRTIA_USE_THREAD)
-##ENDIF(RTIA_USE_THREAD)
-
 # The communication channel to RTIA
 OPTION(RTIA_USE_TCP
            "Force TCP socket usage between RTIA and FederateAmbassador (default is Unix Socket)" OFF)
@@ -387,21 +374,6 @@
 ################ LEX YACC Check ####################
 FIND_PACKAGE(LexYacc)
 
-################ Boost Check #######################
-if(RTIA_USE_THREAD)
-  set(Boost_USE_STATIC_LIBS OFF)
-  set(Boost_USE_MULTITHREADED ON)
-  set(Boost_USE_STATIC_RUNTIME ON)
-  find_package( Boost 1.36.0 COMPONENTS thread )
-  if(NOT Boost_FOUND)
-    message(WARNING "libRTIA will not be built.")
-    set(RTIA_USE_THREAD OFF)
-  endif(NOT Boost_FOUND)
-endif(RTIA_USE_THREAD)
-
-## TODO: may be the better solution is to add the appropriate value to config files?
-## The profit is the correct behaviour of automatic IDE parsers.
-
 ## now we may generate the Autotools compatible config.h
 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake
                             ${CMAKE_CURRENT_BINARY_DIR}/config.h )
@@ -431,17 +403,9 @@
 ADD_SUBDIRECTORY( libHLA )
 ADD_SUBDIRECTORY( libCERTI )
 ADD_SUBDIRECTORY( RTIG )
-# Not sure that it is correct to move the multi-thread build into separate directory.
-# The profit of this approach is that current directory structure is the same.
-if(RTIA_USE_THREAD)
-  ADD_SUBDIRECTORY( libRTIA )
-else(RTIA_USE_THREAD)
-  ADD_SUBDIRECTORY( RTIA )
-  ADD_SUBDIRECTORY( libRTI )
-endif(RTIA_USE_THREAD)
-IF(BUILD_TESTS)
-  ADD_SUBDIRECTORY( test )
-ENDIF(BUILD_TESTS)
+ADD_SUBDIRECTORY( RTIA )
+ADD_SUBDIRECTORY( libRTI )
+ADD_SUBDIRECTORY( test )
 ADD_SUBDIRECTORY( doc )
 ADD_SUBDIRECTORY( scripts )
 
diff -U 3 -H -d -r -N -x '*.kdev' -x '.svn*' -x 'CVS*' -- patched/RTIA/Communications.cc origin/RTIA/Communications.cc
--- patched/RTIA/Communications.cc	2012-01-19 15:21:46.000000000 +0400
+++ origin/RTIA/Communications.cc	2010-03-23 16:13:27.000000000 +0300
@@ -36,9 +36,6 @@
 #include <iostream>
 #include <cstdlib>
 
-#include <sys/time.h>
-#include <limits>
-
 using std::ifstream ;
 using std::ios ;
 using std::cout ;
@@ -86,27 +83,12 @@
 
 // ----------------------------------------------------------------------------
 //! Communications.
-#ifdef RTIA_USE_THREAD
-Communications::Communications( LibRTIABufSet *_bufSet ) {
-	bufSetRef = _bufSet;
-#else // RTIA_USE_THREAD
-Communications::Communications(int RTIA_port, int RTIA_fd ) {
-	socketUN = new SocketUN();
-    // Federate/RTIA link creation.
-    if (0 <= RTIA_fd) {
-      socketUN->setSocketFD(RTIA_fd);
-    } else if (0 <= RTIA_port) {
-      if (socketUN->connectUN(RTIA_port) == -1)
-        exit(EXIT_FAILURE);
-    } else {
-      exit(EXIT_FAILURE);
-    }
-    
-#endif // RTIA_USE_THREAD
-
+Communications::Communications(int RTIA_port, int RTIA_fd)
+{
     char nom_serveur_RTIG[200] ;
     const char *default_host = "localhost" ;
 
+    socketUN = new SocketUN();
 #ifdef FEDERATION_USES_MULTICAST
     socketMC = new SocketMC();
 #endif
@@ -120,6 +102,16 @@
 #endif
     socketUDP = new SocketUDP();
 
+    // Federate/RTIA link creation.
+    if (0 <= RTIA_fd) {
+      socketUN->setSocketFD(RTIA_fd);
+    } else if (0 <= RTIA_port) {
+      if (socketUN->connectUN(RTIA_port) == -1)
+        exit(EXIT_FAILURE);
+    } else {
+      exit(EXIT_FAILURE);
+    }
+
     // RTIG TCP link creation.
     const char *certihost = NULL ;
     ifstream file("RTIA.dat", ios::in);
@@ -156,9 +148,7 @@
     closeMsg.send(socketTCP, NM_msgBufSend);
     socketTCP->close();
 
-#ifndef RTIA_USE_THREAD
     delete socketUN;
-#endif
 #ifdef FEDERATION_USES_MULTICAST
     delete socketMC;
 #endif
@@ -177,11 +167,7 @@
     //               "type %d",req->type);
     assert(req != NULL);
     D.Out(pdRequest, "Sending Request to Federate, Name %s, Type %d.", req->getMessageName(),req->getMessageType());
-#ifdef RTIA_USE_THREAD
-	bufSetRef->amb2fed.push( req );
-#else // RTIA_USE_THREAD
     req->send(socketUN, msgBufSend);
-#endif // RTIA_USE_THREAD
     // G.Out(pdGendoc,"exit  Communications::requestFederateService");
 }
 
@@ -208,130 +194,78 @@
 Communications::readMessage(int &n, NetworkMessage **msg_reseau, Message **msg,
                             struct timeval *timeout)
 {
+    const int tcp_fd(socketTCP->returnSocket());
+    const int udp_fd(socketUDP->returnSocket());
+
+    int max_fd = 0; // not used for _WIN32
+    fd_set fdset ;
+    FD_ZERO(&fdset);
+
+    if (msg_reseau) {
+        FD_SET(tcp_fd, &fdset);
+        FD_SET(udp_fd, &fdset);
+#ifndef _WIN32
+	max_fd = std::max(max_fd, std::max(tcp_fd, udp_fd));
+#endif
+    }
+    if (msg) {
+        FD_SET(socketUN->returnSocket(), &fdset);
+#ifndef _WIN32
+	max_fd = std::max(max_fd, socketUN->returnSocket());
+#endif
+    }
+
+#ifdef FEDERATION_USES_MULTICAST
+    // if multicast link is initialized (during join federation).
+    if (_est_init_mc) {
+        FD_SET(_socket_mc, &fdset);
+#ifndef _WIN32
+        max_fd = std::max(max_fd, _socket_mc);
+#endif
+   }
+#endif
+
     if (msg_reseau && !waitingList.empty()) {
         // One message is in waiting buffer.        
         *msg_reseau = waitingList.front();
         waitingList.pop_front();                
         n = 1 ;
-    } else if (msg_reseau && socketTCP->isDataReady()) {
+    }
+    else if (msg_reseau && socketTCP->isDataReady()) {
         // Datas are in TCP waiting buffer.
         // Read a message from RTIG TCP link.
     	*msg_reseau = NM_Factory::receive(socketTCP);
         n = 1 ;
-    } else if (msg_reseau && socketUDP->isDataReady()) {
+    }
+    else if (msg_reseau && socketUDP->isDataReady()) {
         // Datas are in UDP waiting buffer.
         // Read a message from RTIG UDP link.
     	*msg_reseau = NM_Factory::receive(socketUDP);
         n = 1 ;
-#ifndef RTIA_USE_THREAD
-	// FIXME: it seems useless to check msg parameter
-    } else if (msg && socketUN->isDataReady()) {
+    }
+    else if (msg && socketUN->isDataReady()) {
         // Datas are in UNIX waiting buffer.
         // Read a message from federate UNIX link.
     	*msg = M_Factory::receive(socketUN);
         n = 2 ;
-#endif // RTIA_USE_THREAD
-	} else {
-		
-		// FIXME: the idea to separate this code into independent functions
-		// accorting to chosen build option seems rather legit.
-		
-		const int tcp_fd(socketTCP->returnSocket());
-		const int udp_fd(socketUDP->returnSocket());
-
-		int max_fd = 0; // not used for _WIN32
-		fd_set fdset ;
-		FD_ZERO(&fdset);
-
-		#ifndef RTIA_USE_THREAD
-		if (msg) {
-			FD_SET(socketUN->returnSocket(), &fdset);
-		#ifndef _WIN32
-			max_fd = std::max(max_fd, socketUN->returnSocket());
-		#endif
-		}
-		#endif // RTIA_USE_THREAD
-		
-		if (msg_reseau) {
-			FD_SET(tcp_fd, &fdset);
-			FD_SET(udp_fd, &fdset);
-		#ifndef _WIN32
-			max_fd = std::max(max_fd,std::max(tcp_fd, udp_fd));
-		#endif
-		}
-		
-		#ifdef FEDERATION_USES_MULTICAST
-		// if multicast link is initialized (during join federation).
-		if (_est_init_mc) {
-			FD_SET(_socket_mc, &fdset);
-		#ifndef _WIN32
-			max_fd = std::max(max_fd, _socket_mc);
-		#endif
-		}
-		#endif
-		
+    }
+    else {
         // waitingList is empty and no data in TCP buffer.
         // Wait a message (coming from federate or network).
-        
-#ifdef RTIA_USE_THREAD
-		timeval point, zero = {0,0}, max_timeout;
-		max_timeout.tv_sec = std::numeric_limits<time_t>::max();
-		max_timeout.tv_usec = std::numeric_limits<suseconds_t>::max();
-		if ( !timeout ) {
-			timeout = &max_timeout;
-		} else {
-			gettimeofday( &point, NULL );
-			if ( max_timeout.tv_sec - point.tv_sec <= timeout->tv_sec ) {
-				*timeout = max_timeout;
-			} else {
-				timeout->tv_sec += point.tv_sec;
-				if ( 1000000 - timeout->tv_usec < point.tv_usec ) {
-					timeout->tv_usec = 2000000 - timeout->tv_usec - point.tv_usec;
-					timeout->tv_sec += 1;
-				} else timeout->tv_usec += point.tv_usec;
-			}
-		}
-		// TODO: check if the polling selection works properly on windows.
-		do { int ret_val = select( max_fd+1, &fdset, NULL, NULL, &zero );
-#else // RTIA_USE_THREAD
-			int ret_val = select( max_fd+1, &fdset, NULL, NULL, timeout );
-#endif // RTIA_USE_THREAD
-			// select() return the number of ready descriptors which may be zero if the timeout expires before
-			// anything interesting happens. On error, -1 is returned, and errno is set appropriately.
-			if ( ret_val < 0 ) {
-				// WARNING: the purpose of the separated error handling is not clear
-			#ifdef _WIN32
-				if (WSAGetLastError() == WSAEINTR) {
-			#else
-				if (errno == EINTR) {
-			#endif
-					throw NetworkSignal("EINTR on select"); 
-				} else {
-					throw NetworkError("Unexpected errno on select");
+#ifdef _WIN32
+        if (select(max_fd, &fdset, NULL, NULL, timeout) < 0) {
+            if (WSAGetLastError() == WSAEINTR)
+#else
+        if (select(max_fd+1, &fdset, NULL, NULL, timeout) < 0) {
+            if (errno == EINTR)
+#endif 
+            {
+                throw NetworkSignal("EINTR on select");
+                }
+				else {
+                 throw NetworkError("Unexpected errno on select");
 				}
-			}
-#ifdef RTIA_USE_THREAD
-			gettimeofday( &point, NULL );
-			if ( ret_val > 0 || msg && !bufSetRef->fed2amb.empty() ) break;
-			FD_ZERO(&fdset);
-			if (msg_reseau) {
-				FD_SET(tcp_fd, &fdset);
-				FD_SET(udp_fd, &fdset);
-			}
-			#ifdef FEDERATION_USES_MULTICAST
-			if (_est_init_mc) {
-				FD_SET(_socket_mc, &fdset);
-			}
-			#endif
-		} while ( point.tv_sec < timeout->tv_sec ||
-			point.tv_sec == timeout->tv_sec && point.tv_usec < timeout->tv_usec
-		);
-		// WARNING: Windows does not modify timeout parameter
-		if ( timeout != &max_timeout ) {
-			timeout->tv_sec -= point.tv_sec;
-			timeout->tv_usec -= point.tv_usec;
-		} else timeout = NULL;
-#endif // RTIA_USE_THREAD
+        }
 
         // At least one message has been received, read this message.
 
@@ -355,18 +289,14 @@
             // Read a message coming from the UDP link with RTIG.
         	(*msg_reseau) = NM_Factory::receive(socketUDP);
             n = 1 ;
-#ifndef RTIA_USE_THREAD
-        } else if (FD_ISSET(socketUN->returnSocket(), &fdset)) {
+        }
+        else if (FD_ISSET(socketUN->returnSocket(), &fdset)) {
             // Read a message coming from the federate.
 			*msg = M_Factory::receive(socketUN);
             n = 2 ;
-#else
-		} else if ( msg && !bufSetRef->fed2amb.empty() ) {
-			// Federate buffer stores message
-			*msg = bufSetRef->fed2amb.pull();
-			n = 2;
-#endif
-        } else {
+        }
+        else
+        {
             // select() timeout occured
             n = 3;
         }
@@ -415,22 +345,14 @@
 void
 Communications::sendUN(Message *Msg)
 {
-#ifdef RTIA_USE_THREAD
-	bufSetRef->amb2fed.push( Msg );
-#else // RTIA_USE_THREAD
     Msg->send(socketUN, msgBufSend);
-#endif // RTIA_USE_THREAD
 }
 
 // ----------------------------------------------------------------------------
 Message*
 Communications::receiveUN()
 {
-#ifdef RTIA_USE_THREAD
-	Message* msg = bufSetRef->fed2amb.pull();
-#else // RTIA_USE_THREAD
 	Message* msg = M_Factory::receive(socketUN);
-#endif // RTIA_USE_THREAD
 	return msg;
 }
 
diff -U 3 -H -d -r -N -x '*.kdev' -x '.svn*' -x 'CVS*' -- patched/RTIA/Communications.hh origin/RTIA/Communications.hh
--- patched/RTIA/Communications.hh	2012-01-19 14:40:53.000000000 +0400
+++ origin/RTIA/Communications.hh	2010-02-27 19:53:36.000000000 +0300
@@ -24,7 +24,6 @@
 #ifndef _CERTI_COMMUNICATIONS_HH
 #define _CERTI_COMMUNICATIONS_HH
 
-#include "config.h"
 #include "certi.hh"
 #include "NetworkMessage.hh"
 #include "Message.hh"
@@ -35,10 +34,6 @@
 #include "SocketMC.hh"
 #endif
 
-#ifdef RTIA_USE_THREAD
-#include "../libRTIA/librtia_buf.hpp"
-#endif
-
 #include <list>
 
 namespace certi {
@@ -52,11 +47,7 @@
 class Communications
 {
 public:
-#ifdef RTIA_USE_THREAD
-    Communications( LibRTIABufSet *bufSet );
-#else // RTIA_USE_THREAD
-	Communications( int RTIA_port, int RTIA_fd );
-#endif // RTIA_USE_THREAD
+    Communications(int RTIA_port, int RTIA_fd);
     ~Communications();
 
     /**
@@ -107,11 +98,7 @@
     MessageBuffer NM_msgBufSend;
     MessageBuffer msgBufSend;
 
-#ifdef RTIA_USE_THREAD
-	LibRTIABufSet *bufSetRef;
-#else // RTIA_USE_THREAD
     SocketUN *socketUN;
-#endif // RTIA_USE_THREAD
 #ifdef FEDERATION_USES_MULTICAST
     SocketMC *socketMC;
 #endif
diff -U 3 -H -d -r -N -x '*.kdev' -x '.svn*' -x 'CVS*' -- patched/RTIA/DeclarationManagement.cc origin/RTIA/DeclarationManagement.cc
--- patched/RTIA/DeclarationManagement.cc	2012-01-16 10:10:49.000000000 +0400
+++ origin/RTIA/DeclarationManagement.cc	2011-09-03 01:42:24.000000000 +0400
@@ -371,11 +371,11 @@
 {
     G.Out(pdGendoc,"enter DeclarationManagement::startRegistrationForObjectClass");
 
-    DEFINE_REQ( M_Start_Registration_For_Object_Class );
+    M_Start_Registration_For_Object_Class req;
 
-    req->setObjectClass(the_class);
+    req.setObjectClass(the_class);
 
-    comm->requestFederateService(req);
+    comm->requestFederateService(&req);
 
     G.Out(pdGendoc,"exit  DeclarationManagement::startRegistrationForObjectClass");
 }
diff -U 3 -H -d -r -N -x '*.kdev' -x '.svn*' -x 'CVS*' -- patched/RTIA/FederationManagement.cc origin/RTIA/FederationManagement.cc
--- patched/RTIA/FederationManagement.cc	2012-01-16 10:04:06.000000000 +0400
+++ origin/RTIA/FederationManagement.cc	2011-09-01 17:50:55.000000000 +0400
@@ -466,15 +466,15 @@
 {
     D.Out(pdInit, "Announce Synchronization Point \"%s\"(%s).", label.c_str(), tag.c_str());
 
-    DEFINE_REQ( M_Announce_Synchronization_Point );
+    M_Announce_Synchronization_Point req;
 
-    req->setLabel(label);
-    req->setTag(tag);
+    req.setLabel(label);
+    req.setTag(tag);
 
     // adding label to list of synchronizations to be done.
     _synchronizationLabels.insert(label);
 
-    comm->requestFederateService(req);
+    comm->requestFederateService(&req);
 }
 
 // ----------------------------------------------------------------------------
@@ -483,11 +483,13 @@
 {
     D.Out(pdInit, "Synchronization Point Registration Failed \"%s\".",
           label.c_str());
-	G.Out(pdGendoc,"enter FederationManagement::synchronizationPointRegistrationFailed");
 
-	DEFINE_REQ( M_Synchronization_Point_Registration_Failed );
-    req->setLabel(label);
-    comm->requestFederateService(req);
+    M_Synchronization_Point_Registration_Failed req;
+
+    G.Out(pdGendoc,"enter FederationManagement::synchronizationPointRegistrationFailed");
+    req.setLabel(label);
+
+    comm->requestFederateService(&req);
 
     G.Out(pdGendoc,"exit  FederationManagement::synchronizationPointRegistrationFailed");
 
@@ -499,11 +501,13 @@
 {
     D.Out(pdInit, "Synchronization Point Registration Succeeded \"%s\".",
           label.c_str());
-	G.Out(pdGendoc,"enter FederationManagement::synchronizationPointRegistrationSucceeded");
 
-    DEFINE_REQ( M_Synchronization_Point_Registration_Succeeded );
-    req->setLabel(label);
-    comm->requestFederateService(req);
+    M_Synchronization_Point_Registration_Succeeded req;
+
+    G.Out(pdGendoc,"enter FederationManagement::synchronizationPointRegistrationSucceeded");
+    req.setLabel(label);
+
+    comm->requestFederateService(&req);
 
     G.Out(pdGendoc,"exit  FederationManagement::synchronizationPointRegistrationSucceeded");
 
@@ -515,9 +519,10 @@
 {
     D.Out(pdInit, "Federation Synchronized \"%s\".", label.c_str());
 
-    DEFINE_REQ( M_Federation_Synchronized );
-    req->setLabel(label);
-    comm->requestFederateService(req);
+    M_Federation_Synchronized req;
+
+    req.setLabel(label);
+    comm->requestFederateService(&req);
 }
 
 // ----------------------------------------------------------------------------
@@ -631,9 +636,11 @@
 
     savingState = true ;
 
-    DEFINE_REQ( M_Initiate_Federate_Save );
-    req->setLabel(label);
-    comm->requestFederateService(req);
+    M_Initiate_Federate_Save req;
+
+    req.setLabel(label);
+
+    comm->requestFederateService(&req);
 
     G.Out(pdGendoc,"exit  FederationManagement::initiateFederateSave");
 }
@@ -647,11 +654,11 @@
 
     savingState = false ;
     if (status) {
-        DEFINE_REQ( M_Federation_Saved );
-    	comm->requestFederateService(req);
+        M_Federation_Saved     req;
+    	comm->requestFederateService(&req);
     } else {
-        DEFINE_REQ( M_Federation_Not_Saved );
-    	comm->requestFederateService(req);
+        M_Federation_Not_Saved req;
+    	comm->requestFederateService(&req);
     }
     G.Out(pdGendoc,"exit  FederationManagement::federationSavedStatus");
 }
@@ -704,18 +711,20 @@
     D.Out(pdInit, "Federation restore request %saccepted",
           status ? "" : "not ");
 
+    Message* req;
+
     if (status) {
-    	DEFINE_REQ( M_Request_Federation_Restore_Succeeded );
-		req->setLabel(label);
-		comm->requestFederateService(req);
+    	req = new M_Request_Federation_Restore_Succeeded();
     }
     else {
-		DEFINE_REQ( M_Request_Federation_Restore_Failed );
-        req->setReason(reason);
-		req->setLabel(label);
-		comm->requestFederateService(req);
+    	M_Request_Federation_Restore_Failed* RFRF;
+    	RFRF = new M_Request_Federation_Restore_Failed();
+        RFRF->setReason(reason);
+        req = RFRF;
     }
-
+    req->setLabel(label);
+    comm->requestFederateService(req);
+    delete req;
     G.Out(pdGendoc,"exit  FederationManagement::requestFederationRestoreStatus");
 }
 
@@ -726,8 +735,8 @@
     G.Out(pdGendoc,"enter FederationManagement::federationRestoreBegun");
     D.Out(pdInit, "Federation restore begun");
 
-    DEFINE_REQ( M_Federation_Restore_Begun );
-    comm->requestFederateService(req);
+    M_Federation_Restore_Begun req;
+    comm->requestFederateService(&req);
     G.Out(pdGendoc,"exit  FederationManagement::federationRestoreBegun");
 }
 
@@ -742,12 +751,12 @@
 
     restoringState = true ;
 
-    DEFINE_REQ( M_Initiate_Federate_Restore );
+    M_Initiate_Federate_Restore req;
 
-    req->setFederate(handle);
-    req->setLabel(label);
+    req.setFederate(handle);
+    req.setLabel(label);
 
-    comm->requestFederateService(req);
+    comm->requestFederateService(&req);
     G.Out(pdGendoc,"exit  FederationManagement::initiateFederateRestore");
 }
 
@@ -758,13 +767,17 @@
 
     restoringState = false ;
 
+    Message* req;
+
     if (status) {
-		DEFINE_REQ( M_Federation_Restored );
-		comm->requestFederateService(req);
-	} else {
-		DEFINE_REQ( M_Federation_Not_Restored );
-		comm->requestFederateService(req);
+    	req = new M_Federation_Restored();
     }
+    else {
+    	req = new M_Federation_Not_Restored();
+    }
+
+    comm->requestFederateService(req);
+    delete req;
 }
 
 // ----------------------------------------------------------------------------
diff -U 3 -H -d -r -N -x '*.kdev' -x '.svn*' -x 'CVS*' -- patched/RTIA/ObjectManagement.cc origin/RTIA/ObjectManagement.cc
--- patched/RTIA/ObjectManagement.cc	2012-01-16 10:22:36.000000000 +0400
+++ origin/RTIA/ObjectManagement.cc	2011-10-03 13:17:52.000000000 +0400
@@ -238,17 +238,17 @@
 		EventRetractionHandle the_event,
 		TypeException &)
 {
-	DEFINE_REQ( M_Discover_Object_Instance );
+	M_Discover_Object_Instance req;
 	EventRetraction  event;
 
-	req->setObject(the_object);
-	req->setObjectClass(the_class);
-	req->setDate(the_time);
+	req.setObject(the_object);
+	req.setObjectClass(the_class);
+	req.setDate(the_time);
 	event.setSN(the_event);
-	req->setEventRetraction(event);
-	req->setObjectName(the_name);
+	req.setEventRetraction(event);
+	req.setObjectName(the_name);
 
-	comm->requestFederateService(req);
+	comm->requestFederateService(&req);
 
 	/* The registration of the discovered object in RootObject
 	 * MUST have been done just before putting DO message in FIFO.
@@ -268,24 +268,24 @@
 		EventRetractionHandle the_event,
 		TypeException &)
 {
-	DEFINE_REQ( M_Reflect_Attribute_Values );
+	M_Reflect_Attribute_Values req;
 	EventRetraction event;
 
 	G.Out(pdGendoc,"enter ObjectManagement::reflectAttributeValues with time");
-	req->setObject(the_object);
-	req->setDate(the_time);
+	req.setObject(the_object);
+	req.setDate(the_time);
 	event.setSN(the_event);
-	req->setEventRetraction(event);
-	req->setTag(the_tag);
+	req.setEventRetraction(event);
+	req.setTag(the_tag);
 
-	req->setValuesSize(the_size);
-	req->setAttributesSize(the_size);
+	req.setValuesSize(the_size);
+	req.setAttributesSize(the_size);
 	for (int i=0; i<the_size;++i) {
-		req->setValues(the_values[i],i);
-		req->setAttributes(the_attributes[i],i);
+		req.setValues(the_values[i],i);
+		req.setAttributes(the_attributes[i],i);
 	}
 
-	comm->requestFederateService(req);
+	comm->requestFederateService(&req);
 	G.Out(pdGendoc,"exit  ObjectManagement::reflectAttributeValues with time");
 }
 
@@ -299,21 +299,21 @@
 		const std::string& the_tag,
 		TypeException &)
 {
-	DEFINE_REQ( M_Reflect_Attribute_Values );
+	M_Reflect_Attribute_Values req;
 
 	G.Out(pdGendoc,"enter ObjectManagement::reflectAttributeValues without time");
-	req->setObject(the_object);
-	req->setTag(the_tag);
+	req.setObject(the_object);
+	req.setTag(the_tag);
 
-	req->setValuesSize(the_size);
-	req->setAttributesSize(the_size);
+	req.setValuesSize(the_size);
+	req.setAttributesSize(the_size);
 	for (int i=0; i<the_size;++i) {
-		req->setValues(the_values[i],i);
-		req->setAttributes(the_attributes[i],i);
+		req.setValues(the_values[i],i);
+		req.setAttributes(the_attributes[i],i);
 	}
 
 
-	comm->requestFederateService(req);
+	comm->requestFederateService(&req);
 	G.Out(pdGendoc,"exit  ObjectManagement::reflectAttributeValues without time");
 }
 
@@ -428,21 +428,21 @@
 		EventRetractionHandle the_event,
 		TypeException &)
 {
-	DEFINE_REQ( M_Receive_Interaction );
+	M_Receive_Interaction req;
 	EventRetraction  event;
 
-	req->setInteractionClass(the_interaction);
-	req->setDate(the_time);
+	req.setInteractionClass(the_interaction);
+	req.setDate(the_time);
 	event.setSN(the_event);
-	req->setEventRetraction(event);
-	req->setTag(the_tag);
-	req->setParametersSize(the_size);
-	req->setValuesSize(the_size);
+	req.setEventRetraction(event);
+	req.setTag(the_tag);
+	req.setParametersSize(the_size);
+	req.setValuesSize(the_size);
 	for (uint32_t i=0;i<the_size;++i) {
-		req->setParameters(the_parameters[i],i);
-		req->setValues(the_values[i],i);
+		req.setParameters(the_parameters[i],i);
+		req.setValues(the_values[i],i);
 	}
-	comm->requestFederateService(req);
+	comm->requestFederateService(&req);
 }
 
 // ----------------------------------------------------------------------------
@@ -455,17 +455,17 @@
 		const std::string& the_tag,
 		TypeException &)
 {
-	DEFINE_REQ( M_Receive_Interaction );
+	M_Receive_Interaction req;
 
-	req->setInteractionClass(the_interaction);
-	req->setTag(the_tag);
-	req->setParametersSize(the_size);
-	req->setValuesSize(the_size);
+	req.setInteractionClass(the_interaction);
+	req.setTag(the_tag);
+	req.setParametersSize(the_size);
+	req.setValuesSize(the_size);
 	for (uint32_t i=0;i<the_size;++i) {
-		req->setParameters(the_parameters[i],i);
-		req->setValues(the_values[i],i);
+		req.setParameters(the_parameters[i],i);
+		req.setValues(the_values[i],i);
 	}
-	comm->requestFederateService(req);
+	comm->requestFederateService(&req);
 }
 
 // ----------------------------------------------------------------------------
@@ -548,16 +548,16 @@
 		TypeException &)
 
 {
-	DEFINE_REQ( M_Remove_Object_Instance );
+	M_Remove_Object_Instance req;
 	EventRetraction    event;
 
-	req->setObject(the_object);
+	req.setObject(the_object);
 	event.setSN(the_event);
-	req->setEventRetraction(event);
-	req->setTag(the_tag);
-	req->setDate(theTime);
+	req.setEventRetraction(event);
+	req.setTag(the_tag);
+	req.setDate(theTime);
 
-	comm->requestFederateService(req);
+	comm->requestFederateService(&req);
 
 	rootObject->deleteObjectInstance(the_federate, the_object, theTime, the_tag);
 }
@@ -570,12 +570,12 @@
 		const std::string& the_tag,
 		TypeException &)
 {
-	DEFINE_REQ( M_Remove_Object_Instance );
+	M_Remove_Object_Instance req;
 
-	req->setObject(the_object);
-	req->setTag(the_tag);
+	req.setObject(the_object);
+	req.setTag(the_tag);
 
-	comm->requestFederateService(req);
+	comm->requestFederateService(&req);
 
 	rootObject->deleteObjectInstance(the_federate, the_object, the_tag);
 }
@@ -755,16 +755,16 @@
 		uint32_t attribArraySize,
 		TypeException &)
 {
-	DEFINE_REQ( M_Provide_Attribute_Value_Update );
+	M_Provide_Attribute_Value_Update req;
 
 	G.Out(pdGendoc,"enter ObjectManagement::provideAttributeValueUpdate");
-	req->setObject(the_object);
-	req->setAttributesSize(attribArraySize);
+	req.setObject(the_object);
+	req.setAttributesSize(attribArraySize);
 	for (uint32_t i = 0 ; i < attribArraySize ; ++i) {
-		req->setAttributes(the_attributes[i],i);
+		req.setAttributes(the_attributes[i],i);
 	}
 
-	comm->requestFederateService(req);
+	comm->requestFederateService(&req);
 	G.Out(pdGendoc,"exit  ObjectManagement::provideAttributeValueUpdate");
 }
 
@@ -795,17 +795,18 @@
 ObjectClassHandle
 ObjectManagement::getObjectClassHandle(const std::string& theName)
 {
-	ObjectClassHandle handle ;
-	G.Out(pdGendoc,"enter ObjectManagement::getObjectClassHandle");
-	try {
-		handle = rootObject->ObjectClasses->getObjectClassHandle(theName);
-		G.Out(pdGendoc,"exit  ObjectManagement::getObjectClassHandle");
-		return handle;
-	}
-	catch (NameNotFound) {
-		G.Out(pdGendoc,"exit  ObjectManagement::getObjectClassHandle on NameNotFound");
-		throw NameNotFound(theName);
-	}
+    ObjectClassHandle handle ;
+    G.Out(pdGendoc,"enter ObjectManagement::getObjectClassHandle");
+    try {
+        handle = rootObject->ObjectClasses->getObjectClassHandle(theName);
+        G.Out(pdGendoc,"exit  ObjectManagement::getObjectClassHandle");
+
+    }
+    catch (NameNotFound&) {
+        G.Out(pdGendoc,"exit  ObjectManagement::getObjectClassHandle on NameNotFound");
+        throw NameNotFound(theName);
+    }
+    return handle;
 }
 
 
@@ -996,17 +997,17 @@
 		const uint16_t attribArraySize,
 		TypeException &e) {
 
-	DEFINE_REQ( M_Attributes_In_Scope );
+	M_Attributes_In_Scope req;
 
 	G.Out(pdGendoc,"enter ObjectManagement::attributesInScope");
 
-	req->setObject(theObject);
-	req->setAttributesSize(attribArraySize);
+	req.setObject(theObject);
+	req.setAttributesSize(attribArraySize);
 
 	for (int i = 0 ; i < attribArraySize ; i++)
-		req->setAttributes(attribArray[i],i);
+		req.setAttributes(attribArray[i],i);
 
-	comm->requestFederateService(req);
+	comm->requestFederateService(&req);
 
 	G.Out(pdGendoc,"exit  ObjectManagement::attributesInScope");
 }
@@ -1022,17 +1023,17 @@
 		const uint16_t attribArraySize,
 		TypeException &e) {
 
-	DEFINE_REQ( M_Attributes_Out_Of_Scope );
+	M_Attributes_Out_Of_Scope req;
 
 	G.Out(pdGendoc,"enter ObjectManagement::attributesOutScope");
 
-	req->setObject(theObject);
-	req->setAttributesSize(attribArraySize);
+	req.setObject(theObject);
+	req.setAttributesSize(attribArraySize);
 
 	for (int i = 0 ; i < attribArraySize ; i++)
-		req->setAttributes(attribArray[i],i);
+		req.setAttributes(attribArray[i],i);
 
-	comm->requestFederateService(req);
+	comm->requestFederateService(&req);
 
 	G.Out(pdGendoc,"exit  ObjectManagement::attributesOutScope");
 }
@@ -1072,17 +1073,17 @@
 		const uint16_t attribArraySize,
 		TypeException &e) {
 
-	DEFINE_REQ( M_Turn_Updates_On_For_Object_Instance );
+	M_Turn_Updates_On_For_Object_Instance req;
 
 	G.Out(pdGendoc,"enter ObjectManagement::turnUpdatesOnForObjectInstance");
 
-	req->setObject(theObject);
-	req->setAttributesSize(attribArraySize);
+	req.setObject(theObject);
+	req.setAttributesSize(attribArraySize);
 
 	for (int i = 0 ; i < attribArraySize ; i++)
-		req->setAttributes(attribArray[i],i);
+		req.setAttributes(attribArray[i],i);
 
-	comm->requestFederateService(req);
+	comm->requestFederateService(&req);
 
 	G.Out(pdGendoc,"exit  ObjectManagement::turnUpdatesOnForObjectInstance");
 }
@@ -1098,17 +1099,17 @@
 		const uint16_t attribArraySize,
 		TypeException &e) {
 
-	DEFINE_REQ( M_Turn_Updates_Off_For_Object_Instance );
+	M_Turn_Updates_Off_For_Object_Instance req;
 
 	G.Out(pdGendoc,"enter ObjectManagement::turnUpdatesOffForObjectInstance");
 
-	req->setObject(theObject);
-	req->setAttributesSize(attribArraySize);
+	req.setObject(theObject);
+	req.setAttributesSize(attribArraySize);
 
 	for (int i = 0 ; i < attribArraySize ; i++)
-		req->setAttributes(attribArray[i],i);
+		req.setAttributes(attribArray[i],i);
 
-	comm->requestFederateService(req);
+	comm->requestFederateService(&req);
 
 	G.Out(pdGendoc,"exit  ObjectManagement::turnUpdatesOffForObjectInstance");
 }
@@ -1117,21 +1118,21 @@
 void 
 ObjectManagement::nameReservationSucceeded(const std::string &reservedName)
 {
-	DEFINE_REQ( M_Reserve_Object_Instance_Name_Succeeded );
+	M_Reserve_Object_Instance_Name_Succeeded req;
 
-	req->setObjectName(reservedName);
+	req.setObjectName(reservedName);
 
-	comm->requestFederateService(req);
+	comm->requestFederateService(&req);
 }
 
 void 
 ObjectManagement::nameReservationFailed(const std::string &reservedName)
 {
-	DEFINE_REQ( M_Reserve_Object_Instance_Name_Failed );
+	M_Reserve_Object_Instance_Name_Failed req;
 
-	req->setObjectName(reservedName);
+	req.setObjectName(reservedName);
 
-	comm->requestFederateService(req);
+	comm->requestFederateService(&req);
 }
 
 
diff -U 3 -H -d -r -N -x '*.kdev' -x '.svn*' -x 'CVS*' -- patched/RTIA/OwnershipManagement.cc origin/RTIA/OwnershipManagement.cc
--- patched/RTIA/OwnershipManagement.cc	2012-01-16 10:12:27.000000000 +0400
+++ origin/RTIA/OwnershipManagement.cc	2010-03-23 16:13:27.000000000 +0300
@@ -350,13 +350,13 @@
                                               FederateHandle the_owner,
                                               TypeException &)
 {
-    DEFINE_REQ( M_Inform_Attribute_Ownership );
+    M_Inform_Attribute_Ownership req;
 
-    req->setObject(the_object);
-    req->setAttribute(the_attribute);
-    req->setFederate(the_owner);
+    req.setObject(the_object);
+    req.setAttribute(the_attribute);
+    req.setFederate(the_owner);
 
-    comm->requestFederateService(req);
+    comm->requestFederateService(&req);
 }
 
 // ----------------------------------------------------------------------------
@@ -367,13 +367,13 @@
                                          FederateHandle,
                                          TypeException &)
 {
-    DEFINE_REQ( M_Attribute_Is_Not_Owned );
+    M_Attribute_Is_Not_Owned req;
 
-    req->setObject(the_object);
-    req->setAttribute(the_attribute);
+    req.setObject(the_object);
+    req.setAttribute(the_attribute);
     // req.setFederate(the_owner);
 
-    comm->requestFederateService(req);
+    comm->requestFederateService(&req);
 }
 
 // ----------------------------------------------------------------------------
@@ -386,15 +386,15 @@
                               FederateHandle,
                               TypeException &)
 {
-    DEFINE_REQ( M_Attribute_Ownership_Unavailable );
+    M_Attribute_Ownership_Unavailable req;
 
-    req->setObject(the_object);
-    req->setAttributesSize(the_size);
+    req.setObject(the_object);
+    req.setAttributesSize(the_size);
     for (uint32_t i=0;i<the_size;++i) {
-        req->setAttributes(the_attributes[i], i);
+        req.setAttributes(the_attributes[i], i);
     }
 
-    comm->requestFederateService(req);
+    comm->requestFederateService(&req);
 }
 
 // ----------------------------------------------------------------------------
@@ -407,15 +407,15 @@
                                           FederateHandle,
                                           TypeException &)
 {
-    DEFINE_REQ( M_Attribute_Ownership_Acquisition_Notification );
+    M_Attribute_Ownership_Acquisition_Notification req;
 
-    req->setObject(the_object);
-    req->setAttributesSize(the_size);
+    req.setObject(the_object);
+    req.setAttributesSize(the_size);
     for (uint32_t i=0;i<the_size;++i) {
-    	req->setAttributes(the_attributes[i], i);
+    	req.setAttributes(the_attributes[i], i);
     }
 
-    comm->requestFederateService(req);
+    comm->requestFederateService(&req);
 }
 
 // ----------------------------------------------------------------------------
@@ -429,15 +429,15 @@
                                     const std::string& the_tag,
                                     TypeException &)
 {
-    DEFINE_REQ( M_Request_Attribute_Ownership_Assumption );
+    M_Request_Attribute_Ownership_Assumption req;
 
-    req->setObject(the_object);
-    req->setTag(the_tag);
-    req->setAttributesSize(the_size);
+    req.setObject(the_object);
+    req.setTag(the_tag);
+    req.setAttributesSize(the_size);
     for (uint32_t i=0;i<the_size;++i) {
-    	req->setAttributes(the_attributes[i], i);
+    	req.setAttributes(the_attributes[i], i);
     }
-    comm->requestFederateService(req);
+    comm->requestFederateService(&req);
 }
 
 // ----------------------------------------------------------------------------
@@ -450,15 +450,15 @@
                                  const std::string& the_tag,
                                  TypeException &)
 {
-    DEFINE_REQ( M_Request_Attribute_Ownership_Release );
+    M_Request_Attribute_Ownership_Release req;
 
-    req->setObject(the_object);
-    req->setTag(the_tag);
-    req->setAttributesSize(the_size);
+    req.setObject(the_object);
+    req.setTag(the_tag);
+    req.setAttributesSize(the_size);
     for (uint32_t i=0;i<the_size;++i) {
-    	req->setAttributes(the_attributes[i], i);
+    	req.setAttributes(the_attributes[i], i);
     }
-    comm->requestFederateService(req);
+    comm->requestFederateService(&req);
 }
 
 // ----------------------------------------------------------------------------
@@ -470,14 +470,14 @@
                                           uint32_t the_size,
                                           TypeException &)
 {
-    DEFINE_REQ( M_Attribute_Ownership_Divestiture_Notification );
+    M_Attribute_Ownership_Divestiture_Notification req;
 
-    req->setObject(the_object);
-    req->setAttributesSize(the_size);
+    req.setObject(the_object);
+    req.setAttributesSize(the_size);
     for (uint32_t i=0;i<the_size;++i) {
-    	req->setAttributes(the_attributes[i], i);
+    	req.setAttributes(the_attributes[i], i);
     }
-    comm->requestFederateService(req);
+    comm->requestFederateService(&req);
 }
 
 // ----------------------------------------------------------------------------
@@ -489,14 +489,14 @@
                                                  uint32_t the_size,
                                                  TypeException &)
 {
-	DEFINE_REQ( M_Confirm_Attribute_Ownership_Acquisition_Cancellation );
+    M_Confirm_Attribute_Ownership_Acquisition_Cancellation req;
 
-    req->setObject(the_object);
-    req->setAttributesSize(the_size);
+    req.setObject(the_object);
+    req.setAttributesSize(the_size);
     for (uint32_t i=0;i<the_size;++i) {
-    	req->setAttributes(the_attributes[i], i);
+    	req.setAttributes(the_attributes[i], i);
     }
-    comm->requestFederateService(req);
+    comm->requestFederateService(&req);
 }
 
 }} // namespace certi/rtia
diff -U 3 -H -d -r -N -x '*.kdev' -x '.svn*' -x 'CVS*' -- patched/RTIA/RTIA.cc origin/RTIA/RTIA.cc
--- patched/RTIA/RTIA.cc	2012-01-19 14:36:23.000000000 +0400
+++ origin/RTIA/RTIA.cc	2011-07-11 15:17:24.000000000 +0400
@@ -32,32 +32,15 @@
 
 static PrettyDebug D("RTIA", "(RTIA) ");
 
-#ifdef RTIA_USE_THREAD
-void RTIA::launchRTIAthread( LibRTIABufSet *bufSet ) {
-	init( bufSet );
-	try { m_thread = boost::thread( boost::bind(&RTIA::execute, this) ); }
-	catch ( boost::thread_resource_error &e ) {
-		std::cout << "cannot create RTIA thread: " << e.what() << std::endl;
-	}
-}
-#else // RTIA_USE_THREAD
 RTIA::RTIA(int RTIA_port, int RTIA_fd) {
-	init( RTIA_port, RTIA_fd );
-}
-#endif // RTIA_USE_THREAD
 
-#ifdef RTIA_USE_THREAD
-void RTIA::init( LibRTIABufSet *bufSet ) {
-	comm   = new Communications(bufSet);
-#else // RTIA_USE_THREAD
-void RTIA::init( int RTIA_port, int RTIA_fd ) {
-	comm   = new Communications(RTIA_port, RTIA_fd);
-#endif // RTIA_USE_THREAD
     clock = libhla::clock::Clock::getBestClock();
 
     // No SocketServer is passed to the RootObject (RTIA use case)
 	// socket server are passed to RootObject iff we are in RTIG.
     rootObject = new RootObject(NULL);
+
+    comm   = new Communications(RTIA_port, RTIA_fd);
     queues = new Queues ;
     fm     = new FederationManagement(comm,&stat);
     om     = new ObjectManagement(comm, fm, rootObject);
diff -U 3 -H -d -r -N -x '*.kdev' -x '.svn*' -x 'CVS*' -- patched/RTIA/RTIA.hh origin/RTIA/RTIA.hh
--- patched/RTIA/RTIA.hh	2012-01-19 14:35:41.000000000 +0400
+++ origin/RTIA/RTIA.hh	2010-03-21 20:10:11.000000000 +0300
@@ -25,7 +25,6 @@
 #define _CERTI_RTIA_HH
 
 // Project
-#include "config.h"
 #include "Communications.hh"
 #include "TimeManagement.hh"
 #include "FederationManagement.hh"
@@ -36,12 +35,8 @@
 #include "Statistics.hh"
 #include "Clock.hh"
 
-#ifdef RTIA_USE_THREAD
-#include <boost/thread.hpp>
-#endif
-
 namespace certi {
-	
+
 namespace rtia {
 
 /**
@@ -57,17 +52,12 @@
 class RTIA
 {
 public:
-#ifdef RTIA_USE_THREAD
-	RTIA() {}
-	void launchRTIAthread( LibRTIABufSet* bufSet );
-#else // RTIA_USE_THREAD
 	/**
 	 * RTIA constructor.
 	 * @param[in] RTIA_port the TCP port used
 	 * @param[in] RTIA_fd the file descriptor
 	 */
     RTIA(int RTIA_port, int RTIA_fd);
-#endif // RTIA_USE_THREAD
 
     /**
      * RTIA destructor.
@@ -83,13 +73,6 @@
     void displayStatistics();
 
 private:
-#ifdef RTIA_USE_THREAD
-	void init( LibRTIABufSet *bufSet );
-	boost::thread m_thread;
-#else // RTIA_USE_THREAD
-	void init( int RTIA_port, int RTIA_fd );
-#endif // RTIA_USE_THREAD
-
     RootObject *rootObject ;
 
     FederationManagement *fm ;
diff -U 3 -H -d -r -N -x '*.kdev' -x '.svn*' -x 'CVS*' -- patched/RTIA/RTIA_federate.cc origin/RTIA/RTIA_federate.cc
--- patched/RTIA/RTIA_federate.cc	2012-01-16 13:33:01.000000000 +0400
+++ origin/RTIA/RTIA_federate.cc	2011-09-03 01:42:24.000000000 +0400
@@ -1346,16 +1346,16 @@
 			// else goto TICK_RETURN
 
 		case TimeManagement::TICK_RETURN: {
-			DEFINE_REQ( M_Tick_Request );
+			M_Tick_Request msg_ack;
 			/* send TICK_REQUEST response
 			 */
 			if ( exc != e_RTIinternalError )
-				req->setException(exc);
+				msg_ack.setException(exc);
 			// terminate __tick() call in the federate
-			req->setMultiple(tm->_tick_result);
-			req->setMinTickTime(0); // unused
-			req->setMaxTickTime(0); // unused
-			comm->requestFederateService(req);
+			msg_ack.setMultiple(tm->_tick_result);
+			msg_ack.setMinTickTime(0); // unused
+			msg_ack.setMaxTickTime(0); // unused
+			comm->requestFederateService(&msg_ack);
 
 			tm->_tick_state = TimeManagement::NO_TICK;
 		}
@@ -1403,20 +1403,20 @@
 {
 	/* use virtual constructor in order to build  *
 	 * appropriate answer message.                */
-	Message *rep = M_Factory::create(req->getMessageType());
+	std::auto_ptr<Message> rep(M_Factory::create(req->getMessageType()));
 
 	G.Out(pdGendoc,"enter RTIA::processFederateRequest");
 
 	try {
 		switch(fm->_connection_state) {
 		case FederationManagement::CONNECTION_PRELUDE:
-			initFederateProcessing(req, rep);
+			initFederateProcessing(req, rep.get());
 			break;
 
 		case FederationManagement::CONNECTION_READY:
 		{
 			TypeException exc ;
-			chooseFederateProcessing(req, rep, exc);
+			chooseFederateProcessing(req, rep.get(), exc);
 			if ( exc != e_RTIinternalError && exc != e_NO_EXCEPTION) {
 				rep->setException(exc);
 			}
@@ -1771,7 +1771,7 @@
 		rep->getMessageType() != Message::TICK_REQUEST_STOP) {
 		// generic federate service acknowledgment
 		// the TICK_REQUEST confirmation is generated in processOngoingTick()
-		comm->sendUN(rep);
+		comm->sendUN(rep.get());
 		D.Out(pdDebug, "Reply send to Unix socket.");
 	}
 	G.Out(pdGendoc,"exit  RTIA::processFederateRequest");
diff -U 3 -H -d -r -N -x '*.kdev' -x '.svn*' -x 'CVS*' -- patched/RTIA/TimeManagement.cc origin/RTIA/TimeManagement.cc
--- patched/RTIA/TimeManagement.cc	2012-01-19 11:23:16.000000000 +0400
+++ origin/RTIA/TimeManagement.cc	2011-01-11 15:29:40.000000000 +0300
@@ -777,19 +777,21 @@
 // ----------------------------------------------------------------------------
 void
 TimeManagement::timeRegulationEnabled(FederationTime theTime, TypeException &e) {
-	D.Out(pdDebug,"Sending TIME_REGULATION_ENABLED to Federate");
-	DEFINE_REQ( M_Time_Regulation_Enabled );
-    req->setDate(theTime);
-    comm->requestFederateService(req);
+    M_Time_Regulation_Enabled req;
+
+    D.Out(pdDebug,"Sending TIME_REGULATION_ENABLED to Federate");
+    req.setDate(theTime);
+    comm->requestFederateService(&req);
 }
 
 // ----------------------------------------------------------------------------
 void
 TimeManagement::timeConstrainedEnabled(FederationTime theTime, TypeException &e) {
-	D.Out(pdDebug,"Sending TIME_CONSTRAINED_ENABLED to Federate");
-	DEFINE_REQ( M_Time_Constrained_Enabled );
-    req->setDate(theTime);
-    comm->requestFederateService(req);
+    M_Time_Constrained_Enabled req;
+
+    D.Out(pdDebug,"Sending TIME_CONSTRAINED_ENABLED to Federate");
+    req.setDate(theTime);
+    comm->requestFederateService(&req);
 }
 
 // ----------------------------------------------------------------------------
@@ -946,19 +948,19 @@
 TimeManagement::timeAdvanceGrant(FederationTime logical_time,
                                  TypeException &e)
 {
-    DEFINE_REQ( M_Time_Advance_Grant );
+    M_Time_Advance_Grant req;
 
-    req->setDate(logical_time);
+    req.setDate(logical_time);
 
     D.Out(pdRegister, "timeAdvanceGrant sent to federate (time = %f).",
-          req->getDate().getTime());
+          req.getDate().getTime());
 
     if (_lookahead_courant == epsilon2)
         _lookahead_courant = 0.0 ;
 
     _tick_state = TICK_NEXT;  // indicate the callback was processed
 
-    comm->requestFederateService(req);
+    comm->requestFederateService(&req);
 
     _heure_courante = logical_time ;
     /* reset the sending of NULL PRIME message whenever we get TAG */
diff -U 3 -H -d -r -N -x '*.kdev' -x '.svn*' -x 'CVS*' -- patched/config.h.cmake origin/config.h.cmake
--- patched/config.h.cmake	2012-01-16 10:23:35.000000000 +0400
+++ origin/config.h.cmake	2011-01-09 21:01:44.000000000 +0300
@@ -115,12 +115,4 @@
 /* Define to 1 if the processor have WIN support */
 #cmakedefine HAVE_WIN_CLOCK 1
 
-/* Defines the architecture of RTIA in terms of processes and threads */
-#cmakedefine RTIA_USE_THREAD
 
-/* Macro required to avoid the heap use in multi-process mode */
-#ifndef RTIA_USE_THREAD
-#define DEFINE_REQ( MsgClass ) MsgClass local_req, *req = &local_req
-#else /* RTIA_USE_THREAD */
-#define DEFINE_REQ( MsgClass ) MsgClass *req = new MsgClass
-#endif /* RTIA_USE_THREAD */
diff -U 3 -H -d -r -N -x '*.kdev' -x '.svn*' -x 'CVS*' -- patched/libRTI/RTI1516ambPrivateRefs.cpp origin/libRTI/RTI1516ambPrivateRefs.cpp
--- patched/libRTI/RTI1516ambPrivateRefs.cpp	2012-01-19 14:46:51.000000000 +0400
+++ origin/libRTI/RTI1516ambPrivateRefs.cpp	2011-07-13 19:43:16.000000000 +0400
@@ -139,28 +139,22 @@
 
 } // End anonymous namespace
 
-#ifdef RTIA_USE_THREAD
-RTI1516ambPrivateRefs::RTI1516ambPrivateRefs( LibRTIABufSet *_bufSet ) {
-	bufSet = _bufSet;
-#else 
-RTI1516ambPrivateRefs::RTI1516ambPrivateRefs() {
+RTI1516ambPrivateRefs::RTI1516ambPrivateRefs()
+{
+	fed_amb      = NULL;
 #ifdef _WIN32
 	handle_RTIA  = (HANDLE)-1;
 #else
 	pid_RTIA     = (pid_t)-1;
 #endif
-	socketUn     = NULL;
-#endif
-	fed_amb      = NULL;
 	is_reentrant = false;
 	_theRootObj  = NULL;
+	socketUn     = NULL;
 }
 
 RTI1516ambPrivateRefs::~RTI1516ambPrivateRefs()
 {
-#ifndef RTIA_USE_THREAD
 	delete socketUn ;
-#endif
 }
 
 // ----------------------------------------------------------------------------
@@ -173,17 +167,13 @@
 }
 
 // ----------------------------------------------------------------------------
-Message* RTI1516ambPrivateRefs::executeService( Message *req, Message *rep )
+void
+RTI1516ambPrivateRefs::executeService(Message *req, Message *rep)
 {
-	G.Out(pdGendoc,"enter RTI1516ambPrivateRefs::executeService(%s)",req->getMessageName() );
+	G.Out(pdGendoc,"enter RTI1516ambPrivateRefs::executeService(%s,%s)",req->getMessageName(),rep->getMessageName());
 
 	D.Out(pdDebug, "sending request to RTIA.");
 
-	Message::Type req_type = req->getMessageType();
-#ifdef RTIA_USE_THREAD
-	bufSet->fed2amb.push( req );
-	// Cannot use req any more
-#else // RTIA_USE_THREAD
 	try {
 		req->send(socketUn,msgBufSend);
 	}
@@ -192,19 +182,16 @@
 		if ( req->getMessageType() == certi::Message::CLOSE_CONNEXION)
 		{
 			std::cerr << "libRTI: Could not execute 'Close connexion' service (Network error). Service request ignored." << std::endl;
-			return NULL;
+			return;
 		} else
 		{
 			throw rti1516::RTIinternalError(L"libRTI: Network Write Error");
 		}
 	}
-#endif // RTIA_USE_THREAD
-	
+
 	D.Out(pdDebug, "waiting RTIA reply.");
 
-#ifdef RTIA_USE_THREAD
-	rep = bufSet->amb2fed.pull();
-#else // RTIA_USE_THREAD
+	// waiting RTI reply.
 	try {
 		rep->receive(socketUn,msgBufReceive);
 	}
@@ -212,12 +199,11 @@
 		std::cerr << "libRTI: exception: NetworkError (read)" << std::endl ;
 		throw rti1516::RTIinternalError(L"libRTI: Network Read Error waiting RTI reply");
 	}
-#endif // RTIA_USE_THREAD
 
 	D.Out(pdDebug, "RTIA reply received.");
 
 
-	if (rep->getMessageType() != req_type) {
+	if (rep->getMessageType() != req->getMessageType()) {
 		std::cout << "LibRTI: Assertion failed: rep->type != req->type" << std::endl ;
 		throw rti1516::RTIinternalError(L"RTI1516ambPrivateRefs::executeService: "
 				L"rep->type != req->type");
@@ -230,8 +216,6 @@
 
 	D.Out(pdDebug, "exception processed.");
 	G.Out(pdGendoc,"exit RTI1516ambPrivateRefs::executeService");
-	
-	return rep;
 }
 
 void
@@ -239,10 +223,8 @@
 {
 	G.Out(pdGendoc,"enter RTI1516ambPrivateRefs::sendTickRequestStop");
 
-#ifdef RTIA_USE_THREAD
-	bufSet->fed2amb.push( new M_Tick_Request_Stop );
-#else // RTIA_USE_THREAD
-	M_Tick_Request_Stop req;
+	M_Tick_Request_Stop req, rep ;
+
 	try {
 		req.send(socketUn, msgBufSend);
 	}
@@ -250,12 +232,7 @@
 		std::cerr << "libRTI: exception: NetworkError (write)" << std::endl ;
 		throw rti1516::RTIinternalError(L"libRTI: Network Write Error");
 	}
-#endif // RTIA_USE_THREAD
 
-#ifdef RTIA_USE_THREAD
-	delete bufSet->amb2fed.pull();
-#else // RTIA_USE_THREAD
-	M_Tick_Request_Stop rep;
 	try {
 		rep.receive(socketUn, msgBufReceive);
 	}
@@ -263,7 +240,6 @@
 		std::cerr << "libRTI: exception: NetworkError (read)" << std::endl ;
 		throw rti1516::RTIinternalError(L"libRTI: Network Read Error waiting RTI reply");
 	}
-#endif // RTIA_USE_THREAD
 
 	// ignore the response, ignore exceptions
 	// rep->type == Message::TICK_REQUEST;
diff -U 3 -H -d -r -N -x '*.kdev' -x '.svn*' -x 'CVS*' -- patched/libRTI/RTI1516ambPrivateRefs.h origin/libRTI/RTI1516ambPrivateRefs.h
--- patched/libRTI/RTI1516ambPrivateRefs.h	2012-01-19 14:45:03.000000000 +0400
+++ origin/libRTI/RTI1516ambPrivateRefs.h	2010-04-28 22:48:30.000000000 +0400
@@ -22,47 +22,31 @@
 // $Id: RTI1516ambPrivateRefs.h,v 1.1 2010/04/28 18:48:30 erk Exp $
 // ----------------------------------------------------------------------------
 
-#include "config.h"
 #include <RTI/certiRTI1516.h>
 //#include "fedtime.hh"
 #include "Message.hh"
 #include "RootObject.hh"
 #include "MessageBuffer.hh"
 
-#ifdef RTIA_USE_THREAD
-#include "../libRTIA/librtia_buf.hpp"
-#endif
-
 using namespace certi ;
 
 class RTI1516ambPrivateRefs
 {
 public:
-	~RTI1516ambPrivateRefs();
-#ifdef RTIA_USE_THREAD
-	RTI1516ambPrivateRefs( LibRTIABufSet *bufSet );
-	LibRTIABufSet *bufSet;
-#else
 	RTI1516ambPrivateRefs();
-#endif
+    ~RTI1516ambPrivateRefs();
 
-    void processException( Message* msg );
-    Message* executeService( Message *request, Message *reply );
-	template< typename MSG >
-	MSG* executeServiceTmpl( MSG* request, MSG* reply ) {
-		return (MSG*)executeService(request, reply);
-	}
+    void processException(Message *);
+    void executeService(Message *requete, Message *reponse);
     void sendTickRequestStop();
     void callFederateAmbassador(Message *msg) throw (rti1516::RTIinternalError);
     void leave(const char *msg) throw (rti1516::RTIinternalError);
 
-#ifndef RTIA_USE_THREAD
 #ifdef _WIN32
 	  HANDLE	handle_RTIA;
 #else
     pid_t pid_RTIA ; //!< pid associated with rtia fork (private).
 #endif
-#endif // RTIA_USE_THREAD
 
     //! Federate Ambassador reference for module calls.
     rti1516::FederateAmbassador *fed_amb ;
@@ -72,10 +56,8 @@
 
     RootObject *_theRootObj ;
 
-#ifndef RTIA_USE_THREAD
     SocketUN *socketUn ;
     MessageBuffer msgBufSend,msgBufReceive ;
-#endif
 };
 
 // $Id: RTI1516ambPrivateRefs.h,v 1.1 2010/04/28 18:48:30 erk Exp $
diff -U 3 -H -d -r -N -x '*.kdev' -x '.svn*' -x 'CVS*' -- patched/libRTI/RTI1516ambassador.cpp origin/libRTI/RTI1516ambassador.cpp
--- patched/libRTI/RTI1516ambassador.cpp	2012-01-19 14:45:53.000000000 +0400
+++ origin/libRTI/RTI1516ambassador.cpp	2011-10-03 11:01:21.000000000 +0400
@@ -15,14 +15,6 @@
 
 #include <algorithm>
 
-#ifndef RTIA_USE_THREAD
-#define DEFINE_REQ_REP( MsgClass ) MsgClass local_req, *req = &local_req, local_rep, *rep = &local_rep
-#define DELETE_REP()
-#else
-#define DEFINE_REQ_REP( MsgClass ) MsgClass *req = new MsgClass, *rep = NULL
-#define DELETE_REP() delete rep
-#endif
-
 namespace {
 
 static PrettyDebug D("LIBRTI", __FILE__);
@@ -39,50 +31,53 @@
 	};
 
 	/* Helper functions */
-	template<typename MSG>
-	MSG* RTI1516ambassador::assignPHVMAndExecuteService(const rti1516::ParameterHandleValueMap &PHVM, MSG *req, MSG *rep ) {
+	template<typename T>
+	void
+	RTI1516ambassador::assignPHVMAndExecuteService(const rti1516::ParameterHandleValueMap &PHVM, T &req, T &rep) {
 
-		req->setParametersSize(PHVM.size());
-		req->setValuesSize(PHVM.size());
+		req.setParametersSize(PHVM.size());
+		req.setValuesSize(PHVM.size());
 		uint32_t i = 0;
 		for ( rti1516::ParameterHandleValueMap::const_iterator it = PHVM.begin(); it != PHVM.end(); it++, ++i)
 		{
-		    req->setParameters(ParameterHandleFriend::toCertiHandle(it->first),i);
+		    req.setParameters(ParameterHandleFriend::toCertiHandle(it->first),i);
 		    certi::ParameterValue_t paramValue;
 		    paramValue.resize(it->second.size());
 		    memcpy(&(paramValue[0]), it->second.data(), it->second.size());
-		    req->setValues(paramValue, i);
+		    req.setValues(paramValue, i);
 		}
-		return privateRefs->executeServiceTmpl(req,rep);
+		privateRefs->executeService(&req, &rep);
 	}
 
-	template<typename MSG>
-	MSG* RTI1516ambassador::assignAHVMAndExecuteService(const rti1516::AttributeHandleValueMap &AHVM, MSG *req, MSG *rep ) {
+	template<typename T>
+	void
+	RTI1516ambassador::assignAHVMAndExecuteService(const rti1516::AttributeHandleValueMap &AHVM, T &req, T &rep) {
 
-		req->setAttributesSize(AHVM.size());
-		req->setValuesSize(AHVM.size());
+		req.setAttributesSize(AHVM.size());
+		req.setValuesSize(AHVM.size());
 		uint32_t i = 0;
 		for ( rti1516::AttributeHandleValueMap::const_iterator it = AHVM.begin(); it != AHVM.end(); it++, ++i)
 		{
-			req->setAttributes(AttributeHandleFriend::toCertiHandle(it->first),i);
+			req.setAttributes(AttributeHandleFriend::toCertiHandle(it->first),i);
  			certi::AttributeValue_t attrValue;
  			attrValue.resize(it->second.size());
  			memcpy(&(attrValue[0]), it->second.data(), it->second.size());
- 			req->setValues(attrValue, i);  
+ 			req.setValues(attrValue, i);  
 		}
-		return privateRefs->executeServiceTmpl(req,rep);
+		privateRefs->executeService(&req, &rep);
 	}
 
-	template<typename MSG>
-	MSG* RTI1516ambassador::assignAHSAndExecuteService(const rti1516::AttributeHandleSet &AHS, MSG *req, MSG *rep ) {
-		req->setAttributesSize(AHS.size());
+	template<typename T>
+	void
+	RTI1516ambassador::assignAHSAndExecuteService(const rti1516::AttributeHandleSet &AHS, T &req, T &rep) {
+		req.setAttributesSize(AHS.size());
 		uint32_t i = 0;
 		for ( rti1516::AttributeHandleSet::const_iterator it = AHS.begin(); it != AHS.end(); it++, ++i)
 		{
 			certi::AttributeHandle certiHandle = AttributeHandleFriend::toCertiHandle(*it);
-			req->setAttributes(certiHandle,i);
+			req.setAttributes(certiHandle,i);
 		}
-		return privateRefs->executeServiceTmpl(req,rep);
+		privateRefs->executeService(&req, &rep);
 	}
 
 	std::string varLengthDataAsString(VariableLengthData varLengthData) {
@@ -120,11 +115,10 @@
 
 	RTI1516ambassador::~RTI1516ambassador()
 	{
-		DEFINE_REQ_REP( M_Close_Connexion );
+		certi::M_Close_Connexion req, rep ;
 
 		G.Out(pdGendoc,"        ====>executeService CLOSE_CONNEXION");
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		privateRefs->executeService(&req, &rep);
 		// after the response is received, the privateRefs->socketUn must not be used
 
 		delete privateRefs;
@@ -140,74 +134,57 @@
 	throw (rti1516::SpecifiedSaveLabelDoesNotExist,
 			rti1516::RTIinternalError)
 	{
-		M_Tick_Request *vers_RTI = new M_Tick_Request;
-		Message* vers_Fed = NULL;
+		M_Tick_Request vers_RTI;
+		std::auto_ptr<Message> vers_Fed(NULL);
 
 		// Request callback(s) from the local RTIA
-		vers_RTI->setMultiple(multiple);
-		vers_RTI->setMinTickTime(minimum);
-		vers_RTI->setMaxTickTime(maximum);
+		vers_RTI.setMultiple(multiple);
+		vers_RTI.setMinTickTime(minimum);
+		vers_RTI.setMaxTickTime(maximum);
 
-#ifdef RTIA_USE_THREAD
-		bufSet.fed2amb.push( vers_RTI );
-#else // RTIA_USE_THREAD
 		try {
-			vers_RTI->send(privateRefs->socketUn,privateRefs->msgBufSend);
+			vers_RTI.send(privateRefs->socketUn,privateRefs->msgBufSend);
 		}
 		catch (NetworkError &e) {
-			delete vers_RTI;
 			std::stringstream msg;
 			msg << "NetworkError in tick() while sending TICK_REQUEST: " << e._reason;
 			std::wstring message(msg.str().begin(), msg.str().end());
 			throw RTIinternalError(message);
 		}
-		delete vers_RTI;
-#endif // RTIA_USE_THREAD
 
 		// Read response(s) from the local RTIA until Message::TICK_REQUEST is received.
 		while (1) {
-#ifdef RTIA_USE_THREAD
-			vers_Fed = bufSet.amb2fed.pull();
-#else // RTIA_USE_THREAD
 			try {
-				vers_Fed = M_Factory::receive(privateRefs->socketUn);
+				vers_Fed.reset(M_Factory::receive(privateRefs->socketUn));
 			}
 			catch (NetworkError &e) {
-				delete vers_Fed;
 				std::stringstream msg;
 				msg << "NetworkError in tick() while receiving response: " << e._reason;
 				std::wstring message(msg.str().begin(), msg.str().end());
 				throw RTIinternalError(message);
 			}
-#endif // RTIA_USE_THREAD
 
 			// If the type is TICK_REQUEST, the __tick_kernel() has terminated.
 			if (vers_Fed->getMessageType() == Message::TICK_REQUEST) {
 				if (vers_Fed->getExceptionType() != e_NO_EXCEPTION) {
 					// tick() may only throw exceptions defined in the HLA standard
 					// the RTIA is responsible for sending 'allowed' exceptions only
-					privateRefs->processException(vers_Fed);
+					privateRefs->processException(vers_Fed.get());
 				}
-				delete vers_Fed;
-				return static_cast<M_Tick_Request*>(vers_Fed)->getMultiple();
+				return static_cast<M_Tick_Request*>(vers_Fed.get())->getMultiple();
 			}
-			
+
 			try {
 				// Otherwise, the RTI calls a FederateAmbassador service.
-				privateRefs->callFederateAmbassador(vers_Fed);
+				privateRefs->callFederateAmbassador(vers_Fed.get());
 			}
-			catch (RTIinternalError) {
-				delete vers_Fed;
+			catch (RTIinternalError&) {
 				// RTIA awaits TICK_REQUEST_NEXT, terminate the tick() processing
 				privateRefs->sendTickRequestStop();
 				// ignore the response and re-throw the original exception
 				throw;
 			}
-			delete vers_Fed;
-			
-#ifdef RTIA_USE_THREAD
-			bufSet.fed2amb.push( new M_Tick_Request_Next );
-#else
+
 			try {
 				// Request next callback from the RTIA
 				M_Tick_Request_Next tick_next;
@@ -220,7 +197,6 @@
 				std::wstring message(msg.str().begin(), msg.str().end());
 				throw RTIinternalError(message);
 			}
-#endif // RTIA_USE_THREAD
 		} // while(1)
 	}
 
@@ -236,14 +212,14 @@
 		RTIinternalError)
 	{ 
 		/* TODO */
-		DEFINE_REQ_REP( M_Create_Federation_Execution );
+		certi::M_Create_Federation_Execution req, rep ;
 
 		G.Out(pdGendoc,"enter RTI1516ambassador::createFederationExecution");
 		std::string federationExecutionNameAsString(federationExecutionName.begin(), federationExecutionName.end());
-		req->setFederationName(federationExecutionNameAsString);
+		req.setFederationName(federationExecutionNameAsString);
 		
 		std::string fullPathNameToTheFDDfileAsString(fullPathNameToTheFDDfile.begin(), fullPathNameToTheFDDfile.end());
-		req->setFEDid(fullPathNameToTheFDDfileAsString);
+		req.setFEDid(fullPathNameToTheFDDfileAsString);
 
 		/*#ifdef _WIN32
 		if(!stricmp(FED,executionName)) {
@@ -253,8 +229,7 @@
 		}*/
 		G.Out(pdGendoc,"             ====>executeService CREATE_FEDERATION_EXECUTION");
 
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		privateRefs->executeService(&req, &rep);
 
 		G.Out(pdGendoc,"exit RTI1516ambassador::createFederationExecution");
 
@@ -270,17 +245,16 @@
 		FederationExecutionDoesNotExist,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Destroy_Federation_Execution );
+		M_Destroy_Federation_Execution req, rep ;
 
 		G.Out(pdGendoc,"enter RTI1516ambassador::destroyFederationExecution");
 
 		std::string federationExecutionNameAsString(federationExecutionName.begin(), federationExecutionName.end());
-		req->setFederationName(federationExecutionNameAsString);
+		req.setFederationName(federationExecutionNameAsString);
 
 		G.Out(pdGendoc,"        ====>executeService DESTROY_FEDERATION_EXECUTION");
 
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		privateRefs->executeService(&req, &rep);
 
 		G.Out(pdGendoc,"exit RTI1516ambassador::destroyFederationExecution");
 	}
@@ -297,7 +271,7 @@
 		CouldNotCreateLogicalTimeFactory,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Join_Federation_Execution );
+		M_Join_Federation_Execution req, rep ;
 
 		G.Out(pdGendoc,"enter RTI1516ambassador::joinFederationExecution");
 
@@ -312,17 +286,16 @@
 
 		privateRefs->fed_amb = &federateAmbassador ;
 
-		req->setFederateName(federateTypeAsString);
-		req->setFederationName(federationExecutionNameAsString);
+		req.setFederateName(federateTypeAsString);
+		req.setFederationName(federationExecutionNameAsString);
 		G.Out(pdGendoc,"        ====>executeService JOIN_FEDERATION_EXECUTION");
-		rep = privateRefs->executeServiceTmpl(req,rep);
+		privateRefs->executeService(&req, &rep);
 		G.Out(pdGendoc,"exit  RTI1516ambassador::joinFederationExecution");
 		PrettyDebug::setFederateName( "LibRTI::"+std::string(federateTypeAsString));
 		
-		certi::FederateHandle certiFederateHandle = rep->getFederate();
+		certi::FederateHandle certiFederateHandle = rep.getFederate();
 		rti1516::FederateHandle rti1516FederateHandle = rti1516::FederateHandleFriend::createRTI1516Handle(certiFederateHandle);
 
-		DELETE_REP();
 		return rti1516FederateHandle;
 	}
 
@@ -334,14 +307,13 @@
 		FederateNotExecutionMember,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Resign_Federation_Execution );
+		M_Resign_Federation_Execution req, rep ;
 
 		G.Out(pdGendoc,"enter RTI1516ambassador::resignFederationExecution");
-		//req->setResignAction(static_cast<certi::ResignAction>(resignAction));
-		req->setResignAction(certi::DELETE_OBJECTS_AND_RELEASE_ATTRIBUTES);
+		//req.setResignAction(static_cast<certi::ResignAction>(resignAction));
+		req.setResignAction(certi::DELETE_OBJECTS_AND_RELEASE_ATTRIBUTES);
 		G.Out(pdGendoc,"        ====>executeService RESIGN_FEDERATION_EXECUTION");
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		privateRefs->executeService(&req, &rep);
 		G.Out(pdGendoc,"exit RTI1516ambassador::resignFederationExecution");
 	}
 
@@ -354,21 +326,20 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Register_Federation_Synchronization_Point );
+		M_Register_Federation_Synchronization_Point req, rep ;
 
 		G.Out(pdGendoc,"enter RTI1516ambassador::registerFederationSynchronizationPoint for all federates");
 		std::string labelString(label.begin(), label.end());
-		req->setLabel(labelString);
+		req.setLabel(labelString);
 		// no federate set
-		req->setFederateSetSize(0);
+		req.setFederateSetSize(0);
 		if ( &theUserSuppliedTag == NULL || theUserSuppliedTag.data() == NULL )
 		{
 			throw RTIinternalError (L"Calling registerFederationSynchronizationPoint with Tag NULL");
 		}
-		req->setTag(varLengthDataAsString(theUserSuppliedTag));
+		req.setTag(varLengthDataAsString(theUserSuppliedTag));
 		G.Out(pdGendoc,"        ====>executeService REGISTER_FEDERATION_SYNCHRONIZATION_POINT");
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		privateRefs->executeService(&req, &rep);
 
 		G.Out(pdGendoc,"exit RTI1516ambassador::registerFederationSynchronizationPoint for all federates");
 	}
@@ -382,32 +353,31 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Register_Federation_Synchronization_Point );
+		M_Register_Federation_Synchronization_Point req, rep ;
 
 		G.Out(pdGendoc,"enter RTI1516ambassador::registerFederationSynchronizationPoint for some federates");
 
 		std::string labelString(label.begin(), label.end());
-		req->setLabel(labelString);
+		req.setLabel(labelString);
 		if ( &theUserSuppliedTag == NULL || theUserSuppliedTag.data() == NULL )
 		{
 			throw RTIinternalError (L"Calling registerFederationSynchronizationPoint with Tag NULL");
 		}
-		req->setTag(varLengthDataAsString(theUserSuppliedTag));
+		req.setTag(varLengthDataAsString(theUserSuppliedTag));
 		// Federate set exists but if size=0 (set empty)
 		// We have to send the size even if federate set size is 0
 		// (HLA 1.3 compliance to inform ALL federates)
 
-		req->setFederateSetSize(syncSet.size());
+		req.setFederateSetSize(syncSet.size());
 
 		uint32_t i = 0;
 		for ( rti1516::FederateHandleSet::const_iterator it = syncSet.begin(); it != syncSet.end(); it++, ++i)
 		{
-			req->setFederateSet(FederateHandleFriend::toCertiHandle(*it),i); 
+			req.setFederateSet(FederateHandleFriend::toCertiHandle(*it),i); 
 		}
 
 		G.Out(pdGendoc,"        ====>executeService REGISTER_FEDERATION_SYNCHRONIZATION_POINT");
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		privateRefs->executeService(&req, &rep);
 
 		G.Out(pdGendoc,"exit RTI1516ambassador::registerFederationSynchronizationPoint for some federates");
 	}
@@ -421,16 +391,15 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Synchronization_Point_Achieved );
+		M_Synchronization_Point_Achieved req, rep ;
 
 		G.Out(pdGendoc,"enter RTI1516ambassador::synchronizationPointAchieved");
 
 		std::string labelString(label.begin(), label.end());
-		req->setLabel(labelString);
+		req.setLabel(labelString);
 
 		G.Out(pdGendoc,"        ====>executeService SYNCHRONIZATION_POINT_ACHIEVED");
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		privateRefs->executeService(&req, &rep);
 
 		G.Out(pdGendoc,"exit  RTI1516ambassador::synchronizationPointAchieved"); 
 	}
@@ -443,16 +412,15 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Request_Federation_Save );
+		M_Request_Federation_Save req, rep ;
 
 		G.Out(pdGendoc,"enter RTI1516ambassador::requestFederationSave without time");
 
 		std::string labelString(label.begin(), label.end());
-		req->setLabel(labelString);
+		req.setLabel(labelString);
 		G.Out(pdGendoc,"      ====>executeService REQUEST_FEDERATION_SAVE");
 
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		privateRefs->executeService(&req, &rep);
 		G.Out(pdGendoc,"exit  RTI1516ambassador::requestFederationSave without time");
 	}
 
@@ -467,19 +435,18 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Request_Federation_Save );
+		M_Request_Federation_Save req, rep ;
 
 		G.Out(pdGendoc,"enter RTI1516ambassador::requestFederationSave with time");
 
 		certi::FederationTime certiFedTime(certi_cast<RTI1516fedTime>()(theTime).getFedTime());
-		req->setDate(certiFedTime);
+		req.setDate(certiFedTime);
 
 		std::string labelString(label.begin(), label.end());
-		req->setLabel(labelString);
+		req.setLabel(labelString);
 
 		G.Out(pdGendoc,"        ====>executeService REQUEST_FEDERATION_SAVE");
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		privateRefs->executeService(&req, &rep);
 
 		G.Out(pdGendoc,"exit RTI1516ambassador::requestFederationSave with time");
 	}
@@ -491,13 +458,12 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Federate_Save_Begun );
+		M_Federate_Save_Begun req, rep ;
 
 		G.Out(pdGendoc,"enter RTI1516ambassador::federateSaveBegun");
 
 		G.Out(pdGendoc,"      ====>executeService FEDERATE_SAVE_BEGUN");
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		privateRefs->executeService(&req, &rep);
 
 		G.Out(pdGendoc,"exit  RTI1516ambassador::federateSaveBegun");
 	}
@@ -509,12 +475,11 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Federate_Save_Complete );
+		M_Federate_Save_Complete req, rep ;
 
 		G.Out(pdGendoc,"enter RTI1516ambassador::federateSaveComplete");
 		G.Out(pdGendoc,"      ====>executeService FEDERATE_SAVE_COMPLETE");
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		privateRefs->executeService(&req, &rep);
 		G.Out(pdGendoc,"exit  RTI1516ambassador::federateSaveComplete");
 	}
 
@@ -524,12 +489,11 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Federate_Save_Not_Complete );
+		M_Federate_Save_Not_Complete req, rep ;
 
 		G.Out(pdGendoc,"enter RTI1516ambassador::federateSaveNotComplete");
 		G.Out(pdGendoc,"      ====>executeService FEDERATE_SAVE_NOT_COMPLETE");
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		privateRefs->executeService(&req, &rep);
 
 		G.Out(pdGendoc,"exit  RTI1516ambassador::federateSaveNotComplete");
 	}
@@ -552,14 +516,13 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Request_Federation_Restore );
+		M_Request_Federation_Restore req, rep ;
 
 		G.Out(pdGendoc,"enter RTI1516ambassador::requestFederationRestore");
 		std::string labelString(label.begin(), label.end());
-		req->setLabel(labelString);
+		req.setLabel(labelString);
 		G.Out(pdGendoc,"      ====>executeService REQUEST_FEDERATION_RESTORE");
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		privateRefs->executeService(&req, &rep);
 		G.Out(pdGendoc,"exit  RTI1516ambassador::requestFederationRestore");
 	}
 
@@ -570,13 +533,12 @@
 		SaveInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Federate_Restore_Complete );
+		M_Federate_Restore_Complete req, rep ;
 
 		G.Out(pdGendoc,"enter RTI1516ambassador::federateRestoreComplete");
 
 		G.Out(pdGendoc,"      ====>executeService FEDERATE_RESTORE_COMPLETE");
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		privateRefs->executeService(&req, &rep);
 		G.Out(pdGendoc,"exit  RTI1516ambassador::federateRestoreComplete");
 	}
 
@@ -586,13 +548,12 @@
 		SaveInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Federate_Restore_Not_Complete );
+		M_Federate_Restore_Not_Complete req, rep ;
 
 		G.Out(pdGendoc,"enter RTI1516ambassador::federateRestoreNotComplete");
 		G.Out(pdGendoc,"      ====>executeService FEDERATE_RESTORE_NOT_COMPLETE");
 
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		privateRefs->executeService(&req, &rep);
 		G.Out(pdGendoc,"exit  RTI1516ambassador::federateRestoreNotComplete");
 	}
 
@@ -621,21 +582,20 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Publish_Object_Class );
+		M_Publish_Object_Class req, rep ;
 		G.Out(pdGendoc,"enter RTI1516ambassador::publishObjectClass");
 
 		const certi::ObjectClassHandle objectClassHandle =  ObjectClassHandleFriend::toCertiHandle(theClass);
-		req->setObjectClass(objectClassHandle);
+		req.setObjectClass(objectClassHandle);
 
-		req->setAttributesSize(attributeList.size());
+		req.setAttributesSize(attributeList.size());
 		uint32_t i = 0;
 		for ( rti1516::AttributeHandleSet::const_iterator it = attributeList.begin(); it != attributeList.end(); it++, ++i)
 		{
-			req->setAttributes(AttributeHandleFriend::toCertiHandle(*it),i);
+			req.setAttributes(AttributeHandleFriend::toCertiHandle(*it),i);
 		}
 		G.Out(pdGendoc,"      ====>executeService PUBLISH_OBJECT_CLASS");
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		privateRefs->executeService(&req, &rep);
 		G.Out(pdGendoc,"exit  RTI1516ambassador::publishObjectClass");
 	}
 
@@ -649,14 +609,13 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Unpublish_Object_Class );
+		M_Unpublish_Object_Class req, rep ;
 		G.Out(pdGendoc,"enter RTI1516ambassador::unpublishObjectClass");
 
 		const certi::ObjectClassHandle objectClassHandle = ObjectClassHandleFriend::toCertiHandle(theClass);
-		req->setObjectClass(objectClassHandle);
+		req.setObjectClass(objectClassHandle);
 		G.Out(pdGendoc,"      ====>executeService UNPUBLISH_OBJECT_CLASS");
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		privateRefs->executeService(&req, &rep);
 		G.Out(pdGendoc,"exit  RTI1516ambassador::unpublishObjectClass");
 	}
 
@@ -684,12 +643,11 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Publish_Interaction_Class );
+		M_Publish_Interaction_Class req, rep ;
 		const certi::InteractionClassHandle classHandle = InteractionClassHandleFriend::toCertiHandle(theInteraction);
-		req->setInteractionClass(classHandle);
+		req.setInteractionClass(classHandle);
 		G.Out(pdGendoc,"      ====>executeService PUBLISH_INTERACTION_CLASS");
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		privateRefs->executeService(&req, &rep);
 	}
 
 	// 5.5
@@ -701,12 +659,11 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Unpublish_Interaction_Class );
+		M_Unpublish_Interaction_Class req, rep ;
 		const certi::InteractionClassHandle classHandle = InteractionClassHandleFriend::toCertiHandle(theInteraction);
-		req->setInteractionClass(classHandle);
+		req.setInteractionClass(classHandle);
 
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		privateRefs->executeService(&req, &rep);
 	}
 
 	// 5.6
@@ -721,22 +678,21 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Subscribe_Object_Class_Attributes );
+		M_Subscribe_Object_Class_Attributes req, rep ;
 		G.Out(pdGendoc,"enter RTI1516ambassador::subscribeObjectClassAttributes");
 
 		const certi::ObjectClassHandle objectClassHandle = ObjectClassHandleFriend::toCertiHandle(theClass);
-		req->setObjectClass(objectClassHandle);
+		req.setObjectClass(objectClassHandle);
 
-		req->setAttributesSize(attributeList.size());
+		req.setAttributesSize(attributeList.size());
 		uint32_t i = 0;
 		for ( rti1516::AttributeHandleSet::const_iterator it = attributeList.begin(); it != attributeList.end(); it++, ++i)
 		{
-			req->setAttributes(AttributeHandleFriend::toCertiHandle(*it),i);
+			req.setAttributes(AttributeHandleFriend::toCertiHandle(*it),i);
 		}
-		req->setActive(active);
+		req.setActive(active);
 
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		privateRefs->executeService(&req, &rep);
 		G.Out(pdGendoc,"exit  RTI1516ambassador::subscribeObjectClassAttributes");
 	}
 
@@ -749,13 +705,12 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Unsubscribe_Object_Class );
+		M_Unsubscribe_Object_Class req, rep ;
 
 		const certi::ObjectClassHandle objectClassHandle = ObjectClassHandleFriend::toCertiHandle(theClass);
-		req->setObjectClass(objectClassHandle);
+		req.setObjectClass(objectClassHandle);
 
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP(); 
+		privateRefs->executeService(&req, &rep); 
 	}
 
 	void RTI1516ambassador::unsubscribeObjectClassAttributes
@@ -783,12 +738,11 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Subscribe_Interaction_Class );
+		M_Subscribe_Interaction_Class req, rep ;
 		const certi::InteractionClassHandle classHandle = InteractionClassHandleFriend::toCertiHandle(theClass);
-		req->setInteractionClass(classHandle);
+		req.setInteractionClass(classHandle);
 
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		privateRefs->executeService(&req, &rep);
 	}
 
 	// 5.9
@@ -800,13 +754,12 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Unsubscribe_Interaction_Class );
+		M_Unsubscribe_Interaction_Class req, rep ;
 
 		const certi::InteractionClassHandle classHandle = InteractionClassHandleFriend::toCertiHandle(theClass);
-		req->setInteractionClass(classHandle);
+		req.setInteractionClass(classHandle);
 
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		privateRefs->executeService(&req, &rep);
 	}
 
 	////////////////////////////////
@@ -822,12 +775,11 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Reserve_Object_Instance_Name );
+		M_Reserve_Object_Instance_Name req, rep;
 
 		std::string objInstanceName(theObjectInstanceName.begin(), theObjectInstanceName.end());
-		req->setObjectName(objInstanceName);
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		req.setObjectName(objInstanceName);
+		privateRefs->executeService(&req, &rep);
 	}
 
 	// 6.4
@@ -840,13 +792,11 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Register_Object_Instance );
+		M_Register_Object_Instance req, rep ;
 
-		req->setObjectClass(rti1516::ObjectClassHandleFriend::toCertiHandle(theClass));
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		ObjectInstanceHandle handle = rti1516::ObjectInstanceHandleFriend::createRTI1516Handle(rep->getObject());
-		DELETE_REP();
-		return handle;
+		req.setObjectClass(rti1516::ObjectClassHandleFriend::toCertiHandle(theClass));
+		privateRefs->executeService(&req, &rep);
+		return rti1516::ObjectInstanceHandleFriend::createRTI1516Handle(rep.getObject());
 	}
 
 	ObjectInstanceHandle RTI1516ambassador::registerObjectInstance
@@ -861,15 +811,14 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Register_Object_Instance );
+		M_Register_Object_Instance req, rep ;
 
 		std::string nameString(theObjectInstanceName.begin(), theObjectInstanceName.end());
-		req->setObjectName(nameString);
-		req->setObjectClass(rti1516::ObjectClassHandleFriend::toCertiHandle(theClass));
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		ObjectInstanceHandle handle = rti1516::ObjectInstanceHandleFriend::createRTI1516Handle(rep->getObject());
-		DELETE_REP();
-		return handle;
+		req.setObjectName(nameString);
+		req.setObjectClass(rti1516::ObjectClassHandleFriend::toCertiHandle(theClass));
+		privateRefs->executeService(&req, &rep);
+
+		return rti1516::ObjectInstanceHandleFriend::createRTI1516Handle(rep.getObject());
 	}
 
 	// 6.6
@@ -886,17 +835,17 @@
 		RTIinternalError)
 	{ 
 		G.Out(pdGendoc,"enter RTI1516ambassador::updateAttributeValues without time");
-		DEFINE_REQ_REP( M_Update_Attribute_Values );
+		M_Update_Attribute_Values req, rep ;
 
-		req->setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
+		req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
 		if ( &theUserSuppliedTag == NULL || theUserSuppliedTag.data() == NULL)
 		{
 			throw RTIinternalError(L"Calling updateAttributeValues with Tag NULL");
 		}
 
-		req->setTag(varLengthDataAsString(theUserSuppliedTag));
+		req.setTag(varLengthDataAsString(theUserSuppliedTag));
 
-		rep = assignAHVMAndExecuteService(theAttributeValues, req, rep );
+		assignAHVMAndExecuteService(theAttributeValues, req, rep);
 
 		G.Out(pdGendoc,"exit  RTI1516ambassador::updateAttributeValues without time");
 	}
@@ -916,25 +865,25 @@
 		RTIinternalError)
 	{ 
 		G.Out(pdGendoc,"enter RTI1516ambassador::updateAttributeValues with time");
-		DEFINE_REQ_REP( M_Update_Attribute_Values );
+		M_Update_Attribute_Values req, rep ;
 		
-		req->setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
+		req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
 		
 		certi::FederationTime certiFedTime(certi_cast<RTI1516fedTime>()(theTime).getFedTime());
-		req->setDate(certiFedTime);
+		req.setDate(certiFedTime);
 
 		if ( &theUserSuppliedTag == NULL || theUserSuppliedTag.data() == NULL)
 		{
 			throw RTIinternalError(L"Calling updateAttributeValues with Tag NULL");
 		}
 
-		req->setTag(varLengthDataAsString(theUserSuppliedTag));
+		req.setTag(varLengthDataAsString(theUserSuppliedTag));
 		
-		rep = assignAHVMAndExecuteService(theAttributeValues, req, rep );
+		assignAHVMAndExecuteService(theAttributeValues, req, rep);
 
 		G.Out(pdGendoc,"return  RTI1516ambassador::updateAttributeValues with time");
-		certi::FederateHandle certiHandle = rep->getEventRetraction().getSendingFederate();
-		uint64_t serialNum = rep->getEventRetraction().getSN();
+		certi::FederateHandle certiHandle = rep.getEventRetraction().getSendingFederate();
+		uint64_t serialNum = rep.getEventRetraction().getSN();
 		return rti1516::MessageRetractionHandleFriend::createRTI1516Handle(certiHandle, serialNum);
 	}
 
@@ -951,20 +900,20 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Send_Interaction );
+		M_Send_Interaction req, rep ;
 
 		const certi::InteractionClassHandle classHandle = InteractionClassHandleFriend::toCertiHandle(theInteraction);
-		req->setInteractionClass(classHandle);
+		req.setInteractionClass(classHandle);
 
 		if (&theUserSuppliedTag == NULL || theUserSuppliedTag.data() == NULL )
 		{
 			throw RTIinternalError (L"Calling sendIntercation with Tag NULL") ;
 		}
 
-		req->setTag(varLengthDataAsString(theUserSuppliedTag));
-		req->setRegion(0);
+		req.setTag(varLengthDataAsString(theUserSuppliedTag));
+		req.setRegion(0);
 		
-		rep = assignPHVMAndExecuteService(theParameterValues, req, rep );
+		assignPHVMAndExecuteService(theParameterValues, req, rep);
 	}
 
 	MessageRetractionHandle RTI1516ambassador::sendInteraction
@@ -981,25 +930,25 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Send_Interaction );
+		M_Send_Interaction req, rep ;
 
 		const certi::InteractionClassHandle classHandle = InteractionClassHandleFriend::toCertiHandle(theInteraction);
-		req->setInteractionClass(classHandle);
+		req.setInteractionClass(classHandle);
 
 		certi::FederationTime certiFedTime(certi_cast<RTI1516fedTime>()(theTime).getFedTime());
-		req->setDate(certiFedTime);
+		req.setDate(certiFedTime);
 
 		if (&theUserSuppliedTag == NULL || theUserSuppliedTag.data() == NULL ) {
 			throw RTIinternalError(L"Calling sendInteraction with Tag NULL") ;
 		}
 
-		req->setTag(varLengthDataAsString(theUserSuppliedTag));
-		req->setRegion(0);
-		
-		rep = assignPHVMAndExecuteService(theParameterValues, req, rep );
+		req.setTag(varLengthDataAsString(theUserSuppliedTag));
+		req.setRegion(0);
 		
-		certi::FederateHandle certiHandle = rep->getEventRetraction().getSendingFederate();
-		uint64_t serialNr = rep->getEventRetraction().getSN();
+		assignPHVMAndExecuteService(theParameterValues, req, rep);
+
+		certi::FederateHandle certiHandle = rep.getEventRetraction().getSendingFederate();
+		uint64_t serialNr = rep.getEventRetraction().getSN();
 		rti1516::MessageRetractionHandle rti1516handle = MessageRetractionHandleFriend::createRTI1516Handle(certiHandle, serialNr);
 		
 		return rti1516handle;
@@ -1016,18 +965,17 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Delete_Object_Instance );
+		M_Delete_Object_Instance req, rep ;
 
-		req->setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
+		req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
 		if ( &theUserSuppliedTag == NULL || theUserSuppliedTag.data() == NULL)
 		{
 			throw RTIinternalError(L"Calling deleteObjectInstance with Tag NULL") ;
 		}
 
-		req->setTag(varLengthDataAsString(theUserSuppliedTag));
+		req.setTag(varLengthDataAsString(theUserSuppliedTag));
 
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		privateRefs->executeService(&req, &rep);
 	}
 
 	MessageRetractionHandle RTI1516ambassador::deleteObjectInstance
@@ -1042,25 +990,24 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Delete_Object_Instance );
+		M_Delete_Object_Instance req, rep ;
 
-		req->setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
+		req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
 
 		certi::FederationTime certiFedTime(certi_cast<RTI1516fedTime>()(theTime).getFedTime());
-		req->setDate(certiFedTime);
+		req.setDate(certiFedTime);
 
 		if ( &theUserSuppliedTag == NULL || theUserSuppliedTag.data() == NULL)
 		{
 			throw RTIinternalError(L"Calling deleteObjectInstance with Tag NULL") ;
 		}
 
-		req->setTag(varLengthDataAsString(theUserSuppliedTag));
+		req.setTag(varLengthDataAsString(theUserSuppliedTag));
 
-		rep = privateRefs->executeServiceTmpl(req,rep);
+		privateRefs->executeService(&req, &rep);
 
-		certi::FederateHandle certiHandle = rep->getEventRetraction().getSendingFederate();
-		uint64_t serialNum = rep->getEventRetraction().getSN();
-		DELETE_REP();
+		certi::FederateHandle certiHandle = rep.getEventRetraction().getSendingFederate();
+		uint64_t serialNum = rep.getEventRetraction().getSN();
 		return rti1516::MessageRetractionHandleFriend::createRTI1516Handle(certiHandle, serialNum);
 	}
 
@@ -1076,11 +1023,10 @@
 		RTIinternalError)
 	{ 
 		throw RTIinternalError(L"unimplemented service localDeleteObjectInstance");
-		DEFINE_REQ_REP( M_Local_Delete_Object_Instance );
+		M_Local_Delete_Object_Instance req, rep ;
 
-		req->setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP(); 
+		req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
+		privateRefs->executeService(&req, &rep); 
 	}
 
 	// 6.13
@@ -1096,19 +1042,18 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Change_Attribute_Transportation_Type );
-		req->setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));	
-		req->setTransportationType(toCertiTransportationType(theType));
+		M_Change_Attribute_Transportation_Type req, rep ;
+		req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));	
+		req.setTransportationType(toCertiTransportationType(theType));
 		
-		req->setAttributesSize(theAttributes.size());
+		req.setAttributesSize(theAttributes.size());
 		uint32_t i = 0;
 		for ( rti1516::AttributeHandleSet::const_iterator it = theAttributes.begin(); it != theAttributes.end(); it++, ++i)
 		{
-			req->setAttributes(rti1516::AttributeHandleFriend::toCertiHandle(*it),i);
+			req.setAttributes(rti1516::AttributeHandleFriend::toCertiHandle(*it),i);
 		}
 
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		privateRefs->executeService(&req, &rep);
 	}
 
 	// 6.14
@@ -1122,13 +1067,12 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Change_Interaction_Transportation_Type );
+		M_Change_Interaction_Transportation_Type req, rep ;
 
-		req->setInteractionClass(rti1516::InteractionClassHandleFriend::toCertiHandle(theClass));
-		req->setTransportationType(toCertiTransportationType(theType));
+		req.setInteractionClass(rti1516::InteractionClassHandleFriend::toCertiHandle(theClass));
+		req.setTransportationType(toCertiTransportationType(theType));
 
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		privateRefs->executeService(&req, &rep);
 	}
 
 	// 6.17
@@ -1143,22 +1087,21 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Request_Object_Attribute_Value_Update );
+		M_Request_Object_Attribute_Value_Update req, rep ;
 
 		G.Out(pdGendoc,"enter RTI1516ambassador::requestObjectAttributeValueUpdate");
-		req->setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
+		req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
 
 		size_t attr_num = theAttributes.size();
-		req->setAttributesSize( attr_num );
+		req.setAttributesSize( attr_num );
 		uint32_t i = 0;
 		for ( rti1516::AttributeHandleSet::const_iterator it = theAttributes.begin(); i < attr_num; ++it, ++i)
 		{
-			req->setAttributes(AttributeHandleFriend::toCertiHandle(*it),i);
+			req.setAttributes(AttributeHandleFriend::toCertiHandle(*it),i);
 		}
-		req->setTag(varLengthDataAsString(theUserSuppliedTag));
+		req.setTag(varLengthDataAsString(theUserSuppliedTag));
 
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		privateRefs->executeService(&req, &rep);
 		G.Out(pdGendoc,"exit  RTI1516ambassador::requestObjectAttributeValueUpdate");
 	}
 
@@ -1173,11 +1116,11 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Request_Class_Attribute_Value_Update );
+		M_Request_Class_Attribute_Value_Update req, rep ;
 		G.Out(pdGendoc,"enter RTI1516ambassador::requestClassAttributeValueUpdate");
-		req->setObjectClass(rti1516::ObjectClassHandleFriend::toCertiHandle(theClass));
+		req.setObjectClass(rti1516::ObjectClassHandleFriend::toCertiHandle(theClass));
 
-		rep = assignAHSAndExecuteService( theAttributes, req, rep );
+		assignAHSAndExecuteService(theAttributes, req, rep);
 
 		G.Out(pdGendoc,"exit RTI1516ambassador::requestClassAttributeValueUpdate");
 	}
@@ -1197,18 +1140,17 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Unconditional_Attribute_Ownership_Divestiture );
-		req->setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
+		M_Unconditional_Attribute_Ownership_Divestiture req, rep ;
+		req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
 
-		req->setAttributesSize(theAttributes.size());
+		req.setAttributesSize(theAttributes.size());
 		uint32_t i=0;
 		for ( rti1516::AttributeHandleSet::const_iterator it = theAttributes.begin(); it != theAttributes.end(); it++, ++i)
 		{
-			req->setAttributes(AttributeHandleFriend::toCertiHandle(*it),i); 
+			req.setAttributes(AttributeHandleFriend::toCertiHandle(*it),i); 
 		}
 
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		privateRefs->executeService(&req, &rep);
 	}
 
 	// 7.3
@@ -1225,22 +1167,21 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Negotiated_Attribute_Ownership_Divestiture );
-		req->setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
+		M_Negotiated_Attribute_Ownership_Divestiture req, rep ;
+		req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
 		if (&theUserSuppliedTag == NULL || theUserSuppliedTag.data() == NULL) {
 			throw RTIinternalError (L"Calling negotiatedAttributeOwnershipDivestiture with Tag NULL") ;
 		}
-		req->setTag(rti1516::varLengthDataAsString(theUserSuppliedTag));
+		req.setTag(rti1516::varLengthDataAsString(theUserSuppliedTag));
 		
-		req->setAttributesSize(theAttributes.size());
+		req.setAttributesSize(theAttributes.size());
 		uint32_t i=0;
 		for ( rti1516::AttributeHandleSet::const_iterator it = theAttributes.begin(); it != theAttributes.end(); it++, ++i)
 		{
-			req->setAttributes(AttributeHandleFriend::toCertiHandle(*it),i); 
+			req.setAttributes(AttributeHandleFriend::toCertiHandle(*it),i); 
 		}
 
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		privateRefs->executeService(&req, &rep);
 	}
 
 	// 7.6
@@ -1277,24 +1218,23 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Attribute_Ownership_Acquisition );
+		M_Attribute_Ownership_Acquisition req, rep ;
 
-		req->setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
+		req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
 		if (&theUserSuppliedTag == NULL || theUserSuppliedTag.data() == NULL )
 		{
 			throw RTIinternalError (L"Calling attributeOwnershipAcquisition with Tag NULL") ;
 		}
-		req->setTag(rti1516::varLengthDataAsString(theUserSuppliedTag));
+		req.setTag(rti1516::varLengthDataAsString(theUserSuppliedTag));
 		
-		req->setAttributesSize(desiredAttributes.size());
+		req.setAttributesSize(desiredAttributes.size());
 		uint32_t i = 0;
 		for ( rti1516::AttributeHandleSet::const_iterator it = desiredAttributes.begin(); it != desiredAttributes.end(); it++, ++i)
 		{
-			req->setAttributes(AttributeHandleFriend::toCertiHandle(*it),i);
+			req.setAttributes(AttributeHandleFriend::toCertiHandle(*it),i);
 		}
 		
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP(); 
+		privateRefs->executeService(&req, &rep); 
 	}
 
 	// 7.9
@@ -1312,19 +1252,18 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Attribute_Ownership_Acquisition_If_Available );
+		M_Attribute_Ownership_Acquisition_If_Available req, rep ;
 
-		req->setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
+		req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
 		
-		req->setAttributesSize(desiredAttributes.size());
+		req.setAttributesSize(desiredAttributes.size());
 		uint32_t i = 0;
 		for ( rti1516::AttributeHandleSet::const_iterator it = desiredAttributes.begin(); it != desiredAttributes.end(); it++, ++i)
 		{
-			req->setAttributes(AttributeHandleFriend::toCertiHandle(*it),i);
+			req.setAttributes(AttributeHandleFriend::toCertiHandle(*it),i);
 		}
 
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		privateRefs->executeService(&req, &rep);
 	}
 
 	// 7.12 (in RTI1.3 this function is called: AttributeOwnershipReleaseResponse)
@@ -1340,16 +1279,16 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Attribute_Ownership_Release_Response );
+		M_Attribute_Ownership_Release_Response req, rep ;
 
-		req->setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
+		req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
 
-		rep = assignAHSAndExecuteService( theAttributes, req, rep );
+		assignAHSAndExecuteService(theAttributes, req, rep);
 
-		if (rep->getExceptionType() == e_NO_EXCEPTION) {
+		if (rep.getExceptionType() == e_NO_EXCEPTION) {
 			theDivestedAttributes.clear();
-			for (uint32_t i=0;i<rep->getAttributesSize();++i) {
-				theDivestedAttributes.insert(rti1516::AttributeHandleFriend::createRTI1516Handle(rep->getAttributes()[i]));
+			for (uint32_t i=0;i<rep.getAttributesSize();++i) {
+				theDivestedAttributes.insert(rti1516::AttributeHandleFriend::createRTI1516Handle(rep.getAttributes()[i]));
 			}
 		}
 
@@ -1368,19 +1307,18 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Cancel_Negotiated_Attribute_Ownership_Divestiture );
+		M_Cancel_Negotiated_Attribute_Ownership_Divestiture req, rep ;
 
-		req->setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
+		req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
 		
-		req->setAttributesSize(theAttributes.size());
+		req.setAttributesSize(theAttributes.size());
 		uint32_t i = 0;
 		for ( rti1516::AttributeHandleSet::const_iterator it = theAttributes.begin(); it != theAttributes.end(); it++, ++i)
 		{
-			req->setAttributes(AttributeHandleFriend::toCertiHandle(*it),i);
+			req.setAttributes(AttributeHandleFriend::toCertiHandle(*it),i);
 		}
 
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		privateRefs->executeService(&req, &rep);
 	}
 
 	// 7.14
@@ -1396,19 +1334,18 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Cancel_Attribute_Ownership_Acquisition );
+		M_Cancel_Attribute_Ownership_Acquisition req, rep ;
 
-		req->setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
+		req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
 		
-		req->setAttributesSize(theAttributes.size());
+		req.setAttributesSize(theAttributes.size());
 		uint32_t i = 0;
 		for ( rti1516::AttributeHandleSet::const_iterator it = theAttributes.begin(); it != theAttributes.end(); it++, ++i)
 		{
-			req->setAttributes(AttributeHandleFriend::toCertiHandle(*it),i);
+			req.setAttributes(AttributeHandleFriend::toCertiHandle(*it),i);
 		}
-		
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+
+		privateRefs->executeService(&req, &rep); 
 	}
 
 	// 7.16
@@ -1422,13 +1359,12 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Query_Attribute_Ownership );
+		M_Query_Attribute_Ownership req, rep ;
 
-		req->setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
-		req->setAttribute(rti1516::AttributeHandleFriend::toCertiHandle(theAttribute));
+		req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
+		req.setAttribute(rti1516::AttributeHandleFriend::toCertiHandle(theAttribute));
 
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		privateRefs->executeService(&req, &rep);
 	}
 
 	// 7.18
@@ -1442,15 +1378,14 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Is_Attribute_Owned_By_Federate );
+		M_Is_Attribute_Owned_By_Federate req, rep ;
 
-		req->setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
-		req->setAttribute(rti1516::AttributeHandleFriend::toCertiHandle(theAttribute));
+		req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
+		req.setAttribute(rti1516::AttributeHandleFriend::toCertiHandle(theAttribute));
 
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		bool owned = (rep->getTag() == "RTI_TRUE") ? true : false;
-		DELETE_REP();
-		return owned;
+		privateRefs->executeService(&req, &rep);
+
+		return (rep.getTag() == "RTI_TRUE") ? true : false;
 	}
 
 	//////////////////////////////
@@ -1469,17 +1404,24 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Enable_Time_Regulation );
+		M_Enable_Time_Regulation req, rep ;
 
-		//req->setDate(certi_cast<RTIfedTime>()(theFederateTime).getTime());  //JRE: DATE IS NOT USED!
+		//req.setDate(certi_cast<RTIfedTime>()(theFederateTime).getTime());  //JRE: DATE IS NOT USED!
 		
 		//JRE: is dit wel goed?
 		//JvY: TODO Controleren of dit blijft werken met andere tijdsimplementaties
-		double * lookAheadTime = (double*) theLookahead.encode().data();
-		req->setLookahead(*lookAheadTime);
-
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		union ud {
+			double   dv;
+			uint64_t uv;
+		} value;
+#ifdef HOST_IS_BIG_ENDIAN
+		memcpy(&(value.uv), theLookahead.encode().data(), sizeof(double));
+#else
+		value.uv = CERTI_DECODE_DOUBLE_FROM_UINT64BE(theLookahead.encode().data());
+#endif
+		double lookAheadTime = value.dv;
+		req.setLookahead(lookAheadTime);
+		privateRefs->executeService(&req, &rep);
 	}
 
 	// 8.4
@@ -1490,9 +1432,9 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Disable_Time_Regulation );
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		M_Disable_Time_Regulation req, rep ;
+
+		privateRefs->executeService(&req, &rep);
 	}
 
 	// 8.5
@@ -1505,9 +1447,8 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Enable_Time_Constrained );
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		M_Enable_Time_Constrained req, rep ;
+		privateRefs->executeService(&req, &rep);
 	}
 
 	// 8.7
@@ -1518,9 +1459,8 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Disable_Time_Constrained );
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		M_Disable_Time_Constrained req, rep ;
+		privateRefs->executeService(&req, &rep);
 	}
 
 	// 8.8
@@ -1536,12 +1476,11 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Time_Advance_Request );
+		M_Time_Advance_Request req, rep ;
 
 		certi::FederationTime certiFedTime(certi_cast<RTI1516fedTime>()(theTime).getFedTime());
-		req->setDate(certiFedTime);
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		req.setDate(certiFedTime);
+		privateRefs->executeService(&req, &rep);
 	}
 
 	// 8.9
@@ -1557,13 +1496,12 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Time_Advance_Request_Available );
+		M_Time_Advance_Request_Available req, rep ;
 
 		certi::FederationTime certiFedTime(certi_cast<RTI1516fedTime>()(theTime).getFedTime());
-		req->setDate(certiFedTime);
+		req.setDate(certiFedTime);
 
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP(); 
+		privateRefs->executeService(&req, &rep); 
 	}
 
 	// 8.10
@@ -1579,13 +1517,12 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Next_Event_Request );
+		M_Next_Event_Request req, rep ;
 
 		certi::FederationTime certiFedTime(certi_cast<RTI1516fedTime>()(theTime).getFedTime());
-		req->setDate(certiFedTime);
+		req.setDate(certiFedTime);
 
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		privateRefs->executeService(&req, &rep);
 	}
 
 	// 8.11
@@ -1601,13 +1538,12 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Next_Event_Request_Available );
+		M_Next_Event_Request_Available req, rep ;
 
 		certi::FederationTime certiFedTime(certi_cast<RTI1516fedTime>()(theTime).getFedTime());
-		req->setDate(certiFedTime);
+		req.setDate(certiFedTime);
 
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		privateRefs->executeService(&req, &rep);
 	}
 
 	// 8.12
@@ -1625,13 +1561,12 @@
 	{ 
 		// JvY: Implementation copied from previous CERTI implementation, including immediate throw.
 		throw RTIinternalError(L"Unimplemented Service flushQueueRequest");
-		DEFINE_REQ_REP( M_Flush_Queue_Request );
+		M_Flush_Queue_Request req, rep ;
 
 		certi::FederationTime certiFedTime(certi_cast<RTI1516fedTime>()(theTime).getFedTime());
-		req->setDate(certiFedTime);
+		req.setDate(certiFedTime);
 
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		privateRefs->executeService(&req, &rep);
 	}
 
 	// 8.14
@@ -1644,9 +1579,9 @@
 	{ 
 		// throw AsynchronousDeliveryAlreadyEnabled("Default value (non HLA)");
 
-		DEFINE_REQ_REP( M_Enable_Asynchronous_Delivery );
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		M_Enable_Asynchronous_Delivery req, rep ;
+
+		privateRefs->executeService(&req, &rep);
 	}
 
 	// 8.15
@@ -1657,9 +1592,9 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Disable_Asynchronous_Delivery );
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		M_Disable_Asynchronous_Delivery req, rep ;
+
+		privateRefs->executeService(&req, &rep);
 	}
 
 	// 8.16
@@ -1670,18 +1605,19 @@
 		RTIinternalError)
 	{ 
 		//TODO JRE: goed testen! Is GALT wel precies het zelfde als LBTS?
-		DEFINE_REQ_REP( M_Query_Lbts );
+		M_Query_Lbts req, rep ;
+
+		privateRefs->executeService(&req, &rep);
 
-		rep = privateRefs->executeServiceTmpl(req,rep);
 		//TODO JRE: goed testen of deze return value wel klopt!
-		certi::FederationTime fedTime = rep->getDate();
-		if (fedTime == NULL || fedTime.getTime() == 0) {
+		certi::FederationTime fedTime = rep.getDate();
+		if (fedTime.getTime() == 0.0) {
 			return false;
 		}	
 
 		// JvY: TODO Controleren of dit blijft werken met andere tijdsimplementaties
-		certi_cast<RTI1516fedTime>()(theTime) = rep->getDate().getTime();
-		DELETE_REP();
+		certi_cast<RTI1516fedTime>()(theTime) = rep.getDate().getTime();
+
 		return true;
 	}
 
@@ -1692,13 +1628,12 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Query_Federate_Time );
+		M_Query_Federate_Time req, rep ;
 
-		rep = privateRefs->executeServiceTmpl(req,rep);
+		privateRefs->executeService(&req, &rep);
 
 		// JvY: TODO Controleren of dit blijft werken met andere tijdsimplementaties
-		certi_cast<RTI1516fedTime>()(theTime) = rep->getDate().getTime();
-		DELETE_REP();
+		certi_cast<RTI1516fedTime>()(theTime) = rep.getDate().getTime();
 	}
 
 	// 8.18
@@ -1709,18 +1644,18 @@
 		RTIinternalError)
 	{ 
 		//TODO JRE: goed testen! Is LITS wel precies het zelfde als QueryMinNextEventTime?
-		DEFINE_REQ_REP( M_Query_Min_Next_Event_Time );
+		M_Query_Min_Next_Event_Time req, rep ;
 
-		rep = privateRefs->executeServiceTmpl(req,rep);
+		privateRefs->executeService(&req, &rep);
 
 		//TODO JRE: goed testen of deze return value wel klopt!
-		certi::FederationTime fedTime = rep->getDate();
-		if (fedTime == NULL || fedTime.getTime() == 0) {
+		certi::FederationTime fedTime = rep.getDate();
+		if (fedTime.getTime() == 0.0) {
 			return false;
 		}
 		// JvY: TODO Controleren of dit blijft werken met andere tijdsimplementaties
-		certi_cast<RTI1516fedTime>()(theTime) = rep->getDate().getTime();
-		DELETE_REP();
+		certi_cast<RTI1516fedTime>()(theTime) = rep.getDate().getTime();
+
 		return true;
 	}
 
@@ -1763,13 +1698,12 @@
 		RTIinternalError)
 	{ 
 		throw RTIinternalError(L"Unimplemented Service retract");
-		DEFINE_REQ_REP( M_Retract );
+		M_Retract req, rep ;
 		
 		certi::EventRetraction event = rti1516::MessageRetractionHandleFriend::createEventRetraction(theHandle);
-		req->setEventRetraction(event);
+		req.setEventRetraction(event);
 
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		privateRefs->executeService(&req, &rep);
 	}
 
 	// 8.23
@@ -1785,12 +1719,12 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Change_Attribute_Order_Type );
+		M_Change_Attribute_Order_Type req, rep ;
 
-		req->setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
-		req->setOrder(rti1516::toCertiOrderType(theType));
+		req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
+		req.setOrder(rti1516::toCertiOrderType(theType));
 
-		rep = assignAHSAndExecuteService( theAttributes, req, rep );
+		assignAHSAndExecuteService(theAttributes, req, rep);
 	}
 
 	// 8.24
@@ -1804,13 +1738,12 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Change_Interaction_Order_Type );
+		M_Change_Interaction_Order_Type req, rep ;
 
-		req->setInteractionClass(rti1516::InteractionClassHandleFriend::toCertiHandle(theClass));
-		req->setOrder(rti1516::toCertiOrderType(theType));
+		req.setInteractionClass(rti1516::InteractionClassHandleFriend::toCertiHandle(theClass));
+		req.setOrder(rti1516::toCertiOrderType(theType));
 
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		privateRefs->executeService(&req, &rep);
 	}
 
 	//////////////////////////////////
@@ -2086,18 +2019,17 @@
 		FederateNotExecutionMember,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Get_Object_Class_Handle );
+		M_Get_Object_Class_Handle req, rep ;
 
 		G.Out(pdGendoc,"enter RTI1516ambassador::getObjectClassHandle");
 
 		std::string nameAsString(theName.begin(), theName.end());
-		req->setClassName(nameAsString);
-		rep = privateRefs->executeServiceTmpl(req,rep);
+		req.setClassName(nameAsString);
+		privateRefs->executeService(&req, &rep);
 
 		G.Out(pdGendoc,"exit RTI1516ambassador::getObjectClassHandle");
-		rti1516::ObjectClassHandle rti1516Handle = ObjectClassHandleFriend::createRTI1516Handle(rep->getObjectClass());
-		
-		DELETE_REP();
+		rti1516::ObjectClassHandle rti1516Handle = ObjectClassHandleFriend::createRTI1516Handle(rep.getObjectClass());
+
 		return rti1516Handle;
 	}
 
@@ -2108,22 +2040,21 @@
 		FederateNotExecutionMember,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Get_Object_Class_Name );
+		M_Get_Object_Class_Name req, rep ;
 
 		certi::ObjectClassHandle certiHandle = ObjectClassHandleFriend::toCertiHandle(theHandle);
-		req->setObjectClass(certiHandle);
+		req.setObjectClass(certiHandle);
 		try {
-			rep = privateRefs->executeServiceTmpl(req,rep);
+			privateRefs->executeService(&req, &rep);
 		} catch (rti1516::ObjectClassNotDefined &e)
 		{
 			throw rti1516::InvalidObjectClassHandle(e.what());
 		}
 
-		std::string nameString = rep->getClassName();
+		std::string nameString = rep.getClassName();
 		std::wstring nameWString(nameString.begin(), nameString.end()); 
 
 		//return hla_strdup(rep.getClassName());
-		DELETE_REP();
 		return nameWString;
 	}
 
@@ -2137,14 +2068,14 @@
 		RTIinternalError)
 	{ 
 		G.Out(pdGendoc,"enter RTI::RTI1516ambassador::getAttributeHandle");
-		DEFINE_REQ_REP( M_Get_Attribute_Handle );
+		M_Get_Attribute_Handle req, rep ;
 
 		std::string nameAsString(theAttributeName.begin(), theAttributeName.end());
-		req->setAttributeName(nameAsString);
-		req->setObjectClass(rti1516::ObjectClassHandleFriend::toCertiHandle(whichClass));
+		req.setAttributeName(nameAsString);
+		req.setObjectClass(rti1516::ObjectClassHandleFriend::toCertiHandle(whichClass));
 
 		try {
-			rep = privateRefs->executeServiceTmpl(req,rep);
+			privateRefs->executeService(&req, &rep);
 		} catch (rti1516::ObjectClassNotDefined &e)
 		{
 			if ( ! whichClass.isValid() ) {
@@ -2154,10 +2085,10 @@
 			}
 		}
 
+
+
 		G.Out(pdGendoc,"exit  RTI::RTI1516ambassador::getAttributeHandle");
-		AttributeHandle handle = rti1516::AttributeHandleFriend::createRTI1516Handle(rep->getAttribute());
-		DELETE_REP();
-		return handle;
+		return rti1516::AttributeHandleFriend::createRTI1516Handle(rep.getAttribute());
 	}
 
 	// 10.5
@@ -2170,12 +2101,12 @@
 		FederateNotExecutionMember,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Get_Attribute_Name );
+		M_Get_Attribute_Name req, rep ;
 
-		req->setAttribute(rti1516::AttributeHandleFriend::toCertiHandle(theHandle));
-		req->setObjectClass(rti1516::ObjectClassHandleFriend::toCertiHandle(whichClass));
+		req.setAttribute(rti1516::AttributeHandleFriend::toCertiHandle(theHandle));
+		req.setObjectClass(rti1516::ObjectClassHandleFriend::toCertiHandle(whichClass));
 		try {
-			rep = privateRefs->executeServiceTmpl(req,rep);
+			privateRefs->executeService(&req, &rep);
 		} catch (rti1516::ObjectClassNotDefined &e)
 		{
 			if ( !whichClass.isValid() )
@@ -2198,9 +2129,9 @@
 		
 		//return hla_strdup(rep.getAttributeName());
 
-		std::string nameString = rep->getAttributeName();
+		std::string nameString = rep.getAttributeName();
 		std::wstring nameWString(nameString.begin(), nameString.end());
-		DELETE_REP();
+
 		return nameWString;
 	}
 
@@ -2211,15 +2142,13 @@
 		FederateNotExecutionMember,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Get_Interaction_Class_Handle );
+		M_Get_Interaction_Class_Handle req, rep ;
 		std::string nameString(theName.begin(), theName.end());
-		req->setClassName(nameString);
+		req.setClassName(nameString);
 
-		rep = privateRefs->executeServiceTmpl(req,rep);
+		privateRefs->executeService(&req, &rep);
 
-		InteractionClassHandle handle = rti1516::InteractionClassHandleFriend::createRTI1516Handle(rep->getInteractionClass());
-		DELETE_REP();
-		return handle;
+		return rti1516::InteractionClassHandleFriend::createRTI1516Handle(rep.getInteractionClass());
 	}
 
 	// 10.7
@@ -2229,10 +2158,10 @@
 		FederateNotExecutionMember,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Get_Interaction_Class_Name );
-		req->setInteractionClass(rti1516::InteractionClassHandleFriend::toCertiHandle(theHandle));
+		M_Get_Interaction_Class_Name req, rep ;
+		req.setInteractionClass(rti1516::InteractionClassHandleFriend::toCertiHandle(theHandle));
 		try {
-			rep = privateRefs->executeServiceTmpl(req,rep);
+			privateRefs->executeService(&req, &rep);
 		} catch (rti1516::InteractionClassNotDefined &e)
 		{
 			if ( !theHandle.isValid() )
@@ -2245,10 +2174,9 @@
 		}
 
 		//return hla_strdup(rep.getClassName());
-		std::string nameString = rep->getClassName();
+		std::string nameString = rep.getClassName();
 		std::wstring nameWString(nameString.begin(), nameString.end());
 
-		DELETE_REP();
 		return nameWString;
 	}
 
@@ -2261,13 +2189,13 @@
 		FederateNotExecutionMember,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Get_Parameter_Handle );
+		M_Get_Parameter_Handle req, rep ;
 		std::string nameString(theName.begin(), theName.end());
-		req->setParameterName(nameString);
-		req->setInteractionClass(rti1516::InteractionClassHandleFriend::toCertiHandle(whichClass));
+		req.setParameterName(nameString);
+		req.setInteractionClass(rti1516::InteractionClassHandleFriend::toCertiHandle(whichClass));
 
 		try {
-			rep = privateRefs->executeServiceTmpl(req,rep);
+			privateRefs->executeService(&req, &rep);
 		} catch (rti1516::InteractionClassNotDefined &e)
 		{
 			if ( !whichClass.isValid() )
@@ -2279,9 +2207,7 @@
 			}
 		}
 
-		ParameterHandle handle = rti1516::ParameterHandleFriend::createRTI1516Handle(rep->getParameter());
-		DELETE_REP();
-		return handle;
+		return rti1516::ParameterHandleFriend::createRTI1516Handle(rep.getParameter());
 	}
 
 	// 10.9
@@ -2294,13 +2220,13 @@
 		FederateNotExecutionMember,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Get_Parameter_Name );
+		M_Get_Parameter_Name req, rep ;
 
-		req->setParameter(rti1516::ParameterHandleFriend::toCertiHandle(theHandle));
-		req->setInteractionClass(rti1516::InteractionClassHandleFriend::toCertiHandle(whichClass));
+		req.setParameter(rti1516::ParameterHandleFriend::toCertiHandle(theHandle));
+		req.setInteractionClass(rti1516::InteractionClassHandleFriend::toCertiHandle(whichClass));
 
 		try {
-			rep = privateRefs->executeServiceTmpl(req,rep);
+			privateRefs->executeService(&req, &rep);
 		} catch (rti1516::InteractionClassNotDefined &e)
 		{
 			if ( !whichClass.isValid() )
@@ -2313,10 +2239,9 @@
 		}
 
 		//return hla_strdup(rep.getParameterName());
-		std::string nameString = rep->getParameterName();
+		std::string nameString = rep.getParameterName();
 		std::wstring nameWString(nameString.begin(), nameString.end());
-		
-		DELETE_REP();
+
 		return nameWString;
 	}
 
@@ -2327,14 +2252,12 @@
 		FederateNotExecutionMember,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Get_Object_Instance_Handle );
+		M_Get_Object_Instance_Handle req, rep ;
 		std::string nameString(theName.begin(), theName.end());
-		req->setObjectInstanceName(nameString);
+		req.setObjectInstanceName(nameString);
 
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		ObjectInstanceHandle handle = rti1516::ObjectInstanceHandleFriend::createRTI1516Handle(rep->getObject());
-		DELETE_REP();
-		return handle;
+		privateRefs->executeService(&req, &rep);
+		return rti1516::ObjectInstanceHandleFriend::createRTI1516Handle(rep.getObject());
 	}
 
 	// 10.11
@@ -2344,15 +2267,14 @@
 		FederateNotExecutionMember,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Get_Object_Instance_Name );
-		req->setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theHandle));
-		rep = privateRefs->executeServiceTmpl(req,rep);
+		M_Get_Object_Instance_Name req, rep ;
+		req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theHandle));
+		privateRefs->executeService(&req, &rep);
 
 		//return hla_strdup(rep.getObjectInstanceName());
-		std::string nameString = rep->getObjectInstanceName();
+		std::string nameString = rep.getObjectInstanceName();
 		std::wstring nameWString(nameString.begin(), nameString.end());
-		
-		DELETE_REP();
+
 		return nameWString;
 	}
 
@@ -2363,15 +2285,13 @@
 		FederateNotExecutionMember,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Get_Dimension_Handle );
+		M_Get_Dimension_Handle req, rep ;
 
 		std::string nameString(theName.begin(), theName.end());
-		req->setDimensionName(nameString);
-		//req->setSpace(space);    //SPACE NIET NODIG IN 1516 STANDAARD???
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DimensionHandle handle = rti1516::DimensionHandleFriend::createRTI1516Handle(rep->getDimension());
-		DELETE_REP();
-		return handle;
+		req.setDimensionName(nameString);
+		//req.setSpace(space);    //SPACE NIET NODIG IN 1516 STANDAARD???
+		privateRefs->executeService(&req, &rep);
+		return rti1516::DimensionHandleFriend::createRTI1516Handle(rep.getDimension());
 	}
 
 	// 10.13
@@ -2381,16 +2301,15 @@
 		FederateNotExecutionMember,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Get_Dimension_Name );
+		M_Get_Dimension_Name req, rep ;
 
-		req->setDimension(rti1516::DimensionHandleFriend::toCertiHandle(theHandle));
-		//req->setSpace(space);
-		rep = privateRefs->executeServiceTmpl(req,rep);
+		req.setDimension(rti1516::DimensionHandleFriend::toCertiHandle(theHandle));
+		//req.setSpace(space);
+		privateRefs->executeService(&req, &rep);
 		//return hla_strdup(rep.getDimensionName());
-		std::string nameString = rep->getDimensionName();
+		std::string nameString = rep.getDimensionName();
 		std::wstring nameWString(nameString.begin(), nameString.end());
 
-		DELETE_REP();
 		return nameWString;
 	}
 
@@ -2415,12 +2334,11 @@
 		FederateNotExecutionMember,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Get_Attribute_Space_Handle );
+		M_Get_Attribute_Space_Handle req, rep ;
 
-		req->setAttribute(rti1516::AttributeHandleFriend::toCertiHandle(theHandle));
-		req->setObjectClass(rti1516::ObjectClassHandleFriend::toCertiHandle(theClass));
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		req.setAttribute(rti1516::AttributeHandleFriend::toCertiHandle(theHandle));
+		req.setObjectClass(rti1516::ObjectClassHandleFriend::toCertiHandle(theClass));
+		privateRefs->executeService(&req, &rep);
 		
 		//JRE TODO: Use space handle to to get the DimensionHandleSet?@!
 		//return rep.getSpace();
@@ -2435,13 +2353,11 @@
 		FederateNotExecutionMember,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Get_Object_Class );
+		M_Get_Object_Class req, rep ;
 
-		req->setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		ObjectClassHandle handle = rti1516::ObjectClassHandleFriend::createRTI1516Handle(rep->getObjectClass());
-		DELETE_REP();
-		return handle;
+		req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
+		privateRefs->executeService(&req, &rep);
+		return rti1516::ObjectClassHandleFriend::createRTI1516Handle(rep.getObjectClass());
 	}
 
 	// 10.17
@@ -2451,11 +2367,10 @@
 		FederateNotExecutionMember,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Get_Interaction_Space_Handle );
+		M_Get_Interaction_Space_Handle req, rep ;
 
-		req->setInteractionClass(rti1516::InteractionClassHandleFriend::toCertiHandle(theClass));
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		req.setInteractionClass(rti1516::InteractionClassHandleFriend::toCertiHandle(theClass));
+		this->privateRefs->executeService(&req, &rep);
 		
 		//JRE TODO: Use space handle to to get the DimensionHandleSet?@!
 		//return rep.getSpace();
@@ -2470,14 +2385,12 @@
 		FederateNotExecutionMember,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Get_Transportation_Handle );
+		M_Get_Transportation_Handle req, rep ;
 		std::string nameString(transportationName.begin(), transportationName.end());
-		req->setTransportationName(nameString);
-		rep = privateRefs->executeServiceTmpl(req,rep);
+		req.setTransportationName(nameString);
+		privateRefs->executeService(&req, &rep);
 
-		TransportationType tr = rti1516::toRTI1516TransportationType(rep->getTransportation());
-		DELETE_REP();
-		return tr;
+		return rti1516::toRTI1516TransportationType(rep.getTransportation());
 	}
 
 	// 10.19
@@ -2487,16 +2400,15 @@
 		FederateNotExecutionMember,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Get_Transportation_Name );
+		M_Get_Transportation_Name req, rep ;
 
-		req->setTransportation(rti1516::toCertiTransportationType(transportationType));
-		rep = privateRefs->executeServiceTmpl(req,rep);
+		req.setTransportation(rti1516::toCertiTransportationType(transportationType));
+		privateRefs->executeService(&req, &rep);
 
 		//return hla_strdup(rep.getTransportationName());
-		std::string nameString = rep->getTransportationName();
+		std::string nameString = rep.getTransportationName();
 		std::wstring nameWString(nameString.begin(), nameString.end());
 
-		DELETE_REP();
 		return nameWString;
 	}
 
@@ -2507,15 +2419,13 @@
 		FederateNotExecutionMember,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Get_Ordering_Handle );
+		M_Get_Ordering_Handle req, rep ;
 
 		std::string nameAsString(orderName.begin(), orderName.end());
-		req->setOrderingName(nameAsString);
-		rep = privateRefs->executeServiceTmpl(req,rep);
+		req.setOrderingName(nameAsString);
+		privateRefs->executeService(&req, &rep);
 		
-		OrderType order = rti1516::toRTI1516OrderType(rep->getOrdering());
-		DELETE_REP();
-		return order;
+		return rti1516::toRTI1516OrderType(rep.getOrdering());
 	}
 
 	// 10.21
@@ -2525,16 +2435,15 @@
 		FederateNotExecutionMember,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Get_Ordering_Name );
+		M_Get_Ordering_Name req, rep ;
 
-		req->setOrdering(rti1516::toCertiOrderType(orderType));
-		rep = privateRefs->executeServiceTmpl(req,rep);
+		req.setOrdering(rti1516::toCertiOrderType(orderType));
+		privateRefs->executeService(&req, &rep);
 		
 		//return hla_strdup(rep.getOrderingName());
-		std::string nameString = rep->getOrderingName();
+		std::string nameString = rep.getOrderingName();
 		std::wstring nameWString(nameString.begin(), nameString.end());
 
-		DELETE_REP();
 		return nameWString;
 	}
 
@@ -2564,9 +2473,8 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Enable_Class_Relevance_Advisory_Switch );
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		M_Enable_Class_Relevance_Advisory_Switch req, rep ;
+		privateRefs->executeService(&req, &rep);
 	}
 
 	// 10.23
@@ -2595,9 +2503,8 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Disable_Class_Relevance_Advisory_Switch );
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		M_Disable_Class_Relevance_Advisory_Switch req, rep ;
+		privateRefs->executeService(&req, &rep);
 	}
 
 	// 10.24
@@ -2627,9 +2534,8 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Enable_Attribute_Relevance_Advisory_Switch );
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP(); 
+		M_Enable_Attribute_Relevance_Advisory_Switch req, rep ;
+		privateRefs->executeService(&req, &rep); 
 	}
 
 	// 10.25
@@ -2659,9 +2565,8 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Disable_Attribute_Relevance_Advisory_Switch );
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		M_Disable_Attribute_Relevance_Advisory_Switch req, rep ;
+		privateRefs->executeService(&req, &rep);
 	}
 
 	// 10.26
@@ -2690,9 +2595,8 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Enable_Attribute_Scope_Advisory_Switch );
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		M_Enable_Attribute_Scope_Advisory_Switch req, rep ;
+		privateRefs->executeService(&req, &rep);
 	}
 
 	// 10.27
@@ -2721,9 +2625,8 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Disable_Attribute_Scope_Advisory_Switch );
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		M_Disable_Attribute_Scope_Advisory_Switch req, rep ;
+		privateRefs->executeService(&req, &rep);
 	}
 
 	// 10.28
@@ -2752,9 +2655,8 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Enable_Interaction_Relevance_Advisory_Switch );
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP();
+		M_Enable_Interaction_Relevance_Advisory_Switch req, rep ;
+		privateRefs->executeService(&req, &rep);
 	}
 
 	// 10.29
@@ -2783,9 +2685,8 @@
 		RestoreInProgress,
 		RTIinternalError)
 	{ 
-		DEFINE_REQ_REP( M_Disable_Interaction_Relevance_Advisory_Switch );
-		rep = privateRefs->executeServiceTmpl(req,rep);
-		DELETE_REP(); 
+		M_Disable_Interaction_Relevance_Advisory_Switch req, rep ;
+		privateRefs->executeService(&req, &rep); 
 	}
 
 	// 10.30
diff -U 3 -H -d -r -N -x '*.kdev' -x '.svn*' -x 'CVS*' -- patched/libRTI/RTI1516ambassador.h origin/libRTI/RTI1516ambassador.h
--- patched/libRTI/RTI1516ambassador.h	2012-01-16 14:08:55.000000000 +0400
+++ origin/libRTI/RTI1516ambassador.h	2010-05-31 13:33:25.000000000 +0400
@@ -3,16 +3,10 @@
 #ifndef RTI_RTI1516ambassador_h
 #define RTI_RTI1516ambassador_h
 
-#include "config.h"
 #include <RTI/RTIambassador.h>
 #include <RTI/RTIambassadorFactory.h>
 #include "RTI1516ambPrivateRefs.h"
 
-#ifdef RTIA_USE_THREAD
-// path to these files is actually defined in CMakeLists.txt
-#include "../libRTIA/librtia_buf.hpp"
-#include "../RTIA/RTIA.hh"
-#endif
 
 namespace rti1516
 {
@@ -26,22 +20,17 @@
 	private:
 		RTI1516ambPrivateRefs* privateRefs ;
 
-#ifdef RTIA_USE_THREAD
-		certi::rtia::RTIA rtia1516;
-		LibRTIABufSet bufSet;
-#endif
-
 		// Helper functions
-		template<typename MSG>
-		MSG* assignAHSAndExecuteService(const rti1516::AttributeHandleSet &AHS, MSG *req, MSG *rep  );
-		template<typename MSG>
-		MSG* assignPHVMAndExecuteService(const rti1516::ParameterHandleValueMap &PHVM, MSG *req, MSG *rep );
-		template<typename MSG>
-		MSG* assignAHVMAndExecuteService(const rti1516::AttributeHandleValueMap &AHVM, MSG *req, MSG *rep );
+		template<typename T> void
+			assignAHSAndExecuteService(const rti1516::AttributeHandleSet &AHS, T &req, T &rep);
+		template<typename T> void
+			assignPHVMAndExecuteService(const rti1516::ParameterHandleValueMap &PHVM, T &req, T &rep);
+		template<typename T> void 
+			assignAHVMAndExecuteService(const rti1516::AttributeHandleValueMap &AHVM, T &req, T &rep);
 		// Helper function for CallBacks
 		bool __tick_kernel(bool, TickTime, TickTime)
 			throw (SpecifiedSaveLabelDoesNotExist, RTIinternalError);
-		
+
 	protected:
 		RTI1516ambassador()
 			throw ();
diff -U 3 -H -d -r -N -x '*.kdev' -x '.svn*' -x 'CVS*' -- patched/libRTI/RTI1516ambassadorFactory.cpp origin/libRTI/RTI1516ambassadorFactory.cpp
--- patched/libRTI/RTI1516ambassadorFactory.cpp	2012-01-19 14:57:25.000000000 +0400
+++ origin/libRTI/RTI1516ambassadorFactory.cpp	2011-10-27 11:59:51.000000000 +0400
@@ -45,17 +45,12 @@
 	PrettyDebug::setFederateName( "LibRTI::UnjoinedFederate" );
 	std::wstringstream msg;
 
-#ifdef RTIA_USE_THREAD
-	p_ambassador->privateRefs = new RTI1516ambPrivateRefs( &p_ambassador->bufSet );
-#else //RTIA_USE_THREAD
 	p_ambassador->privateRefs = new RTI1516ambPrivateRefs();
-#endif //RTIA_USE_THREAD
-	// WARNING: not sure about this
-	p_ambassador->privateRefs->is_reentrant = false ;
-	
-#ifndef RTIA_USE_THREAD
+
 	p_ambassador->privateRefs->socketUn = new SocketUN(stIgnoreSignal);
 
+	p_ambassador->privateRefs->is_reentrant = false ;
+
 	std::vector<std::string> rtiaList;
 	const char* env = getenv("CERTI_RTIA");
 	if (env && strlen(env))
@@ -88,7 +83,6 @@
 	si.cb = sizeof(si);
 	ZeroMemory( &pi, sizeof(pi) );
 
-// TODO: cope the relation between RTIA_CONSOLE_SHOW & RTIA_USE_THREAD
 #ifndef RTIA_CONSOLE_SHOW
 	/*
 	 * Avoid displaying console window
@@ -151,7 +145,7 @@
 	closesocket(newPipeFd);
 #endif
 
-#else // _WIN32
+#else
 
 	sigset_t nset, oset;
 	// temporarily block termination signals
@@ -220,26 +214,12 @@
 	}
 #endif
 
-#else // RTIA_USE_THREAD
-	p_ambassador->rtia1516.launchRTIAthread( &p_ambassador->bufSet );
-#endif // RTIA_USE_THREAD
-
-#ifdef RTIA_USE_THREAD
-	certi::M_Open_Connexion *req = new certi::M_Open_Connexion, *rep = NULL;
-#else // RTIA_USE_THREAD
-	certi::M_Open_Connexion local_req, *req = &local_req, local_rep, *rep = &local_rep;
-#endif // RTIA_USE_THREAD
-
-	
-	req->setVersionMajor(CERTI_Message::versionMajor);
-	req->setVersionMinor(CERTI_Message::versionMinor);
+	certi::M_Open_Connexion req, rep ;
+	req.setVersionMajor(CERTI_Message::versionMajor);
+	req.setVersionMinor(CERTI_Message::versionMinor);
 
 	G1516.Out(pdGendoc,"        ====>executeService OPEN_CONNEXION");
-	p_ambassador->privateRefs->executeService( req, rep );
-
-#ifdef RTIA_USE_THREAD
-	delete rep;
-#endif // RTIA_USE_THREAD
+	p_ambassador->privateRefs->executeService(&req, &rep);
 
 	G1516.Out(pdGendoc,"exit  RTIambassador::RTIambassador");
 
diff -U 3 -H -d -r -N -x '*.kdev' -x '.svn*' -x 'CVS*' -- patched/libRTIA/CMakeLists.txt origin/libRTIA/CMakeLists.txt
--- patched/libRTIA/CMakeLists.txt	2012-01-16 09:26:13.000000000 +0400
+++ origin/libRTIA/CMakeLists.txt	1970-01-01 03:00:00.000000000 +0300
@@ -1,163 +0,0 @@
-include_directories(${CMAKE_SOURCE_DIR}/libCERTI)
-include_directories(${CMAKE_SOURCE_DIR}/libRTI)
-include_directories(${CMAKE_SOURCE_DIR}/libHLA)
-
-# these directories are globally included
-# include_directories(${CMAKE_BINARY_DIR}/include)
-# include_directories(${CMAKE_SOURCE_DIR}/include)
-include_directories(${CMAKE_SOURCE_DIR}/include/RTI)
-
-include_directories(${CMAKE_SOURCE_DIR}/RTIA)
-include_directories(${CMAKE_SOURCE_DIR}/libRTIA)
-
-#macro to add source files from different subdirectories
-macro( add_sources_from_dir res_list source_dir source_file )
-  file( TO_CMAKE_PATH ${source_dir} dir )
-  set( sources ${ARGV} )
-  list( REMOVE_AT sources 0 1 )
-  foreach( item IN ITEMS ${sources} )
-    list( APPEND ${res_list} "${dir}/${item}" )
-  endforeach( item )
-endmacro( add_sources_from_dir )
-
-add_sources_from_dir( RTI_LIB_SRCS "${CMAKE_SOURCE_DIR}/libRTI/"
-  RTIambassador.cc
-  RTIambPrivateRefs.cc
-  RTItypes.cc
-  RTItypesImp.cc
-)
-
-add_sources_from_dir( RTI1516_LIB_SRCS "${CMAKE_SOURCE_DIR}/libRTI/"
-  RTI1516ambassadorFactory.cpp
-  RTI1516exception.cpp
-  RTI1516variableLengthData.cpp
-  RTI1516ambassador.cpp
-  RTI1516ambPrivateRefs.cpp
-  RTI1516Handle.cpp
-  RTI1516HandleImplementation.cpp
-  RTI1516ambTime.cpp
-  RTI1516fedAmbassador.cpp
-  RTI1516HandleFactory.cpp
-)
-
-add_sources_from_dir( RTIA_SRCS "${CMAKE_SOURCE_DIR}/RTIA/"
-  Communications.cc
-  DataDistribution.cc
-  DeclarationManagement.cc
-  FederationManagement.cc
-  Files.cc
-  ObjectManagement.cc
-  OwnershipManagement.cc
-  RTIA.cc
-  RTIA_federate.cc
-  RTIA_network.cc
-  RTIA_cmdline.c
-  Statistics.cc
-  TimeManagement.cc
-)
-
-list( APPEND RTI1516_LIB_SRCS ${RTIA_SRCS} )
-
-
-
-# TODO: currently following lines are copy-pasted with minor fixes from the main multi-process branch.
-# It should be separated into the self-sufficient function or merged.
-
-
-##########################################################
-
-ADD_LIBRARY(RTI ${RTI_LIB_SRCS} )
-TARGET_LINK_LIBRARIES(RTI CERTI FedTime)
-
-IF (BUILD_LEGACY_LIBRTI)
-    MESSAGE(STATUS "libRTI variant: CERTI legacy")
-    SET_TARGET_PROPERTIES(RTI PROPERTIES OUTPUT_NAME "RTI")
-    SET_TARGET_PROPERTIES(RTI PROPERTIES COMPILE_FLAGS "-DLEGACY_LIBRTI")
-ELSE (BUILD_LEGACY_LIBRTI)
-    MESSAGE(STATUS "libRTI variant: HLA 1.3 NG")
-    SET_TARGET_PROPERTIES(RTI PROPERTIES OUTPUT_NAME "RTI-NG")
-    SET_TARGET_PROPERTIES(RTI PROPERTIES COMPILE_FLAGS "-DHLA13NG_LIBRTI")
-ENDIF (BUILD_LEGACY_LIBRTI)
-SET_TARGET_PROPERTIES(RTI PROPERTIES VERSION 1.0.0 SOVERSION 1)
-IF (MINGW)
-    SET_TARGET_PROPERTIES(RTI PROPERTIES LINK_FLAGS "-Wl,--output-def,${LIBRARY_OUTPUT_PATH}/libRTI.def")
-    INSTALL(FILES ${LIBRARY_OUTPUT_PATH}/libRTI.def
-            DESTINATION lib)
-ENDIF (MINGW)
-
-##########################################################
-
-ADD_LIBRARY(RTI1516 ${RTI1516_LIB_SRCS} )
-TARGET_LINK_LIBRARIES(RTI1516 CERTI FedTime1516 boost_thread )
-
-MESSAGE(STATUS "libRTI variant: HLA 1516")
-SET_TARGET_PROPERTIES(RTI1516 PROPERTIES OUTPUT_NAME "RTI1516")
-SET_TARGET_PROPERTIES(RTI1516 PROPERTIES COMPILE_FLAGS
-  "-DHLA13NG_LIBRTI -DRTI_DISABLE_WARNINGS -DBUILDING_RTI -DBUILD_RTIA_AS_THREAD")
-SET_TARGET_PROPERTIES(RTI1516 PROPERTIES VERSION 1.0.0 SOVERSION 1)
-IF (MINGW)
-    SET_TARGET_PROPERTIES(RTI1516 PROPERTIES LINK_FLAGS "-Wl,--output-def,${LIBRARY_OUTPUT_PATH}/libRTI1516.def")
-    INSTALL(FILES ${LIBRARY_OUTPUT_PATH}/libRTI1516.def
-            DESTINATION lib)
-ENDIF (MINGW)
-
-##################################################################
-# Lib FedTime
-# A replacement lib FedTime may be provided by the user
-# CERTI is provided one. The lib FedTime depends on libRTI
-# since it inherits from the RTI::FedTime abstract class.
-##################################################################
-IF(CMAKE_COMPILER_IS_GNUCC)
-    SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long")
-ENDIF(CMAKE_COMPILER_IS_GNUCC)
-IF(CMAKE_COMPILER_IS_GNUCXX)
-    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-long-long")
-ENDIF(CMAKE_COMPILER_IS_GNUCXX)
-
-SET(FEDTIME_SRCS ../libRTI/RTIfedTime.cc)
-ADD_LIBRARY(FedTime ${FEDTIME_SRCS})
-
-SET_TARGET_PROPERTIES(FedTime PROPERTIES PROJECT_LABEL LibFedTime)
-IF (MINGW)
-    SET_TARGET_PROPERTIES(FedTime PROPERTIES LINK_FLAGS "-Wl,--output-def,${LIBRARY_OUTPUT_PATH}/libFedTime.def")
-    INSTALL(FILES ${LIBRARY_OUTPUT_PATH}/libFedTime.def
-            DESTINATION lib)
-ENDIF (MINGW)
-SET_TARGET_PROPERTIES(FedTime PROPERTIES VERSION 1.0.0 SOVERSION 1)
-
-SET(TestFedTime_SRCS ../libRTI/TestFedTime.cc )
-ADD_EXECUTABLE(TestFedTime ${TestFedTime_SRCS})
-TARGET_LINK_LIBRARIES(TestFedTime FedTime RTI)
-ADD_TEST(TestLibFedTime TestFedTime)
-
-##########################################################
-SET(FEDTIME1516_SRCS ../libRTI/RTI1516fedTime.cpp )
-IF (BUILD_WITH_EXTRA_LOGICAL_TIME)
-   LIST(APPEND FEDTIME1516_SRCS ../libRTI/LogicalTimeDouble.cpp )
-ENDIF(BUILD_WITH_EXTRA_LOGICAL_TIME)
-
-ADD_LIBRARY(FedTime1516 ${FEDTIME1516_SRCS} )
-
-SET_TARGET_PROPERTIES(FedTime1516 PROPERTIES PROJECT_LABEL LibFedTime1516)
-SET_TARGET_PROPERTIES(FedTime1516 PROPERTIES COMPILE_FLAGS "-DBUILDING_FEDTIME -DRTI_DISABLE_WARNINGS")
-IF (MINGW)
-    SET_TARGET_PROPERTIES(FedTime1516 PROPERTIES LINK_FLAGS "-Wl,--output-def,${LIBRARY_OUTPUT_PATH}/libFedTime1516.def")
-    INSTALL(FILES ${LIBRARY_OUTPUT_PATH}/libFedTime1516.def
-            DESTINATION lib)
-ENDIF (MINGW)
-SET_TARGET_PROPERTIES(FedTime1516 PROPERTIES VERSION 1.0.0 SOVERSION 1)
-
-SET(TestFedTime1516_SRCS ../libRTI/TestFedTime.cc )
-
-#ADD_EXECUTABLE(TestFedTime1516 ${TestFedTime1516_SRCS})
-# TODO: Should link with RTI1516 lib, instead of base RTI lib
-#TARGET_LINK_LIBRARIES(TestFedTime1516 FedTime1516 RTI)
-#ADD_TEST(TestLibFedTime1516 TestFedTime1516)
-
-# Install rules for both libRTI-NG and libFedTime
-INSTALL(TARGETS RTI FedTime RTI1516 FedTime1516
-    RUNTIME DESTINATION bin
-    LIBRARY DESTINATION lib
-    ARCHIVE DESTINATION lib)
-
-INSTALL(FILES ../libRTI/RTI1516fedTime.h DESTINATION include/RTI)
\ No newline at end of file
diff -U 3 -H -d -r -N -x '*.kdev' -x '.svn*' -x 'CVS*' -- patched/libRTIA/librtia_buf.hpp origin/libRTIA/librtia_buf.hpp
--- patched/libRTIA/librtia_buf.hpp	2012-01-19 11:47:02.000000000 +0400
+++ origin/libRTIA/librtia_buf.hpp	1970-01-01 03:00:00.000000000 +0300
@@ -1,54 +0,0 @@
-#pragma once
-#ifndef LIBRTIA_BUF_HPP
-#define LIBRTIA_BUF_HPP
-
-#include <boost/thread.hpp>
-#include <list>
-
-#include "../libCERTI/Message.hh"
-
-// FIXME: is the fair message buffer necessary here?
-// Mere pointer could be enough.
-//! The thread safe message queue class.
-class MsgBuf {
-	typedef boost::lock_guard<boost::mutex> Guard;
-	boost::condition_variable cond;
-	boost::mutex mut;
-	std::list<certi::Message*> buf;
-public:
-	void push( certi::Message* msg ) {
-		// TODO: find out wheather it is possible to use simple lock guard
-		Guard lock(mut);
-		buf.push_back( msg );
-		cond.notify_one();
-	}
-	certi::Message* pull() {
-		boost::unique_lock<boost::mutex> lock(mut);
-		while ( buf.empty() )
-			cond.wait( lock );
-		certi::Message* msg = buf.front();
-		buf.pop_front();
-		return msg;
-	}
-	bool empty() {
-		Guard lock(mut);
-		return buf.empty();
-	}
-	~MsgBuf() {
-		// FIXME: what should be done in case the buffer is not empty?
-		Guard lock(mut);
-		if ( buf.empty() ) {
-			typename std::list<certi::Message*>::iterator i, max_i = buf.end();
-			for( i = buf.begin(); i != max_i; i++ )
-				delete *i;
-		}
-	}
-};
-
-//! Thread safe message buffer set.
-class LibRTIABufSet {
-public:
-	MsgBuf fed2amb, amb2fed;
-};
-
-#endif // LIBRTIA_BUF_HPP
\ No newline at end of file
