[OSADL-svn-commits] r87 - in fapia-trunk/FAPIAIPCParameter/test: . communication communication/make communication/make/MPC communication/source concepts concepts/make concepts/make/MPC concepts/source marshalling marshalling/make marshalling/make/MPC marshalling/source source

OSADL repository commits osadl-svn-commits at lists.osadl.org
Tue Oct 2 11:46:51 CEST 2007


Author: tb10rts
Date: Thu Jul 19 07:18:07 2007
New Revision: 87

Log:


Added:
   fapia-trunk/FAPIAIPCParameter/test/
   fapia-trunk/FAPIAIPCParameter/test/communication/
   fapia-trunk/FAPIAIPCParameter/test/communication/make/
   fapia-trunk/FAPIAIPCParameter/test/communication/make/MPC/
   fapia-trunk/FAPIAIPCParameter/test/communication/make/MPC/testcommunication.mpc
   fapia-trunk/FAPIAIPCParameter/test/communication/make/MPC/testcommunication.mwc
   fapia-trunk/FAPIAIPCParameter/test/communication/make/makefile
   fapia-trunk/FAPIAIPCParameter/test/communication/makeall.bat
   fapia-trunk/FAPIAIPCParameter/test/communication/makefile
   fapia-trunk/FAPIAIPCParameter/test/communication/source/
   fapia-trunk/FAPIAIPCParameter/test/communication/source/testcommunication.cpp
   fapia-trunk/FAPIAIPCParameter/test/concepts/
   fapia-trunk/FAPIAIPCParameter/test/concepts/make/
   fapia-trunk/FAPIAIPCParameter/test/concepts/make/MPC/
   fapia-trunk/FAPIAIPCParameter/test/concepts/make/MPC/concepts.mpc
   fapia-trunk/FAPIAIPCParameter/test/concepts/make/MPC/concepts.mwc
   fapia-trunk/FAPIAIPCParameter/test/concepts/make/MPC/parameter_client.mpc
   fapia-trunk/FAPIAIPCParameter/test/concepts/make/MPC/parameter_server.mpc
   fapia-trunk/FAPIAIPCParameter/test/concepts/make/makefile
   fapia-trunk/FAPIAIPCParameter/test/concepts/makeall.bat
   fapia-trunk/FAPIAIPCParameter/test/concepts/makefile
   fapia-trunk/FAPIAIPCParameter/test/concepts/source/
   fapia-trunk/FAPIAIPCParameter/test/concepts/source/parameter_client.cpp
   fapia-trunk/FAPIAIPCParameter/test/concepts/source/parameter_handler.cpp
   fapia-trunk/FAPIAIPCParameter/test/concepts/source/parameter_handler.h
   fapia-trunk/FAPIAIPCParameter/test/concepts/source/parameter_server.cpp
   fapia-trunk/FAPIAIPCParameter/test/concepts/source/reply_handler.cpp
   fapia-trunk/FAPIAIPCParameter/test/concepts/source/reply_handler.h
   fapia-trunk/FAPIAIPCParameter/test/marshalling/
   fapia-trunk/FAPIAIPCParameter/test/marshalling/make/
   fapia-trunk/FAPIAIPCParameter/test/marshalling/make/MPC/
   fapia-trunk/FAPIAIPCParameter/test/marshalling/make/MPC/testmarshalling.mpc
   fapia-trunk/FAPIAIPCParameter/test/marshalling/make/MPC/testmarshalling.mwc
   fapia-trunk/FAPIAIPCParameter/test/marshalling/make/makefile
   fapia-trunk/FAPIAIPCParameter/test/marshalling/makeall.bat
   fapia-trunk/FAPIAIPCParameter/test/marshalling/makefile
   fapia-trunk/FAPIAIPCParameter/test/marshalling/source/
   fapia-trunk/FAPIAIPCParameter/test/marshalling/source/marshallingtest.cpp
   fapia-trunk/FAPIAIPCParameter/test/marshalling/source/marshallingtest.h
   fapia-trunk/FAPIAIPCParameter/test/marshalling/source/testmarshalling.cpp
   fapia-trunk/FAPIAIPCParameter/test/source/
   fapia-trunk/FAPIAIPCParameter/test/source/marshallingdata.cpp
   fapia-trunk/FAPIAIPCParameter/test/source/marshallingdata.h

Added: fapia-trunk/FAPIAIPCParameter/test/communication/make/MPC/testcommunication.mpc
==============================================================================
--- (empty file)
+++ fapia-trunk/FAPIAIPCParameter/test/communication/make/MPC/testcommunication.mpc	Thu Jul 19 07:18:07 2007
@@ -0,0 +1,14 @@
+project (testcommunication) : FAPIAIPCParameterlocalcomponentsexe, cppunitcomponentsexe {
+  
+  exename = testcommunication
+
+  includes += ../../../source ../../../../source
+  
+  source_files {
+    ../../source/testcommunication.cpp
+  }
+  
+  header_files {
+  }
+   
+}
\ No newline at end of file

Added: fapia-trunk/FAPIAIPCParameter/test/communication/make/MPC/testcommunication.mwc
==============================================================================
--- (empty file)
+++ fapia-trunk/FAPIAIPCParameter/test/communication/make/MPC/testcommunication.mwc	Thu Jul 19 07:18:07 2007
@@ -0,0 +1,3 @@
+workspace (testcommunication) {
+  testcommunication.mpc
+}
\ No newline at end of file

Added: fapia-trunk/FAPIAIPCParameter/test/communication/make/makefile
==============================================================================
--- (empty file)
+++ fapia-trunk/FAPIAIPCParameter/test/communication/make/makefile	Thu Jul 19 07:18:07 2007
@@ -0,0 +1,24 @@
+MODULE=testcommunication
+
+TYPES:= VC8_STATIC Automake
+
+NMAKE_STATIC_CFG="Static_Multi_Unicode_Debug_StaticRTL" "Static_Multi_Unicode_Release_StaticRTL"
+NMAKE_DLL_CFG= 
+GNU_LINUX_CFG = "Debug" "Release"
+
+MPC_DIRS := $(VIEW_ROOT)/DevTools_vob/cppunit/make/MPC/config $(VIEW_ROOT)/IOFramework_vob/FAPIA/make/MPC/config $(VIEW_ROOT)/ACE_Wrappers_vob/ACE_wrappers/make/MPC/config
+
+ALL: MPC BUILD
+
+BUILD: BUILD_ALL
+
+CLEAN: CLEAN_BUILD CLEAN_MPC
+
+REALCLEAN: REALCLEAN_BUILD CLEAN_MPC
+
+EXPORT: EXPORT_ALL
+
+%include <.homag_make_rules>
+%include <.homag_mpc_make_rules>
+%include <.homag_build_make_rules>
+%include <.homag_export_make_rules>

Added: fapia-trunk/FAPIAIPCParameter/test/communication/makeall.bat
==============================================================================
--- (empty file)
+++ fapia-trunk/FAPIAIPCParameter/test/communication/makeall.bat	Thu Jul 19 07:18:07 2007
@@ -0,0 +1,2 @@
+set ARP_Tools=%cd%\..\..\..\..\..\DevTools_vob\ARP-Tools
+ccperl %arp_tools%\mk.pl %*
\ No newline at end of file

Added: fapia-trunk/FAPIAIPCParameter/test/communication/makefile
==============================================================================
--- (empty file)
+++ fapia-trunk/FAPIAIPCParameter/test/communication/makefile	Thu Jul 19 07:18:07 2007
@@ -0,0 +1,10 @@
+SPEC = *
+MODULE_DIRS= $(SPEC,*D)
+MODULE_DIRS = ./make
+
+
+ALL: $(MODULE_DIRS) $(MAKETARGETS)
+ %echo ALL_SOURCES $(.SOURCES)
+
+%include <.homag_make_rules>
+%include <.homag_release_make_rules>

Added: fapia-trunk/FAPIAIPCParameter/test/communication/source/testcommunication.cpp
==============================================================================
--- (empty file)
+++ fapia-trunk/FAPIAIPCParameter/test/communication/source/testcommunication.cpp	Thu Jul 19 07:18:07 2007
@@ -0,0 +1,87 @@
+#include "FAPIAIPCParameterSenderService.h"
+#include "FAPIAIPCParameterReceiverTask.h"
+#include "FAPIAIPCParameterMethodRequestReadRequest.h"
+#include "FAPIAIPCParameterStreaming.h"
+#include "FAPIATrace.h"
+
+#include <ace/Activation_Queue.h>
+#include <sstream>
+
+using namespace FAPI::Acyclic::IPC::Parameter;
+
+int main (int argc, char* argv[])
+{  
+  FAPIA_TRACE;
+
+  ACE::init ();
+#ifdef _DEBUG
+  ACE_LOG_MSG->priority_mask (LM_INFO|LM_DEBUG|LM_ERROR|LM_WARNING, 
+                              ACE_Log_Msg::PROCESS);
+#else
+  ACE_LOG_MSG->priority_mask (LM_ERROR|LM_WARNING, ACE_Log_Msg::PROCESS);
+#endif /* _DEBUG */
+
+  ACE_Activation_Queue send_queue;
+  ACE_Activation_Queue receive_queue;
+
+  ReceiverTask receiver (&receive_queue);
+  receiver.activate ();
+
+  SenderService sender;
+  sender.send_queue (&send_queue);
+  sender.receive_queue (&receive_queue);
+
+  sender.activate ();
+
+  // enqueue MethodRequest
+  Parameter p;
+  p.parameter_name_ = "special parameter";
+  
+  MethodRequestReadRequest* request = new MethodRequestReadRequest ();
+  request->destination_physical_object_address_ = receiver.listen_addr ();
+  request->priority (2);
+  request->communication_.communication_error_.error_code_ = FAPIA_ERROR_OK;
+  request->communication_.send_reply_ = false;
+  request->communication_.logical_object_name_ = "testparameterobject";
+  request->communication_.source_physical_object_name_ = "TestObject";
+  request->communication_.transaction_id_ = 4398;
+  request->parameters_.push_back (p);
+
+  std::stringstream ss;
+  ss << "request = " << *request << endl;
+  FAPIA_DEBUG (LM_DEBUG, "%s", ss.str ().c_str ());
+
+  clock_t end_ticks;
+  clock_t start_ticks = clock ();
+  send_queue.enqueue (request);
+  MethodRequestReadRequest* result = 
+      ACE_dynamic_cast (MethodRequestReadRequest*, receive_queue.dequeue ());
+  end_ticks = ::clock ();
+
+  if (result == NULL)
+    {
+      FAPIA_DEBUG (LM_ERROR, 
+        "Method request did not get into the receive queue correctly!");
+    }
+  else 
+    {
+      if (*request != *result)
+        {
+          FAPIA_DEBUG (LM_ERROR, 
+            "data content was not delivered correctly!");
+
+          std::stringstream rss;
+          rss << "result = " << *result << endl;
+          FAPIA_DEBUG (LM_DEBUG, "%s", rss.str ().c_str ());
+        }
+    }
+
+  sender.shutdown ();
+  receiver.shutdown ();
+
+  FAPIA_DEBUG (LM_INFO, "SENDTIME: %d ticks\n", start_ticks);
+  FAPIA_DEBUG (LM_INFO, "RECVTIME: %d ticks\n", end_ticks);
+  FAPIA_DEBUG (LM_INFO, "difference : %d ticks with %d ticks per second", end_ticks - start_ticks, CLOCKS_PER_SEC);
+
+  return 0;
+}

Added: fapia-trunk/FAPIAIPCParameter/test/concepts/make/MPC/concepts.mpc
==============================================================================
--- (empty file)
+++ fapia-trunk/FAPIAIPCParameter/test/concepts/make/MPC/concepts.mpc	Thu Jul 19 07:18:07 2007
@@ -0,0 +1,15 @@
+project (concepts) : FAPIAIPCParameterlocalcomponentsexe {
+  
+  exename = testfapiaconcepts
+
+  macros += ACE_NTRACE=0
+
+  source_files {
+    ../../source/test_fapia_concepts.cpp
+    ../../../source/marshallingdata.cpp
+  }
+  
+  header_files {
+    ../../../source/marshallingdata.h
+  }
+}
\ No newline at end of file

Added: fapia-trunk/FAPIAIPCParameter/test/concepts/make/MPC/concepts.mwc
==============================================================================
--- (empty file)
+++ fapia-trunk/FAPIAIPCParameter/test/concepts/make/MPC/concepts.mwc	Thu Jul 19 07:18:07 2007
@@ -0,0 +1,5 @@
+workspace (concepts) {
+  //concepts.mpc
+  parameter_server.mpc
+  parameter_client.mpc  
+}
\ No newline at end of file

Added: fapia-trunk/FAPIAIPCParameter/test/concepts/make/MPC/parameter_client.mpc
==============================================================================
--- (empty file)
+++ fapia-trunk/FAPIAIPCParameter/test/concepts/make/MPC/parameter_client.mpc	Thu Jul 19 07:18:07 2007
@@ -0,0 +1,13 @@
+project (parameter_client) : FAPIAIPCParameterlocalcomponentsexe {
+  
+  exename = paramclient
+
+  source_files {
+    ../../source/parameter_client.cpp
+    ../../../source/marshallingdata.cpp
+  }
+  
+  header_files {
+    ../../../source/marshallingdata.h
+  }
+}
\ No newline at end of file

Added: fapia-trunk/FAPIAIPCParameter/test/concepts/make/MPC/parameter_server.mpc
==============================================================================
--- (empty file)
+++ fapia-trunk/FAPIAIPCParameter/test/concepts/make/MPC/parameter_server.mpc	Thu Jul 19 07:18:07 2007
@@ -0,0 +1,17 @@
+project (parameter_server) : FAPIAIPCParameterlocalcomponentsexe {
+  
+  exename = paramserv
+
+  source_files {
+    ../../source/parameter_server.cpp
+    ../../source/parameter_handler.cpp
+    ../../source/reply_handler.cpp
+    ../../../source/marshallingdata.cpp
+  }
+  
+  header_files {
+    ../../source/parameter_handler.h
+    ../../source/reply_handler.h
+    ../../../source/marshallingdata.h
+  }
+}
\ No newline at end of file

Added: fapia-trunk/FAPIAIPCParameter/test/concepts/make/makefile
==============================================================================
--- (empty file)
+++ fapia-trunk/FAPIAIPCParameter/test/concepts/make/makefile	Thu Jul 19 07:18:07 2007
@@ -0,0 +1,24 @@
+MODULE=concepts
+
+TYPES:= VC8 VC8_STATIC Automake
+
+NMAKE_STATIC_CFG="Static_Multi_Unicode_Debug_StaticRTL" "Static_Multi_Unicode_Release_StaticRTL"
+NMAKE_DLL_CFG= 
+GNU_LINUX_CFG = "Debug" "Release"
+
+MPC_DIRS := $(VIEW_ROOT)/IOFramework_vob/FAPIA/make/MPC/config $(VIEW_ROOT)/DevTools_vob/MPC/config $(VIEW_ROOT)/ACE_wrappers_vob/ACE_wrappers/make/MPC/config
+
+ALL:  MPC BUILD
+
+BUILD: BUILD_ALL 
+
+CLEAN:  CLEAN_BUILD CLEAN_MPC
+
+REALCLEAN: REALCLEAN_BUILD CLEAN_MPC
+
+EXPORT: EXPORT_ALL
+
+%include <.homag_make_rules>
+%include <.homag_mpc_make_rules>
+%include <.homag_build_make_rules>
+%include <.homag_export_make_rules>

Added: fapia-trunk/FAPIAIPCParameter/test/concepts/makeall.bat
==============================================================================
--- (empty file)
+++ fapia-trunk/FAPIAIPCParameter/test/concepts/makeall.bat	Thu Jul 19 07:18:07 2007
@@ -0,0 +1,2 @@
+set ARP_Tools=%cd%\..\..\..\..\..\DevTools_vob\ARP-Tools
+ccperl %arp_tools%\mk.pl %*
\ No newline at end of file

Added: fapia-trunk/FAPIAIPCParameter/test/concepts/makefile
==============================================================================
--- (empty file)
+++ fapia-trunk/FAPIAIPCParameter/test/concepts/makefile	Thu Jul 19 07:18:07 2007
@@ -0,0 +1,10 @@
+SPEC = *
+MODULE_DIRS= $(SPEC,*D)
+MODULE_DIRS = ./make
+
+
+ALL: $(MODULE_DIRS) $(MAKETARGETS)
+ %echo ALL_SOURCES $(.SOURCES)
+
+%include <.homag_make_rules>
+%include <.homag_release_make_rules>

Added: fapia-trunk/FAPIAIPCParameter/test/concepts/source/parameter_client.cpp
==============================================================================
--- (empty file)
+++ fapia-trunk/FAPIAIPCParameter/test/concepts/source/parameter_client.cpp	Thu Jul 19 07:18:07 2007
@@ -0,0 +1,173 @@
+#ifdef _DEBUG
+//#define ACE_NTRACE 0
+#endif
+
+#include <FAPIATrace.h>
+#include <FAPIA/FAPIAIPCParameter/test/source/marshallingdata.h>
+#include <FAPIA/FAPIAIPCParameter/source/FAPIAIPCParameterStreaming.h>
+#include <ace/SOCK_Connector.h>
+#include <ace/CDR_Stream.h>
+
+int main (int argc, char* argv[])
+{
+  FAPIA_TRACE;
+
+  const char *server_host = argc > 1 ? argv[1] : ACE_DEFAULT_SERVER_HOST;
+  int server_port = argc > 2 ? ACE_OS::atoi (argv[2]) : ACE_DEFAULT_SERVER_PORT;
+
+  ACE_SOCK_Stream server;
+  ACE_SOCK_Connector connector;
+  ACE_INET_Addr addr (ACE_static_cast (u_short,server_port),
+                      server_host);
+
+  if (connector.connect (server, addr) == -1)
+    {
+      ACE_TCHAR buffer[255];
+      addr.addr_to_string (buffer, 255);
+      FAPIA_DEBUG (LM_ERROR, "could not connect to address %s\n", buffer);
+      return -1;
+    }
+
+  FAPI::Acyclic::IPC::Parameter::Test::init_data ();
+
+  cout << "choose the request to send :\n\t[1] ReadRequest\n\t[2] ReadResponse"
+       << "\n\t[3] WriteRequest\n\t[4] WriteResponse\n\t[q] exit" << endl;
+
+  char c;
+  while (cin >> c)
+    {
+      switch (c)
+        {
+          case '1':
+            {
+              cout << endl << "sending " <<  g_read_request << endl;
+
+              // get necessary length for the buffer
+              unsigned long payload_size = 0;
+              payload_size += g_read_request;
+              ACE_OutputCDR payload (payload_size);
+              
+              // put data into the buffer
+              payload << g_read_request;
+              ACE_CDR::ULong length = payload.total_length ();
+
+              ACE_OutputCDR header (ACE_CDR::MAX_ALIGNMENT + FAPIA_HEADER_SIZE);
+              header << ACE_OutputCDR::from_boolean (ACE_CDR_BYTE_ORDER);
+              header << ACE_CDR::ULong (length);
+              header << ACE_CDR::ULong (FAPI::Acyclic::IPC::Parameter::FAPIA_READ_REQUEST);
+
+              iovec iov[2];
+              iov[0].iov_base = header.begin ()->rd_ptr ();
+              iov[0].iov_len = FAPIA_HEADER_SIZE;
+              iov[1].iov_base = payload.begin ()->rd_ptr ();
+              iov[1].iov_len = length;
+
+              if ( server.sendv_n (iov, 2) <= 0)
+                {
+                  ACE_DEBUG ((LM_ERROR, ACE_TEXT ("Could not send data!\n")));
+                  return 1;
+                }
+              break;
+            }
+          case '2':
+            {
+              cout << endl << "sending " <<  g_read_response << endl;
+
+              // get necessary length for the buffer
+              unsigned long payload_size = 0;
+              payload_size += g_read_response;
+              ACE_OutputCDR payload (payload_size);
+              
+              // put data into the buffer
+              payload << g_read_response;
+              ACE_CDR::ULong length = payload.total_length ();
+
+              ACE_OutputCDR header (ACE_CDR::MAX_ALIGNMENT + FAPIA_HEADER_SIZE);
+              header << ACE_OutputCDR::from_boolean (ACE_CDR_BYTE_ORDER);
+              header << ACE_CDR::ULong (length);
+              header << ACE_CDR::ULong (FAPI::Acyclic::IPC::Parameter::FAPIA_READ_RESPONSE);
+
+              iovec iov[2];
+              iov[0].iov_base = header.begin ()->rd_ptr ();
+              iov[0].iov_len = FAPIA_HEADER_SIZE;
+              iov[1].iov_base = payload.begin ()->rd_ptr ();
+              iov[1].iov_len = length;
+
+              if ( server.sendv_n (iov, 2) <= 0)
+                {
+                  ACE_DEBUG ((LM_ERROR, ACE_TEXT ("Could not send data!\n")));
+                  return 1;
+                }
+              break;
+            }
+          case '3':
+            {
+              cout << endl << "sending " <<  g_write_request << endl;
+
+              // get necessary length for the buffer
+              unsigned long payload_size = 0;
+              payload_size += g_write_request;
+              ACE_OutputCDR payload (payload_size);
+              
+              // put data into the buffer
+              payload << g_write_request;
+              ACE_CDR::ULong length = payload.total_length ();
+
+              ACE_OutputCDR header (ACE_CDR::MAX_ALIGNMENT + FAPIA_HEADER_SIZE);
+              header << ACE_OutputCDR::from_boolean (ACE_CDR_BYTE_ORDER);
+              header << ACE_CDR::ULong (length);
+              header << ACE_CDR::ULong (FAPI::Acyclic::IPC::Parameter::FAPIA_WRITE_REQUEST);
+
+              iovec iov[2];
+              iov[0].iov_base = header.begin ()->rd_ptr ();
+              iov[0].iov_len = FAPIA_HEADER_SIZE;
+              iov[1].iov_base = payload.begin ()->rd_ptr ();
+              iov[1].iov_len = length;
+
+              if ( server.sendv_n (iov, 2) <= 0)
+                {
+                  ACE_DEBUG ((LM_ERROR, ACE_TEXT ("Could not send data!\n")));
+                  return 1;
+                }
+              break;
+            }
+          case '4':
+            {
+              cout << endl << "sending " <<  g_write_response << endl;
+
+              // get necessary length for the buffer
+              unsigned long payload_size = 0;
+              payload_size += g_write_response;
+              ACE_OutputCDR payload (payload_size);
+              
+              // put data into the buffer
+              payload << g_write_response;
+              ACE_CDR::ULong length = payload.total_length ();
+
+              ACE_OutputCDR header (ACE_CDR::MAX_ALIGNMENT + FAPIA_HEADER_SIZE);
+              header << ACE_OutputCDR::from_boolean (ACE_CDR_BYTE_ORDER);
+              header << ACE_CDR::ULong (length);
+              header << ACE_CDR::ULong (FAPI::Acyclic::IPC::Parameter::FAPIA_WRITE_RESPONSE);
+
+              iovec iov[2];
+              iov[0].iov_base = header.begin ()->rd_ptr ();
+              iov[0].iov_len = FAPIA_HEADER_SIZE;
+              iov[1].iov_base = payload.begin ()->rd_ptr ();
+              iov[1].iov_len = length;
+
+              if ( server.sendv_n (iov, 2) <= 0)
+                {
+                  ACE_DEBUG ((LM_ERROR, ACE_TEXT ("Could not send data!\n")));
+                  return 1;
+                }
+              break;
+            }
+          case 'q':
+          default:
+            ACE_DEBUG ((LM_DEBUG, ACE_TEXT("finished.\n")));
+            return 0;
+        }
+    }
+
+  return 0;
+}

Added: fapia-trunk/FAPIAIPCParameter/test/concepts/source/parameter_handler.cpp
==============================================================================
--- (empty file)
+++ fapia-trunk/FAPIAIPCParameter/test/concepts/source/parameter_handler.cpp	Thu Jul 19 07:18:07 2007
@@ -0,0 +1,271 @@
+#include "parameter_handler.h"
+
+#include "FAPIATrace.h"
+#include <FAPIA/FAPIAIPCParameter/source/FAPIAIPCParameterStreaming.h>
+#include <FAPIA/FAPIAIPCParameter/test/source/marshallingdata.h>
+
+#include <ace/CDR_Stream.h>
+#include <ace/Activation_Queue.h>
+
+namespace FAPI
+  {
+    namespace Acyclic
+      {
+        namespace IPC
+          {
+            namespace Parameter
+              {
+                namespace Test
+                  {
+
+/*---------------------------------------------------------------------------*/
+
+ParameterHandler::ParameterHandler (void)
+{
+  FAPIA_TRACE;
+  queue_ = NULL;
+}
+
+/*---------------------------------------------------------------------------*/
+
+ParameterHandler::~ParameterHandler (void)
+{
+  FAPIA_TRACE;
+
+  ACE_Reactor::end_event_loop ();
+}
+
+/*---------------------------------------------------------------------------*/
+
+int ParameterHandler::open (void *)
+{
+  FAPIA_TRACE;
+
+  if (this->queue_ == NULL)
+    {
+      FAPIA_DEBUG (LM_ERROR, "parameter handler queue not initialized.");
+      return -1;
+    }
+
+  if (this->reactor ()->register_handler (this,
+         ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>::READ_MASK) == 1)
+    {
+      FAPIA_DEBUG (LM_ERROR, "could not register parameter handler");
+      return -1;
+    }
+
+  return 0;
+}
+
+/*---------------------------------------------------------------------------*/
+
+int ParameterHandler::handle_input (ACE_HANDLE)
+{
+  FAPIA_TRACE;
+
+  ACE_Message_Block *header_data =
+    new ACE_Message_Block (ACE_DEFAULT_CDR_BUFSIZE);
+  ACE_CDR::mb_align (header_data);
+
+  if (this->peer ().recv_n (header_data->wr_ptr (), FAPIA_HEADER_SIZE) == 
+      FAPIA_HEADER_SIZE)
+    {
+      header_data->wr_ptr (FAPIA_HEADER_SIZE);
+
+      ACE_InputCDR header_cdr (header_data);
+
+      ACE_CDR::Boolean byte_order;
+      header_cdr >> ACE_InputCDR::to_boolean (byte_order);
+      header_cdr.reset_byte_order (byte_order);
+
+      ACE_CDR::ULong data_length;
+      header_cdr >> data_length;
+
+      ACE_CDR::ULong method_request_val;
+      header_cdr >> method_request_val;
+      FAPI::Acyclic::IPC::Parameter::MethodRequestType method_request_type =
+        ACE_static_cast (FAPI::Acyclic::IPC::Parameter::MethodRequestType,
+                         method_request_val);
+
+      ACE_Message_Block *request_data =
+        new ACE_Message_Block (data_length);
+      ACE_CDR::mb_align (request_data);
+
+      if (this->peer ().recv_n (request_data->wr_ptr (), data_length) == (long)data_length)
+        {
+          request_data->wr_ptr (data_length);
+          ACE_InputCDR request_cdr (request_data);
+
+          switch (method_request_type)
+            {
+              case FAPIA_READ_REQUEST:
+                {
+                  FAPI::Acyclic::IPC::Parameter::MethodRequestReadRequest*
+                      read_request = new FAPI::Acyclic::IPC::Parameter::
+                          MethodRequestReadRequest;
+
+                  if ((request_cdr >> *read_request) &&
+                      !(*read_request != g_read_request))
+                    {
+                      cout << "enqueue " << *read_request << endl;
+                      queue_->enqueue (read_request);
+                    }
+                  else
+                    {
+                      ACE_ERROR ((LM_DEBUG, 
+                          ACE_TEXT("ReadRequest was not received correctly")));
+                      header_data->release ();
+                      header_data = NULL;
+                      request_data->release ();
+                      request_data = NULL;
+                      return -1;
+                    }
+
+                  break;
+                }
+              case FAPIA_READ_RESPONSE:
+                {
+                  FAPI::Acyclic::IPC::Parameter::MethodRequestReadResponse*
+                      read_response = new FAPI::Acyclic::IPC::Parameter::
+                          MethodRequestReadResponse;
+
+                  if ((request_cdr >> *read_response) &&
+                      !(*read_response != g_read_response))
+                    {
+                      cout << "enqueue " << *read_response << endl;
+                      queue_->enqueue (read_response);
+                    }
+                  else
+                    {
+                      ACE_ERROR ((LM_DEBUG, 
+                          ACE_TEXT("ReadResponse was not received correctly")));
+                      header_data->release ();
+                      header_data = NULL;
+                      request_data->release ();
+                      request_data = NULL;
+                      return -1;
+                    }
+
+                  break;
+                }
+              case FAPIA_WRITE_REQUEST:
+                {
+                  FAPI::Acyclic::IPC::Parameter::MethodRequestWriteRequest*
+                      write_request = new FAPI::Acyclic::IPC::Parameter::
+                          MethodRequestWriteRequest;
+
+                  if ((request_cdr >> *write_request) &&
+                      !(*write_request != g_write_request))
+                    {
+                      cout << "enqueue " << *write_request << endl;
+                      queue_->enqueue (write_request);
+                    }
+                  else
+                    {
+                      ACE_ERROR ((LM_DEBUG, 
+                          ACE_TEXT("WriteRequest was not received correctly")));
+                      header_data->release ();
+                      header_data = NULL;
+                      request_data->release ();
+                      request_data = NULL;
+                      return -1;
+                    }
+
+                  break;
+                }
+              case FAPIA_WRITE_RESPONSE:
+                {
+                  FAPI::Acyclic::IPC::Parameter::MethodRequestWriteResponse*
+                      write_response = new FAPI::Acyclic::IPC::Parameter::
+                          MethodRequestWriteResponse;
+
+                  if ((request_cdr >> *write_response) &&
+                      !(*write_response != g_write_response))
+                    {
+                      cout << "enqueue " << *write_response << endl;
+                      queue_->enqueue (write_response);
+                    }
+                  else
+                    {
+                      ACE_ERROR ((LM_DEBUG, 
+                          ACE_TEXT("WriteResponse was not received correctly")));
+                      header_data->release ();
+                      header_data = NULL;
+                      request_data->release ();
+                      request_data = NULL;
+                      return -1;
+                    }
+
+                  break;
+                }
+              default:
+                {
+                  ACE_DEBUG ((LM_ERROR, ACE_TEXT("unkown method request type revieved.\n")));
+                  header_data->release ();
+                  header_data = NULL;
+                  request_data->release ();
+                  request_data = NULL;
+                  return -1;
+                }
+            }
+
+          header_data->release ();
+          header_data = NULL;
+          return data_length + FAPIA_HEADER_SIZE;
+        }
+    }
+
+  header_data->release ();
+  header_data = NULL;
+  return 0;
+}
+
+/*---------------------------------------------------------------------------*/
+
+Parameter_Acceptor::Parameter_Acceptor (ACE_Activation_Queue* q)
+: queue_ (q)
+{
+}
+
+/*---------------------------------------------------------------------------*/
+
+Parameter_Acceptor::~Parameter_Acceptor (void)
+{
+}
+
+/*---------------------------------------------------------------------------*/
+
+int Parameter_Acceptor::accept_svc_handler (ParameterHandler* svc_handler)
+{
+  svc_handler->queue (this->queue_);
+
+  // Try to find out if the implementation of the reactor that we are
+  // using requires us to reset the event association for the newly
+  // created handle. This is because the newly created handle will
+  // inherit the properties of the listen handle, including its event
+  // associations.
+  int reset_new_handle = this->reactor ()->uses_event_associations ();
+
+  if (this->acceptor ().accept (svc_handler->peer (), // stream
+                                0, // remote address
+                                0, // timeout
+                                1, // restart
+                                reset_new_handle  // reset new handler
+                                ) == -1)
+    {
+      // Close down handler to avoid memory leaks.
+      svc_handler->close (0);
+
+      return -1;
+    }
+  else
+    return 0;
+}
+
+/*---------------------------------------------------------------------------*/
+
+                  } /* namespace Test */
+              } /* namespace Parameter */
+          } /* namespace IPC */
+      } /* namespace Acyclic */
+  } /* namespace FAPI */

Added: fapia-trunk/FAPIAIPCParameter/test/concepts/source/parameter_handler.h
==============================================================================
--- (empty file)
+++ fapia-trunk/FAPIAIPCParameter/test/concepts/source/parameter_handler.h	Thu Jul 19 07:18:07 2007
@@ -0,0 +1,71 @@
+/* -*- C++ -*- */
+
+//=============================================================================
+/**
+ *  @file    parameter_handler.h
+ *
+ *  $Id$
+ *
+ *  @author Friedhelm Wolf <friedhelm.wolf at homag.de>
+ */
+//=============================================================================
+
+#ifndef _FAPIA_IPC_PARAMETER_SOCKET_TEST_HANDLER_H_
+#define _FAPIA_IPC_PARAMETER_SOCKET_TEST_HANDLER_H_
+
+#include <ace/SOCK_Stream.h>
+#include <ace/Svc_Handler.h>
+#include <ace/Acceptor.h>
+#include <ace/SOCK_Acceptor.h>
+
+// forward declaration
+class ACE_Activation_Queue;
+
+namespace FAPI
+  {
+    namespace Acyclic
+      {
+        namespace IPC
+          {
+            namespace Parameter
+              {
+                namespace Test
+                  {
+
+                    class ParameterHandler : 
+                        public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>
+                      {
+                      public:
+                        ParameterHandler (void);
+                        ~ParameterHandler (void);
+
+                        virtual int open (void *);
+                        virtual int handle_input (ACE_HANDLE);
+
+                        void queue (ACE_Activation_Queue* q) {this->queue_ = q;}
+                      private:
+                        ACE_Activation_Queue* queue_;
+                      };
+
+                    class Parameter_Acceptor :
+                        public ACE_Acceptor<ParameterHandler, ACE_SOCK_ACCEPTOR>
+                      {
+                      public:
+                        Parameter_Acceptor (ACE_Activation_Queue* q);
+                        virtual ~Parameter_Acceptor ();
+
+                        virtual int accept_svc_handler (ParameterHandler* svc_handler);
+
+                      private:
+                        ACE_Activation_Queue* queue_;
+                      };
+
+                  } /* namespace Test */
+              } /* namespace Parameter */
+          } /* namespace IPC */
+      } /* namespace Acyclic */
+  } /* namespace FAPI */
+
+
+
+#endif /* _FAPIA_IPC_PARAMETER_SOCKET_TEST_HANDLER_H_ */

Added: fapia-trunk/FAPIAIPCParameter/test/concepts/source/parameter_server.cpp
==============================================================================
--- (empty file)
+++ fapia-trunk/FAPIAIPCParameter/test/concepts/source/parameter_server.cpp	Thu Jul 19 07:18:07 2007
@@ -0,0 +1,65 @@
+#ifdef _DEBUG
+//#define ACE_NTRACE 0
+#endif
+
+#include <FAPIATrace.h>
+#include "reply_handler.h"
+#include "parameter_handler.h"
+#include <FAPIA/FAPIAIPCParameter/test/source/marshallingdata.h>
+#include <FAPIA/FAPIAIPCParameter/source/FAPIAIPCParameterMethodRequestFinish.h>
+#include <ace/Activation_Queue.h>
+
+int main (int argc, char* argv[])
+  {
+    FAPIA_TRACE;
+
+    FAPI::Acyclic::IPC::Parameter::Test::init_data ();
+
+    // Create an adapter to end the event loop.
+    ACE_Sig_Adapter sa ((ACE_Sig_Handler_Ex) ACE_Reactor::end_event_loop);
+
+    ACE_Sig_Set sig_set;
+    sig_set.sig_add (SIGINT);
+    sig_set.sig_add (SIGQUIT);
+
+    // Register ourselves to receive SIGINT and SIGQUIT so we can shut
+    // down gracefully via signals.
+    if (ACE_Reactor::instance ()->register_handler (sig_set,
+                                                    &sa) == -1)
+      {
+        FAPIA_DEBUG (LM_ERROR, "could not register signal handler.\n");
+        return -1;
+      }
+
+    ACE_Activation_Queue request_queue;
+
+    FAPI::Acyclic::IPC::Parameter::Test::ReplyHandler reply_handler;
+    reply_handler.queue (&request_queue);
+    if (reply_handler.activate () == -1)
+      {
+        FAPIA_DEBUG (LM_ERROR, "could not start reply handler.\n");
+        return -1;
+      }
+
+    FAPI::Acyclic::IPC::Parameter::Test::Parameter_Acceptor param_acptr (&request_queue);
+    ACE_INET_Addr addr (argc > 1 ? (u_short)ACE_OS::atoi (argv[1]) : ACE_DEFAULT_SERVER_PORT);
+
+    if (param_acptr.open (addr, ACE_Reactor::instance ()) == -1)
+      {
+        ACE_TCHAR buffer[255];
+        addr.addr_to_string (buffer, 255);
+        FAPIA_DEBUG (LM_ERROR, "could not open address %s\n", buffer);
+        return -1;
+      }
+
+    FAPIA_DEBUG (LM_NOTICE, "waiting for requests ...\n");
+
+    ACE_Reactor::run_event_loop ();
+    request_queue.enqueue (new FAPI::Acyclic::IPC::Parameter::MethodRequestFinish ());
+    FAPIA_DEBUG (LM_NOTICE, "waiting for reply handler to finish ...\n");
+    reply_handler.wait ();
+
+    FAPIA_DEBUG (LM_NOTICE, "shutting down ...\n");
+
+    return 0;
+  }

Added: fapia-trunk/FAPIAIPCParameter/test/concepts/source/reply_handler.cpp
==============================================================================
--- (empty file)
+++ fapia-trunk/FAPIAIPCParameter/test/concepts/source/reply_handler.cpp	Thu Jul 19 07:18:07 2007
@@ -0,0 +1,121 @@
+#include "reply_handler.h"
+
+#include "FAPIATrace.h"
+#include <FAPIA/FAPIAIPCParameter/source/FAPIAIPCParameterStreaming.h>
+#include <FAPIA/FAPIAIPCParameter/test/source/marshallingdata.h>
+
+#include <ace/Activation_Queue.h>
+#include <ace/Bound_Ptr.h>
+
+namespace FAPI
+  {
+    namespace Acyclic
+      {
+        namespace IPC
+          {
+            namespace Parameter
+              {
+                namespace Test
+                  {
+
+/*---------------------------------------------------------------------------*/
+
+ReplyHandler::ReplyHandler (void)
+: shutdown_ (false)
+{
+  queue_ = NULL;
+}
+
+/*---------------------------------------------------------------------------*/
+
+ReplyHandler::~ReplyHandler (void)
+{
+}
+
+/*---------------------------------------------------------------------------*/
+
+int ReplyHandler::svc ()
+{
+  FAPIA_TRACE;
+
+  do
+    {
+      if (queue_ == NULL)
+        {
+          ACE_DEBUG ((LM_WARNING, ACE_TEXT ("queue was not initialized")));
+          shutdown_ = true;
+        }
+
+      ACE_Strong_Bound_Ptr<ACE_Method_Request, ACE_Null_Mutex> request(this->queue_->dequeue ());
+
+      if (!request.null ())
+        {
+        
+          if (request->call () != 0)
+            {
+              shutdown_ = true;
+            }
+          else
+            {
+              FAPI::Acyclic::IPC::Parameter::MethodRequestReadRequest* rreq =
+                  ACE_dynamic_cast (
+                      FAPI::Acyclic::IPC::Parameter::MethodRequestReadRequest*,
+                      request.get ());
+              if (rreq != NULL)
+                {
+                  cout << "dequeued " << *rreq << endl;
+                }
+              else
+                {
+                  FAPI::Acyclic::IPC::Parameter::MethodRequestReadResponse* rres =
+                      ACE_dynamic_cast (
+                          FAPI::Acyclic::IPC::Parameter::MethodRequestReadResponse*,
+                          request.get ());
+                  if (rres != NULL)
+                    {
+                      cout << "dequeued " << *rres << endl;
+                    }
+                  else
+                    {
+                      FAPI::Acyclic::IPC::Parameter::MethodRequestWriteRequest* wreq =
+                          ACE_dynamic_cast (
+                              FAPI::Acyclic::IPC::Parameter::MethodRequestWriteRequest*,
+                              request.get ());
+                      if (wreq != NULL)
+                        {
+                          cout << "dequeued " << *wreq << endl;
+                        }
+                      else
+                        {
+                          FAPI::Acyclic::IPC::Parameter::MethodRequestWriteResponse* wres =
+                              ACE_dynamic_cast (
+                                  FAPI::Acyclic::IPC::Parameter::MethodRequestWriteResponse*,
+                                  request.get ());
+                          if (wres != NULL)
+                            {
+                              cout << "dequeued " << *wres << endl;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+      else
+        {
+          ACE_DEBUG ((LM_WARNING, ACE_TEXT("could not read the enqueued request.")));
+          shutdown_ = true;
+        }
+
+    } while (shutdown_ == false);
+
+  FAPIA_DEBUG (LM_DEBUG, "closing reply handler.");
+  return 0;
+}
+
+/*---------------------------------------------------------------------------*/
+
+                  } /* namespace Test */
+              } /* namespace Parameter */
+          } /* namespace IPC */
+      } /* namespace Acyclic */
+  } /* namespace FAPI */

Added: fapia-trunk/FAPIAIPCParameter/test/concepts/source/reply_handler.h
==============================================================================
--- (empty file)
+++ fapia-trunk/FAPIAIPCParameter/test/concepts/source/reply_handler.h	Thu Jul 19 07:18:07 2007
@@ -0,0 +1,59 @@
+/* -*- C++ -*- */
+
+//=============================================================================
+/**
+ *  @file    reply_handler.h
+ *
+ *  $Id$
+ *
+ *  @author Friedhelm Wolf <friedhelm.wolf at homag.de>
+ */
+//=============================================================================
+
+#ifndef _FAPIA_IPC_PARAMETER_QUEUE_REPLY_HANDLER_H_
+#define _FAPIA_IPC_PARAMETER_QUEUE_REPLY_HANDLER_H_
+
+#include <ace/SOCK_Stream.h>
+#include <ace/Svc_Handler.h>
+#include <ace/Reactor_Notification_Strategy.h>
+
+// forward declaration
+class ACE_Activation_Queue;
+
+namespace FAPI
+  {
+    namespace Acyclic
+      {
+        namespace IPC
+          {
+            namespace Parameter
+              {
+                namespace Test
+                  {
+
+                    class ReplyHandler : 
+                        public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>
+                      {
+                      public:
+                        ReplyHandler (void);
+                        ~ReplyHandler (void);
+
+                        virtual int svc (void);
+
+                        void shutdown () {shutdown_ = true;}
+
+                        void queue (ACE_Activation_Queue* q) {this->queue_ = q;}
+                      private:
+                        ACE_Activation_Queue* queue_;
+                        bool shutdown_;
+                      };
+
+                  } /* namespace Test */
+              } /* namespace Parameter */
+          } /* namespace IPC */
+      } /* namespace Acyclic */
+  } /* namespace FAPI */
+
+
+
+#endif /* _FAPIA_IPC_PARAMETER_QUEUE_REPLY_HANDLER_H_ */

Added: fapia-trunk/FAPIAIPCParameter/test/marshalling/make/MPC/testmarshalling.mpc
==============================================================================
--- (empty file)
+++ fapia-trunk/FAPIAIPCParameter/test/marshalling/make/MPC/testmarshalling.mpc	Thu Jul 19 07:18:07 2007
@@ -0,0 +1,18 @@
+project (testmarshalling) : FAPIAIPCParameterlocalcomponentsexe, cppunitcomponentsexe {
+  
+  exename = testmarshalling
+
+  includes += ../../../source
+  
+  source_files {
+    ../../source/testmarshalling.cpp
+    ../../source/marshallingtest.cpp
+    ../../../source/marshallingdata.cpp
+  }
+  
+  header_files {
+    ../../source/marshallingtest.h
+    ../../../source/marshallingdata.h
+  }
+  
+}
\ No newline at end of file

Added: fapia-trunk/FAPIAIPCParameter/test/marshalling/make/MPC/testmarshalling.mwc
==============================================================================
--- (empty file)
+++ fapia-trunk/FAPIAIPCParameter/test/marshalling/make/MPC/testmarshalling.mwc	Thu Jul 19 07:18:07 2007
@@ -0,0 +1,3 @@
+workspace (testmarshalling) {
+  testmarshalling.mpc
+}
\ No newline at end of file

Added: fapia-trunk/FAPIAIPCParameter/test/marshalling/make/makefile
==============================================================================
--- (empty file)
+++ fapia-trunk/FAPIAIPCParameter/test/marshalling/make/makefile	Thu Jul 19 07:18:07 2007
@@ -0,0 +1,24 @@
+MODULE=testmarshalling
+
+TYPES:= VC8 VC8_STATIC Automake
+
+NMAKE_STATIC_CFG="Static_Multi_Unicode_Debug_StaticRTL" "Static_Multi_Unicode_Release_StaticRTL"
+NMAKE_DLL_CFG= 
+GNU_LINUX_CFG = "Debug" "Release"
+
+MPC_DIRS := $(VIEW_ROOT)/DevTools_vob/cppunit/make/MPC/config $(VIEW_ROOT)/IOFramework_vob/FAPIA/make/MPC/config $(VIEW_ROOT)/ACE_Wrappers_vob/ACE_wrappers/make/MPC/config
+
+ALL: MPC BUILD
+
+BUILD: BUILD_ALL
+
+CLEAN: CLEAN_BUILD CLEAN_MPC
+
+REALCLEAN: REALCLEAN_BUILD CLEAN_MPC
+
+EXPORT: EXPORT_ALL
+
+%include <.homag_make_rules>
+%include <.homag_mpc_make_rules>
+%include <.homag_build_make_rules>
+%include <.homag_export_make_rules>

Added: fapia-trunk/FAPIAIPCParameter/test/marshalling/makeall.bat
==============================================================================
--- (empty file)
+++ fapia-trunk/FAPIAIPCParameter/test/marshalling/makeall.bat	Thu Jul 19 07:18:07 2007
@@ -0,0 +1,2 @@
+set ARP_Tools=%cd%\..\..\..\..\..\DevTools_vob\ARP-Tools
+ccperl %arp_tools%\mk.pl %*
\ No newline at end of file

Added: fapia-trunk/FAPIAIPCParameter/test/marshalling/makefile
==============================================================================
--- (empty file)
+++ fapia-trunk/FAPIAIPCParameter/test/marshalling/makefile	Thu Jul 19 07:18:07 2007
@@ -0,0 +1,10 @@
+SPEC = *
+MODULE_DIRS= $(SPEC,*D)
+MODULE_DIRS = ./make
+
+
+ALL: $(MODULE_DIRS) $(MAKETARGETS)
+ %echo ALL_SOURCES $(.SOURCES)
+
+%include <.homag_make_rules>
+%include <.homag_release_make_rules>

Added: fapia-trunk/FAPIAIPCParameter/test/marshalling/source/marshallingtest.cpp
==============================================================================
--- (empty file)
+++ fapia-trunk/FAPIAIPCParameter/test/marshalling/source/marshallingtest.cpp	Thu Jul 19 07:18:07 2007
@@ -0,0 +1,315 @@
+// $Id$
+
+
+#include "marshallingtest.h"
+#include "marshallingdata.h"
+#include "FAPIA\FAPIAIPCParameter\source\FAPIAIPCParameterStreaming.h"
+#include <ace/CDR_Stream.h>
+
+namespace FAPI
+  {
+    namespace Acyclic
+      {
+        namespace IPC
+          {
+            namespace Parameter
+              {
+                namespace Test
+                  {
+
+CPPUNIT_TEST_SUITE_REGISTRATION (MarshallingTest);
+
+/*---------------------------------------------------------------------------*/
+
+MarshallingTest::MarshallingTest()
+  {
+  }
+
+/*---------------------------------------------------------------------------*/
+
+void MarshallingTest::setUp()
+  {
+  }
+
+/*---------------------------------------------------------------------------*/
+
+void MarshallingTest::tearDown()
+  {
+  }
+
+/*---------------------------------------------------------------------------*/
+
+void MarshallingTest::test_base_types ()
+  {
+    std::cout << std::endl << __FUNCTION__ << std::endl;
+
+    // test marshalling of FAPI::Acyclic::IPC::Parameter::Communication
+
+    FAPI::Acyclic::IPC::Parameter::Communication recv_comm;
+    ACE_OutputCDR cdr_out;
+    CPPUNIT_ASSERT (cdr_out << g_communication);
+    ACE_InputCDR cdr_in (cdr_out.begin ());
+    CPPUNIT_ASSERT (cdr_in >> recv_comm);
+    CPPUNIT_ASSERT (!(g_communication != recv_comm));
+
+    // test marshalling of FAPI::Acyclic::IPC::Parameter::Parameter
+    FAPI::Acyclic::IPC::Parameter::Parameter recv_param;
+    cdr_out.reset ();
+    CPPUNIT_ASSERT (cdr_out << g_parameters[0]);
+    cdr_in.reset (cdr_out.begin (), cdr_out.byte_order ());
+    CPPUNIT_ASSERT (cdr_in >> recv_param);
+    CPPUNIT_ASSERT (!(g_parameters[0] != recv_param));
+
+    // test marshalling of FAPI::Acyclic::IPC::Parameter::Value
+    FAPI::Acyclic::IPC::Parameter::Value recv_value;
+    cdr_out.reset ();
+    CPPUNIT_ASSERT (cdr_out << g_values[0]);
+    cdr_in.reset (cdr_out.begin (), cdr_out.byte_order ());
+    CPPUNIT_ASSERT (cdr_in >> recv_value);
+    CPPUNIT_ASSERT (!(g_values[0] != recv_value));
+
+    // test marshalling of FAPI::Acyclic::IPC::Parameter::Error
+    FAPI::Acyclic::IPC::Parameter::Error recv_error;
+    cdr_out.reset ();
+    CPPUNIT_ASSERT (cdr_out << g_errors[0]);
+    cdr_in.reset (cdr_out.begin (), cdr_out.byte_order ());
+    CPPUNIT_ASSERT (cdr_in >> recv_error);
+    CPPUNIT_ASSERT (!(g_errors[0] != recv_error));
+  }
+
+/*---------------------------------------------------------------------------*/
+
+void MarshallingTest::test_vectors()
+  {
+    std::cout << std::endl << __FUNCTION__ << std::endl;
+
+    // test marshalling of parameter vector
+    FAPI::Acyclic::IPC::Parameter::Parameters recv_params;
+    ACE_OutputCDR cdr_out;
+    CPPUNIT_ASSERT (cdr_out << g_parameters);
+    ACE_InputCDR cdr_in (cdr_out.begin ());
+    CPPUNIT_ASSERT (cdr_in >> recv_params);
+    CPPUNIT_ASSERT (!(g_parameters != recv_params));
+
+    // test marshalling of value vector
+    FAPI::Acyclic::IPC::Parameter::Values recv_values;
+    cdr_out.reset ();
+    CPPUNIT_ASSERT (cdr_out << g_values);
+    cdr_in.reset (cdr_out.begin (), cdr_out.byte_order ());
+    CPPUNIT_ASSERT (cdr_in >> recv_values);
+    CPPUNIT_ASSERT (!(g_values != recv_values));
+
+    // test marshalling of error vector
+    FAPI::Acyclic::IPC::Parameter::Errors recv_errors;
+    cdr_out.reset ();
+    CPPUNIT_ASSERT (cdr_out << g_errors);
+    cdr_in.reset (cdr_out.begin (), cdr_out.byte_order ());
+    CPPUNIT_ASSERT (cdr_in >> recv_errors);
+    CPPUNIT_ASSERT (!(g_errors != recv_errors));
+  }
+
+/*---------------------------------------------------------------------------*/
+
+void MarshallingTest::test_method_requests()
+  {
+    std::cout << std::endl << __FUNCTION__ << std::endl;
+
+    // test marshalling of MethodRequestReadRequest
+    FAPI::Acyclic::IPC::Parameter::MethodRequestReadRequest recv_rrequest;
+    ACE_OutputCDR cdr_out;
+    CPPUNIT_ASSERT (cdr_out << g_read_request);
+    ACE_InputCDR cdr_in (cdr_out.begin ());
+    CPPUNIT_ASSERT (cdr_in >> recv_rrequest);
+    CPPUNIT_ASSERT (!(g_read_request != recv_rrequest));
+
+    // test marshalling of MethodRequestReadResponse
+    FAPI::Acyclic::IPC::Parameter::MethodRequestReadResponse recv_rresponse;
+    cdr_out.reset ();
+    CPPUNIT_ASSERT (cdr_out << g_read_response);
+    cdr_in.reset_contents (); // don't know why, but I have to delete contents
+    cdr_in.reset (cdr_out.begin (), cdr_out.byte_order ());
+    CPPUNIT_ASSERT (cdr_in >> recv_rresponse);
+    CPPUNIT_ASSERT (!(g_read_response != recv_rresponse));
+
+    // test marshalling of MethodRequestWriteRequest
+    FAPI::Acyclic::IPC::Parameter::MethodRequestWriteRequest recv_wrequest;
+    cdr_out.reset ();
+    CPPUNIT_ASSERT (cdr_out << g_write_request);
+    cdr_in.reset_contents (); // don't know why, but I have to delete contents
+    cdr_in.reset (cdr_out.begin (), cdr_out.byte_order ());
+    CPPUNIT_ASSERT (cdr_in >> recv_wrequest);
+    CPPUNIT_ASSERT (!(g_write_request != recv_wrequest));
+
+    // test marshalling of MethodRequestWriteResponse
+    FAPI::Acyclic::IPC::Parameter::MethodRequestWriteResponse recv_wresponse;
+    cdr_out.reset ();
+    CPPUNIT_ASSERT (cdr_out << g_write_response);
+    cdr_in.reset_contents (); // don't know why, but I have to delete contents
+    cdr_in.reset (cdr_out.begin (), cdr_out.byte_order ());
+    CPPUNIT_ASSERT (cdr_in >> recv_wresponse);
+    CPPUNIT_ASSERT (!(g_write_response != recv_wresponse));
+  }
+
+/*---------------------------------------------------------------------------*/
+
+void MarshallingTest::test_size_evaluation ()
+{
+  std::cout << std::endl << __FUNCTION__ << std::endl;
+
+  // test size of FAPI::Acyclic::IPC::Parameter::Communication
+  unsigned long comm_size = 0;
+  comm_size += g_communication;
+  ACE_OutputCDR cdr;
+  cdr << g_communication;
+  CPPUNIT_ASSERT (comm_size >= cdr.total_length ());
+
+  // test size of FAPI::Acyclic::IPC::Parameter::Parameter
+  unsigned long param_size = 0;
+  param_size += g_parameters[0];
+  cdr.reset ();
+  cdr << g_parameters[0];
+  CPPUNIT_ASSERT (param_size == cdr.total_length ());
+
+  // test size of parameter vector
+  unsigned long params_size = 0;
+  params_size += g_parameters;
+  cdr.reset ();
+  cdr << g_parameters;
+  CPPUNIT_ASSERT (params_size >= cdr.total_length ());
+
+  // test size of FAPI::Acyclic::IPC::Parameter::Value
+  unsigned long value_size = 0;
+  value_size += g_values[0];
+  cdr.reset ();
+  cdr << g_values[0];
+  CPPUNIT_ASSERT (value_size >= cdr.total_length ());
+
+  // test size of value vector
+  unsigned long values_size = 0;
+  values_size += g_values;
+  cdr.reset ();
+  cdr << g_values;
+  CPPUNIT_ASSERT (values_size >= cdr.total_length ());
+
+  // test size of FAPI::Acyclic::IPC::Parameter::Error
+  unsigned long error_size = 0;
+  error_size += g_errors[0];
+  cdr.reset ();
+  cdr << g_errors[0];
+  CPPUNIT_ASSERT (error_size >= cdr.total_length ());
+
+  // test size of error vector
+  unsigned long errors_size = 0;
+  errors_size += g_errors;
+  cdr.reset ();
+  cdr << g_errors;
+  CPPUNIT_ASSERT (errors_size >= cdr.total_length ());
+
+  // test size of MethodRequestReadRequest
+  unsigned long read_request_size = 0;
+  read_request_size += g_read_request;
+  cdr.reset ();
+  cdr << g_read_request;
+  CPPUNIT_ASSERT (read_request_size >= cdr.total_length ());
+
+  // test size of MethodRequestReadResponse
+  unsigned long read_response_size = 0;
+  read_response_size += g_read_response;
+  cdr.reset ();
+  cdr << g_read_response;
+  CPPUNIT_ASSERT (read_response_size >= cdr.total_length ());
+
+  // test size of MethodRequestWriteRequest
+  unsigned long write_request_size = 0;
+  write_request_size += g_write_request;
+  cdr.reset ();
+  cdr << g_write_request;
+  CPPUNIT_ASSERT (write_request_size >= cdr.total_length ());
+
+  // test size of MethodRequestWriteResponse
+  unsigned long write_response_size = 0;
+  write_response_size += g_write_response;
+  cdr.reset ();
+  cdr << g_write_response;
+  CPPUNIT_ASSERT (write_response_size >= cdr.total_length ());
+}
+
+/*---------------------------------------------------------------------------*/
+
+void MarshallingTest::test_string_streaming ()
+{
+  std::cout << std::endl << __FUNCTION__ << std::endl;
+
+  std::stringstream rrqss, rrpss, wrqss, wrpss;
+
+  std::string rrqstr = "ReadRequest {\n\tprio=99\n\tdest=192.0.0.4:9900\n\t";
+  rrqstr += "communication [id=9876543, logical_name=my logical object, obj";
+  rrqstr += "_name=my physical object name, send_reply=1]\n\tparameters (pa";
+  rrqstr += "rameter [my first parameter], parameter [my second parameter],";
+  rrqstr += " parameter [my third parameter], )\n}\n";
+
+  std::string rrpstr = "ReadResponse {\n\tprio=23\n\tdest=127.0.0.1:1212\n";
+  rrpstr += "\tcommunication [id=9876543, logical_name=my logical object, ";
+  rrpstr += "obj_name=my physical object name, send_reply=1]\n\tparameters";
+  rrpstr += " (parameter [my first parameter], parameter [my second parame";
+  rrpstr += "ter], parameter [my third parameter], )\n\tvalues (value [typ";
+  rrpstr += "e=7, len=26, data=Hamp], value [type=5, len=4, data=ÿÿÿ";
+  rrpstr += (char) 0x7f;
+  rrpstr += "], value [type=8, len=";
+  rrpstr += "8, data=";
+  rrpstr += (char) 0xec;
+  rrpstr += (char) 0x1e;
+  rrpstr += (char) 0x22;
+  rrpstr += (char) 0x82;
+  rrpstr += "], )\n\terrors (error [code=FAPIA_ERROR_OBJECT_N";
+  rrpstr += "OT_FOUND, reason=My bonnie is over the ocean, my bonnie is ov";
+  rrpstr += "er the sea.], error [code=FAPIA_ERROR_COMMUNICATION, reason=W";
+  rrpstr += "hat did you say? I don't understand German!], error [code=FAP";
+  rrpstr += "IA_ERROR_CONFIG_PARSE_ERROR, reason=asdf ölkj hiks kisikss ör";
+  rrpstr += "ks], )\n}\n";
+
+  std::string wrqstr = "WriteRequest {\n\tprio=1\n\tdest=23.233.2.121:3000\n";
+  wrqstr += "\tcommunication [id=9876543, logical_name=my logical object, ob";
+  wrqstr += "j_name=my physical object name, send_reply=1]\n\tparameters (pa";
+  wrqstr += "rameter [my first parameter], parameter [my second parameter], ";
+  wrqstr += "parameter [my third parameter], )\n\tvalues (value [type=7, len";
+  wrqstr += "=26, data=Hamp], value [type=5, len=4, data=ÿÿÿ";
+  wrqstr += (char) 0x7f;
+  wrqstr += "], value [type=8, len=8, data=";
+  wrqstr += (char) 0xec;
+  wrqstr += (char) 0x1e;
+  wrqstr += (char) 0x22;
+  wrqstr += (char) 0x82;
+  wrqstr += "], )\n}\n";
+
+  std::string wrpstr = "WriteResponse {\n\tprio=87\n\tdest=1.2.3.4:5678\n\tco";
+  wrpstr += "mmunication [id=9876543, logical_name=my logical object, obj_nam";
+  wrpstr += "e=my physical object name, send_reply=1]\n\tparameters (paramete";
+  wrpstr += "r [my first parameter], parameter [my second parameter], paramet";
+  wrpstr += "er [my third parameter], )\n\terrors (error [code=FAPIA_ERROR_OB";
+  wrpstr += "JECT_NOT_FOUND, reason=My bonnie is over the ocean, my bonnie is";
+  wrpstr += " over the sea.], error [code=FAPIA_ERROR_COMMUNICATION, reason=W";
+  wrpstr += "hat did you say? I don't understand German!], error [code=FAPIA_";
+  wrpstr += "ERROR_CONFIG_PARSE_ERROR, reason=asdf ölkj hiks kisikss örks], )";
+  wrpstr += "\n}\n";
+
+  rrqss << g_read_request;
+  CPPUNIT_ASSERT (rrqstr.compare (rrqss.str ()) == 0);
+
+  rrpss << g_read_response;
+  CPPUNIT_ASSERT (rrpstr.compare (rrpss.str ()) == 0);
+
+  wrqss << g_write_request;
+  CPPUNIT_ASSERT (wrqstr.compare (wrqss.str ()) == 0);
+
+  wrpss << g_write_response;
+  CPPUNIT_ASSERT (wrpstr.compare (wrpss.str ()) == 0);
+}
+
+/*---------------------------------------------------------------------------*/
+
+                 } /* namespace Test */
+              } /* namespace Parameter */
+          } /* namespace IPC */
+      } /* namespace Acyclic */
+  } /* namespace FAPI */

Added: fapia-trunk/FAPIAIPCParameter/test/marshalling/source/marshallingtest.h
==============================================================================
--- (empty file)
+++ fapia-trunk/FAPIAIPCParameter/test/marshalling/source/marshallingtest.h	Thu Jul 19 07:18:07 2007
@@ -0,0 +1,64 @@
+/* -*- C++ -*- */
+
+//=============================================================================
+/**
+ *  @file    marshallingtest.h
+ *
+ *  $Id$
+ *
+ *  @author Friedhelm Wolf <friedhelm.wolf at homag.de>
+ */
+//=============================================================================
+
+#ifndef _FAPIA_IPC_PARAMETER_MARSHALLING_TEST_H_
+#define _FAPIA_IPC_PARAMETER_MARSHALLING_TEST_H_
+
+#ifdef WIN32
+#  pragma warning (disable : 4512)
+#endif
+
+#include <cppunit/extensions/HelperMacros.h>
+
+namespace FAPI
+  {
+    namespace Acyclic
+      {
+        namespace IPC
+          {
+            namespace Parameter
+              {
+                namespace Test
+                  {
+                    class MarshallingTest : public CppUnit::TestFixture
+                      {
+                      public:
+                        CPPUNIT_TEST_SUITE (MarshallingTest);
+                        CPPUNIT_TEST (test_base_types);
+                        CPPUNIT_TEST (test_vectors);
+                        CPPUNIT_TEST (test_method_requests);
+                        CPPUNIT_TEST (test_size_evaluation);
+                        CPPUNIT_TEST (test_string_streaming);
+                        CPPUNIT_TEST_SUITE_END ();
+                      
+                      private:
+                      
+                      public:
+                        MarshallingTest (void);
+
+                        void setUp (void);
+                        void tearDown (void);
+
+                        void test_base_types (void);
+                        void test_vectors (void);
+                        void test_method_requests (void);
+                        void test_size_evaluation (void);
+                        void test_string_streaming (void);
+                      }; /* class MarshallingTest */
+
+                } /* namespace Test */
+              } /* namespace Parameter */
+          } /* namespace IPC */
+      } /* namespace Acyclic */
+  } /* namespace FAPI */
+
+#endif // _FAPIA_IPC_PARAMETER_MARSHALLING_TEST_H_

Added: fapia-trunk/FAPIAIPCParameter/test/marshalling/source/testmarshalling.cpp
==============================================================================
--- (empty file)
+++ fapia-trunk/FAPIAIPCParameter/test/marshalling/source/testmarshalling.cpp	Thu Jul 19 07:18:07 2007
@@ -0,0 +1,29 @@
+#include <stdio.h>
+#include <assert.h>
+
+#ifdef WIN32
+#  pragma warning (disable : 4100)
+#  pragma warning (push)
+#endif /* WIN32 */
+
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/TestResult.h>
+#include <cppunit/TestResultCollector.h>
+#include <cppunit/ui/text/TestRunner.h>
+
+#include "marshallingdata.h"
+
+#ifdef WIN32
+#  pragma warning (pop)
+#endif /* WIN32 */
+
+int main( int argc, char **argv)
+{
+  FAPI::Acyclic::IPC::Parameter::Test::init_data ();
+
+  CppUnit::TextUi::TestRunner runner;
+  CppUnit::TestFactoryRegistry &registry = CppUnit::TestFactoryRegistry::getRegistry();
+  runner.addTest( registry.makeTest() );
+  bool wasSuccessful = runner.run( "", false);
+  return wasSuccessful;
+}

Added: fapia-trunk/FAPIAIPCParameter/test/source/marshallingdata.cpp
==============================================================================
--- (empty file)
+++ fapia-trunk/FAPIAIPCParameter/test/source/marshallingdata.cpp	Thu Jul 19 07:18:07 2007
@@ -0,0 +1,127 @@
+#include "marshallingdata.h"
+
+/*---------------------------------------------------------------------------*/
+
+FAPI::Acyclic::IPC::Parameter::Communication g_communication;
+FAPI::Acyclic::IPC::Parameter::Parameters g_parameters;
+FAPI::Acyclic::IPC::Parameter::Values g_values;
+FAPI::Acyclic::IPC::Parameter::Errors g_errors;
+FAPI::Acyclic::IPC::Parameter::MethodRequestReadRequest g_read_request;
+FAPI::Acyclic::IPC::Parameter::MethodRequestReadResponse g_read_response;
+FAPI::Acyclic::IPC::Parameter::MethodRequestWriteRequest g_write_request;
+FAPI::Acyclic::IPC::Parameter::MethodRequestWriteResponse g_write_response;
+
+/*---------------------------------------------------------------------------*/
+
+namespace FAPI
+  {
+    namespace Acyclic
+      {
+        namespace IPC
+          {
+            namespace Parameter
+              {
+                namespace Test
+                  {
+
+/*---------------------------------------------------------------------------*/
+
+void init_data (void)
+  {
+    // init communication
+    g_communication.send_reply_ = true;
+    g_communication.logical_object_name_ = "my logical object";
+    g_communication.source_physical_object_name_ =
+        "my physical object name";
+    g_communication.transaction_id_ = 9876543;
+    g_communication.communication_error_.error_code_ = 
+        FAPIA_ERROR_DESTINATION_NOT_ONLINE;
+    g_communication.communication_error_.reason_ = "could not open port 0909";
+    
+    // init parameters
+    Parameter param;
+    param.parameter_name_ = "my first parameter";
+    g_parameters.push_back (param);
+
+    param.parameter_name_ = "my second parameter";
+    g_parameters.push_back (param);
+
+    param.parameter_name_ = "my third parameter";
+    g_parameters.push_back (param);
+
+    // init values
+    char* test_data = new char[26];
+    ACE_OS::strcpy (test_data, "Hamptidamti dumm di \n dei");
+    Value val;
+    val.data_value (test_data, ACE_OS::strlen (test_data)+1);
+    val.data_type_ = FAPIA_DATA_TYPE_STRING;
+    g_values.push_back (val);
+
+    long* long_data = new long;
+    *long_data = LONG_MAX;
+    val.data_value (long_data, sizeof (*long_data));
+    val.data_type_ = FAPIA_DATA_TYPE_SGN32;
+    g_values.push_back (val);
+
+    double* double_data = new double;
+    *double_data = 123e-12;
+    val.data_value (double_data, sizeof (*double_data));
+    val.data_type_ = FAPIA_DATA_TYPE_REAL64;
+    g_values.push_back (val);
+
+    delete[] test_data;
+    delete long_data;
+    delete double_data;
+
+    // init errors
+    Error err;
+    err.error_code_ = FAPIA_ERROR_OBJECT_NOT_FOUND;
+    err.reason_ = "My bonnie is over the ocean, my bonnie is over the sea.";
+    g_errors.push_back (err);
+
+    err.error_code_ = FAPIA_ERROR_COMMUNICATION;
+    err.reason_ = "What did you say? I don't understand German!";
+    g_errors.push_back (err);
+    
+    err.error_code_ = FAPIA_ERROR_CONFIG_PARSE_ERROR;
+    err.reason_ = "asdf ölkj hiks kisikss örks";
+    g_errors.push_back (err);
+
+    // init g_read_request
+    g_read_request.priority (99);
+    g_read_request.communication_ = g_communication;
+    g_read_request.parameters_ = g_parameters;
+    g_read_request.destination_physical_object_address_ = "192.0.0.4:9900";
+
+    // init g_read_response
+    g_read_response.priority (23);
+    g_read_response.communication_ = g_communication;
+    g_read_response.parameters_ = g_parameters;
+    g_read_response.values_ = g_values;
+    g_read_response.errors_ = g_errors;
+    g_read_response.destination_physical_object_address_ = "127.0.0.1:1212";
+
+    // init g_write_request
+    g_write_request.priority (1);
+    g_write_request.communication_ = g_communication;
+    g_write_request.parameters_ = g_parameters;
+    g_write_request.values_ = g_values;
+    g_write_request.destination_physical_object_address_ = "23.233.2.121:3000";
+
+    // init g_write_response
+    g_write_response.priority (87);
+    g_write_response.communication_ = g_communication;
+    g_write_response.parameters_ = g_parameters;
+    g_write_response.errors_ = g_errors;
+    g_write_response.destination_physical_object_address_ = "1.2.3.4:5678";
+  }
+
+/*---------------------------------------------------------------------------*/
+
+                  } /* namespace Test */
+              } /* namespace Parameter */
+          } /* namespace IPC */
+      } /* namespace Acyclic */
+  } /* namespace FAPI */
+
+/*---------------------------------------------------------------------------*/

Added: fapia-trunk/FAPIAIPCParameter/test/source/marshallingdata.h
==============================================================================
--- (empty file)
+++ fapia-trunk/FAPIAIPCParameter/test/source/marshallingdata.h	Thu Jul 19 07:18:07 2007
@@ -0,0 +1,52 @@
+/* -*- C++ -*- */
+
+//=============================================================================
+/**
+ *  @file    marshallingdata.h
+ *
+ *  $Id$
+ *
+ *  @author Friedhelm Wolf <friedhelm.wolf at homag.de>
+ */
+//=============================================================================
+
+#ifndef _FAPIA_IPC_PARAMETER_MARSHALLING_DATA_H_
+#define _FAPIA_IPC_PARAMETER_MARSHALLING_DATA_H_
+
+#include <FAPIAIPCParameter/source/FAPIAIPCParameterMarshalling.h>
+
+extern FAPI::Acyclic::IPC::Parameter::Communication g_communication;
+extern FAPI::Acyclic::IPC::Parameter::Parameters g_parameters;
+extern FAPI::Acyclic::IPC::Parameter::Values g_values;
+extern FAPI::Acyclic::IPC::Parameter::Errors g_errors;
+
+extern FAPI::Acyclic::IPC::Parameter::MethodRequestReadRequest
+    g_read_request;
+
+extern FAPI::Acyclic::IPC::Parameter::MethodRequestReadResponse
+    g_read_response;
+
+extern FAPI::Acyclic::IPC::Parameter::MethodRequestWriteRequest
+    g_write_request;
+
+extern FAPI::Acyclic::IPC::Parameter::MethodRequestWriteResponse
+    g_write_response;
+
+namespace FAPI
+  {
+    namespace Acyclic
+      {
+        namespace IPC
+          {
+            namespace Parameter
+              {
+                namespace Test
+                  {
+                    void init_data (void);
+                  } /* namespace Test */
+              } /* namespace Parameter */
+          } /* namespace IPC */
+      } /* namespace Acyclic */
+  } /* namespace FAPI */
+
+#endif /* _FAPIA_IPC_PARAMETER_MARSHALLING_DATA_H_ */


More information about the OSADL-svn-commits mailing list