[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[certi-cvs] certi/libRTI/ieee1516-2000 LogicalTimeDouble.h ...
From: |
CERTI CVS commits |
Subject: |
[certi-cvs] certi/libRTI/ieee1516-2000 LogicalTimeDouble.h ... |
Date: |
Mon, 03 Mar 2014 16:41:53 +0000 |
CVSROOT: /sources/certi
Module name: certi
Changes by: Eric NOULARD <erk> 14/03/03 16:41:53
Modified files:
libRTI/ieee1516-2000: LogicalTimeDouble.h RTI1516fedTime.cpp
CMakeLists.txt LogicalTimeDouble.cpp
RTI1516fedTime.h
Added files:
libRTI/ieee1516-2000: RTIfedAmbassador.cpp RTIHandleFactory.h
RTIHandleFactory.cpp
HandleImplementation.cpp
RTIvariableLengthData.cpp
RTIambPrivateRefs.h RTIambassador.h
HandleImplementation.h
RTIambassadorFactory.cpp Handle.cpp
RTIambassador.cpp RTIambPrivateRefs.cpp
RTIvariableLengthDataImplementation.h
Exception.cpp RTIambTime.cpp
Removed files:
libRTI/ieee1516-2000: RTI1516ambassador.h
RTI1516variableLengthData.cpp
RTI1516exception.cpp
RTI1516HandleFactory.h RTI1516ambTime.cpp
RTI1516HandleImplementation.h
RTI1516fedAmbassador.cpp
RTI1516ambPrivateRefs.cpp
RTI1516Handle.cpp
RTI1516variableLengthDataImplementation.h
RTI1516ambassadorFactory.cpp
RTI1516HandleImplementation.cpp
RTI1516ambassador.cpp
RTI1516HandleFactory.cpp
RTI1516ambPrivateRefs.h
Log message:
Rename file since we now have a private directory.
It will ease the 1516-2000 --> 1516-2010 copy/paste
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/LogicalTimeDouble.h?cvsroot=certi&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTI1516fedTime.cpp?cvsroot=certi&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/CMakeLists.txt?cvsroot=certi&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/LogicalTimeDouble.cpp?cvsroot=certi&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTI1516fedTime.h?cvsroot=certi&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTIfedAmbassador.cpp?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTIHandleFactory.h?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTIHandleFactory.cpp?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/HandleImplementation.cpp?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTIvariableLengthData.cpp?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTIambPrivateRefs.h?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTIambassador.h?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/HandleImplementation.h?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTIambassadorFactory.cpp?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/Handle.cpp?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTIambassador.cpp?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTIambPrivateRefs.cpp?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTIvariableLengthDataImplementation.h?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/Exception.cpp?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTIambTime.cpp?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTI1516ambassador.h?cvsroot=certi&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTI1516variableLengthData.cpp?cvsroot=certi&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTI1516exception.cpp?cvsroot=certi&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTI1516HandleFactory.h?cvsroot=certi&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTI1516ambTime.cpp?cvsroot=certi&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTI1516HandleImplementation.h?cvsroot=certi&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTI1516fedAmbassador.cpp?cvsroot=certi&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTI1516ambPrivateRefs.cpp?cvsroot=certi&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTI1516Handle.cpp?cvsroot=certi&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTI1516variableLengthDataImplementation.h?cvsroot=certi&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTI1516ambassadorFactory.cpp?cvsroot=certi&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTI1516HandleImplementation.cpp?cvsroot=certi&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTI1516ambassador.cpp?cvsroot=certi&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTI1516HandleFactory.cpp?cvsroot=certi&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTI1516ambPrivateRefs.h?cvsroot=certi&r1=1.1&r2=0
Patches:
Index: LogicalTimeDouble.h
===================================================================
RCS file: /sources/certi/certi/libRTI/ieee1516-2000/LogicalTimeDouble.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- LogicalTimeDouble.h 3 Mar 2014 15:18:22 -0000 1.1
+++ LogicalTimeDouble.h 3 Mar 2014 16:41:48 -0000 1.2
@@ -1,5 +1,27 @@
-#ifndef LogicalTimeDouble_INCLUDED
-#define LogicalTimeDouble_INCLUDED
+// ----------------------------------------------------------------------------
+// CERTI - HLA RunTime Infrastructure
+// Copyright (C) 2002-2014 ONERA
+//
+// This file is part of CERTI-libRTI
+//
+// CERTI-libRTI is free software ; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License
+// as published by the Free Software Foundation ; either version 2 of
+// the License, or (at your option) any later version.
+//
+// CERTI-libRTI is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY ; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this program ; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA
+//
+// ----------------------------------------------------------------------------
+#ifndef LogicalTimeDouble_h
+#define LogicalTimeDouble_h
#ifdef _WIN32
#pragma warning(disable:4290)
@@ -412,4 +434,4 @@
};
-#endif // LogicalTimeDouble_INCLUDED
+#endif // LogicalTimeDouble_h
Index: RTI1516fedTime.cpp
===================================================================
RCS file: /sources/certi/certi/libRTI/ieee1516-2000/RTI1516fedTime.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- RTI1516fedTime.cpp 3 Mar 2014 15:18:22 -0000 1.1
+++ RTI1516fedTime.cpp 3 Mar 2014 16:41:52 -0000 1.2
@@ -1,3 +1,26 @@
+// ----------------------------------------------------------------------------
+// CERTI - HLA RunTime Infrastructure
+// Copyright (C) 2002-2014 ONERA
+//
+// This file is part of CERTI-libRTI
+//
+// CERTI-libRTI is free software ; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License
+// as published by the Free Software Foundation ; either version 2 of
+// the License, or (at your option) any later version.
+//
+// CERTI-libRTI is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY ; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this program ; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA
+//
+// ----------------------------------------------------------------------------
+
#include <RTI/certiLogicalTime.h>
#include <RTI/certiLogicalTimeInterval.h>
#include <RTI/certiLogicalTimeFactory.h>
Index: CMakeLists.txt
===================================================================
RCS file: /sources/certi/certi/libRTI/ieee1516-2000/CMakeLists.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- CMakeLists.txt 3 Mar 2014 15:18:22 -0000 1.1
+++ CMakeLists.txt 3 Mar 2014 16:41:52 -0000 1.2
@@ -12,8 +12,8 @@
##########################################################
if (WIN32)
set(VARDATA1516_SRCS
- RTI1516variableLengthData.cpp
- RTI1516variableLengthDataImplementation.h
+ RTIvariableLengthData.cpp
+ RTIvariableLengthDataImplementation.h
${CMAKE_SOURCE_DIR}/include/ieee1516-2000/RTI/VariableLengthData.h
)
@@ -42,21 +42,21 @@
##########################
set(RTI1516_LIB_SRCS
- RTI1516ambassadorFactory.cpp
- RTI1516exception.cpp
- RTI1516variableLengthData.cpp
- RTI1516variableLengthDataImplementation.h
- RTI1516ambassador.cpp
- RTI1516ambassador.h
- RTI1516ambPrivateRefs.cpp
- RTI1516ambPrivateRefs.h
- RTI1516Handle.cpp
- RTI1516HandleImplementation.cpp
- RTI1516HandleImplementation.h
- RTI1516ambTime.cpp
- RTI1516fedAmbassador.cpp
- RTI1516HandleFactory.cpp
- RTI1516HandleFactory.h
+ RTIambassadorFactory.cpp
+ Exception.cpp
+ RTIvariableLengthData.cpp
+ RTIvariableLengthDataImplementation.h
+ RTIambassador.cpp
+ RTIambassador.h
+ RTIambPrivateRefs.cpp
+ RTIambPrivateRefs.h
+ Handle.cpp
+ HandleImplementation.cpp
+ HandleImplementation.h
+ RTIambTime.cpp
+ RTIfedAmbassador.cpp
+ RTIHandleFactory.cpp
+ RTIHandleFactory.h
)
set(RTI1516_LIB_INCLUDE
Index: LogicalTimeDouble.cpp
===================================================================
RCS file: /sources/certi/certi/libRTI/ieee1516-2000/LogicalTimeDouble.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- LogicalTimeDouble.cpp 3 Mar 2014 15:18:23 -0000 1.1
+++ LogicalTimeDouble.cpp 3 Mar 2014 16:41:53 -0000 1.2
@@ -1,3 +1,25 @@
+// ----------------------------------------------------------------------------
+// CERTI - HLA RunTime Infrastructure
+// Copyright (C) 2002-2014 ONERA
+//
+// This file is part of CERTI-libRTI
+//
+// CERTI-libRTI is free software ; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License
+// as published by the Free Software Foundation ; either version 2 of
+// the License, or (at your option) any later version.
+//
+// CERTI-libRTI is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY ; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this program ; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA
+//
+// ----------------------------------------------------------------------------
#ifdef _WIN32
#pragma warning(disable : 4786)
#pragma warning(disable:4290)
Index: RTI1516fedTime.h
===================================================================
RCS file: /sources/certi/certi/libRTI/ieee1516-2000/RTI1516fedTime.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- RTI1516fedTime.h 3 Mar 2014 15:18:21 -0000 1.1
+++ RTI1516fedTime.h 3 Mar 2014 16:41:53 -0000 1.2
@@ -1,5 +1,27 @@
-#ifndef RTI1516_FEDTIME_H
-#define RTI1516_FEDTIME_H
+// ----------------------------------------------------------------------------
+// CERTI - HLA RunTime Infrastructure
+// Copyright (C) 2002-2014 ONERA
+//
+// This file is part of CERTI-libRTI
+//
+// CERTI-libRTI is free software ; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License
+// as published by the Free Software Foundation ; either version 2 of
+// the License, or (at your option) any later version.
+//
+// CERTI-libRTI is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY ; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this program ; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA
+//
+// ----------------------------------------------------------------------------
+#ifndef RTI1516FEDTIME_H
+#define RTI1516FEDTIME_H
#include <RTI/certiLogicalTime.h>
#include <RTI/certiLogicalTimeInterval.h>
Index: RTIfedAmbassador.cpp
===================================================================
RCS file: RTIfedAmbassador.cpp
diff -N RTIfedAmbassador.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ RTIfedAmbassador.cpp 3 Mar 2014 16:41:46 -0000 1.1
@@ -0,0 +1,32 @@
+// ----------------------------------------------------------------------------
+// CERTI - HLA RunTime Infrastructure
+// Copyright (C) 2002-2014 ONERA
+//
+// This file is part of CERTI-libRTI
+//
+// CERTI-libRTI is free software ; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License
+// as published by the Free Software Foundation ; either version 2 of
+// the License, or (at your option) any later version.
+//
+// CERTI-libRTI is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY ; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this program ; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA
+//
+// ----------------------------------------------------------------------------
+#include <RTI/FederateAmbassador.h>
+#include <RTI/NullFederateAmbassador.h>
+
+rti1516::FederateAmbassador::FederateAmbassador() throw (FederateInternalError)
+{
+}
+
+rti1516::FederateAmbassador::~FederateAmbassador() throw()
+{
+}
Index: RTIHandleFactory.h
===================================================================
RCS file: RTIHandleFactory.h
diff -N RTIHandleFactory.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ RTIHandleFactory.h 3 Mar 2014 16:41:46 -0000 1.1
@@ -0,0 +1,114 @@
+// ----------------------------------------------------------------------------
+// CERTI - HLA RunTime Infrastructure
+// Copyright (C) 2002-2014 ONERA
+//
+// This file is part of CERTI-libRTI
+//
+// CERTI-libRTI is free software ; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License
+// as published by the Free Software Foundation ; either version 2 of
+// the License, or (at your option) any later version.
+//
+// CERTI-libRTI is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY ; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this program ; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA
+//
+// ----------------------------------------------------------------------------
+#ifndef RTIHandleFactory_h
+#define RTIHandleFactory_h
+
+#include <set>
+#include <map>
+#include <vector>
+#include <list>
+#include "certi.hh"
+#include "GAV.hh"
+#include <RTI/Typedefs.h>
+#include "HandleImplementation.h"
+#include "M_Classes.hh"
+
+
+template<class I>
+struct certi_cast
+{
+ template<class R>
+ const I& operator()(const R& imp)
+ {
+ try {
+ return dynamic_cast<const I&>(imp);
+ }
+ catch (...)
+ {
+ throw rti1516::RTIinternalError(L"Incompatible object on input.");
+ }
+ }
+
+ template<class R>
+ I& operator()(R& imp)
+ {
+ try {
+ return dynamic_cast<I&>(imp);
+ }
+ catch (...)
+ {
+ throw rti1516::RTIinternalError(L"Incompatible object on input.");
+ }
+ }
+};
+
+#define DEFINE_HANDLE_FRIEND_CLASS(HandleKind) \
+
\
+/* Forward declaration for the RTI-internal class */ \
+/* used to implement a specific kind of handle */ \
+class HandleKind;
\
+class HandleKind##Implementation; \
+
\
+/* Each handle class generated by this macro provides the */ \
+/* following interface */ \
+class RTI_EXPORT HandleKind##Friend \
+{ \
+public: \
+ static HandleKind createRTI1516Handle(const certi::Handle & certiHandle);
\
+ static HandleKind createRTI1516Handle(const rti1516::VariableLengthData &
encodedValue); \
+ static certi::Handle toCertiHandle(const HandleKind & rti1516Handle);
\
+
\
+private: \
+ HandleKind##Friend(); \
+ ~HandleKind##Friend(); \
+
\
+}; \
+
+namespace rti1516
+{
+
+ // All of the RTI API's HandleFriend classes are defined
+ // by invoking the macro above.
+ DEFINE_HANDLE_FRIEND_CLASS(FederateHandle)
+ DEFINE_HANDLE_FRIEND_CLASS(ObjectClassHandle)
+ DEFINE_HANDLE_FRIEND_CLASS(InteractionClassHandle)
+ DEFINE_HANDLE_FRIEND_CLASS(ObjectInstanceHandle)
+ DEFINE_HANDLE_FRIEND_CLASS(AttributeHandle)
+ DEFINE_HANDLE_FRIEND_CLASS(ParameterHandle)
+ DEFINE_HANDLE_FRIEND_CLASS(DimensionHandle)
+ //DEFINE_HANDLE_FRIEND_CLASS(MessageRetractionHandle)
+ DEFINE_HANDLE_FRIEND_CLASS(RegionHandle)
+
+ class MessageRetractionHandleFriend {
+ public:
+ static MessageRetractionHandle createRTI1516Handle(const
certi::Handle & certiHandle, uint64_t serialNr);
+ static MessageRetractionHandle createRTI1516Handle(const
rti1516::VariableLengthData & encodedValue);
+ static certi::EventRetraction createEventRetraction(const
rti1516::MessageRetractionHandle & messageRetractionHandle);
+ private:
+ MessageRetractionHandleFriend();
+ ~MessageRetractionHandleFriend();
+ };
+
+}
+
+#endif // RTI_RTI1516HandleFactory_h
Index: RTIHandleFactory.cpp
===================================================================
RCS file: RTIHandleFactory.cpp
diff -N RTIHandleFactory.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ RTIHandleFactory.cpp 3 Mar 2014 16:41:47 -0000 1.1
@@ -0,0 +1,98 @@
+// ----------------------------------------------------------------------------
+// CERTI - HLA RunTime Infrastructure
+// Copyright (C) 2002-2014 ONERA
+//
+// This file is part of CERTI-libRTI
+//
+// CERTI-libRTI is free software ; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License
+// as published by the Free Software Foundation ; either version 2 of
+// the License, or (at your option) any later version.
+//
+// CERTI-libRTI is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY ; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this program ; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA
+//
+// ----------------------------------------------------------------------------
+#include "RTIHandleFactory.h"
+
+
+#define DECLARE_HANDLE_FRIEND_CLASS(HandleKind)
\
+
\
+ HandleKind HandleKind##Friend::createRTI1516Handle(const certi::Handle &
certiHandle) \
+ {
\
+ HandleKind##Implementation* handleImpl = new
HandleKind##Implementation(); \
+ handleImpl->setValue(certiHandle);
\
+ HandleKind rti1516Handle(handleImpl);
\
+ return rti1516Handle;
\
+ }
\
+
\
+ HandleKind HandleKind##Friend::createRTI1516Handle(const
rti1516::VariableLengthData & encodedValue)\
+ {
\
+ HandleKind rti1516Handle(encodedValue);
\
+ return rti1516Handle;
\
+ }
\
+
\
+ certi::Handle HandleKind##Friend::toCertiHandle(const HandleKind &
rti1516Handle) \
+ {
\
+ certi::Handle certiHandle;
\
+ if (rti1516Handle.isValid())
\
+ {
\
+ const HandleKind##Implementation* handleImpl =
rti1516Handle.getImplementation(); \
+ certiHandle = handleImpl->getValue();
\
+ } else {
\
+ certiHandle = 0;
\
+ }
\
+ return certiHandle;
\
+ }
\
+
\
+ HandleKind##Friend::HandleKind##Friend() {}
\
+ HandleKind##Friend::~HandleKind##Friend() {}
\
+
+/* end of DECLARE_HANDLE_FRIEND_CLASS */
+
+namespace rti1516
+{
+
+// All of the RTI API's HandleFriend classes are defined
+// by invoking the macro above.
+DECLARE_HANDLE_FRIEND_CLASS(FederateHandle)
+DECLARE_HANDLE_FRIEND_CLASS(ObjectClassHandle)
+DECLARE_HANDLE_FRIEND_CLASS(InteractionClassHandle)
+DECLARE_HANDLE_FRIEND_CLASS(ObjectInstanceHandle)
+DECLARE_HANDLE_FRIEND_CLASS(AttributeHandle)
+DECLARE_HANDLE_FRIEND_CLASS(ParameterHandle)
+DECLARE_HANDLE_FRIEND_CLASS(DimensionHandle)
+//DECLARE_HANDLE_FRIEND_CLASS(MessageRetractionHandle)
+DECLARE_HANDLE_FRIEND_CLASS(RegionHandle)
+
+MessageRetractionHandle
MessageRetractionHandleFriend::createRTI1516Handle(const certi::Handle &
certiHandle, uint64_t serialNr) {
+ MessageRetractionHandleImplementation* handleImpl = new
MessageRetractionHandleImplementation();
+ handleImpl->setValue(certiHandle);
+ handleImpl->setSerialNum(serialNr);
+ MessageRetractionHandle rti1516Handle(handleImpl);
+ return rti1516Handle;
+}
+MessageRetractionHandle
MessageRetractionHandleFriend::createRTI1516Handle(const
rti1516::VariableLengthData & encodedValue) {
+ MessageRetractionHandle rti1516Handle(encodedValue);
+ return rti1516Handle;
+}
+certi::EventRetraction
MessageRetractionHandleFriend::createEventRetraction(const
rti1516::MessageRetractionHandle & messageRetractionHandle) {
+ const MessageRetractionHandleImplementation* handleImpl =
messageRetractionHandle.getImplementation();
+ certi::EventRetraction eventRetraction;
+ eventRetraction.setSendingFederate( handleImpl->getValue() );
+ eventRetraction.setSN( handleImpl->getSerialNum() );
+ return eventRetraction;
+}
+MessageRetractionHandleFriend::MessageRetractionHandleFriend() {}
+MessageRetractionHandleFriend::~MessageRetractionHandleFriend() {}
+
+
+}
+
Index: HandleImplementation.cpp
===================================================================
RCS file: HandleImplementation.cpp
diff -N HandleImplementation.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ HandleImplementation.cpp 3 Mar 2014 16:41:47 -0000 1.1
@@ -0,0 +1,304 @@
+// ----------------------------------------------------------------------------
+// CERTI - HLA RunTime Infrastructure
+// Copyright (C) 2002-2014 ONERA
+//
+// This file is part of CERTI-libRTI
+//
+// CERTI-libRTI is free software ; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License
+// as published by the Free Software Foundation ; either version 2 of
+// the License, or (at your option) any later version.
+//
+// CERTI-libRTI is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY ; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this program ; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA
+//
+// ----------------------------------------------------------------------------
+
+#include <RTI/Handle.h>
+#include <limits.h>
+#include <sstream>
+#include <cstring>
+#include "HandleImplementation.h"
+
+namespace rti1516
+{
+
+ /* Constructs an invalid handle */
+ HandleImplementation::HandleImplementation()
+ : _value(ULONG_MAX)
+ {
+ }
+
+ HandleImplementation::HandleImplementation(VariableLengthData const &
encodedValue)
+ : _value(ULONG_MAX)
+ {
+ ULong val = 0;
+ const size_t size = sizeof(val);
+ unsigned char buf[size];
+
+ if (encodedValue.size() != size) {
+ throw CouldNotDecode(L"Encoded value has an unexpected
size.");
+ }
+
+ memcpy(&val, encodedValue.data(), size);
+ for(uint32_t i = 0; i < sizeof(val); i++)
+ {
+ buf[size-i-1] = (char) val & 0xFF;
+ val = val >> 8;
+ }
+
+ //copy buffer to _value
+ ULong newValue;
+ memcpy(&newValue, buf, size);
+ _value = newValue;
+ }
+
+ HandleImplementation::~HandleImplementation()
+ throw()
+ {
+ }
+
+ HandleImplementation::HandleImplementation(HandleImplementation const &
rhs)
+ : _value(ULONG_MAX)
+ {
+ _value = rhs._value;
+ }
+
+ /* Indicates whether this handle is valid */
+ bool HandleImplementation::isValid() const
+ {
+ if (_value == ULONG_MAX)
+ return false;
+ else
+ return true;
+ }
+
+ /* Generate an encoded value that can be used to send */
+ /* handles to other federates in updates or interactions. */
+ VariableLengthData HandleImplementation::encode() const
+ {
+ unsigned char buf[sizeof(_value)];
+ encode(buf, sizeof(_value));
+ VariableLengthData c(buf, sizeof(_value));
+ return c;
+ }
+
+ /* Alternate encode for directly filling a buffer */
+ unsigned long HandleImplementation::encodedLength() const
+ {
+ return sizeof(_value);
+ }
+ unsigned long HandleImplementation::encode(
+ void* buffer, unsigned long bufferSize) const
+ throw (CouldNotEncode)
+ {
+ if (bufferSize < sizeof(_value))
+ throw CouldNotEncode(L"Not enough room in buffer to
encode handle");
+
+ unsigned long val = _value;
+ char *buf = (char *) buffer;
+ for(uint32_t i = 0; i < sizeof(_value); i++)
+ {
+ buf[sizeof(_value)-i-1] = (char) val & 0xFF;
+ val = val >> 8;
+ }
+ return sizeof(_value);
+ }
+
+ std::wstring HandleImplementation::toString() const
+ {
+ std::wostringstream ost;
+ ost << _value;
+ return ost.str();
+ }
+
+
+
+#define DECLARE_HANDLE_IMPLEMENTATION_CLASS(HIK) \
+ \
+ /* Constructs an invalid handle */ \
+ HIK::HIK() \
+ : HandleImplementation() \
+ { \
+ } \
+ \
+ HIK::HIK(VariableLengthData const & encodedValue) \
+ : HandleImplementation(encodedValue) \
+ { \
+ \
+ } \
+ \
+ HIK::~HIK() \
+ throw() \
+ { \
+ } \
+ \
+ HIK::HIK(HIK const & rhs) \
+ { \
+ _value = rhs._value;
\
+ } \
+ \
+ HIK & HIK::operator=(HIK const & rhs) \
+ { \
+ if (this != &rhs) \
+ { \
+ _value = rhs._value; \
+ } \
+ return *this; \
+ } \
+ \
+ \
+ /* All invalid handles are equivalent */ \
+ bool HIK::operator==(HIK const & rhs) const \
+ { \
+ return _value == rhs._value; \
+ } \
+ bool HIK::operator!=(HIK const & rhs) const \
+ { \
+ return _value != rhs._value; \
+ } \
+ bool HIK::operator< (HIK const & rhs) const \
+ { \
+ return _value < rhs._value; \
+ } \
+ \
+ /* end DECLARE_HANDLE_IMPLEMENTATION_CLASS */
+
+
+DECLARE_HANDLE_IMPLEMENTATION_CLASS(FederateHandleImplementation)
+DECLARE_HANDLE_IMPLEMENTATION_CLASS(ObjectClassHandleImplementation)
+DECLARE_HANDLE_IMPLEMENTATION_CLASS(InteractionClassHandleImplementation)
+DECLARE_HANDLE_IMPLEMENTATION_CLASS(ObjectInstanceHandleImplementation)
+DECLARE_HANDLE_IMPLEMENTATION_CLASS(AttributeHandleImplementation)
+DECLARE_HANDLE_IMPLEMENTATION_CLASS(ParameterHandleImplementation)
+DECLARE_HANDLE_IMPLEMENTATION_CLASS(DimensionHandleImplementation)
+//DECLARE_HANDLE_IMPLEMENTATION_CLASS(MessageRetractionHandleImplementation)
+DECLARE_HANDLE_IMPLEMENTATION_CLASS(RegionHandleImplementation)
+
+
+MessageRetractionHandleImplementation::MessageRetractionHandleImplementation()
+: HandleImplementation()
+{
+}
+
+MessageRetractionHandleImplementation::MessageRetractionHandleImplementation(MessageRetractionHandleImplementation
const & rhs)
+{
+ _value = rhs._value;
+}
+
+MessageRetractionHandleImplementation::MessageRetractionHandleImplementation(VariableLengthData
const & encodedValue)
+{
+ ULong val1 = 0;
+ ULong val2 = 0;
+ const size_t size = sizeof(val1);
+ unsigned char buf1[size];
+ unsigned char buf2[size];
+
+ if (encodedValue.size() != 2*size) {
+ throw CouldNotDecode(L"Encoded value has an unexpected size.");
+ }
+
+ memcpy(&val1, encodedValue.data(), size);
+ memcpy(&val2, (ULong*)encodedValue.data() + 1 , size);
+
+ // _value
+ for(uint32_t i = 0; i < sizeof(val1); i++)
+ {
+ buf1[size-i-1] = (char) val1 & 0xFF;
+ val1 = val1 >> 8;
+ }
+ //copy buf1 to _value
+ ULong newValue;
+ memcpy(&newValue, buf1, size);
+ _value = newValue;
+
+ // _serialNum
+ for(uint32_t i = 0; i < sizeof(val2); i++)
+ {
+ buf2[size-i-1] = (char) val2 & 0xFF;
+ val2 = val2 >> 8;
+ }
+ //copy buf2 to _serailNum
+ ULong newSerialNum;
+ memcpy(&newSerialNum, buf2, size);
+ _serialNum = newSerialNum;
+}
+
+MessageRetractionHandleImplementation::~MessageRetractionHandleImplementation()
+throw()
+{
+}
+
+MessageRetractionHandleImplementation &
MessageRetractionHandleImplementation::operator=(MessageRetractionHandleImplementation
const & rhs)
+{
+ if (this != &rhs) {
+ _value = rhs._value;
+ }
+ return *this;
+}
+
+bool
MessageRetractionHandleImplementation::operator==(MessageRetractionHandleImplementation
const & rhs) const
+{
+ bool isEqual = (_value == rhs._value) && (_serialNum == rhs._serialNum);
+ return isEqual;
+}
+
+bool
MessageRetractionHandleImplementation::operator!=(MessageRetractionHandleImplementation
const & rhs) const
+{
+ bool isEqual = (_value == rhs._value) && (_serialNum == rhs._serialNum);
+ return !isEqual;
+}
+
+bool MessageRetractionHandleImplementation::operator<
(MessageRetractionHandleImplementation const & rhs) const
+{
+ return _value < rhs._value;
+}
+
+/* Generate an encoded value that can be used to send */
+/* handles to other federates in updates or interactions. */
+VariableLengthData MessageRetractionHandleImplementation::encode() const
+{
+ unsigned char buf[ sizeof(_value) + sizeof(_serialNum) ];
+ encode(buf, sizeof(_value) + sizeof(_serialNum) );
+ VariableLengthData c(buf, sizeof(_value) + sizeof(_serialNum) );
+ return c;
+}
+
+/* Alternate encode for directly filling a buffer */
+unsigned long MessageRetractionHandleImplementation::encodedLength() const
+{
+ return sizeof(_value) + sizeof(_serialNum);
+}
+
+unsigned long MessageRetractionHandleImplementation::encode(
+void* buffer, unsigned long bufferSize) const
+throw (CouldNotEncode)
+{
+ if ( bufferSize < (sizeof(_value)+sizeof(_serialNum)) )
+ throw CouldNotEncode(L"Not enough room in buffer to encode
handle");
+
+ unsigned long val = _value;
+ unsigned long serialNum = _serialNum;
+ char *buf = (char *) buffer;
+ for(uint32_t i = 0; i < sizeof(_value); i++)
+ {
+ buf[sizeof(_value)-i-1] = (char) val & 0xFF;
+ val = val >> 8;
+ }
+ for(uint32_t i = 0; i < sizeof(_serialNum); i++)
+ {
+ buf[sizeof(_value)+sizeof(_serialNum)-i-1] = (char) serialNum &
0xFF;
+ serialNum = serialNum >> 8;
+ }
+ return sizeof(_value) + sizeof(_serialNum);
+}
+
+
+} // end namespace rti1516
Index: RTIvariableLengthData.cpp
===================================================================
RCS file: RTIvariableLengthData.cpp
diff -N RTIvariableLengthData.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ RTIvariableLengthData.cpp 3 Mar 2014 16:41:48 -0000 1.1
@@ -0,0 +1,202 @@
+#include <RTI/VariableLengthData.h>
+#include "RTIvariableLengthDataImplementation.h"
+#include <stdlib.h>
+#include <string.h>
+
+namespace rti1516
+{
+ // ******************************************************
+ // ********* VariableLengthData implementation **********
+ // ******************************************************
+
+ VariableLengthData::VariableLengthData()
+ : _impl(0)
+ {
+ }
+
+ // Caller is free to delete inData after the call
+ VariableLengthData::VariableLengthData(void const * inData, unsigned
long inSize)
+ : _impl(0)
+ {
+ _impl = new VariableLengthDataImplementation(inData, inSize);
+ }
+
+ // Caller is free to delete rhs after the call
+ VariableLengthData::VariableLengthData(VariableLengthData const & rhs)
+ : _impl(0)
+ {
+ _impl = new VariableLengthDataImplementation(*(rhs._impl));
+ }
+
+ VariableLengthData::~VariableLengthData()
+ {
+ delete _impl;
+ }
+
+ VariableLengthData &
+ VariableLengthData::operator=(VariableLengthData const & rhs)
+ {
+ // Beware of self assignment
+ if (this != &rhs)
+ {
+ delete _impl;
+ _impl = new
VariableLengthDataImplementation(*(rhs._impl));
+ }
+
+ return *this;
+ }
+
+ void const *
+ VariableLengthData::data() const
+ {
+ if (_impl != 0)
+ {
+ return _impl->getData();
+ } else
+ {
+ return 0;
+ }
+ }
+ unsigned long
+ VariableLengthData::size() const
+ {
+ if (_impl != 0)
+ {
+ return _impl->getSize();
+ } else
+ {
+ return 0;
+ }
+ }
+
+ // Caller is free to delete inData after the call
+ void VariableLengthData::setData(void const * inData, unsigned long
inSize)
+ {
+ if (_impl != 0)
+ {
+ _impl->setData(inData, inSize);
+ } else
+ {
+ _impl = new VariableLengthDataImplementation(inData,
inSize);
+ }
+ }
+
+ // Caller is responsible for ensuring that the data that is
+ // pointed to is valid for the lifetime of this object, or past
+ // the next time this object is given new data.
+ void VariableLengthData::setDataPointer(void* inData, unsigned long
inSize)
+ {
+ if (_impl == 0)
+ {
+ _impl = new VariableLengthDataImplementation();
+ }
+ _impl->setDataPointer(inData, inSize);
+ }
+
+ // Caller gives up ownership of inData to this object.
+ // This object assumes the responsibility of deleting inData
+ // when it is no longer needed.
+ void VariableLengthData::takeDataPointer(void* inData, unsigned long
inSize)
+ {
+ if (_impl == 0)
+ {
+ _impl = new VariableLengthDataImplementation();
+ }
+ _impl->takeDataPointer(inData, inSize);
+ }
+
+ // ********************************************************************
+ // ********* VariableLengthDataImplementation implementation **********
+ // ********************************************************************
+
+ VariableLengthDataImplementation::VariableLengthDataImplementation()
+ : _data(0)
+ , _size(0)
+ , _dataOwner(false)
+ {
+ }
+
+ // Caller is free to delete inData after the call
+ VariableLengthDataImplementation::VariableLengthDataImplementation(void
const * inData, unsigned long inSize)
+ : _data(0)
+ , _size(inSize)
+ , _dataOwner(true)
+ {
+ _data = malloc(inSize+1);
+ memcpy(_data, inData, _size);
+ }
+
+ // Caller is free to delete rhs after the call
+
VariableLengthDataImplementation::VariableLengthDataImplementation(VariableLengthDataImplementation
const & rhs)
+ : _data(0)
+ , _size(rhs._size)
+ , _dataOwner(true)
+ {
+ _data = malloc(rhs._size);
+ memcpy(_data, rhs._data, _size);
+ }
+
+ VariableLengthDataImplementation::~VariableLengthDataImplementation()
+ {
+ if (_data && _dataOwner)
+ {
+ free(_data);
+ }
+ }
+
+ // Caller is free to delete rhs after the call
+ VariableLengthDataImplementation &
+
VariableLengthDataImplementation::operator=(VariableLengthDataImplementation
const & rhs)
+ {
+ // Beware of self assignment
+ if (this != &rhs)
+ {
+ setData(rhs._data, rhs._size);
+ }
+
+ return *this;
+ }
+
+ // Caller is free to delete inData after the call
+ void VariableLengthDataImplementation::setData(void const * inData,
unsigned long inSize)
+ {
+ if (_data && _dataOwner)
+ {
+ free(_data);
+ }
+ _size = inSize;
+ _dataOwner = true;
+ _data = malloc(_size);
+ memcpy(_data, inData, _size);
+ }
+
+ // Caller is responsible for ensuring that the data that is
+ // pointed to is valid for the lifetime of this object, or past
+ // the next time this object is given new data.
+ void VariableLengthDataImplementation::setDataPointer(void* inData,
unsigned long inSize)
+ {
+ if (_data && _dataOwner)
+ {
+ free(_data);
+ }
+ _size = inSize;
+ _dataOwner = false;
+ _data = inData;
+ }
+
+ // Caller gives up ownership of inData to this object.
+ // This object assumes the responsibility of deleting inData
+ // when it is no longer needed.
+ void VariableLengthDataImplementation::takeDataPointer(void* inData,
unsigned long inSize)
+ {
+ if (_data && _dataOwner)
+ {
+ free(_data);
+ }
+ _size = inSize;
+ _dataOwner = true;
+ _data = inData;
+ }
+
+
+} // end namespace rti1516
Index: RTIambPrivateRefs.h
===================================================================
RCS file: RTIambPrivateRefs.h
diff -N RTIambPrivateRefs.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ RTIambPrivateRefs.h 3 Mar 2014 16:41:48 -0000 1.1
@@ -0,0 +1,62 @@
+// ----------------------------------------------------------------------------
+// CERTI - HLA RunTime Infrastructure
+// Copyright (C) 2002-2005 ONERA
+//
+// This file is part of CERTI-libRTI
+//
+// CERTI-libRTI is free software ; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License
+// as published by the Free Software Foundation ; either version 2 of
+// the License, or (at your option) any later version.
+//
+// CERTI-libRTI is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY ; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this program ; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA
+//
+// $Id: RTIambPrivateRefs.h,v 1.1 2014/03/03 16:41:48 erk Exp $
+// ----------------------------------------------------------------------------
+
+#include <RTI/certiRTI1516.h>
+#include "Message.hh"
+#include "RootObject.hh"
+#include "MessageBuffer.hh"
+
+using namespace certi ;
+
+class RTI1516ambPrivateRefs
+{
+public:
+ RTI1516ambPrivateRefs();
+ ~RTI1516ambPrivateRefs();
+
+ 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);
+
+#ifdef _WIN32
+ HANDLE handle_RTIA;
+#else
+ pid_t pid_RTIA ; //!< pid associated with rtia fork (private).
+#endif
+
+ //! Federate Ambassador reference for module calls.
+ rti1516::FederateAmbassador *fed_amb ;
+
+ //! used to prevent reentrant calls (see tick() and executeService()).
+ bool is_reentrant ;
+
+ RootObject *_theRootObj ;
+
+ SocketUN *socketUn ;
+ MessageBuffer msgBufSend,msgBufReceive ;
+};
+
+// $Id: RTIambPrivateRefs.h,v 1.1 2014/03/03 16:41:48 erk Exp $
Index: RTIambassador.h
===================================================================
RCS file: RTIambassador.h
diff -N RTIambassador.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ RTIambassador.h 3 Mar 2014 16:41:48 -0000 1.1
@@ -0,0 +1,1340 @@
+// ----------------------------------------------------------------------------
+// CERTI - HLA RunTime Infrastructure
+// Copyright (C) 2002-2014 ONERA
+//
+// This file is part of CERTI-libRTI
+//
+// CERTI-libRTI is free software ; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License
+// as published by the Free Software Foundation ; either version 2 of
+// the License, or (at your option) any later version.
+//
+// CERTI-libRTI is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY ; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this program ; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA
+//
+// ----------------------------------------------------------------------------
+// This interface is used to access the services of the RTI.
+
+#ifndef RTIambassador_h
+#define RTIambassador_h
+
+#include <RTI/RTIambassador.h>
+#include <RTI/RTIambassadorFactory.h>
+#include "RTIambPrivateRefs.h"
+
+namespace rti1516
+{
+ class RTI_EXPORT RTI1516ambassador : RTIambassador
+ {
+ friend std::auto_ptr< RTIambassador >
+ RTIambassadorFactory::createRTIambassador(std::vector<
std::wstring > & args)
+ throw (BadInitializationParameter, RTIinternalError);
+
+ private:
+ RTI1516ambPrivateRefs* privateRefs ;
+
+ // Helper functions
+ 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 ();
+
+ public:
+ virtual
+ ~RTI1516ambassador();
+ // throw ()
+
+ // 4.2
+ virtual void createFederationExecution
+ (std::wstring const & federationExecutionName,
+ std::wstring const & fullPathNameToTheFDDfile,
+ std::wstring const & logicalTimeImplementationName =
L"")
+ throw (FederationExecutionAlreadyExists,
+ CouldNotOpenFDD,
+ ErrorReadingFDD,
+ CouldNotCreateLogicalTimeFactory,
+ RTIinternalError);
+
+ // 4.3
+ virtual void destroyFederationExecution
+ (std::wstring const & federationExecutionName)
+ throw (FederatesCurrentlyJoined,
+ FederationExecutionDoesNotExist,
+ RTIinternalError);
+
+ // 4.4
+ virtual FederateHandle joinFederationExecution
+ (std::wstring const & federateType,
+ std::wstring const & federationExecutionName,
+ FederateAmbassador & federateAmbassador)
+ throw (FederateAlreadyExecutionMember,
+ FederationExecutionDoesNotExist,
+ SaveInProgress,
+ RestoreInProgress,
+ CouldNotCreateLogicalTimeFactory,
+ RTIinternalError);
+
+ // 4.5
+ virtual void resignFederationExecution
+ (ResignAction resignAction)
+ throw (OwnershipAcquisitionPending,
+ FederateOwnsAttributes,
+ FederateNotExecutionMember,
+ RTIinternalError);
+
+ // 4.6
+ virtual void registerFederationSynchronizationPoint
+ (std::wstring const & label,
+ VariableLengthData const & theUserSuppliedTag)
+ throw (FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ virtual void registerFederationSynchronizationPoint
+ (std::wstring const & label,
+ VariableLengthData const & theUserSuppliedTag,
+ FederateHandleSet const & syncSet)
+ throw (FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 4.9
+ virtual void synchronizationPointAchieved
+ (std::wstring const & label)
+ throw (SynchronizationPointLabelNotAnnounced,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 4.11
+ virtual void requestFederationSave
+ (std::wstring const & label)
+ throw (FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ virtual void requestFederationSave
+ (std::wstring const & label,
+ LogicalTime const & theTime)
+ throw (LogicalTimeAlreadyPassed,
+ InvalidLogicalTime,
+ FederateUnableToUseTime,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 4.13
+ virtual void federateSaveBegun ()
+ throw (SaveNotInitiated,
+ FederateNotExecutionMember,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 4.14
+ virtual void federateSaveComplete ()
+ throw (FederateHasNotBegunSave,
+ FederateNotExecutionMember,
+ RestoreInProgress,
+ RTIinternalError);
+
+ virtual void federateSaveNotComplete()
+ throw (FederateHasNotBegunSave,
+ FederateNotExecutionMember,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 4.16
+ virtual void queryFederationSaveStatus ()
+ throw (FederateNotExecutionMember,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 4.18
+ virtual void requestFederationRestore
+ (std::wstring const & label)
+ throw (FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 4.22
+ virtual void federateRestoreComplete ()
+ throw (RestoreNotRequested,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RTIinternalError);
+
+ virtual void federateRestoreNotComplete ()
+ throw (RestoreNotRequested,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RTIinternalError);
+
+ // 4.24
+ virtual void queryFederationRestoreStatus ()
+ throw (FederateNotExecutionMember,
+ SaveInProgress,
+ RTIinternalError);
+
+ /////////////////////////////////////
+ // Declaration Management Services //
+ /////////////////////////////////////
+
+ // 5.2
+ virtual void publishObjectClassAttributes
+ (ObjectClassHandle theClass,
+ AttributeHandleSet const & attributeList)
+ throw (ObjectClassNotDefined,
+ AttributeNotDefined,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 5.3
+ virtual void unpublishObjectClass
+ (ObjectClassHandle theClass)
+ throw (ObjectClassNotDefined,
+ OwnershipAcquisitionPending,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ virtual void unpublishObjectClassAttributes
+ (ObjectClassHandle theClass,
+ AttributeHandleSet const & attributeList)
+ throw (ObjectClassNotDefined,
+ AttributeNotDefined,
+ OwnershipAcquisitionPending,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 5.4
+ virtual void publishInteractionClass
+ (InteractionClassHandle theInteraction)
+ throw (InteractionClassNotDefined,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 5.5
+ virtual void unpublishInteractionClass
+ (InteractionClassHandle theInteraction)
+ throw (InteractionClassNotDefined,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 5.6
+ virtual void subscribeObjectClassAttributes
+ (ObjectClassHandle theClass,
+ AttributeHandleSet const & attributeList,
+ bool active = true)
+ throw (ObjectClassNotDefined,
+ AttributeNotDefined,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 5.7
+ virtual void unsubscribeObjectClass
+ (ObjectClassHandle theClass)
+ throw (ObjectClassNotDefined,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ virtual void unsubscribeObjectClassAttributes
+ (ObjectClassHandle theClass,
+ AttributeHandleSet const & attributeList)
+ throw (ObjectClassNotDefined,
+ AttributeNotDefined,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 5.8
+ virtual void subscribeInteractionClass
+ (InteractionClassHandle theClass,
+ bool active = true)
+ throw (InteractionClassNotDefined,
+ FederateServiceInvocationsAreBeingReportedViaMOM,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 5.9
+ virtual void unsubscribeInteractionClass
+ (InteractionClassHandle theClass)
+ throw (InteractionClassNotDefined,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ ////////////////////////////////
+ // Object Management Services //
+ ////////////////////////////////
+
+ // 6.2
+ virtual void reserveObjectInstanceName
+ (std::wstring const & theObjectInstanceName)
+ throw (IllegalName,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 6.4
+ virtual ObjectInstanceHandle registerObjectInstance
+ (ObjectClassHandle theClass)
+ throw (ObjectClassNotDefined,
+ ObjectClassNotPublished,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ virtual ObjectInstanceHandle registerObjectInstance
+ (ObjectClassHandle theClass,
+ std::wstring const & theObjectInstanceName)
+ throw (ObjectClassNotDefined,
+ ObjectClassNotPublished,
+ ObjectInstanceNameNotReserved,
+ ObjectInstanceNameInUse,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 6.6
+ virtual void updateAttributeValues
+ (ObjectInstanceHandle theObject,
+ AttributeHandleValueMap const & theAttributeValues,
+ VariableLengthData const & theUserSuppliedTag)
+ throw (ObjectInstanceNotKnown,
+ AttributeNotDefined,
+ AttributeNotOwned,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ virtual MessageRetractionHandle updateAttributeValues
+ (ObjectInstanceHandle theObject,
+ AttributeHandleValueMap const & theAttributeValues,
+ VariableLengthData const & theUserSuppliedTag,
+ LogicalTime const & theTime)
+ throw (ObjectInstanceNotKnown,
+ AttributeNotDefined,
+ AttributeNotOwned,
+ InvalidLogicalTime,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 6.8
+ virtual void sendInteraction
+ (InteractionClassHandle theInteraction,
+ ParameterHandleValueMap const & theParameterValues,
+ VariableLengthData const & theUserSuppliedTag)
+ throw (InteractionClassNotPublished,
+ InteractionClassNotDefined,
+ InteractionParameterNotDefined,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ virtual MessageRetractionHandle sendInteraction
+ (InteractionClassHandle theInteraction,
+ ParameterHandleValueMap const & theParameterValues,
+ VariableLengthData const & theUserSuppliedTag,
+ LogicalTime const & theTime)
+ throw (InteractionClassNotPublished,
+ InteractionClassNotDefined,
+ InteractionParameterNotDefined,
+ InvalidLogicalTime,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 6.10
+ virtual void deleteObjectInstance
+ (ObjectInstanceHandle theObject,
+ VariableLengthData const & theUserSuppliedTag)
+ throw (DeletePrivilegeNotHeld,
+ ObjectInstanceNotKnown,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ virtual MessageRetractionHandle deleteObjectInstance
+ (ObjectInstanceHandle theObject,
+ VariableLengthData const & theUserSuppliedTag,
+ LogicalTime const & theTime)
+ throw (DeletePrivilegeNotHeld,
+ ObjectInstanceNotKnown,
+ InvalidLogicalTime,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 6.12
+ virtual void localDeleteObjectInstance
+ (ObjectInstanceHandle theObject)
+ throw (ObjectInstanceNotKnown,
+ FederateOwnsAttributes,
+ OwnershipAcquisitionPending,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 6.13
+ virtual void changeAttributeTransportationType
+ (ObjectInstanceHandle theObject,
+ AttributeHandleSet const & theAttributes,
+ TransportationType theType)
+ throw (ObjectInstanceNotKnown,
+ AttributeNotDefined,
+ AttributeNotOwned,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 6.14
+ virtual void changeInteractionTransportationType
+ (InteractionClassHandle theClass,
+ TransportationType theType)
+ throw (InteractionClassNotDefined,
+ InteractionClassNotPublished,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 6.17
+ virtual void requestAttributeValueUpdate
+ (ObjectInstanceHandle theObject,
+ AttributeHandleSet const & theAttributes,
+ VariableLengthData const & theUserSuppliedTag)
+ throw (ObjectInstanceNotKnown,
+ AttributeNotDefined,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ virtual void requestAttributeValueUpdate
+ (ObjectClassHandle theClass,
+ AttributeHandleSet const & theAttributes,
+ VariableLengthData const & theUserSuppliedTag)
+ throw (ObjectClassNotDefined,
+ AttributeNotDefined,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ ///////////////////////////////////
+ // Ownership Management Services //
+ ///////////////////////////////////
+ // 7.2
+ virtual void unconditionalAttributeOwnershipDivestiture
+ (ObjectInstanceHandle theObject,
+ AttributeHandleSet const & theAttributes)
+ throw (ObjectInstanceNotKnown,
+ AttributeNotDefined,
+ AttributeNotOwned,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 7.3
+ virtual void negotiatedAttributeOwnershipDivestiture
+ (ObjectInstanceHandle theObject,
+ AttributeHandleSet const & theAttributes,
+ VariableLengthData const & theUserSuppliedTag)
+ throw (ObjectInstanceNotKnown,
+ AttributeNotDefined,
+ AttributeNotOwned,
+ AttributeAlreadyBeingDivested,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 7.6
+ virtual void confirmDivestiture
+ (ObjectInstanceHandle theObject,
+ AttributeHandleSet const & confirmedAttributes,
+ VariableLengthData const & theUserSuppliedTag)
+ throw (ObjectInstanceNotKnown,
+ AttributeNotDefined,
+ AttributeNotOwned,
+ AttributeDivestitureWasNotRequested,
+ NoAcquisitionPending,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 7.8
+ virtual void attributeOwnershipAcquisition
+ (ObjectInstanceHandle theObject,
+ AttributeHandleSet const & desiredAttributes,
+ VariableLengthData const & theUserSuppliedTag)
+ throw (ObjectInstanceNotKnown,
+ ObjectClassNotPublished,
+ AttributeNotDefined,
+ AttributeNotPublished,
+ FederateOwnsAttributes,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 7.9
+ virtual void attributeOwnershipAcquisitionIfAvailable
+ (ObjectInstanceHandle theObject,
+ AttributeHandleSet const & desiredAttributes)
+ throw (ObjectInstanceNotKnown,
+ ObjectClassNotPublished,
+ AttributeNotDefined,
+ AttributeNotPublished,
+ FederateOwnsAttributes,
+ AttributeAlreadyBeingAcquired,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 7.12
+ virtual void attributeOwnershipDivestitureIfWanted
+ (ObjectInstanceHandle theObject,
+ AttributeHandleSet const & theAttributes,
+ AttributeHandleSet & theDivestedAttributes) // filled
by RTI
+ throw (ObjectInstanceNotKnown,
+ AttributeNotDefined,
+ AttributeNotOwned,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 7.13
+ virtual void cancelNegotiatedAttributeOwnershipDivestiture
+ (ObjectInstanceHandle theObject,
+ AttributeHandleSet const & theAttributes)
+ throw (ObjectInstanceNotKnown,
+ AttributeNotDefined,
+ AttributeNotOwned,
+ AttributeDivestitureWasNotRequested,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 7.14
+ virtual void cancelAttributeOwnershipAcquisition
+ (ObjectInstanceHandle theObject,
+ AttributeHandleSet const & theAttributes)
+ throw (ObjectInstanceNotKnown,
+ AttributeNotDefined,
+ AttributeAlreadyOwned,
+ AttributeAcquisitionWasNotRequested,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 7.16
+ virtual void queryAttributeOwnership
+ (ObjectInstanceHandle theObject,
+ AttributeHandle theAttribute)
+ throw (ObjectInstanceNotKnown,
+ AttributeNotDefined,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 7.18
+ virtual bool isAttributeOwnedByFederate
+ (ObjectInstanceHandle theObject,
+ AttributeHandle theAttribute)
+ throw (ObjectInstanceNotKnown,
+ AttributeNotDefined,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ //////////////////////////////
+ // Time Management Services //
+ //////////////////////////////
+
+ // 8.2
+ virtual void enableTimeRegulation
+ (LogicalTimeInterval const & theLookahead)
+ throw (TimeRegulationAlreadyEnabled,
+ InvalidLookahead,
+ InTimeAdvancingState,
+ RequestForTimeRegulationPending,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 8.4
+ virtual void disableTimeRegulation ()
+ throw (TimeRegulationIsNotEnabled,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 8.5
+ virtual void enableTimeConstrained ()
+ throw (TimeConstrainedAlreadyEnabled,
+ InTimeAdvancingState,
+ RequestForTimeConstrainedPending,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 8.7
+ virtual void disableTimeConstrained ()
+ throw (TimeConstrainedIsNotEnabled,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 8.8
+ virtual void timeAdvanceRequest
+ (LogicalTime const & theTime)
+ throw (InvalidLogicalTime,
+ LogicalTimeAlreadyPassed,
+ InTimeAdvancingState,
+ RequestForTimeRegulationPending,
+ RequestForTimeConstrainedPending,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 8.9
+ virtual void timeAdvanceRequestAvailable
+ (LogicalTime const & theTime)
+ throw (InvalidLogicalTime,
+ LogicalTimeAlreadyPassed,
+ InTimeAdvancingState,
+ RequestForTimeRegulationPending,
+ RequestForTimeConstrainedPending,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 8.10
+ virtual void nextMessageRequest
+ (LogicalTime const & theTime)
+ throw (InvalidLogicalTime,
+ LogicalTimeAlreadyPassed,
+ InTimeAdvancingState,
+ RequestForTimeRegulationPending,
+ RequestForTimeConstrainedPending,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 8.11
+ virtual void nextMessageRequestAvailable
+ (LogicalTime const & theTime)
+ throw (InvalidLogicalTime,
+ LogicalTimeAlreadyPassed,
+ InTimeAdvancingState,
+ RequestForTimeRegulationPending,
+ RequestForTimeConstrainedPending,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 8.12
+ virtual void flushQueueRequest
+ (LogicalTime const & theTime)
+ throw (InvalidLogicalTime,
+ LogicalTimeAlreadyPassed,
+ InTimeAdvancingState,
+ RequestForTimeRegulationPending,
+ RequestForTimeConstrainedPending,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 8.14
+ virtual void enableAsynchronousDelivery ()
+ throw (AsynchronousDeliveryAlreadyEnabled,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 8.15
+ virtual void disableAsynchronousDelivery ()
+ throw (AsynchronousDeliveryAlreadyDisabled,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 8.16
+ virtual bool queryGALT (LogicalTime & theTime)
+ throw (FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 8.17
+ virtual void queryLogicalTime (LogicalTime & theTime)
+ throw (FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 8.18
+ virtual bool queryLITS (LogicalTime & theTime)
+ throw (FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 8.19
+ virtual void modifyLookahead
+ (LogicalTimeInterval const & theLookahead)
+ throw (TimeRegulationIsNotEnabled,
+ InvalidLookahead,
+ InTimeAdvancingState,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 8.20
+ virtual void queryLookahead (LogicalTimeInterval & interval)
+ throw (TimeRegulationIsNotEnabled,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 8.21
+ virtual void retract
+ (MessageRetractionHandle theHandle)
+ throw (InvalidRetractionHandle,
+ TimeRegulationIsNotEnabled,
+ MessageCanNoLongerBeRetracted,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 8.23
+ virtual void changeAttributeOrderType
+ (ObjectInstanceHandle theObject,
+ AttributeHandleSet const & theAttributes,
+ OrderType theType)
+ throw (ObjectInstanceNotKnown,
+ AttributeNotDefined,
+ AttributeNotOwned,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 8.24
+ virtual void changeInteractionOrderType
+ (InteractionClassHandle theClass,
+ OrderType theType)
+ throw (InteractionClassNotDefined,
+ InteractionClassNotPublished,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ //////////////////////////////////
+ // Data Distribution Management //
+ //////////////////////////////////
+
+ // 9.2
+ virtual RegionHandle createRegion
+ (DimensionHandleSet const & theDimensions)
+ throw (InvalidDimensionHandle,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 9.3
+ virtual void commitRegionModifications
+ (RegionHandleSet const & theRegionHandleSet)
+ throw (InvalidRegion,
+ RegionNotCreatedByThisFederate,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 9.4
+ virtual void deleteRegion
+ (RegionHandle theRegion)
+ throw (InvalidRegion,
+ RegionNotCreatedByThisFederate,
+ RegionInUseForUpdateOrSubscription,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 9.5
+ virtual ObjectInstanceHandle registerObjectInstanceWithRegions
+ (ObjectClassHandle theClass,
+ AttributeHandleSetRegionHandleSetPairVector const &
+ theAttributeHandleSetRegionHandleSetPairVector)
+ throw (ObjectClassNotDefined,
+ ObjectClassNotPublished,
+ AttributeNotDefined,
+ AttributeNotPublished,
+ InvalidRegion,
+ RegionNotCreatedByThisFederate,
+ InvalidRegionContext,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ virtual ObjectInstanceHandle registerObjectInstanceWithRegions
+ (ObjectClassHandle theClass,
+ AttributeHandleSetRegionHandleSetPairVector const &
+ theAttributeHandleSetRegionHandleSetPairVector,
+ std::wstring const & theObjectInstanceName)
+ throw (ObjectClassNotDefined,
+ ObjectClassNotPublished,
+ AttributeNotDefined,
+ AttributeNotPublished,
+ InvalidRegion,
+ RegionNotCreatedByThisFederate,
+ InvalidRegionContext,
+ ObjectInstanceNameNotReserved,
+ ObjectInstanceNameInUse,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 9.6
+ virtual void associateRegionsForUpdates
+ (ObjectInstanceHandle theObject,
+ AttributeHandleSetRegionHandleSetPairVector const &
+ theAttributeHandleSetRegionHandleSetPairVector)
+ throw (ObjectInstanceNotKnown,
+ AttributeNotDefined,
+ InvalidRegion,
+ RegionNotCreatedByThisFederate,
+ InvalidRegionContext,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 9.7
+ virtual void unassociateRegionsForUpdates
+ (ObjectInstanceHandle theObject,
+ AttributeHandleSetRegionHandleSetPairVector const &
+ theAttributeHandleSetRegionHandleSetPairVector)
+ throw (ObjectInstanceNotKnown,
+ AttributeNotDefined,
+ InvalidRegion,
+ RegionNotCreatedByThisFederate,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 9.8
+ virtual void subscribeObjectClassAttributesWithRegions
+ (ObjectClassHandle theClass,
+ AttributeHandleSetRegionHandleSetPairVector const &
+ theAttributeHandleSetRegionHandleSetPairVector,
+ bool active = true)
+ throw (ObjectClassNotDefined,
+ AttributeNotDefined,
+ InvalidRegion,
+ RegionNotCreatedByThisFederate,
+ InvalidRegionContext,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 9.9
+ virtual void unsubscribeObjectClassAttributesWithRegions
+ (ObjectClassHandle theClass,
+ AttributeHandleSetRegionHandleSetPairVector const &
+ theAttributeHandleSetRegionHandleSetPairVector)
+ throw (ObjectClassNotDefined,
+ AttributeNotDefined,
+ InvalidRegion,
+ RegionNotCreatedByThisFederate,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 9.10
+ virtual void subscribeInteractionClassWithRegions
+ (InteractionClassHandle theClass,
+ RegionHandleSet const & theRegionHandleSet,
+ bool active = true)
+ throw (InteractionClassNotDefined,
+ InvalidRegion,
+ RegionNotCreatedByThisFederate,
+ InvalidRegionContext,
+ FederateServiceInvocationsAreBeingReportedViaMOM,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 9.11
+ virtual void unsubscribeInteractionClassWithRegions
+ (InteractionClassHandle theClass,
+ RegionHandleSet const & theRegionHandleSet)
+ throw (InteractionClassNotDefined,
+ InvalidRegion,
+ RegionNotCreatedByThisFederate,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 9.12
+ virtual void sendInteractionWithRegions
+ (InteractionClassHandle theInteraction,
+ ParameterHandleValueMap const & theParameterValues,
+ RegionHandleSet const & theRegionHandleSet,
+ VariableLengthData const & theUserSuppliedTag)
+ throw (InteractionClassNotDefined,
+ InteractionClassNotPublished,
+ InteractionParameterNotDefined,
+ InvalidRegion,
+ RegionNotCreatedByThisFederate,
+ InvalidRegionContext,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ virtual MessageRetractionHandle sendInteractionWithRegions
+ (InteractionClassHandle theInteraction,
+ ParameterHandleValueMap const & theParameterValues,
+ RegionHandleSet const & theRegionHandleSet,
+ VariableLengthData const & theUserSuppliedTag,
+ LogicalTime const & theTime)
+ throw (InteractionClassNotDefined,
+ InteractionClassNotPublished,
+ InteractionParameterNotDefined,
+ InvalidRegion,
+ RegionNotCreatedByThisFederate,
+ InvalidRegionContext,
+ InvalidLogicalTime,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 9.13
+ virtual void requestAttributeValueUpdateWithRegions
+ (ObjectClassHandle theClass,
+ AttributeHandleSetRegionHandleSetPairVector const &
theSet,
+ VariableLengthData const & theUserSuppliedTag)
+ throw (ObjectClassNotDefined,
+ AttributeNotDefined,
+ InvalidRegion,
+ RegionNotCreatedByThisFederate,
+ InvalidRegionContext,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ //////////////////////////
+ // RTI Support Services //
+ //////////////////////////
+
+ // 10.2
+ virtual ObjectClassHandle getObjectClassHandle
+ (std::wstring const & theName)
+ throw (NameNotFound,
+ FederateNotExecutionMember,
+ RTIinternalError);
+
+ // 10.3
+ virtual std::wstring getObjectClassName
+ (ObjectClassHandle theHandle)
+ throw (InvalidObjectClassHandle,
+ FederateNotExecutionMember,
+ RTIinternalError);
+
+ // 10.4
+ virtual AttributeHandle getAttributeHandle
+ (ObjectClassHandle whichClass,
+ std::wstring const & theAttributeName)
+ throw (InvalidObjectClassHandle,
+ NameNotFound,
+ FederateNotExecutionMember,
+ RTIinternalError);
+
+ // 10.5
+ virtual std::wstring getAttributeName
+ (ObjectClassHandle whichClass,
+ AttributeHandle theHandle)
+ throw (InvalidObjectClassHandle,
+ InvalidAttributeHandle,
+ AttributeNotDefined,
+ FederateNotExecutionMember,
+ RTIinternalError);
+
+ // 10.6
+ virtual InteractionClassHandle getInteractionClassHandle
+ (std::wstring const & theName)
+ throw (NameNotFound,
+ FederateNotExecutionMember,
+ RTIinternalError);
+
+ // 10.7
+ virtual std::wstring getInteractionClassName
+ (InteractionClassHandle theHandle)
+ throw (InvalidInteractionClassHandle,
+ FederateNotExecutionMember,
+ RTIinternalError);
+
+ // 10.8
+ virtual ParameterHandle getParameterHandle
+ (InteractionClassHandle whichClass,
+ std::wstring const & theName)
+ throw (InvalidInteractionClassHandle,
+ NameNotFound,
+ FederateNotExecutionMember,
+ RTIinternalError);
+
+ // 10.9
+ virtual std::wstring getParameterName
+ (InteractionClassHandle whichClass,
+ ParameterHandle theHandle)
+ throw (InvalidInteractionClassHandle,
+ InvalidParameterHandle,
+ InteractionParameterNotDefined,
+ FederateNotExecutionMember,
+ RTIinternalError);
+
+ // 10.10
+ virtual ObjectInstanceHandle getObjectInstanceHandle
+ (std::wstring const & theName)
+ throw (ObjectInstanceNotKnown,
+ FederateNotExecutionMember,
+ RTIinternalError);
+
+ // 10.11
+ virtual std::wstring getObjectInstanceName
+ (ObjectInstanceHandle theHandle)
+ throw (ObjectInstanceNotKnown,
+ FederateNotExecutionMember,
+ RTIinternalError);
+
+ // 10.12
+ virtual DimensionHandle getDimensionHandle
+ (std::wstring const & theName)
+ throw (NameNotFound,
+ FederateNotExecutionMember,
+ RTIinternalError);
+
+ // 10.13
+ virtual std::wstring getDimensionName
+ (DimensionHandle theHandle)
+ throw (InvalidDimensionHandle,
+ FederateNotExecutionMember,
+ RTIinternalError);
+
+ // 10.14
+ virtual unsigned long getDimensionUpperBound
+ (DimensionHandle theHandle)
+ throw (InvalidDimensionHandle,
+ FederateNotExecutionMember,
+ RTIinternalError);
+
+ // 10.15
+ virtual DimensionHandleSet
getAvailableDimensionsForClassAttribute
+ (ObjectClassHandle theClass,
+ AttributeHandle theHandle)
+ throw (InvalidObjectClassHandle,
+ InvalidAttributeHandle,
+ AttributeNotDefined,
+ FederateNotExecutionMember,
+ RTIinternalError);
+
+ // 10.16
+ virtual ObjectClassHandle getKnownObjectClassHandle
+ (ObjectInstanceHandle theObject)
+ throw (ObjectInstanceNotKnown,
+ FederateNotExecutionMember,
+ RTIinternalError);
+
+ // 10.17
+ virtual DimensionHandleSet
getAvailableDimensionsForInteractionClass
+ (InteractionClassHandle theClass)
+ throw (InvalidInteractionClassHandle,
+ FederateNotExecutionMember,
+ RTIinternalError);
+
+ // 10.18
+ virtual TransportationType getTransportationType
+ (std::wstring const & transportationName)
+ throw (InvalidTransportationName,
+ FederateNotExecutionMember,
+ RTIinternalError);
+
+ // 10.19
+ virtual std::wstring getTransportationName
+ (TransportationType transportationType)
+ throw (InvalidTransportationType,
+ FederateNotExecutionMember,
+ RTIinternalError);
+
+ // 10.20
+ virtual OrderType getOrderType
+ (std::wstring const & orderName)
+ throw (InvalidOrderName,
+ FederateNotExecutionMember,
+ RTIinternalError);
+
+ // 10.21
+ virtual std::wstring getOrderName
+ (OrderType orderType)
+ throw (InvalidOrderType,
+ FederateNotExecutionMember,
+ RTIinternalError);
+
+ // 10.22
+ virtual void enableObjectClassRelevanceAdvisorySwitch ()
+ throw (ObjectClassRelevanceAdvisorySwitchIsOn,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 10.23
+ virtual void disableObjectClassRelevanceAdvisorySwitch ()
+ throw (ObjectClassRelevanceAdvisorySwitchIsOff,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 10.24
+ virtual void enableAttributeRelevanceAdvisorySwitch ()
+ throw (AttributeRelevanceAdvisorySwitchIsOn,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 10.25
+ virtual void disableAttributeRelevanceAdvisorySwitch ()
+ throw (AttributeRelevanceAdvisorySwitchIsOff,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 10.26
+ virtual void enableAttributeScopeAdvisorySwitch ()
+ throw (AttributeScopeAdvisorySwitchIsOn,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 10.27
+ virtual void disableAttributeScopeAdvisorySwitch ()
+ throw (AttributeScopeAdvisorySwitchIsOff,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 10.28
+ virtual void enableInteractionRelevanceAdvisorySwitch ()
+ throw (InteractionRelevanceAdvisorySwitchIsOn,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 10.29
+ virtual void disableInteractionRelevanceAdvisorySwitch ()
+ throw (InteractionRelevanceAdvisorySwitchIsOff,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 10.30
+ virtual
+ DimensionHandleSet getDimensionHandleSet
+ (RegionHandle theRegionHandle)
+ throw (InvalidRegion,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 10.31
+ virtual
+ RangeBounds getRangeBounds
+ (RegionHandle theRegionHandle,
+ DimensionHandle theDimensionHandle)
+ throw (InvalidRegion,
+ RegionDoesNotContainSpecifiedDimension,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 10.32
+ virtual void setRangeBounds
+ (RegionHandle theRegionHandle,
+ DimensionHandle theDimensionHandle,
+ RangeBounds const & theRangeBounds)
+ throw (InvalidRegion,
+ RegionNotCreatedByThisFederate,
+ RegionDoesNotContainSpecifiedDimension,
+ InvalidRangeBound,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 10.33
+ virtual unsigned long normalizeFederateHandle
+ (FederateHandle theFederateHandle)
+ throw (FederateNotExecutionMember,
+ InvalidFederateHandle,
+ RTIinternalError);
+
+ // 10.34
+ virtual unsigned long normalizeServiceGroup
+ (ServiceGroupIndicator theServiceGroup)
+ throw (FederateNotExecutionMember,
+ InvalidServiceGroup,
+ RTIinternalError);
+
+ // 10.37
+ virtual bool evokeCallback(double
approximateMinimumTimeInSeconds)
+ throw (FederateNotExecutionMember,
+ RTIinternalError);
+
+ // 10.38
+ virtual bool evokeMultipleCallbacks(double
approximateMinimumTimeInSeconds,
+ double approximateMaximumTimeInSeconds)
+ throw (FederateNotExecutionMember,
+ RTIinternalError);
+
+ // 10.39
+ virtual void enableCallbacks ()
+ throw (FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ // 10.40
+ virtual void disableCallbacks ()
+ throw (FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError);
+
+ virtual FederateHandle decodeFederateHandle(
+ VariableLengthData const & encodedValue) const;
+
+ virtual ObjectClassHandle decodeObjectClassHandle(
+ VariableLengthData const & encodedValue) const;
+
+ virtual InteractionClassHandle decodeInteractionClassHandle(
+ VariableLengthData const & encodedValue) const;
+
+ virtual ObjectInstanceHandle decodeObjectInstanceHandle(
+ VariableLengthData const & encodedValue) const;
+
+ virtual AttributeHandle decodeAttributeHandle(
+ VariableLengthData const & encodedValue) const;
+
+ virtual ParameterHandle decodeParameterHandle(
+ VariableLengthData const & encodedValue) const;
+
+ virtual DimensionHandle decodeDimensionHandle(
+ VariableLengthData const & encodedValue) const;
+
+ virtual MessageRetractionHandle decodeMessageRetractionHandle(
+ VariableLengthData const & encodedValue) const;
+
+ virtual RegionHandle decodeRegionHandle(
+ VariableLengthData const & encodedValue) const;
+
+ };
+}
+
+#endif // RTI_RTI1516ambassador_h
Index: HandleImplementation.h
===================================================================
RCS file: HandleImplementation.h
diff -N HandleImplementation.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ HandleImplementation.h 3 Mar 2014 16:41:48 -0000 1.1
@@ -0,0 +1,179 @@
+// ----------------------------------------------------------------------------
+// CERTI - HLA RunTime Infrastructure
+// Copyright (C) 2002-2014 ONERA
+//
+// This file is part of CERTI-libRTI
+//
+// CERTI-libRTI is free software ; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License
+// as published by the Free Software Foundation ; either version 2 of
+// the License, or (at your option) any later version.
+//
+// CERTI-libRTI is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY ; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this program ; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA
+//
+// ----------------------------------------------------------------------------
+#ifndef HandleImplementation_h
+#define HandleImplementation_h
+
+#include <RTI/SpecificConfig.h>
+#include <RTI/Exception.h>
+#include <RTI/VariableLengthData.h>
+#include <string>
+
+// TODO Text below should be fixed. (Copied from Handle definition macro.)
+// The following macro is used to define each of the Handle classes
+// that are used by the RTI's API, e.g. AttributeHandle, ParameterHandle, etc.
+// Each kind of handle contains the same set of operators and functions, but
+// each is a separate class for type safety. The encode method can be used to
+// generate an encoded value for a handle, that can be sent to other federates
+// as an attribute or parameter. (Use RTIambassador functions to reconstruct
a
+// handle from an encoded value). RTI implementations contain definitions
+// for each kind of the HandleKindImplementation classes (e.g.
+// AttributeHandleImplementation), but these classes are not needed by
+// federate code.
+
+typedef unsigned long ULong ;
+
+namespace rti1516
+{
+ class RTI_EXPORT HandleImplementation
+ {
+ protected:
+ /* Constructs an invalid handle */
+ HandleImplementation();
+
+ public:
+ HandleImplementation(HandleImplementation const & rhs);
+
+ explicit
+ HandleImplementation(VariableLengthData const & encodedValue);
+
+ virtual ~HandleImplementation()
+ throw();
+
+ /* Indicates whether this handle is valid */
+ virtual bool isValid() const;
+
+ /* Generate an encoded value that can be used to send */
+ /* handles to other federates in updates or interactions. */
+ virtual VariableLengthData encode() const;
+
+ /* Alternate encode for directly filling a buffer */
+ virtual unsigned long encodedLength() const;
+ virtual unsigned long encode(
+ void* buffer, unsigned long bufferSize) const
+ throw (CouldNotEncode);
+
+ virtual std::wstring toString() const;
+
+ ULong getValue() const
+ { return _value; }
+
+ void setValue(ULong val)
+ { _value = val; }
+
+ protected:
+ ULong _value;
+ };
+}
+
+#define DEFINE_HANDLE_IMPLEMENTATION_CLASS(HandleKind) \
+ \
+/* Each handle class generated by this macro provides the */ \
+/* following interface */ \
+class RTI_EXPORT HandleKind##Implementation : public HandleImplementation \
+{ \
+public: \
+ \
+ /* Constructs an invalid handle */ \
+ HandleKind##Implementation();
\
+
\
+ HandleKind##Implementation(HandleKind##Implementation const & rhs);
\
+
\
+ explicit
\
+ HandleKind##Implementation(VariableLengthData const & encodedValue);
\
+
\
+ virtual ~HandleKind##Implementation()
\
+ throw();
\
+
\
+ HandleKind##Implementation &
\
+ operator=(HandleKind##Implementation const & rhs);
\
+
\
+ /* All invalid handles are equivalent */
\
+ virtual bool operator==(HandleKind##Implementation const & rhs) const;
\
+ virtual bool operator!=(HandleKind##Implementation const & rhs) const;
\
+ virtual bool operator< (HandleKind##Implementation const & rhs) const;
\
+};
\
+
+
+namespace rti1516
+{
+
+// All of the RTI API's Handle classes are defined
+// by invoking the macro above.
+DEFINE_HANDLE_IMPLEMENTATION_CLASS(FederateHandle)
+DEFINE_HANDLE_IMPLEMENTATION_CLASS(ObjectClassHandle)
+DEFINE_HANDLE_IMPLEMENTATION_CLASS(InteractionClassHandle)
+DEFINE_HANDLE_IMPLEMENTATION_CLASS(ObjectInstanceHandle)
+DEFINE_HANDLE_IMPLEMENTATION_CLASS(AttributeHandle)
+DEFINE_HANDLE_IMPLEMENTATION_CLASS(ParameterHandle)
+DEFINE_HANDLE_IMPLEMENTATION_CLASS(DimensionHandle)
+DEFINE_HANDLE_IMPLEMENTATION_CLASS(RegionHandle)
+
+
+class MessageRetractionHandleImplementation : public HandleImplementation
+{
+ public:
+
+ /* Constructs an invalid handle */
+ MessageRetractionHandleImplementation();
+
+
MessageRetractionHandleImplementation(MessageRetractionHandleImplementation
const & rhs);
+
+ explicit
+ MessageRetractionHandleImplementation(VariableLengthData const &
encodedValue);
+
+ virtual ~MessageRetractionHandleImplementation()
+ throw();
+
+ virtual MessageRetractionHandleImplementation &
+ operator=(MessageRetractionHandleImplementation const & rhs);
+
+ /* All invalid handles are equivalent */
+ virtual bool operator==(MessageRetractionHandleImplementation const
& rhs) const;
+ virtual bool operator!=(MessageRetractionHandleImplementation const
& rhs) const;
+ virtual bool operator< (MessageRetractionHandleImplementation const
& rhs) const;
+
+ /* Generate an encoded value that can be used to send */
+ /* handles to other federates in updates or interactions. */
+ virtual VariableLengthData encode() const;
+
+ /* Alternate encode for directly filling a buffer */
+ virtual unsigned long encodedLength() const;
+ virtual unsigned long encode(
+ void* buffer, unsigned long bufferSize) const
+ throw (CouldNotEncode);
+
+ ULong getSerialNum() const
+ { return _serialNum; }
+
+ void setSerialNum(ULong sn)
+ { _serialNum = sn; }
+
+ protected:
+ ULong _serialNum;
+};
+
+
+}
+
+#endif // RTI_HandleImplementation_h
+
Index: RTIambassadorFactory.cpp
===================================================================
RCS file: RTIambassadorFactory.cpp
diff -N RTIambassadorFactory.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ RTIambassadorFactory.cpp 3 Mar 2014 16:41:50 -0000 1.1
@@ -0,0 +1,229 @@
+//#include "RTI/RTI1516.h"
+
+#include <RTI/RTIambassadorFactory.h>
+#include <memory>
+#include <iostream>
+#include <cstdlib>
+#include <cerrno>
+#include <cstring>
+#ifndef _WIN32
+#include <csignal>
+#include <unistd.h>
+#endif
+
+#include "PrettyDebug.hh"
+#include "RTIambassador.h"
+
+#include "M_Classes.hh"
+
+#include "config.h"
+
+rti1516::RTIambassadorFactory::RTIambassadorFactory()
+{
+}
+
+rti1516::RTIambassadorFactory::~RTIambassadorFactory()
+throw ()
+{
+}
+
+namespace {
+ static PrettyDebug D1516("LIBRTI1516", __FILE__);
+ static PrettyDebug G1516("GENDOC1516",__FILE__) ;
+}
+
+std::auto_ptr< rti1516::RTIambassador >
+rti1516::RTIambassadorFactory::createRTIambassador(std::vector< std::wstring >
& args)
+throw (BadInitializationParameter,
+ RTIinternalError)
+{
+ rti1516::RTI1516ambassador* p_ambassador(new
rti1516::RTI1516ambassador());
+
+ std::auto_ptr< rti1516::RTIambassador > ap_ambassador(p_ambassador);
+
+ G1516.Out(pdGendoc,"enter RTIambassador::RTIambassador");
+ PrettyDebug::setFederateName( "LibRTI::UnjoinedFederate" );
+ std::wstringstream msg;
+
+ p_ambassador->privateRefs = new RTI1516ambPrivateRefs();
+
+ 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))
+ rtiaList.push_back(std::string(env));
+ env = getenv("CERTI_HOME");
+ if (env && strlen(env))
+ rtiaList.push_back(std::string(env) + "/bin/rtia");
+ rtiaList.push_back(PACKAGE_INSTALL_PREFIX "/bin/rtia");
+ rtiaList.push_back("rtia");
+
+#if defined(RTIA_USE_TCP)
+ int port = p_ambassador->privateRefs->socketUn->listenUN();
+ if (port == -1) {
+ D1516.Out( pdError, "Cannot listen to RTIA connection. Abort."
);
+ throw rti1516::RTIinternalError(L"Cannot listen to RTIA
connection" );
+ }
+#else
+ int pipeFd = p_ambassador->privateRefs->socketUn->socketpair();
+ if (pipeFd == -1) {
+ D1516.Out( pdError, "Cannot get socketpair to RTIA connection.
Abort." );
+ throw rti1516::RTIinternalError( L"Cannot get socketpair to
RTIA connection" );
+ }
+#endif
+
+#ifdef _WIN32
+ STARTUPINFO si;
+ PROCESS_INFORMATION pi;
+
+ ZeroMemory( &si, sizeof(si) );
+ si.cb = sizeof(si);
+ ZeroMemory( &pi, sizeof(pi) );
+
+#ifndef RTIA_CONSOLE_SHOW
+ /*
+ * Avoid displaying console window
+ * when running RTIA.
+ */
+ si.dwFlags = STARTF_USESHOWWINDOW;
+ si.wShowWindow = SW_HIDE;
+#endif
+
+#if !defined(RTIA_USE_TCP)
+ SOCKET newPipeFd;
+ if (!DuplicateHandle(GetCurrentProcess(),
+ (HANDLE)pipeFd,
+ GetCurrentProcess(),
+ (HANDLE*)&newPipeFd,
+ 0,
+ TRUE, // Inheritable
+ DUPLICATE_SAME_ACCESS)) {
+ D1516.Out( pdError, "Cannot duplicate socket for RTIA
connection. Abort." );
+ throw rti1516::RTIinternalError( L"Cannot duplicate
socket for RTIA connection. Abort." );
+ }
+#endif
+
+ bool success = false;
+ for (unsigned i = 0; i < rtiaList.size(); ++i) {
+ std::stringstream stream;
+#if defined(RTIA_USE_TCP)
+ stream << rtiaList[i] << ".exe -p " << port;
+#else
+ stream << rtiaList[i] << ".exe -f " << newPipeFd;
+#endif
+
+ // Start the child process.
+ if (CreateProcess( NULL, // No module name (use command line).
+ (char*)stream.str().c_str(), // Command line.
+ NULL, // Process
handle not inheritable.
+ NULL, // Thread
handle not inheritable.
+ TRUE, // Set handle
inheritance to TRUE.
+ 0, // No creation
flags.
+ NULL, // Use parent's
environment block.
+ NULL, // Use parent's
starting directory.
+ &si, // Pointer to
STARTUPINFO structure.
+ &pi )) // Pointer to
PROCESS_INFORMATION structure.
+ {
+ success = true;
+ break;
+ }
+ }
+ if (!success) {
+ msg << "CreateProcess - GetLastError()=<"
+ << GetLastError() <<"> "
+ << "Cannot connect to RTIA.exe";
+ throw rti1516::RTIinternalError(msg.str());
+ }
+
+ p_ambassador->privateRefs->handle_RTIA = pi.hProcess;
+
+#if !defined(RTIA_USE_TCP)
+ closesocket(pipeFd);
+ closesocket(newPipeFd);
+#endif
+
+#else
+
+ sigset_t nset, oset;
+ // temporarily block termination signals
+ // note: this is to prevent child processes from receiving termination
signals
+ sigemptyset(&nset);
+ sigaddset(&nset, SIGINT);
+ sigprocmask(SIG_BLOCK, &nset, &oset);
+
+ switch((p_ambassador->privateRefs->pid_RTIA = fork())) {
+ case -1: // fork failed.
+ perror("fork");
+ // unbock the above blocked signals
+ sigprocmask(SIG_SETMASK, &oset, NULL);
+#if !defined(RTIA_USE_TCP)
+ close(pipeFd);
+#endif
+ throw rti1516::RTIinternalError(wstringize() << "fork failed in
RTIambassador constructor");
+ break ;
+
+ case 0: // child process (RTIA).
+ // close all open filedescriptors except the pipe one
+ for (int fdmax = sysconf(_SC_OPEN_MAX), fd = 3; fd < fdmax;
++fd) {
+#if !defined(RTIA_USE_TCP)
+ if (fd == pipeFd)
+ continue;
+#endif
+ close(fd);
+ }
+ for (unsigned i = 0; i < rtiaList.size(); ++i)
+ {
+ std::stringstream stream;
+#if defined(RTIA_USE_TCP)
+ stream << port;
+ execlp(rtiaList[i].c_str(), rtiaList[i].c_str(), "-p",
stream.str().c_str(), NULL);
+#else
+ stream << pipeFd;
+ execlp(rtiaList[i].c_str(), rtiaList[i].c_str(), "-f",
stream.str().c_str(), NULL);
+#endif
+ }
+ // unbock the above blocked signals
+ sigprocmask(SIG_SETMASK, &oset, NULL);
+ msg << "Could not launch RTIA process (execlp): "
+ << strerror(errno)
+ << std::endl
+ << "Maybe RTIA is not in search PATH environment.";
+ throw rti1516::RTIinternalError(msg.str().c_str());
+
+ default: // father process (Federe).
+ // unbock the above blocked signals
+ sigprocmask(SIG_SETMASK, &oset, NULL);
+#if !defined(RTIA_USE_TCP)
+ close(pipeFd);
+#endif
+ break ;
+ }
+#endif
+
+#if defined(RTIA_USE_TCP)
+ if (p_ambassador->privateRefs->socketUn->acceptUN(10*1000) == -1) {
+#ifdef _WIN32
+ TerminateProcess(p_ambassador->privateRefs->handle_RTIA, 0);
+#else
+ kill(p_ambassador->privateRefs->pid_RTIA, SIGINT );
+#endif
+ throw rti1516::RTIinternalError( wstringize() << "Cannot
connect to RTIA" );
+ }
+#endif
+
+ 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);
+
+ G1516.Out(pdGendoc,"exit RTIambassador::RTIambassador");
+
+ return ap_ambassador;
+}
+
+//} // end namespace rti1516
Index: Handle.cpp
===================================================================
RCS file: Handle.cpp
diff -N Handle.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Handle.cpp 3 Mar 2014 16:41:50 -0000 1.1
@@ -0,0 +1,165 @@
+// ----------------------------------------------------------------------------
+// CERTI - HLA RunTime Infrastructure
+// Copyright (C) 2002-2014 ONERA
+//
+// This file is part of CERTI-libRTI
+//
+// CERTI-libRTI is free software ; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License
+// as published by the Free Software Foundation ; either version 2 of
+// the License, or (at your option) any later version.
+//
+// CERTI-libRTI is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY ; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this program ; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA
+//
+// ----------------------------------------------------------------------------
+#include <sstream>
+#include <RTI/Handle.h>
+#include "HandleImplementation.h"
+
+namespace rti1516
+{
+
+#define DECLARE_HANDLE_CLASS(HandleKind) \
+ \
+ /* Constructs an invalid handle */ \
+ HandleKind::HandleKind() \
+ : _impl(0) \
+ { \
+ } \
+ \
+ HandleKind::HandleKind(HandleKind##Implementation* impl) \
+ : _impl(0) \
+ { \
+ _impl = impl; \
+ } \
+ \
+ HandleKind::HandleKind(VariableLengthData const & encodedValue) \
+ : _impl(0) \
+ { \
+ _impl = new HandleKind##Implementation(encodedValue); \
+ } \
+ \
+ HandleKind::~HandleKind() \
+ throw() \
+ { \
+ delete _impl; \
+ } \
+ \
+ HandleKind::HandleKind(HandleKind const & rhs) \
+ : _impl(0) \
+ { \
+ if ( rhs._impl != 0)
\
+ _impl = new HandleKind##Implementation(*rhs._impl); \
+ } \
+ \
+ HandleKind & \
+ HandleKind::operator=(HandleKind const & rhs) \
+ { \
+ if (this != &rhs) \
+ { \
+ delete _impl; \
+ if ( 0 != rhs._impl ) \
+ _impl = new
HandleKind##Implementation(*(rhs._impl)); \
+ else
\
+ _impl = 0;
\
+ } \
+ return *this; \
+ } \
+ \
+ /* Indicates whether this handle is valid */ \
+ bool HandleKind::isValid() const \
+ { \
+ if (_impl == 0) \
+ return false; \
+ else \
+ return _impl->isValid(); \
+ }
\
+ \
+ /* All invalid handles are equivalent */ \
+ bool HandleKind::operator==(HandleKind const & rhs) const \
+ { \
+ if (_impl == 0 || rhs.getImplementation() == 0)
\
+ return false;
\
+ else
\
+ return ((*_impl)==(*rhs.getImplementation()));
\
+ } \
+ bool HandleKind::operator!=(HandleKind const & rhs) const \
+ { \
+ if (_impl == 0 || rhs.getImplementation() == 0)
\
+ return false;
\
+ else
\
+ return ((*_impl)!=(*rhs.getImplementation()));
\
+ } \
+ bool HandleKind::operator< (HandleKind const & rhs) const \
+ { \
+ if (_impl == 0 || rhs.getImplementation() == 0)
\
+ return false;
\
+ else
\
+ return ((*_impl)<(*rhs.getImplementation()));
\
+ } \
+ \
+ /* Generate an encoded value that can be used to send */ \
+ /* handles to other federates in updates or interactions. */ \
+ VariableLengthData HandleKind::encode() const \
+ { \
+ return _impl->encode(); \
+ } \
+ \
+ /* Alternate encode for directly filling a buffer */ \
+ unsigned long HandleKind::encodedLength() const \
+ { \
+ return _impl->encodedLength(); \
+ } \
+ unsigned long HandleKind::encode( \
+ void* buffer, unsigned long bufferSize) const \
+ throw (CouldNotEncode) \
+ { \
+ return _impl->encode( buffer, bufferSize ); \
+ } \
+ \
+ std::wstring HandleKind::toString() const \
+ {
\
+ if (_impl == NULL) return L"";
\
+ std::wstring implStr = _impl->toString();
\
+ std::wstringstream ss;
\
+ ss << #HandleKind << "_" << implStr;
\
+ return ss.str(); \
+ } \
+ \
+ const HandleKind##Implementation* HandleKind::getImplementation() const
\
+ { \
+ return _impl; \
+ } \
+ \
+ HandleKind##Implementation* HandleKind::getImplementation() \
+ { \
+ return _impl; \
+ } \
+ \
+ /* Output operator for Handles */ \
+ std::wostream & \
+ operator << (std::wostream &str, HandleKind const &h) \
+ { \
+ return str; \
+ } \
+ /* end DECLARE_HANDLE_CLASS */
+
+DECLARE_HANDLE_CLASS(FederateHandle)
+DECLARE_HANDLE_CLASS(ObjectClassHandle)
+DECLARE_HANDLE_CLASS(InteractionClassHandle)
+DECLARE_HANDLE_CLASS(ObjectInstanceHandle)
+DECLARE_HANDLE_CLASS(AttributeHandle)
+DECLARE_HANDLE_CLASS(ParameterHandle)
+DECLARE_HANDLE_CLASS(DimensionHandle)
+DECLARE_HANDLE_CLASS(MessageRetractionHandle)
+DECLARE_HANDLE_CLASS(RegionHandle)
+
+} // end namespace rti1516
Index: RTIambassador.cpp
===================================================================
RCS file: RTIambassador.cpp
diff -N RTIambassador.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ RTIambassador.cpp 3 Mar 2014 16:41:50 -0000 1.1
@@ -0,0 +1,2881 @@
+// ----------------------------------------------------------------------------
+// CERTI - HLA RunTime Infrastructure
+// Copyright (C) 2002-2014 ONERA
+//
+// This file is part of CERTI-libRTI
+//
+// CERTI-libRTI is free software ; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License
+// as published by the Free Software Foundation ; either version 2 of
+// the License, or (at your option) any later version.
+//
+// CERTI-libRTI is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY ; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this program ; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA
+//
+// ----------------------------------------------------------------------------
+
+#include "RTIambassador.h"
+#include <RTI/RangeBounds.h>
+
+#ifndef _WIN32
+#include <cstdlib>
+#include <cstring>
+#endif
+
+#include "PrettyDebug.hh"
+
+#include "M_Classes.hh"
+#include "RTIHandleFactory.h"
+#include "RTI1516fedTime.h"
+
+#include <algorithm>
+
+namespace {
+
+static PrettyDebug D("LIBRTI", __FILE__);
+static PrettyDebug G("GENDOC",__FILE__) ;
+
+}
+
+namespace rti1516
+{
+ /* Deletor Object */
+ template <class T>
+ struct Deletor {
+ void operator() (T* e) {delete e;};
+ };
+
+ /* Helper functions */
+ template<typename T>
+ void
+ RTI1516ambassador::assignPHVMAndExecuteService(const
rti1516::ParameterHandleValueMap &PHVM, T &req, T &rep) {
+
+ 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);
+ certi::ParameterValue_t paramValue;
+ paramValue.resize(it->second.size());
+ memcpy(&(paramValue[0]), it->second.data(),
it->second.size());
+ req.setValues(paramValue, i);
+ }
+ privateRefs->executeService(&req, &rep);
+ }
+
+ template<typename T>
+ void
+ RTI1516ambassador::assignAHVMAndExecuteService(const
rti1516::AttributeHandleValueMap &AHVM, T &req, T &rep) {
+
+ 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);
+ certi::AttributeValue_t attrValue;
+ attrValue.resize(it->second.size());
+ memcpy(&(attrValue[0]), it->second.data(),
it->second.size());
+ req.setValues(attrValue, i);
+ }
+ privateRefs->executeService(&req, &rep);
+ }
+
+ 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);
+ }
+ privateRefs->executeService(&req, &rep);
+ }
+
+ std::string varLengthDataAsString(VariableLengthData varLengthData) {
+ std::string retVal( (char*)varLengthData.data(),
varLengthData.size() );
+ return retVal;
+ }
+
+ certi::TransportType
toCertiTransportationType(rti1516::TransportationType theType) {
+ return (theType == rti1516::RELIABLE) ? certi::RELIABLE :
certi::BEST_EFFORT;
+ }
+ rti1516::TransportationType
toRTI1516TransportationType(certi::TransportType theType) {
+ return (theType == certi::RELIABLE) ? rti1516::RELIABLE :
rti1516::BEST_EFFORT;
+ }
+ certi::OrderType toCertiOrderType(rti1516::OrderType theType) {
+ return (theType == rti1516::RECEIVE) ? certi::RECEIVE :
certi::TIMESTAMP;
+ }
+ rti1516::OrderType toRTI1516OrderType(certi::OrderType theType) {
+ return (theType == certi::RECEIVE) ? rti1516::RECEIVE :
rti1516::TIMESTAMP;
+ }
+ /* end of Helper functions */
+
+ RTIambassador::RTIambassador() throw()
+ {
+ }
+
+ RTIambassador::~RTIambassador()
+ {
+ }
+
+
+ RTI1516ambassador::RTI1516ambassador() throw()
+ : privateRefs(0)
+ {
+ }
+
+ RTI1516ambassador::~RTI1516ambassador()
+ {
+ certi::M_Close_Connexion req, rep ;
+
+ G.Out(pdGendoc," ====>executeService CLOSE_CONNEXION");
+ privateRefs->executeService(&req, &rep);
+ // after the response is received, the privateRefs->socketUn
must not be used
+
+ delete privateRefs;
+ }
+
+ //
----------------------------------------------------------------------------
+ //! Generic callback evocation (CERTI extension).
+ /*! Blocks up to "minimum" seconds until a callback delivery and then
evokes a
+ * single callback.
+ * @return true if additional callbacks pending, false otherwise
+ */
+ bool RTI1516ambassador::__tick_kernel(bool multiple, TickTime minimum,
TickTime maximum)
+ throw (rti1516::SpecifiedSaveLabelDoesNotExist,
+ rti1516::RTIinternalError)
+ {
+ 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);
+
+ try {
+
vers_RTI.send(privateRefs->socketUn,privateRefs->msgBufSend);
+ }
+ catch (NetworkError &e) {
+ 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);
+ }
+
+ // Read response(s) from the local RTIA until
Message::TICK_REQUEST is received.
+ while (1) {
+ try {
+
vers_Fed.reset(M_Factory::receive(privateRefs->socketUn));
+ }
+ catch (NetworkError &e) {
+ std::stringstream msg;
+ msg << "NetworkError in tick() while receiving
response: " << e._reason;
+ std::wstring message(msg.str().begin(),
msg.str().end());
+ throw RTIinternalError(message);
+ }
+
+ // 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.get());
+ }
+ return
static_cast<M_Tick_Request*>(vers_Fed.get())->getMultiple();
+ }
+
+ try {
+ // Otherwise, the RTI calls a
FederateAmbassador service.
+
privateRefs->callFederateAmbassador(vers_Fed.get());
+ }
+ catch (RTIinternalError&) {
+ // RTIA awaits TICK_REQUEST_NEXT, terminate the
tick() processing
+ privateRefs->sendTickRequestStop();
+ // ignore the response and re-throw the
original exception
+ throw;
+ }
+
+ try {
+ // Request next callback from the RTIA
+ M_Tick_Request_Next tick_next;
+ tick_next.send(privateRefs->socketUn,
privateRefs->msgBufSend);
+ }
+ catch (NetworkError &e) {
+ std::stringstream msg;
+ msg << "NetworkError in tick() while sending
TICK_REQUEST_NEXT: " << e._reason;
+
+ std::wstring message(msg.str().begin(),
msg.str().end());
+ throw RTIinternalError(message);
+ }
+ } // while(1)
+ }
+
+ // 4.2
+ void RTI1516ambassador::createFederationExecution
+ (std::wstring const & federationExecutionName,
+ std::wstring const & fullPathNameToTheFDDfile,
+ std::wstring const & logicalTimeImplementationName)
+ throw (FederationExecutionAlreadyExists,
+ CouldNotOpenFDD,
+ ErrorReadingFDD,
+ CouldNotCreateLogicalTimeFactory,
+ RTIinternalError)
+ {
+ /* TODO */
+ certi::M_Create_Federation_Execution req, rep ;
+
+ G.Out(pdGendoc,"enter
RTI1516ambassador::createFederationExecution");
+ std::string
federationExecutionNameAsString(federationExecutionName.begin(),
federationExecutionName.end());
+ req.setFederationName(federationExecutionNameAsString);
+
+ std::string
fullPathNameToTheFDDfileAsString(fullPathNameToTheFDDfile.begin(),
fullPathNameToTheFDDfile.end());
+ req.setFEDid(fullPathNameToTheFDDfileAsString);
+
+ /*#ifdef _WIN32
+ if(!stricmp(FED,executionName)) {
+ #else
+ if(!strcasecmp(FED,exeName)) {
+ #endif
+ }*/
+ G.Out(pdGendoc," ====>executeService
CREATE_FEDERATION_EXECUTION");
+
+ privateRefs->executeService(&req, &rep);
+
+ G.Out(pdGendoc,"exit
RTI1516ambassador::createFederationExecution");
+
+ // TODO What to do with the 'logicalTimeImplementationName'?
Can't find it's use in SISO-STD-004.1-2004
+ // Only exists in C++ interface.
+ // Ignored for now.
+ }
+
+ // 4.3
+ void RTI1516ambassador::destroyFederationExecution
+ (std::wstring const & federationExecutionName)
+ throw (FederatesCurrentlyJoined,
+ FederationExecutionDoesNotExist,
+ RTIinternalError)
+ {
+ M_Destroy_Federation_Execution req, rep ;
+
+ G.Out(pdGendoc,"enter
RTI1516ambassador::destroyFederationExecution");
+
+ std::string
federationExecutionNameAsString(federationExecutionName.begin(),
federationExecutionName.end());
+ req.setFederationName(federationExecutionNameAsString);
+
+ G.Out(pdGendoc," ====>executeService
DESTROY_FEDERATION_EXECUTION");
+
+ privateRefs->executeService(&req, &rep);
+
+ G.Out(pdGendoc,"exit
RTI1516ambassador::destroyFederationExecution");
+ }
+
+ // 4.4
+ FederateHandle RTI1516ambassador::joinFederationExecution
+ (std::wstring const & federateType,
+ std::wstring const & federationExecutionName,
+ FederateAmbassador & federateAmbassador)
+ throw (FederateAlreadyExecutionMember,
+ FederationExecutionDoesNotExist,
+ SaveInProgress,
+ RestoreInProgress,
+ CouldNotCreateLogicalTimeFactory,
+ RTIinternalError)
+ {
+ M_Join_Federation_Execution req, rep ;
+
+ G.Out(pdGendoc,"enter
RTI1516ambassador::joinFederationExecution");
+
+ if ( &federateType == NULL || federateType.length() <= 0 ) {
+ throw RTIinternalError(L"Incorrect or empty federate
name");
+ }
+ std::string federateTypeAsString(federateType.begin(),
federateType.end());
+
+ if ( &federationExecutionName == NULL ||
federationExecutionName.length() <= 0 )
+ throw RTIinternalError(L"Incorrect or empty federation
name");
+ std::string
federationExecutionNameAsString(federationExecutionName.begin(),
federationExecutionName.end());
+
+ privateRefs->fed_amb = &federateAmbassador ;
+
+ req.setFederateName(federateTypeAsString);
+ req.setFederationName(federationExecutionNameAsString);
+ G.Out(pdGendoc," ====>executeService
JOIN_FEDERATION_EXECUTION");
+ privateRefs->executeService(&req, &rep);
+ G.Out(pdGendoc,"exit
RTI1516ambassador::joinFederationExecution");
+ PrettyDebug::setFederateName(
"LibRTI::"+std::string(federateTypeAsString));
+
+ certi::FederateHandle certiFederateHandle = rep.getFederate();
+ rti1516::FederateHandle rti1516FederateHandle =
rti1516::FederateHandleFriend::createRTI1516Handle(certiFederateHandle);
+
+ return rti1516FederateHandle;
+ }
+
+ // 4.5
+ void RTI1516ambassador::resignFederationExecution
+ (ResignAction resignAction)
+ throw (OwnershipAcquisitionPending,
+ FederateOwnsAttributes,
+ FederateNotExecutionMember,
+ RTIinternalError)
+ {
+ 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);
+ G.Out(pdGendoc," ====>executeService
RESIGN_FEDERATION_EXECUTION");
+ privateRefs->executeService(&req, &rep);
+ G.Out(pdGendoc,"exit
RTI1516ambassador::resignFederationExecution");
+ }
+
+ // 4.6
+ void RTI1516ambassador::registerFederationSynchronizationPoint
+ (std::wstring const & label,
+ VariableLengthData const & theUserSuppliedTag)
+ throw (FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ 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);
+ // no federate set
+ req.setFederateSetSize(0);
+ if ( &theUserSuppliedTag == NULL || theUserSuppliedTag.data()
== NULL )
+ {
+ throw RTIinternalError (L"Calling
registerFederationSynchronizationPoint with Tag NULL");
+ }
+ req.setTag(varLengthDataAsString(theUserSuppliedTag));
+ G.Out(pdGendoc," ====>executeService
REGISTER_FEDERATION_SYNCHRONIZATION_POINT");
+ privateRefs->executeService(&req, &rep);
+
+ G.Out(pdGendoc,"exit
RTI1516ambassador::registerFederationSynchronizationPoint for all federates");
+ }
+
+ void RTI1516ambassador::registerFederationSynchronizationPoint
+ (std::wstring const & label,
+ VariableLengthData const & theUserSuppliedTag,
+ FederateHandleSet const & syncSet)
+ throw (FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ 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);
+ if ( &theUserSuppliedTag == NULL || theUserSuppliedTag.data()
== NULL )
+ {
+ throw RTIinternalError (L"Calling
registerFederationSynchronizationPoint with Tag NULL");
+ }
+ 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());
+
+ uint32_t i = 0;
+ for ( rti1516::FederateHandleSet::const_iterator it =
syncSet.begin(); it != syncSet.end(); it++, ++i)
+ {
+
req.setFederateSet(FederateHandleFriend::toCertiHandle(*it),i);
+ }
+
+ G.Out(pdGendoc," ====>executeService
REGISTER_FEDERATION_SYNCHRONIZATION_POINT");
+ privateRefs->executeService(&req, &rep);
+
+ G.Out(pdGendoc,"exit
RTI1516ambassador::registerFederationSynchronizationPoint for some federates");
+ }
+
+ // 4.9
+ void RTI1516ambassador::synchronizationPointAchieved
+ (std::wstring const & label)
+ throw (SynchronizationPointLabelNotAnnounced,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Synchronization_Point_Achieved req, rep ;
+
+ G.Out(pdGendoc,"enter
RTI1516ambassador::synchronizationPointAchieved");
+
+ std::string labelString(label.begin(), label.end());
+ req.setLabel(labelString);
+
+ G.Out(pdGendoc," ====>executeService
SYNCHRONIZATION_POINT_ACHIEVED");
+ privateRefs->executeService(&req, &rep);
+
+ G.Out(pdGendoc,"exit
RTI1516ambassador::synchronizationPointAchieved");
+ }
+
+ // 4.11
+ void RTI1516ambassador::requestFederationSave
+ (std::wstring const & label)
+ throw (FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Request_Federation_Save req, rep ;
+
+ G.Out(pdGendoc,"enter RTI1516ambassador::requestFederationSave
without time");
+
+ std::string labelString(label.begin(), label.end());
+ req.setLabel(labelString);
+ G.Out(pdGendoc," ====>executeService
REQUEST_FEDERATION_SAVE");
+
+ privateRefs->executeService(&req, &rep);
+ G.Out(pdGendoc,"exit RTI1516ambassador::requestFederationSave
without time");
+ }
+
+ void RTI1516ambassador::requestFederationSave
+ (std::wstring const & label,
+ LogicalTime const & theTime)
+ throw (LogicalTimeAlreadyPassed,
+ InvalidLogicalTime,
+ FederateUnableToUseTime,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ 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);
+
+ std::string labelString(label.begin(), label.end());
+ req.setLabel(labelString);
+
+ G.Out(pdGendoc," ====>executeService
REQUEST_FEDERATION_SAVE");
+ privateRefs->executeService(&req, &rep);
+
+ G.Out(pdGendoc,"exit RTI1516ambassador::requestFederationSave
with time");
+ }
+
+ // 4.13
+ void RTI1516ambassador::federateSaveBegun ()
+ throw (SaveNotInitiated,
+ FederateNotExecutionMember,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Federate_Save_Begun req, rep ;
+
+ G.Out(pdGendoc,"enter RTI1516ambassador::federateSaveBegun");
+
+ G.Out(pdGendoc," ====>executeService FEDERATE_SAVE_BEGUN");
+ privateRefs->executeService(&req, &rep);
+
+ G.Out(pdGendoc,"exit RTI1516ambassador::federateSaveBegun");
+ }
+
+ // 4.14
+ void RTI1516ambassador::federateSaveComplete ()
+ throw (FederateHasNotBegunSave,
+ FederateNotExecutionMember,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Federate_Save_Complete req, rep ;
+
+ G.Out(pdGendoc,"enter RTI1516ambassador::federateSaveComplete");
+ G.Out(pdGendoc," ====>executeService
FEDERATE_SAVE_COMPLETE");
+ privateRefs->executeService(&req, &rep);
+ G.Out(pdGendoc,"exit RTI1516ambassador::federateSaveComplete");
+ }
+
+ void RTI1516ambassador::federateSaveNotComplete()
+ throw (FederateHasNotBegunSave,
+ FederateNotExecutionMember,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Federate_Save_Not_Complete req, rep ;
+
+ G.Out(pdGendoc,"enter
RTI1516ambassador::federateSaveNotComplete");
+ G.Out(pdGendoc," ====>executeService
FEDERATE_SAVE_NOT_COMPLETE");
+ privateRefs->executeService(&req, &rep);
+
+ G.Out(pdGendoc,"exit
RTI1516ambassador::federateSaveNotComplete");
+ }
+
+ // 4.16
+ void RTI1516ambassador::queryFederationSaveStatus ()
+ throw (FederateNotExecutionMember,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ /* TODO */
+ throw RTIinternalError(L"Not yet implemented");
+ }
+
+ // 4.18
+ void RTI1516ambassador::requestFederationRestore
+ (std::wstring const & label)
+ throw (FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Request_Federation_Restore req, rep ;
+
+ G.Out(pdGendoc,"enter
RTI1516ambassador::requestFederationRestore");
+ std::string labelString(label.begin(), label.end());
+ req.setLabel(labelString);
+ G.Out(pdGendoc," ====>executeService
REQUEST_FEDERATION_RESTORE");
+ privateRefs->executeService(&req, &rep);
+ G.Out(pdGendoc,"exit
RTI1516ambassador::requestFederationRestore");
+ }
+
+ // 4.22
+ void RTI1516ambassador::federateRestoreComplete ()
+ throw (RestoreNotRequested,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RTIinternalError)
+ {
+ M_Federate_Restore_Complete req, rep ;
+
+ G.Out(pdGendoc,"enter
RTI1516ambassador::federateRestoreComplete");
+
+ G.Out(pdGendoc," ====>executeService
FEDERATE_RESTORE_COMPLETE");
+ privateRefs->executeService(&req, &rep);
+ G.Out(pdGendoc,"exit
RTI1516ambassador::federateRestoreComplete");
+ }
+
+ void RTI1516ambassador::federateRestoreNotComplete ()
+ throw (RestoreNotRequested,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RTIinternalError)
+ {
+ M_Federate_Restore_Not_Complete req, rep ;
+
+ G.Out(pdGendoc,"enter
RTI1516ambassador::federateRestoreNotComplete");
+ G.Out(pdGendoc," ====>executeService
FEDERATE_RESTORE_NOT_COMPLETE");
+
+ privateRefs->executeService(&req, &rep);
+ G.Out(pdGendoc,"exit
RTI1516ambassador::federateRestoreNotComplete");
+ }
+
+ // 4.24
+ void RTI1516ambassador::queryFederationRestoreStatus ()
+ throw (FederateNotExecutionMember,
+ SaveInProgress,
+ RTIinternalError)
+ {
+ /* TODO */
+ throw RTIinternalError(L"Not yet implemented");
+ }
+
+ /////////////////////////////////////
+ // Declaration Management Services //
+ /////////////////////////////////////
+
+ // 5.2
+ void RTI1516ambassador::publishObjectClassAttributes
+ (ObjectClassHandle theClass,
+ rti1516::AttributeHandleSet const & attributeList)
+ throw (ObjectClassNotDefined,
+ AttributeNotDefined,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Publish_Object_Class req, rep ;
+ G.Out(pdGendoc,"enter RTI1516ambassador::publishObjectClass");
+
+ const certi::ObjectClassHandle objectClassHandle =
ObjectClassHandleFriend::toCertiHandle(theClass);
+ req.setObjectClass(objectClassHandle);
+
+ 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);
+ }
+ G.Out(pdGendoc," ====>executeService
PUBLISH_OBJECT_CLASS");
+ privateRefs->executeService(&req, &rep);
+ G.Out(pdGendoc,"exit RTI1516ambassador::publishObjectClass");
+ }
+
+ // 5.3
+ void RTI1516ambassador::unpublishObjectClass
+ (ObjectClassHandle theClass)
+ throw (ObjectClassNotDefined,
+ OwnershipAcquisitionPending,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Unpublish_Object_Class req, rep ;
+ G.Out(pdGendoc,"enter RTI1516ambassador::unpublishObjectClass");
+
+ const certi::ObjectClassHandle objectClassHandle =
ObjectClassHandleFriend::toCertiHandle(theClass);
+ req.setObjectClass(objectClassHandle);
+ G.Out(pdGendoc," ====>executeService
UNPUBLISH_OBJECT_CLASS");
+ privateRefs->executeService(&req, &rep);
+ G.Out(pdGendoc,"exit RTI1516ambassador::unpublishObjectClass");
+ }
+
+ void RTI1516ambassador::unpublishObjectClassAttributes
+ (ObjectClassHandle theClass,
+ AttributeHandleSet const & attributeList)
+ throw (ObjectClassNotDefined,
+ AttributeNotDefined,
+ OwnershipAcquisitionPending,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ /* TODO */
+ throw RTIinternalError(L"Not yet implemented");
+ }
+
+ // 5.4
+ void RTI1516ambassador::publishInteractionClass
+ (InteractionClassHandle theInteraction)
+ throw (InteractionClassNotDefined,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Publish_Interaction_Class req, rep ;
+ const certi::InteractionClassHandle classHandle =
InteractionClassHandleFriend::toCertiHandle(theInteraction);
+ req.setInteractionClass(classHandle);
+ G.Out(pdGendoc," ====>executeService
PUBLISH_INTERACTION_CLASS");
+ privateRefs->executeService(&req, &rep);
+ }
+
+ // 5.5
+ void RTI1516ambassador::unpublishInteractionClass
+ (InteractionClassHandle theInteraction)
+ throw (InteractionClassNotDefined,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Unpublish_Interaction_Class req, rep ;
+ const certi::InteractionClassHandle classHandle =
InteractionClassHandleFriend::toCertiHandle(theInteraction);
+ req.setInteractionClass(classHandle);
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+ // 5.6
+ void RTI1516ambassador::subscribeObjectClassAttributes
+ (ObjectClassHandle theClass,
+ AttributeHandleSet const & attributeList,
+ bool active)
+ throw (ObjectClassNotDefined,
+ AttributeNotDefined,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Subscribe_Object_Class_Attributes req, rep ;
+ G.Out(pdGendoc,"enter
RTI1516ambassador::subscribeObjectClassAttributes");
+
+ const certi::ObjectClassHandle objectClassHandle =
ObjectClassHandleFriend::toCertiHandle(theClass);
+ req.setObjectClass(objectClassHandle);
+
+ 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.setActive(active);
+
+ privateRefs->executeService(&req, &rep);
+ G.Out(pdGendoc,"exit
RTI1516ambassador::subscribeObjectClassAttributes");
+ }
+
+ // 5.7
+ void RTI1516ambassador::unsubscribeObjectClass
+ (ObjectClassHandle theClass)
+ throw (ObjectClassNotDefined,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Unsubscribe_Object_Class req, rep ;
+
+ const certi::ObjectClassHandle objectClassHandle =
ObjectClassHandleFriend::toCertiHandle(theClass);
+ req.setObjectClass(objectClassHandle);
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+ void RTI1516ambassador::unsubscribeObjectClassAttributes
+ (ObjectClassHandle theClass,
+ AttributeHandleSet const & attributeList)
+ throw (ObjectClassNotDefined,
+ AttributeNotDefined,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ /* TODO */
+ throw RTIinternalError(L"Not yet implemented");
+ }
+
+ // 5.8
+ void RTI1516ambassador::subscribeInteractionClass
+ (InteractionClassHandle theClass,
+ bool active)
+ throw (InteractionClassNotDefined,
+ FederateServiceInvocationsAreBeingReportedViaMOM,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Subscribe_Interaction_Class req, rep ;
+ const certi::InteractionClassHandle classHandle =
InteractionClassHandleFriend::toCertiHandle(theClass);
+ req.setInteractionClass(classHandle);
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+ // 5.9
+ void RTI1516ambassador::unsubscribeInteractionClass
+ (InteractionClassHandle theClass)
+ throw (InteractionClassNotDefined,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Unsubscribe_Interaction_Class req, rep ;
+
+ const certi::InteractionClassHandle classHandle =
InteractionClassHandleFriend::toCertiHandle(theClass);
+ req.setInteractionClass(classHandle);
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+ ////////////////////////////////
+ // Object Management Services //
+ ////////////////////////////////
+
+ // 6.2
+ void RTI1516ambassador::reserveObjectInstanceName
+ (std::wstring const & theObjectInstanceName)
+ throw (IllegalName,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Reserve_Object_Instance_Name req, rep;
+
+ std::string objInstanceName(theObjectInstanceName.begin(),
theObjectInstanceName.end());
+ req.setObjectName(objInstanceName);
+ privateRefs->executeService(&req, &rep);
+ }
+
+ // 6.4
+ ObjectInstanceHandle RTI1516ambassador::registerObjectInstance
+ (ObjectClassHandle theClass)
+ throw (ObjectClassNotDefined,
+ ObjectClassNotPublished,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Register_Object_Instance req, rep ;
+
+
req.setObjectClass(rti1516::ObjectClassHandleFriend::toCertiHandle(theClass));
+ privateRefs->executeService(&req, &rep);
+ return
rti1516::ObjectInstanceHandleFriend::createRTI1516Handle(rep.getObject());
+ }
+
+ ObjectInstanceHandle RTI1516ambassador::registerObjectInstance
+ (ObjectClassHandle theClass,
+ std::wstring const & theObjectInstanceName)
+ throw (ObjectClassNotDefined,
+ ObjectClassNotPublished,
+ ObjectInstanceNameNotReserved,
+ ObjectInstanceNameInUse,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Register_Object_Instance req, rep ;
+
+ std::string nameString(theObjectInstanceName.begin(),
theObjectInstanceName.end());
+ req.setObjectName(nameString);
+
req.setObjectClass(rti1516::ObjectClassHandleFriend::toCertiHandle(theClass));
+ privateRefs->executeService(&req, &rep);
+
+ return
rti1516::ObjectInstanceHandleFriend::createRTI1516Handle(rep.getObject());
+ }
+
+ // 6.6
+ void RTI1516ambassador::updateAttributeValues
+ (ObjectInstanceHandle theObject,
+ AttributeHandleValueMap const & theAttributeValues,
+ VariableLengthData const & theUserSuppliedTag)
+ throw (ObjectInstanceNotKnown,
+ AttributeNotDefined,
+ AttributeNotOwned,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ G.Out(pdGendoc,"enter RTI1516ambassador::updateAttributeValues
without time");
+ M_Update_Attribute_Values req, rep ;
+
+
req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
+ if ( &theUserSuppliedTag == NULL || theUserSuppliedTag.data()
== NULL)
+ {
+ throw RTIinternalError(L"Calling updateAttributeValues
with Tag NULL");
+ }
+
+ req.setTag(varLengthDataAsString(theUserSuppliedTag));
+
+ assignAHVMAndExecuteService(theAttributeValues, req, rep);
+
+ G.Out(pdGendoc,"exit RTI1516ambassador::updateAttributeValues
without time");
+ }
+
+ MessageRetractionHandle RTI1516ambassador::updateAttributeValues
+ (ObjectInstanceHandle theObject,
+ AttributeHandleValueMap const & theAttributeValues,
+ VariableLengthData const & theUserSuppliedTag,
+ LogicalTime const & theTime)
+ throw (ObjectInstanceNotKnown,
+ AttributeNotDefined,
+ AttributeNotOwned,
+ InvalidLogicalTime,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ G.Out(pdGendoc,"enter RTI1516ambassador::updateAttributeValues
with time");
+ M_Update_Attribute_Values req, rep ;
+
+
req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
+
+ certi::FederationTime
certiFedTime(certi_cast<RTI1516fedTime>()(theTime).getFedTime());
+ req.setDate(certiFedTime);
+
+ if ( &theUserSuppliedTag == NULL || theUserSuppliedTag.data()
== NULL)
+ {
+ throw RTIinternalError(L"Calling updateAttributeValues
with Tag NULL");
+ }
+
+ req.setTag(varLengthDataAsString(theUserSuppliedTag));
+
+ assignAHVMAndExecuteService(theAttributeValues, req, rep);
+
+ G.Out(pdGendoc,"return
RTI1516ambassador::updateAttributeValues with time");
+ certi::FederateHandle certiHandle =
rep.getEventRetraction().getSendingFederate();
+ uint64_t serialNum = rep.getEventRetraction().getSN();
+ return
rti1516::MessageRetractionHandleFriend::createRTI1516Handle(certiHandle,
serialNum);
+ }
+
+ // 6.8
+ void RTI1516ambassador::sendInteraction
+ (InteractionClassHandle theInteraction,
+ ParameterHandleValueMap const & theParameterValues,
+ VariableLengthData const & theUserSuppliedTag)
+ throw (InteractionClassNotPublished,
+ InteractionClassNotDefined,
+ InteractionParameterNotDefined,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Send_Interaction req, rep ;
+
+ const certi::InteractionClassHandle classHandle =
InteractionClassHandleFriend::toCertiHandle(theInteraction);
+ req.setInteractionClass(classHandle);
+
+ if (&theUserSuppliedTag == NULL || theUserSuppliedTag.data() ==
NULL )
+ {
+ throw RTIinternalError (L"Calling sendIntercation with
Tag NULL") ;
+ }
+
+ req.setTag(varLengthDataAsString(theUserSuppliedTag));
+ req.setRegion(0);
+
+ assignPHVMAndExecuteService(theParameterValues, req, rep);
+ }
+
+ MessageRetractionHandle RTI1516ambassador::sendInteraction
+ (InteractionClassHandle theInteraction,
+ ParameterHandleValueMap const & theParameterValues,
+ VariableLengthData const & theUserSuppliedTag,
+ LogicalTime const & theTime)
+ throw (InteractionClassNotPublished,
+ InteractionClassNotDefined,
+ InteractionParameterNotDefined,
+ InvalidLogicalTime,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Send_Interaction req, rep ;
+
+ const certi::InteractionClassHandle classHandle =
InteractionClassHandleFriend::toCertiHandle(theInteraction);
+ req.setInteractionClass(classHandle);
+
+ certi::FederationTime
certiFedTime(certi_cast<RTI1516fedTime>()(theTime).getFedTime());
+ req.setDate(certiFedTime);
+
+ if (&theUserSuppliedTag == NULL || theUserSuppliedTag.data() ==
NULL ) {
+ throw RTIinternalError(L"Calling sendInteraction with
Tag NULL") ;
+ }
+
+ req.setTag(varLengthDataAsString(theUserSuppliedTag));
+ req.setRegion(0);
+
+ 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;
+ }
+
+ // 6.10
+ void RTI1516ambassador::deleteObjectInstance
+ (ObjectInstanceHandle theObject,
+ VariableLengthData const & theUserSuppliedTag)
+ throw (DeletePrivilegeNotHeld,
+ ObjectInstanceNotKnown,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Delete_Object_Instance req, rep ;
+
+
req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
+ if ( &theUserSuppliedTag == NULL || theUserSuppliedTag.data()
== NULL)
+ {
+ throw RTIinternalError(L"Calling deleteObjectInstance
with Tag NULL") ;
+ }
+
+ req.setTag(varLengthDataAsString(theUserSuppliedTag));
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+ MessageRetractionHandle RTI1516ambassador::deleteObjectInstance
+ (ObjectInstanceHandle theObject,
+ VariableLengthData const & theUserSuppliedTag,
+ LogicalTime const & theTime)
+ throw (DeletePrivilegeNotHeld,
+ ObjectInstanceNotKnown,
+ InvalidLogicalTime,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Delete_Object_Instance req, rep ;
+
+
req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
+
+ certi::FederationTime
certiFedTime(certi_cast<RTI1516fedTime>()(theTime).getFedTime());
+ req.setDate(certiFedTime);
+
+ if ( &theUserSuppliedTag == NULL || theUserSuppliedTag.data()
== NULL)
+ {
+ throw RTIinternalError(L"Calling deleteObjectInstance
with Tag NULL") ;
+ }
+
+ req.setTag(varLengthDataAsString(theUserSuppliedTag));
+
+ privateRefs->executeService(&req, &rep);
+
+ certi::FederateHandle certiHandle =
rep.getEventRetraction().getSendingFederate();
+ uint64_t serialNum = rep.getEventRetraction().getSN();
+ return
rti1516::MessageRetractionHandleFriend::createRTI1516Handle(certiHandle,
serialNum);
+ }
+
+ // 6.12
+ void RTI1516ambassador::localDeleteObjectInstance
+ (ObjectInstanceHandle theObject)
+ throw (ObjectInstanceNotKnown,
+ FederateOwnsAttributes,
+ OwnershipAcquisitionPending,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ throw RTIinternalError(L"unimplemented service
localDeleteObjectInstance");
+ M_Local_Delete_Object_Instance req, rep ;
+
+
req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
+ privateRefs->executeService(&req, &rep);
+ }
+
+ // 6.13
+ void RTI1516ambassador::changeAttributeTransportationType
+ (ObjectInstanceHandle theObject,
+ AttributeHandleSet const & theAttributes,
+ TransportationType theType)
+ throw (ObjectInstanceNotKnown,
+ AttributeNotDefined,
+ AttributeNotOwned,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Change_Attribute_Transportation_Type req, rep ;
+
req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
+ req.setTransportationType(toCertiTransportationType(theType));
+
+ 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);
+ }
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+ // 6.14
+ void RTI1516ambassador::changeInteractionTransportationType
+ (InteractionClassHandle theClass,
+ TransportationType theType)
+ throw (InteractionClassNotDefined,
+ InteractionClassNotPublished,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Change_Interaction_Transportation_Type req, rep ;
+
+
req.setInteractionClass(rti1516::InteractionClassHandleFriend::toCertiHandle(theClass));
+ req.setTransportationType(toCertiTransportationType(theType));
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+ // 6.17
+ void RTI1516ambassador::requestAttributeValueUpdate
+ (ObjectInstanceHandle theObject,
+ AttributeHandleSet const & theAttributes,
+ VariableLengthData const & theUserSuppliedTag)
+ throw (ObjectInstanceNotKnown,
+ AttributeNotDefined,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Request_Object_Attribute_Value_Update req, rep ;
+
+ G.Out(pdGendoc,"enter
RTI1516ambassador::requestObjectAttributeValueUpdate");
+
req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
+
+ size_t attr_num = theAttributes.size();
+ 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.setTag(varLengthDataAsString(theUserSuppliedTag));
+
+ privateRefs->executeService(&req, &rep);
+ G.Out(pdGendoc,"exit
RTI1516ambassador::requestObjectAttributeValueUpdate");
+ }
+
+ void RTI1516ambassador::requestAttributeValueUpdate
+ (ObjectClassHandle theClass,
+ AttributeHandleSet const & theAttributes,
+ VariableLengthData const & theUserSuppliedTag)
+ throw (ObjectClassNotDefined,
+ AttributeNotDefined,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Request_Class_Attribute_Value_Update req, rep ;
+ G.Out(pdGendoc,"enter
RTI1516ambassador::requestClassAttributeValueUpdate");
+
req.setObjectClass(rti1516::ObjectClassHandleFriend::toCertiHandle(theClass));
+
+ assignAHSAndExecuteService(theAttributes, req, rep);
+
+ G.Out(pdGendoc,"exit
RTI1516ambassador::requestClassAttributeValueUpdate");
+ }
+
+ ///////////////////////////////////
+ // Ownership Management Services //
+ ///////////////////////////////////
+ // 7.2
+ void RTI1516ambassador::unconditionalAttributeOwnershipDivestiture
+ (ObjectInstanceHandle theObject,
+ AttributeHandleSet const & theAttributes)
+ throw (ObjectInstanceNotKnown,
+ AttributeNotDefined,
+ AttributeNotOwned,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Unconditional_Attribute_Ownership_Divestiture req, rep ;
+
req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
+
+ 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);
+ }
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+ // 7.3
+ void RTI1516ambassador::negotiatedAttributeOwnershipDivestiture
+ (ObjectInstanceHandle theObject,
+ AttributeHandleSet const & theAttributes,
+ VariableLengthData const & theUserSuppliedTag)
+ throw (ObjectInstanceNotKnown,
+ AttributeNotDefined,
+ AttributeNotOwned,
+ AttributeAlreadyBeingDivested,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ 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.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);
+ }
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+ // 7.6
+ void RTI1516ambassador::confirmDivestiture
+ (ObjectInstanceHandle theObject,
+ AttributeHandleSet const & confirmedAttributes,
+ VariableLengthData const & theUserSuppliedTag)
+ throw (ObjectInstanceNotKnown,
+ AttributeNotDefined,
+ AttributeNotOwned,
+ AttributeDivestitureWasNotRequested,
+ NoAcquisitionPending,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ /* TODO */
+ throw RTIinternalError(L"Not yet implemented");
+ }
+
+ // 7.8
+ void RTI1516ambassador::attributeOwnershipAcquisition
+ (ObjectInstanceHandle theObject,
+ AttributeHandleSet const & desiredAttributes,
+ VariableLengthData const & theUserSuppliedTag)
+ throw (ObjectInstanceNotKnown,
+ ObjectClassNotPublished,
+ AttributeNotDefined,
+ AttributeNotPublished,
+ FederateOwnsAttributes,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Attribute_Ownership_Acquisition req, rep ;
+
+
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.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);
+ }
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+ // 7.9
+ void RTI1516ambassador::attributeOwnershipAcquisitionIfAvailable
+ (ObjectInstanceHandle theObject,
+ AttributeHandleSet const & desiredAttributes)
+ throw (ObjectInstanceNotKnown,
+ ObjectClassNotPublished,
+ AttributeNotDefined,
+ AttributeNotPublished,
+ FederateOwnsAttributes,
+ AttributeAlreadyBeingAcquired,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Attribute_Ownership_Acquisition_If_Available req, rep ;
+
+
req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
+
+ 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);
+ }
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+ // 7.12 (in RTI1.3 this function is called:
AttributeOwnershipReleaseResponse)
+ void RTI1516ambassador::attributeOwnershipDivestitureIfWanted
+ (ObjectInstanceHandle theObject,
+ AttributeHandleSet const & theAttributes,
+ AttributeHandleSet & theDivestedAttributes) // filled by RTI
+ throw (ObjectInstanceNotKnown,
+ AttributeNotDefined,
+ AttributeNotOwned,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Attribute_Ownership_Release_Response req, rep ;
+
+
req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
+
+ assignAHSAndExecuteService(theAttributes, req, rep);
+
+ 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]));
+ }
+ }
+
+ }
+
+ // 7.13
+ void RTI1516ambassador::cancelNegotiatedAttributeOwnershipDivestiture
+ (ObjectInstanceHandle theObject,
+ AttributeHandleSet const & theAttributes)
+ throw (ObjectInstanceNotKnown,
+ AttributeNotDefined,
+ AttributeNotOwned,
+ AttributeDivestitureWasNotRequested,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Cancel_Negotiated_Attribute_Ownership_Divestiture req, rep ;
+
+
req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
+
+ 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);
+ }
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+ // 7.14
+ void RTI1516ambassador::cancelAttributeOwnershipAcquisition
+ (ObjectInstanceHandle theObject,
+ AttributeHandleSet const & theAttributes)
+ throw (ObjectInstanceNotKnown,
+ AttributeNotDefined,
+ AttributeAlreadyOwned,
+ AttributeAcquisitionWasNotRequested,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Cancel_Attribute_Ownership_Acquisition req, rep ;
+
+
req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
+
+ 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);
+ }
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+ // 7.16
+ void RTI1516ambassador::queryAttributeOwnership
+ (ObjectInstanceHandle theObject,
+ AttributeHandle theAttribute)
+ throw (ObjectInstanceNotKnown,
+ AttributeNotDefined,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Query_Attribute_Ownership req, rep ;
+
+
req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
+
req.setAttribute(rti1516::AttributeHandleFriend::toCertiHandle(theAttribute));
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+ // 7.18
+ bool RTI1516ambassador::isAttributeOwnedByFederate
+ (ObjectInstanceHandle theObject,
+ AttributeHandle theAttribute)
+ throw (ObjectInstanceNotKnown,
+ AttributeNotDefined,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Is_Attribute_Owned_By_Federate req, rep ;
+
+
req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
+
req.setAttribute(rti1516::AttributeHandleFriend::toCertiHandle(theAttribute));
+
+ privateRefs->executeService(&req, &rep);
+
+ return (rep.getTag() == "RTI_TRUE") ? true : false;
+ }
+
+ //////////////////////////////
+ // Time Management Services //
+ //////////////////////////////
+
+ // 8.2
+ void RTI1516ambassador::enableTimeRegulation
+ (LogicalTimeInterval const & theLookahead)
+ throw (TimeRegulationAlreadyEnabled,
+ InvalidLookahead,
+ InTimeAdvancingState,
+ RequestForTimeRegulationPending,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Enable_Time_Regulation req, rep ;
+
+
//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
+ 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
+ void RTI1516ambassador::disableTimeRegulation ()
+ throw (TimeRegulationIsNotEnabled,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Disable_Time_Regulation req, rep ;
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+ // 8.5
+ void RTI1516ambassador::enableTimeConstrained ()
+ throw (TimeConstrainedAlreadyEnabled,
+ InTimeAdvancingState,
+ RequestForTimeConstrainedPending,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Enable_Time_Constrained req, rep ;
+ privateRefs->executeService(&req, &rep);
+ }
+
+ // 8.7
+ void RTI1516ambassador::disableTimeConstrained ()
+ throw (TimeConstrainedIsNotEnabled,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Disable_Time_Constrained req, rep ;
+ privateRefs->executeService(&req, &rep);
+ }
+
+ // 8.8
+ void RTI1516ambassador::timeAdvanceRequest
+ (LogicalTime const & theTime)
+ throw (InvalidLogicalTime,
+ LogicalTimeAlreadyPassed,
+ InTimeAdvancingState,
+ RequestForTimeRegulationPending,
+ RequestForTimeConstrainedPending,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Time_Advance_Request req, rep ;
+
+ certi::FederationTime
certiFedTime(certi_cast<RTI1516fedTime>()(theTime).getFedTime());
+ req.setDate(certiFedTime);
+ privateRefs->executeService(&req, &rep);
+ }
+
+ // 8.9
+ void RTI1516ambassador::timeAdvanceRequestAvailable
+ (LogicalTime const & theTime)
+ throw (InvalidLogicalTime,
+ LogicalTimeAlreadyPassed,
+ InTimeAdvancingState,
+ RequestForTimeRegulationPending,
+ RequestForTimeConstrainedPending,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Time_Advance_Request_Available req, rep ;
+
+ certi::FederationTime
certiFedTime(certi_cast<RTI1516fedTime>()(theTime).getFedTime());
+ req.setDate(certiFedTime);
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+ // 8.10
+ void RTI1516ambassador::nextMessageRequest
+ (LogicalTime const & theTime)
+ throw (InvalidLogicalTime,
+ LogicalTimeAlreadyPassed,
+ InTimeAdvancingState,
+ RequestForTimeRegulationPending,
+ RequestForTimeConstrainedPending,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Next_Event_Request req, rep ;
+
+ certi::FederationTime
certiFedTime(certi_cast<RTI1516fedTime>()(theTime).getFedTime());
+ req.setDate(certiFedTime);
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+ // 8.11
+ void RTI1516ambassador::nextMessageRequestAvailable
+ (LogicalTime const & theTime)
+ throw (InvalidLogicalTime,
+ LogicalTimeAlreadyPassed,
+ InTimeAdvancingState,
+ RequestForTimeRegulationPending,
+ RequestForTimeConstrainedPending,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Next_Event_Request_Available req, rep ;
+
+ certi::FederationTime
certiFedTime(certi_cast<RTI1516fedTime>()(theTime).getFedTime());
+ req.setDate(certiFedTime);
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+ // 8.12
+ void RTI1516ambassador::flushQueueRequest
+ (LogicalTime const & theTime)
+ throw (InvalidLogicalTime,
+ LogicalTimeAlreadyPassed,
+ InTimeAdvancingState,
+ RequestForTimeRegulationPending,
+ RequestForTimeConstrainedPending,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ // JvY: Implementation copied from previous CERTI
implementation, including immediate throw.
+ throw RTIinternalError(L"Unimplemented Service
flushQueueRequest");
+ M_Flush_Queue_Request req, rep ;
+
+ certi::FederationTime
certiFedTime(certi_cast<RTI1516fedTime>()(theTime).getFedTime());
+ req.setDate(certiFedTime);
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+ // 8.14
+ void RTI1516ambassador::enableAsynchronousDelivery ()
+ throw (AsynchronousDeliveryAlreadyEnabled,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ // throw AsynchronousDeliveryAlreadyEnabled("Default value (non
HLA)");
+
+ M_Enable_Asynchronous_Delivery req, rep ;
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+ // 8.15
+ void RTI1516ambassador::disableAsynchronousDelivery ()
+ throw (AsynchronousDeliveryAlreadyDisabled,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Disable_Asynchronous_Delivery req, rep ;
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+ // 8.16
+ bool RTI1516ambassador::queryGALT (LogicalTime & theTime)
+ throw (FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ //TODO JRE: goed testen! Is GALT wel precies het zelfde als
LBTS?
+ M_Query_Lbts req, rep ;
+
+ privateRefs->executeService(&req, &rep);
+
+ //TODO JRE: goed testen of deze return value wel klopt!
+ 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();
+
+ return true;
+ }
+
+ // 8.17
+ void RTI1516ambassador::queryLogicalTime (LogicalTime & theTime)
+ throw (FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Query_Federate_Time req, rep ;
+
+ privateRefs->executeService(&req, &rep);
+
+ // JvY: TODO Controleren of dit blijft werken met andere
tijdsimplementaties
+ certi_cast<RTI1516fedTime>()(theTime) = rep.getDate().getTime();
+ }
+
+ // 8.18
+ bool RTI1516ambassador::queryLITS (LogicalTime & theTime)
+ throw (FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ //TODO JRE: goed testen! Is LITS wel precies het zelfde als
QueryMinNextEventTime?
+ M_Query_Min_Next_Event_Time req, rep ;
+
+ privateRefs->executeService(&req, &rep);
+
+ //TODO JRE: goed testen of deze return value wel klopt!
+ 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();
+
+ return true;
+ }
+
+ // 8.19
+ void RTI1516ambassador::modifyLookahead
+ (LogicalTimeInterval const & theLookahead)
+ throw (TimeRegulationIsNotEnabled,
+ InvalidLookahead,
+ InTimeAdvancingState,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ /* TODO */
+ throw RTIinternalError(L"Not yet implemented");
+ }
+
+ // 8.20
+ void RTI1516ambassador::queryLookahead (LogicalTimeInterval & interval)
+ throw (TimeRegulationIsNotEnabled,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ /* TODO */
+ throw RTIinternalError(L"Not yet implemented");
+ }
+
+ // 8.21
+ void RTI1516ambassador::retract
+ (MessageRetractionHandle theHandle)
+ throw (InvalidRetractionHandle,
+ TimeRegulationIsNotEnabled,
+ MessageCanNoLongerBeRetracted,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ throw RTIinternalError(L"Unimplemented Service retract");
+ M_Retract req, rep ;
+
+ certi::EventRetraction event =
rti1516::MessageRetractionHandleFriend::createEventRetraction(theHandle);
+ req.setEventRetraction(event);
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+ // 8.23
+ void RTI1516ambassador::changeAttributeOrderType
+ (ObjectInstanceHandle theObject,
+ AttributeHandleSet const & theAttributes,
+ OrderType theType)
+ throw (ObjectInstanceNotKnown,
+ AttributeNotDefined,
+ AttributeNotOwned,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Change_Attribute_Order_Type req, rep ;
+
+
req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
+ req.setOrder(rti1516::toCertiOrderType(theType));
+
+ assignAHSAndExecuteService(theAttributes, req, rep);
+ }
+
+ // 8.24
+ void RTI1516ambassador::changeInteractionOrderType
+ (InteractionClassHandle theClass,
+ OrderType theType)
+ throw (InteractionClassNotDefined,
+ InteractionClassNotPublished,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Change_Interaction_Order_Type req, rep ;
+
+
req.setInteractionClass(rti1516::InteractionClassHandleFriend::toCertiHandle(theClass));
+ req.setOrder(rti1516::toCertiOrderType(theType));
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+ //////////////////////////////////
+ // Data Distribution Management //
+ //////////////////////////////////
+
+ // 9.2
+ RegionHandle RTI1516ambassador::createRegion
+ (DimensionHandleSet const & theDimensions)
+ throw (InvalidDimensionHandle,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ /* TODO */
+ throw RTIinternalError(L"Not yet implemented");
+ }
+
+ // 9.3
+ void RTI1516ambassador::commitRegionModifications
+ (RegionHandleSet const & theRegionHandleSet)
+ throw (InvalidRegion,
+ RegionNotCreatedByThisFederate,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ /* TODO */
+ throw RTIinternalError(L"Not yet implemented");
+ }
+
+ // 9.4
+ void RTI1516ambassador::deleteRegion
+ (RegionHandle theRegion)
+ throw (InvalidRegion,
+ RegionNotCreatedByThisFederate,
+ RegionInUseForUpdateOrSubscription,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ /* TODO */
+ throw RTIinternalError(L"Not yet implemented");
+ }
+
+ // 9.5
+ ObjectInstanceHandle
RTI1516ambassador::registerObjectInstanceWithRegions
+ (ObjectClassHandle theClass,
+ AttributeHandleSetRegionHandleSetPairVector const &
+ theAttributeHandleSetRegionHandleSetPairVector)
+ throw (ObjectClassNotDefined,
+ ObjectClassNotPublished,
+ AttributeNotDefined,
+ AttributeNotPublished,
+ InvalidRegion,
+ RegionNotCreatedByThisFederate,
+ InvalidRegionContext,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ /* TODO */
+ throw RTIinternalError(L"Not yet implemented");
+ }
+
+ ObjectInstanceHandle
RTI1516ambassador::registerObjectInstanceWithRegions
+ (ObjectClassHandle theClass,
+ AttributeHandleSetRegionHandleSetPairVector const &
+ theAttributeHandleSetRegionHandleSetPairVector,
+ std::wstring const & theObjectInstanceName)
+ throw (ObjectClassNotDefined,
+ ObjectClassNotPublished,
+ AttributeNotDefined,
+ AttributeNotPublished,
+ InvalidRegion,
+ RegionNotCreatedByThisFederate,
+ InvalidRegionContext,
+ ObjectInstanceNameNotReserved,
+ ObjectInstanceNameInUse,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ /* TODO */
+ throw RTIinternalError(L"Not yet implemented");
+ }
+
+ // 9.6
+ void RTI1516ambassador::associateRegionsForUpdates
+ (ObjectInstanceHandle theObject,
+ AttributeHandleSetRegionHandleSetPairVector const &
+ theAttributeHandleSetRegionHandleSetPairVector)
+ throw (ObjectInstanceNotKnown,
+ AttributeNotDefined,
+ InvalidRegion,
+ RegionNotCreatedByThisFederate,
+ InvalidRegionContext,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ /* TODO */
+ throw RTIinternalError(L"Not yet implemented");
+ }
+
+ // 9.7
+ void RTI1516ambassador::unassociateRegionsForUpdates
+ (ObjectInstanceHandle theObject,
+ AttributeHandleSetRegionHandleSetPairVector const &
+ theAttributeHandleSetRegionHandleSetPairVector)
+ throw (ObjectInstanceNotKnown,
+ AttributeNotDefined,
+ InvalidRegion,
+ RegionNotCreatedByThisFederate,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ /* TODO */
+ throw RTIinternalError(L"Not yet implemented");
+ }
+
+ // 9.8
+ void RTI1516ambassador::subscribeObjectClassAttributesWithRegions
+ (ObjectClassHandle theClass,
+ AttributeHandleSetRegionHandleSetPairVector const &
+ theAttributeHandleSetRegionHandleSetPairVector,
+ bool active)
+ throw (ObjectClassNotDefined,
+ AttributeNotDefined,
+ InvalidRegion,
+ RegionNotCreatedByThisFederate,
+ InvalidRegionContext,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ /* TODO */
+ throw RTIinternalError(L"Not yet implemented");
+ }
+
+ // 9.9
+ void RTI1516ambassador::unsubscribeObjectClassAttributesWithRegions
+ (ObjectClassHandle theClass,
+ AttributeHandleSetRegionHandleSetPairVector const &
+ theAttributeHandleSetRegionHandleSetPairVector)
+ throw (ObjectClassNotDefined,
+ AttributeNotDefined,
+ InvalidRegion,
+ RegionNotCreatedByThisFederate,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ /* TODO */
+ throw RTIinternalError(L"Not yet implemented");
+ }
+
+ // 9.10
+ void RTI1516ambassador::subscribeInteractionClassWithRegions
+ (InteractionClassHandle theClass,
+ RegionHandleSet const & theRegionHandleSet,
+ bool active)
+ throw (InteractionClassNotDefined,
+ InvalidRegion,
+ RegionNotCreatedByThisFederate,
+ InvalidRegionContext,
+ FederateServiceInvocationsAreBeingReportedViaMOM,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ /* TODO */
+ throw RTIinternalError(L"Not yet implemented");
+ }
+
+ // 9.11
+ void RTI1516ambassador::unsubscribeInteractionClassWithRegions
+ (InteractionClassHandle theClass,
+ RegionHandleSet const & theRegionHandleSet)
+ throw (InteractionClassNotDefined,
+ InvalidRegion,
+ RegionNotCreatedByThisFederate,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ /* TODO */
+ throw RTIinternalError(L"Not yet implemented");
+ }
+
+ // 9.12
+ void RTI1516ambassador::sendInteractionWithRegions
+ (InteractionClassHandle theInteraction,
+ ParameterHandleValueMap const & theParameterValues,
+ RegionHandleSet const & theRegionHandleSet,
+ VariableLengthData const & theUserSuppliedTag)
+ throw (InteractionClassNotDefined,
+ InteractionClassNotPublished,
+ InteractionParameterNotDefined,
+ InvalidRegion,
+ RegionNotCreatedByThisFederate,
+ InvalidRegionContext,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ /* TODO */
+ throw RTIinternalError(L"Not yet implemented");
+ }
+
+ MessageRetractionHandle RTI1516ambassador::sendInteractionWithRegions
+ (InteractionClassHandle theInteraction,
+ ParameterHandleValueMap const & theParameterValues,
+ RegionHandleSet const & theRegionHandleSet,
+ VariableLengthData const & theUserSuppliedTag,
+ LogicalTime const & theTime)
+ throw (InteractionClassNotDefined,
+ InteractionClassNotPublished,
+ InteractionParameterNotDefined,
+ InvalidRegion,
+ RegionNotCreatedByThisFederate,
+ InvalidRegionContext,
+ InvalidLogicalTime,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ /* TODO */
+ throw RTIinternalError(L"Not yet implemented");
+ }
+
+ // 9.13
+ void RTI1516ambassador::requestAttributeValueUpdateWithRegions
+ (ObjectClassHandle theClass,
+ AttributeHandleSetRegionHandleSetPairVector const & theSet,
+ VariableLengthData const & theUserSuppliedTag)
+ throw (ObjectClassNotDefined,
+ AttributeNotDefined,
+ InvalidRegion,
+ RegionNotCreatedByThisFederate,
+ InvalidRegionContext,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ /* TODO */
+ throw RTIinternalError(L"Not yet implemented");
+ }
+
+ //////////////////////////
+ // RTI Support Services //
+ //////////////////////////
+
+ // 10.2
+ ObjectClassHandle RTI1516ambassador::getObjectClassHandle
+ (std::wstring const & theName)
+ throw (NameNotFound,
+ FederateNotExecutionMember,
+ RTIinternalError)
+ {
+ M_Get_Object_Class_Handle req, rep ;
+
+ G.Out(pdGendoc,"enter RTI1516ambassador::getObjectClassHandle");
+
+ std::string nameAsString(theName.begin(), theName.end());
+ req.setClassName(nameAsString);
+ privateRefs->executeService(&req, &rep);
+
+ G.Out(pdGendoc,"exit RTI1516ambassador::getObjectClassHandle");
+ rti1516::ObjectClassHandle rti1516Handle =
ObjectClassHandleFriend::createRTI1516Handle(rep.getObjectClass());
+
+ return rti1516Handle;
+ }
+
+ // 10.3
+ std::wstring RTI1516ambassador::getObjectClassName
+ (ObjectClassHandle theHandle)
+ throw (InvalidObjectClassHandle,
+ FederateNotExecutionMember,
+ RTIinternalError)
+ {
+ M_Get_Object_Class_Name req, rep ;
+
+ certi::ObjectClassHandle certiHandle =
ObjectClassHandleFriend::toCertiHandle(theHandle);
+ req.setObjectClass(certiHandle);
+ try {
+ privateRefs->executeService(&req, &rep);
+ } catch (rti1516::ObjectClassNotDefined &e)
+ {
+ throw rti1516::InvalidObjectClassHandle(e.what());
+ }
+
+ std::string nameString = rep.getClassName();
+ std::wstring nameWString(nameString.begin(), nameString.end());
+
+ //return hla_strdup(rep.getClassName());
+ return nameWString;
+ }
+
+ // 10.4
+ AttributeHandle RTI1516ambassador::getAttributeHandle
+ (ObjectClassHandle whichClass,
+ std::wstring const & theAttributeName)
+ throw (InvalidObjectClassHandle,
+ NameNotFound,
+ FederateNotExecutionMember,
+ RTIinternalError)
+ {
+ G.Out(pdGendoc,"enter
RTI::RTI1516ambassador::getAttributeHandle");
+ M_Get_Attribute_Handle req, rep ;
+
+ std::string nameAsString(theAttributeName.begin(),
theAttributeName.end());
+ req.setAttributeName(nameAsString);
+
req.setObjectClass(rti1516::ObjectClassHandleFriend::toCertiHandle(whichClass));
+
+ try {
+ privateRefs->executeService(&req, &rep);
+ } catch (rti1516::ObjectClassNotDefined &e)
+ {
+ if ( ! whichClass.isValid() ) {
+ throw
rti1516::InvalidObjectClassHandle(e.what());
+ } else {
+ throw rti1516::NameNotFound(e.what());
+ }
+ }
+
+
+
+ G.Out(pdGendoc,"exit
RTI::RTI1516ambassador::getAttributeHandle");
+ return
rti1516::AttributeHandleFriend::createRTI1516Handle(rep.getAttribute());
+ }
+
+ // 10.5
+ std::wstring RTI1516ambassador::getAttributeName
+ (ObjectClassHandle whichClass,
+ AttributeHandle theHandle)
+ throw (InvalidObjectClassHandle,
+ InvalidAttributeHandle,
+ AttributeNotDefined,
+ FederateNotExecutionMember,
+ RTIinternalError)
+ {
+ M_Get_Attribute_Name req, rep ;
+
+
req.setAttribute(rti1516::AttributeHandleFriend::toCertiHandle(theHandle));
+
req.setObjectClass(rti1516::ObjectClassHandleFriend::toCertiHandle(whichClass));
+ try {
+ privateRefs->executeService(&req, &rep);
+ } catch (rti1516::ObjectClassNotDefined &e)
+ {
+ if ( !whichClass.isValid() )
+ {
+ throw
rti1516::InvalidObjectClassHandle(e.what());
+ } else
+ {
+ throw;
+ }
+ } catch ( rti1516::AttributeNotDefined &e)
+ {
+ if (! theHandle.isValid() )
+ {
+ throw rti1516::InvalidAttributeHandle(e.what());
+ } else
+ {
+ throw;
+ }
+ }
+
+ //return hla_strdup(rep.getAttributeName());
+
+ std::string nameString = rep.getAttributeName();
+ std::wstring nameWString(nameString.begin(), nameString.end());
+
+ return nameWString;
+ }
+
+ // 10.6
+ InteractionClassHandle RTI1516ambassador::getInteractionClassHandle
+ (std::wstring const & theName)
+ throw (NameNotFound,
+ FederateNotExecutionMember,
+ RTIinternalError)
+ {
+ M_Get_Interaction_Class_Handle req, rep ;
+ std::string nameString(theName.begin(), theName.end());
+ req.setClassName(nameString);
+
+ privateRefs->executeService(&req, &rep);
+
+ return
rti1516::InteractionClassHandleFriend::createRTI1516Handle(rep.getInteractionClass());
+ }
+
+ // 10.7
+ std::wstring RTI1516ambassador::getInteractionClassName
+ (InteractionClassHandle theHandle)
+ throw (InvalidInteractionClassHandle,
+ FederateNotExecutionMember,
+ RTIinternalError)
+ {
+ M_Get_Interaction_Class_Name req, rep ;
+
req.setInteractionClass(rti1516::InteractionClassHandleFriend::toCertiHandle(theHandle));
+ try {
+ privateRefs->executeService(&req, &rep);
+ } catch (rti1516::InteractionClassNotDefined &e)
+ {
+ if ( !theHandle.isValid() )
+ {
+ throw
rti1516::InvalidInteractionClassHandle(e.what());
+ } else
+ {
+ throw;
+ }
+ }
+
+ //return hla_strdup(rep.getClassName());
+ std::string nameString = rep.getClassName();
+ std::wstring nameWString(nameString.begin(), nameString.end());
+
+ return nameWString;
+ }
+
+ // 10.8
+ ParameterHandle RTI1516ambassador::getParameterHandle
+ (InteractionClassHandle whichClass,
+ std::wstring const & theName)
+ throw (InvalidInteractionClassHandle,
+ NameNotFound,
+ FederateNotExecutionMember,
+ RTIinternalError)
+ {
+ M_Get_Parameter_Handle req, rep ;
+ std::string nameString(theName.begin(), theName.end());
+ req.setParameterName(nameString);
+
req.setInteractionClass(rti1516::InteractionClassHandleFriend::toCertiHandle(whichClass));
+
+ try {
+ privateRefs->executeService(&req, &rep);
+ } catch (rti1516::InteractionClassNotDefined &e)
+ {
+ if ( !whichClass.isValid() )
+ {
+ throw
rti1516::InvalidInteractionClassHandle(e.what());
+ } else
+ {
+ throw;
+ }
+ }
+
+ return
rti1516::ParameterHandleFriend::createRTI1516Handle(rep.getParameter());
+ }
+
+ // 10.9
+ std::wstring RTI1516ambassador::getParameterName
+ (InteractionClassHandle whichClass,
+ ParameterHandle theHandle)
+ throw (InvalidInteractionClassHandle,
+ InvalidParameterHandle,
+ InteractionParameterNotDefined,
+ FederateNotExecutionMember,
+ RTIinternalError)
+ {
+ M_Get_Parameter_Name req, rep ;
+
+
req.setParameter(rti1516::ParameterHandleFriend::toCertiHandle(theHandle));
+
req.setInteractionClass(rti1516::InteractionClassHandleFriend::toCertiHandle(whichClass));
+
+ try {
+ privateRefs->executeService(&req, &rep);
+ } catch (rti1516::InteractionClassNotDefined &e)
+ {
+ if ( !whichClass.isValid() )
+ {
+ throw
rti1516::InvalidInteractionClassHandle(e.what());
+ } else
+ {
+ throw;
+ }
+ }
+
+ //return hla_strdup(rep.getParameterName());
+ std::string nameString = rep.getParameterName();
+ std::wstring nameWString(nameString.begin(), nameString.end());
+
+ return nameWString;
+ }
+
+ // 10.10
+ ObjectInstanceHandle RTI1516ambassador::getObjectInstanceHandle
+ (std::wstring const & theName)
+ throw (ObjectInstanceNotKnown,
+ FederateNotExecutionMember,
+ RTIinternalError)
+ {
+ M_Get_Object_Instance_Handle req, rep ;
+ std::string nameString(theName.begin(), theName.end());
+ req.setObjectInstanceName(nameString);
+
+ privateRefs->executeService(&req, &rep);
+ return
rti1516::ObjectInstanceHandleFriend::createRTI1516Handle(rep.getObject());
+ }
+
+ // 10.11
+ std::wstring RTI1516ambassador::getObjectInstanceName
+ (ObjectInstanceHandle theHandle)
+ throw (ObjectInstanceNotKnown,
+ FederateNotExecutionMember,
+ RTIinternalError)
+ {
+ 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::wstring nameWString(nameString.begin(), nameString.end());
+
+ return nameWString;
+ }
+
+ // 10.12
+ DimensionHandle RTI1516ambassador::getDimensionHandle
+ (std::wstring const & theName)
+ throw (NameNotFound,
+ FederateNotExecutionMember,
+ RTIinternalError)
+ {
+ 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???
+ privateRefs->executeService(&req, &rep);
+ return
rti1516::DimensionHandleFriend::createRTI1516Handle(rep.getDimension());
+ }
+
+ // 10.13
+ std::wstring RTI1516ambassador::getDimensionName
+ (DimensionHandle theHandle)
+ throw (InvalidDimensionHandle,
+ FederateNotExecutionMember,
+ RTIinternalError)
+ {
+ M_Get_Dimension_Name 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::wstring nameWString(nameString.begin(), nameString.end());
+
+ return nameWString;
+ }
+
+ // 10.14
+ unsigned long RTI1516ambassador::getDimensionUpperBound
+ (DimensionHandle theHandle)
+ throw (InvalidDimensionHandle,
+ FederateNotExecutionMember,
+ RTIinternalError)
+ {
+ /* TODO */
+ throw RTIinternalError(L"Not yet implemented");
+ }
+
+ // 10.15
+ DimensionHandleSet
RTI1516ambassador::getAvailableDimensionsForClassAttribute
+ (ObjectClassHandle theClass,
+ AttributeHandle theHandle)
+ throw (InvalidObjectClassHandle,
+ InvalidAttributeHandle,
+ AttributeNotDefined,
+ FederateNotExecutionMember,
+ RTIinternalError)
+ {
+ M_Get_Attribute_Space_Handle req, 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 address@hidden
+ //return rep.getSpace();
+ DimensionHandleSet invalidSet;
+ return invalidSet;
+ }
+
+ // 10.16
+ ObjectClassHandle RTI1516ambassador::getKnownObjectClassHandle
+ (ObjectInstanceHandle theObject)
+ throw (ObjectInstanceNotKnown,
+ FederateNotExecutionMember,
+ RTIinternalError)
+ {
+ M_Get_Object_Class req, rep ;
+
+
req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
+ privateRefs->executeService(&req, &rep);
+ return
rti1516::ObjectClassHandleFriend::createRTI1516Handle(rep.getObjectClass());
+ }
+
+ // 10.17
+ DimensionHandleSet
RTI1516ambassador::getAvailableDimensionsForInteractionClass
+ (InteractionClassHandle theClass)
+ throw (InvalidInteractionClassHandle,
+ FederateNotExecutionMember,
+ RTIinternalError)
+ {
+ M_Get_Interaction_Space_Handle req, rep ;
+
+
req.setInteractionClass(rti1516::InteractionClassHandleFriend::toCertiHandle(theClass));
+ this->privateRefs->executeService(&req, &rep);
+
+ //JRE TODO: Use space handle to to get the address@hidden
+ //return rep.getSpace();
+ DimensionHandleSet invalidSet;
+ return invalidSet;
+ }
+
+ // 10.18
+ TransportationType RTI1516ambassador::getTransportationType
+ (std::wstring const & transportationName)
+ throw (InvalidTransportationName,
+ FederateNotExecutionMember,
+ RTIinternalError)
+ {
+ M_Get_Transportation_Handle req, rep ;
+ std::string nameString(transportationName.begin(),
transportationName.end());
+ req.setTransportationName(nameString);
+ privateRefs->executeService(&req, &rep);
+
+ return
rti1516::toRTI1516TransportationType(rep.getTransportation());
+ }
+
+ // 10.19
+ std::wstring RTI1516ambassador::getTransportationName
+ (TransportationType transportationType)
+ throw (InvalidTransportationType,
+ FederateNotExecutionMember,
+ RTIinternalError)
+ {
+ M_Get_Transportation_Name req, rep ;
+
+
req.setTransportation(rti1516::toCertiTransportationType(transportationType));
+ privateRefs->executeService(&req, &rep);
+
+ //return hla_strdup(rep.getTransportationName());
+ std::string nameString = rep.getTransportationName();
+ std::wstring nameWString(nameString.begin(), nameString.end());
+
+ return nameWString;
+ }
+
+ // 10.20
+ OrderType RTI1516ambassador::getOrderType
+ (std::wstring const & orderName)
+ throw (InvalidOrderName,
+ FederateNotExecutionMember,
+ RTIinternalError)
+ {
+ M_Get_Ordering_Handle req, rep ;
+
+ std::string nameAsString(orderName.begin(), orderName.end());
+ req.setOrderingName(nameAsString);
+ privateRefs->executeService(&req, &rep);
+
+ return rti1516::toRTI1516OrderType(rep.getOrdering());
+ }
+
+ // 10.21
+ std::wstring RTI1516ambassador::getOrderName
+ (OrderType orderType)
+ throw (InvalidOrderType,
+ FederateNotExecutionMember,
+ RTIinternalError)
+ {
+ M_Get_Ordering_Name req, rep ;
+
+ req.setOrdering(rti1516::toCertiOrderType(orderType));
+ privateRefs->executeService(&req, &rep);
+
+ //return hla_strdup(rep.getOrderingName());
+ std::string nameString = rep.getOrderingName();
+ std::wstring nameWString(nameString.begin(), nameString.end());
+
+ return nameWString;
+ }
+
+ // 10.22
+ /**
+ * Sets the ClassRelevanceAdvisory (CRA) switch to true. The switch
+ * state is hold on the RTIG side. That's why the message
+ * ENABLE_CLASS_RELEVANCE_ADVISORY_SWITCH
+ * is transmitted to RTIA. RTIA transmits the message towards RTIG.
+ *
+ * By default, the CRA switch is true. This causes a delivery of the
+ * federate service startRegistrationForObjectClass to a publisher
+ * if there are any new subscribers for the federates published object
+ * classes. If there are no more subscribers a publisher gets the
+ * federate service stopRegistrationForObjectClass.
+ *
+ * By disabling the CRA switch the federate is no longer informed by
+ * subscriptions to its published object classes, i.e. the federate
+ * services startRegistrationForObjectClass and
+ * stopRegistrationForObjectClass respectively are not invoked.
+ * @see disableClassRelevanceAdvisorySwitch()
+ */
+ void RTI1516ambassador::enableObjectClassRelevanceAdvisorySwitch ()
+ throw (ObjectClassRelevanceAdvisorySwitchIsOn,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Enable_Class_Relevance_Advisory_Switch req, rep ;
+ privateRefs->executeService(&req, &rep);
+ }
+
+ // 10.23
+ /**
+ * Sets the ClassRelevanceAdvisory (CRA) switch to false. The switch
+ * state is hold on the RTIG side. That's why the message
+ * DISABLE_CLASS_RELEVANCE_ADVISORY_SWITCH
+ * is transmitted to RTIA. RTIA transmits the message towards RTIG.
+ *
+ * By default, the CRA switch is true. This causes a delivery of the
+ * federate service startRegistrationForObjectClass to a publisher
+ * if there are any new subscribers for the federates published object
+ * classes. If there are no more subscribers a publisher gets the
+ * federate service stopRegistrationForObjectClass.
+ * @see enableClassRelevanceAdvisorySwitch()
+ *
+ * By disabling the CRA switch the federate is no longer informed by
+ * subscriptions to its published object classes, i.e. the federate
+ * services startRegistrationForObjectClass and
+ * stopRegistrationForObjectClass respectively are not invoked.
+ */
+ void RTI1516ambassador::disableObjectClassRelevanceAdvisorySwitch ()
+ throw (ObjectClassRelevanceAdvisorySwitchIsOff,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Disable_Class_Relevance_Advisory_Switch req, rep ;
+ privateRefs->executeService(&req, &rep);
+ }
+
+ // 10.24
+ /**
+ * Sets the AttributeRelevanceAdvisory (ARA) switch to true. The switch
+ * state is hold on the RTIG side. That's why the message
+ * ENABLE_ATTRIBUTE_RELEVANCE_ADVISORY_SWITCH
+ * is transmitted to RTIA. RTIA transmits the message towards RTIG.
+ *
+ * By default, the ARA switch is false. When enabling the ARA switch
+ * the federate is informed by the federate service
+ * turnUpdatesOnForObjectInstance of new object instances within remote
+ * federates actively subscribed to its published attributes. If there
+ * are no active subscribers for a set of instance-attributes the
federate
+ * receives the federate service turnUpdatesOffForObjectInstance.
+ *
+ * By disabling the ARA switch the federate is no longer informed by
+ * subscriptions to its published attributes, i.e. the federate
+ * services turnUpdatesOnForObjectInstance and
+ * turnUpdatesOffForObjectInstance respectively are not invoked.
+ * @see disableAttributeRelevanceAdvisorySwitch()
+ */
+ void RTI1516ambassador::enableAttributeRelevanceAdvisorySwitch ()
+ throw (AttributeRelevanceAdvisorySwitchIsOn,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Enable_Attribute_Relevance_Advisory_Switch req, rep ;
+ privateRefs->executeService(&req, &rep);
+ }
+
+ // 10.25
+ /**
+ * Sets the AttributeRelevanceAdvisory (ARA) switch to false. The
switch
+ * state is hold on the RTIG side. That's why the message
+ * DISABLE_ATTRIBUTE_RELEVANCE_ADVISORY_SWITCH
+ * is transmitted to RTIA. RTIA transmits the message towards RTIG.
+ *
+ * By default, the ARA switch is false. When enabling the ARA switch
+ * the federate is informed by the federate service
+ * turnUpdatesOnForObjectInstance of new object instances within remote
+ * federates actively subscribed to its published attributes. If there
+ * are no active subscribers for a set of instance-attributes the
federate
+ * receives the federate service turnUpdatesOffForObjectInstance.
+ * @see enableAttributeRelevanceAdvisorySwitch()
+ *
+ * By disabling the ARA switch the federate is no longer informed by
+ * subscriptions to its published attributes, i.e. the federate
+ * services turnUpdatesOnForObjectInstance and
+ * turnUpdatesOffForObjectInstance respectively are not invoked.
+ */
+ void RTI1516ambassador::disableAttributeRelevanceAdvisorySwitch ()
+ throw (AttributeRelevanceAdvisorySwitchIsOff,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Disable_Attribute_Relevance_Advisory_Switch req, rep ;
+ privateRefs->executeService(&req, &rep);
+ }
+
+ // 10.26
+ /**
+ * Sets the AttributeScopeAdvisory (ASA) switch to true. The switch
state
+ * is hold on the RTIG side. That's why the message
+ * ENABLE_ATTRIBUTE_SCOPE_ADVISORY_SWITCH
+ * is transmitted to RTIA. RTIA transmits the message towards RTIG.
+ *
+ * By default, the ASA switch is false. When enabling the ASA switch
+ * the federate is informed by the federate services
+ * attributesInScope and attributesOutScope respectively of discovered
+ * or registrated but not owned attribute-instances intersecting or
+ * leaving its subscription regions.
+ *
+ * By disabling the ASA switch the federate is no longer informed of
+ * changes in attribute-instance scope, i.e. the federate
+ * services attributesInScope and attributesOutScope respectively are
+ * not invoked.
+ * @see disableAttributeScopeAdvisorySwitch()
+ */
+ void RTI1516ambassador::enableAttributeScopeAdvisorySwitch ()
+ throw (AttributeScopeAdvisorySwitchIsOn,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Enable_Attribute_Scope_Advisory_Switch req, rep ;
+ privateRefs->executeService(&req, &rep);
+ }
+
+ // 10.27
+ /**
+ * Sets the AttributeScopeAdvisory (ASA) switch to false. The switch
state
+ * is hold on the RTIG side. That's why the message
+ * DISABLE_ATTRIBUTE_SCOPE_ADVISORY_SWITCH
+ * is transmitted to RTIA. RTIA transmits the message towards RTIG.
+ *
+ * By default, the ASA switch is false. When enabling the ASA switch
+ * the federate is informed by the federate services
+ * attributesInScope and attributesOutScope respectively of discovered
+ * or registrated but not owned attribute-instances intersecting or
+ * leaving its subscription regions.
+ * @see enableAttributeScopeAdvisorySwitch()
+ *
+ * By disabling the ASA switch the federate is no longer informed of
+ * changes in attribute-instance scope, i.e. the federate
+ * services attributesInScope and attributesOutScope respectively are
+ * not invoked.
+ */
+ void RTI1516ambassador::disableAttributeScopeAdvisorySwitch ()
+ throw (AttributeScopeAdvisorySwitchIsOff,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Disable_Attribute_Scope_Advisory_Switch req, rep ;
+ privateRefs->executeService(&req, &rep);
+ }
+
+ // 10.28
+ /**
+ * Sets the InteractionRelevanceAdvisory (IRA) switch to true. The
switch
+ * state is hold on the RTIG side. That's why the message
+ * ENABLE_INTERACTION_RELEVANCE_ADVISORY_SWITCH
+ * is transmitted to RTIA. RTIA transmits the message towards RTIG.
+ *
+ * By default, the IRA switch is true. This causes a delivery of the
+ * federate service turnInteractionsOn to a publisher if there are
+ * any new subscribers for the federates published interaction
+ * classes. If there are no more subscribers a publisher gets the
+ * federate service turnInteractionsOff().
+ *
+ * By disabling the IRA switch the federate is no longer informed by
+ * subscriptions to its published interaction classes, i.e. the
federate
+ * services turnInteractionsOn and turnInteractionsOff respectively are
+ * not invoked.
+ * @see disableInteractionRelevanceAdvisorySwitch()
+ */
+ void RTI1516ambassador::enableInteractionRelevanceAdvisorySwitch ()
+ throw (InteractionRelevanceAdvisorySwitchIsOn,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Enable_Interaction_Relevance_Advisory_Switch req, rep ;
+ privateRefs->executeService(&req, &rep);
+ }
+
+ // 10.29
+ /**
+ * Sets the InteractionRelevanceAdvisory (IRA) switch to false. The
switch
+ * state is hold on the RTIG side. That's why the message
+ * DISABLE_INTERACTION_RELEVANCE_ADVISORY_SWITCH
+ * is transmitted to RTIA. RTIA transmits the message towards RTIG.
+ *
+ * By default, the IRA switch is true. This causes a delivery of the
+ * federate service turnInteractionsOn to a publisher if there are
+ * any new subscribers for the federates published interaction
+ * classes. If there are no more subscribers a publisher gets the
+ * federate service turnInteractionsOff().
+ * @see enableInteractionRelevanceAdvisorySwitch()
+ *
+ * By disabling the IRA switch the federate is no longer informed by
+ * subscriptions to its published interaction classes, i.e. the
federate
+ * services turnInteractionsOn and turnInteractionsOff respectively are
+ * not invoked.
+ */
+ void RTI1516ambassador::disableInteractionRelevanceAdvisorySwitch ()
+ throw (InteractionRelevanceAdvisorySwitchIsOff,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ M_Disable_Interaction_Relevance_Advisory_Switch req, rep ;
+ privateRefs->executeService(&req, &rep);
+ }
+
+ // 10.30
+
+ DimensionHandleSet RTI1516ambassador::getDimensionHandleSet
+ (RegionHandle theRegionHandle)
+ throw (InvalidRegion,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ /* TODO */
+ throw RTIinternalError(L"Not yet implemented");
+ }
+
+ // 10.31
+
+ RangeBounds RTI1516ambassador::getRangeBounds
+ (RegionHandle theRegionHandle,
+ DimensionHandle theDimensionHandle)
+ throw (InvalidRegion,
+ RegionDoesNotContainSpecifiedDimension,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ /* TODO */
+ throw RTIinternalError(L"Not yet implemented");
+ }
+
+ // 10.32
+ void RTI1516ambassador::setRangeBounds
+ (RegionHandle theRegionHandle,
+ DimensionHandle theDimensionHandle,
+ RangeBounds const & theRangeBounds)
+ throw (InvalidRegion,
+ RegionNotCreatedByThisFederate,
+ RegionDoesNotContainSpecifiedDimension,
+ InvalidRangeBound,
+ FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ /* TODO */
+ throw RTIinternalError(L"Not yet implemented");
+ }
+
+ // 10.33
+ unsigned long RTI1516ambassador::normalizeFederateHandle
+ (FederateHandle theFederateHandle)
+ throw (FederateNotExecutionMember,
+ InvalidFederateHandle,
+ RTIinternalError)
+ {
+ /* TODO */
+ throw RTIinternalError(L"Not yet implemented");
+ }
+
+ // 10.34
+ unsigned long RTI1516ambassador::normalizeServiceGroup
+ (ServiceGroupIndicator theServiceGroup)
+ throw (FederateNotExecutionMember,
+ InvalidServiceGroup,
+ RTIinternalError)
+ {
+ /* TODO */
+ throw RTIinternalError(L"Not yet implemented");
+ }
+
+ // 10.37
+ bool RTI1516ambassador::evokeCallback(double
approximateMinimumTimeInSeconds)
+ throw (FederateNotExecutionMember,
+ RTIinternalError)
+ {
+ return __tick_kernel(false, approximateMinimumTimeInSeconds,
approximateMinimumTimeInSeconds);
+ }
+
+ // 10.38
+ bool RTI1516ambassador::evokeMultipleCallbacks(double
approximateMinimumTimeInSeconds,
+ double approximateMaximumTimeInSeconds)
+ throw (FederateNotExecutionMember,
+ RTIinternalError)
+ {
+ return __tick_kernel(true, approximateMinimumTimeInSeconds,
approximateMaximumTimeInSeconds);
+ }
+
+ // 10.39
+ void RTI1516ambassador::enableCallbacks ()
+ throw (FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ /* TODO */
+ throw RTIinternalError(L"Not yet implemented");
+ }
+
+ // 10.40
+ void RTI1516ambassador::disableCallbacks ()
+ throw (FederateNotExecutionMember,
+ SaveInProgress,
+ RestoreInProgress,
+ RTIinternalError)
+ {
+ /* TODO */
+ throw RTIinternalError(L"Not yet implemented");
+ }
+
+ FederateHandle RTI1516ambassador::decodeFederateHandle(
+ VariableLengthData const & encodedValue) const
+ {
+ return
rti1516::FederateHandleFriend::createRTI1516Handle(encodedValue);
+ }
+
+ ObjectClassHandle RTI1516ambassador::decodeObjectClassHandle(
+ VariableLengthData const & encodedValue) const
+ {
+ return
rti1516::ObjectClassHandleFriend::createRTI1516Handle(encodedValue);
+ }
+
+ InteractionClassHandle RTI1516ambassador::decodeInteractionClassHandle(
+ VariableLengthData const & encodedValue) const
+ {
+ return
rti1516::InteractionClassHandleFriend::createRTI1516Handle(encodedValue);
+ }
+
+ ObjectInstanceHandle RTI1516ambassador::decodeObjectInstanceHandle(
+ VariableLengthData const & encodedValue) const
+ {
+ return
rti1516::ObjectInstanceHandleFriend::createRTI1516Handle(encodedValue);
+ }
+
+ AttributeHandle RTI1516ambassador::decodeAttributeHandle(
+ VariableLengthData const & encodedValue) const
+ {
+ return
rti1516::AttributeHandleFriend::createRTI1516Handle(encodedValue);
+ }
+
+ ParameterHandle RTI1516ambassador::decodeParameterHandle(
+ VariableLengthData const & encodedValue) const
+ {
+ return
rti1516::ParameterHandleFriend::createRTI1516Handle(encodedValue);
+ }
+
+ DimensionHandle RTI1516ambassador::decodeDimensionHandle(
+ VariableLengthData const & encodedValue) const
+ {
+ return
rti1516::DimensionHandleFriend::createRTI1516Handle(encodedValue);
+ }
+
+ MessageRetractionHandle
RTI1516ambassador::decodeMessageRetractionHandle(
+ VariableLengthData const & encodedValue) const
+ {
+ return
rti1516::MessageRetractionHandleFriend::createRTI1516Handle(encodedValue);
+ }
+
+ RegionHandle RTI1516ambassador::decodeRegionHandle(
+ VariableLengthData const & encodedValue) const
+ {
+ return
rti1516::RegionHandleFriend::createRTI1516Handle(encodedValue);
+ }
+
+
+
+
+
+} // end namespace rti1516
Index: RTIambPrivateRefs.cpp
===================================================================
RCS file: RTIambPrivateRefs.cpp
diff -N RTIambPrivateRefs.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ RTIambPrivateRefs.cpp 3 Mar 2014 16:41:51 -0000 1.1
@@ -0,0 +1,1207 @@
+// ----------------------------------------------------------------------------
+// CERTI - HLA RunTime Infrastructure
+// Copyright (C) 2002-2005 ONERA
+//
+// This file is part of CERTI-libRTI
+//
+// CERTI-libRTI is free software ; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License
+// as published by the Free Software Foundation ; either version 2 of
+// the License, or (at your option) any later version.
+//
+// CERTI-libRTI is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY ; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this program ; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA
+//
+// $Id: RTIambPrivateRefs.cpp,v 1.1 2014/03/03 16:41:51 erk Exp $
+// ----------------------------------------------------------------------------
+
+#include <config.h>
+#include "RTIambPrivateRefs.h"
+#include "HandleImplementation.h"
+
+#include <RTI/Exception.h>
+#include <RTI/certiLogicalTime.h>
+#include <RTI/certiLogicalTimeInterval.h>
+#include <RTI/certiLogicalTimeFactory.h>
+#include "RTIHandleFactory.h"
+#include "RTI1516fedTime.h"
+
+#include "PrettyDebug.hh"
+#include "M_Classes.hh"
+#include <sstream>
+#include <iostream>
+
+namespace {
+static PrettyDebug D("LIBRTI", __FILE__);
+static PrettyDebug G("GENDOC",__FILE__);
+
+template<typename T>
+std::vector<std::pair<AttributeHandle, AttributeValue_t> >
+getAHVPSFromRequest(T* request)
+{
+ uint32_t size = request->getAttributesSize();
+ std::vector<std::pair<AttributeHandle, AttributeValue_t> > result;
+ result.resize(size);
+
+ for (uint32_t i = 0 ; i < size ; ++i) {
+ result[i].first = request->getAttributes(i);
+ result[i].second.assign(request->getValues(i).data(),
request->getValues(i).length());
+ }
+
+ return result;
+}
+
+template<typename T>
+std::vector<std::pair<rti1516::ParameterHandle, ParameterValue_t> >
+getPHVPSFromRequest(T* request)
+{
+ uint32_t size = request->getParametersSize();
+
+ std::vector<std::pair<rti1516::ParameterHandle, ParameterValue_t> >
result;
+ result.resize(size);
+
+ for (uint32_t i = 0 ; i < size ; ++i) {
+ result[i].first = request->getParameters(i);
+ result[i].second.assign(request->getValues(i).data(),
request->getValues(i).length());
+ }
+
+ return result;
+}
+
+template<typename T>
+rti1516::AttributeHandleValueMap *
+getAHVMFromRequest(T* request)
+{
+ uint32_t size = request->getAttributesSize();
+ rti1516::AttributeHandleValueMap *result = new
rti1516::AttributeHandleValueMap();
+
+ for (uint32_t i = 0 ; i < size ; ++i) {
+ rti1516::AttributeHandle attribute =
rti1516::AttributeHandleFriend::createRTI1516Handle(request->getAttributes(i));
+ rti1516::VariableLengthData
varData(&(request->getValues(i)[0]), request->getValues(i).size());
+
result->insert(std::pair<rti1516::AttributeHandle,rti1516::VariableLengthData>(attribute,
varData));
+ }
+
+ return result;
+}
+
+template<typename T>
+rti1516::ParameterHandleValueMap *
+getPHVMFromRequest(T* request)
+{
+ uint32_t size = request->getParametersSize();
+ rti1516::ParameterHandleValueMap *result = new
rti1516::ParameterHandleValueMap();
+
+ for (uint32_t i = 0 ; i < size ; ++i) {
+ rti1516::ParameterHandle parameter =
rti1516::ParameterHandleFriend::createRTI1516Handle(request->getParameters(i));
+ rti1516::VariableLengthData
varData(&(request->getValues(i)[0]), request->getValues(i).size());
+
result->insert(std::pair<rti1516::ParameterHandle,rti1516::VariableLengthData>(parameter,
varData));
+ }
+
+ return result;
+}
+
+template<typename T>
+rti1516::AttributeHandleSet *
+getAHSFromRequest(T* request)
+{
+ uint32_t size = request->getAttributesSize();
+ rti1516::AttributeHandleSet *result = new rti1516::AttributeHandleSet();
+
+ for (uint32_t i = 0 ; i < size ; ++i) {
+ rti1516::AttributeHandle attribute =
rti1516::AttributeHandleFriend::createRTI1516Handle(request->getAttributes(i));
+ result->insert(attribute);
+ }
+
+ return result;
+}
+
+std::auto_ptr< rti1516::LogicalTime >
+getLogicalTime()
+throw ( rti1516::RTIinternalError )
+{
+ std::auto_ptr< rti1516::LogicalTimeFactory > timeFactory =
rti1516::LogicalTimeFactoryFactory::makeLogicalTimeFactory(L"");
+ if (timeFactory.get() != 0)
+ {
+ return timeFactory->makeLogicalTime();
+ } else
+ {
+ throw rti1516::RTIinternalError(L"Could not create
LogicalTimeFactory");
+ }
+}
+
+} // End anonymous namespace
+
+RTI1516ambPrivateRefs::RTI1516ambPrivateRefs()
+{
+ fed_amb = NULL;
+#ifdef _WIN32
+ handle_RTIA = (HANDLE)-1;
+#else
+ pid_RTIA = (pid_t)-1;
+#endif
+ is_reentrant = false;
+ _theRootObj = NULL;
+ socketUn = NULL;
+}
+
+RTI1516ambPrivateRefs::~RTI1516ambPrivateRefs()
+{
+ delete socketUn ;
+}
+
+// ----------------------------------------------------------------------------
+void
+RTI1516ambPrivateRefs::leave(const char *msg) throw (rti1516::RTIinternalError)
+{
+ std::wstringstream smsg;
+ smsg << "RTI called leave because <" <<msg<<">";
+ throw rti1516::RTIinternalError(smsg.str());
+}
+
+// ----------------------------------------------------------------------------
+void
+RTI1516ambPrivateRefs::executeService(Message *req, Message *rep)
+{
+ G.Out(pdGendoc,"enter
RTI1516ambPrivateRefs::executeService(%s,%s)",req->getMessageName(),rep->getMessageName());
+
+ D.Out(pdDebug, "sending request to RTIA.");
+
+ try {
+ req->send(socketUn,msgBufSend);
+ }
+ catch (certi::NetworkError) {
+ std::cerr << "libRTI: exception: NetworkError (write)" <<
std::endl ;
+ if ( req->getMessageType() == certi::Message::CLOSE_CONNEXION)
+ {
+ std::cerr << "libRTI: Could not execute 'Close
connexion' service (Network error). Service request ignored." << std::endl;
+ return;
+ } else
+ {
+ throw rti1516::RTIinternalError(L"libRTI: Network Write
Error");
+ }
+ }
+
+ D.Out(pdDebug, "waiting RTIA reply.");
+
+ // waiting RTI reply.
+ try {
+ rep->receive(socketUn,msgBufReceive);
+ }
+ catch (certi::NetworkError) {
+ std::cerr << "libRTI: exception: NetworkError (read)" <<
std::endl ;
+ throw rti1516::RTIinternalError(L"libRTI: Network Read Error
waiting RTI reply");
+ }
+
+ D.Out(pdDebug, "RTIA reply received.");
+
+
+ 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");
+ }
+
+ D.Out(pdDebug, "processing returned exception (from reply).");
+ // the services may only throw exceptions defined in the HLA standard
+ // the RTIA is responsible for sending 'allowed' exceptions only
+ processException(rep);
+
+ D.Out(pdDebug, "exception processed.");
+ G.Out(pdGendoc,"exit RTI1516ambPrivateRefs::executeService");
+}
+
+void
+RTI1516ambPrivateRefs::sendTickRequestStop()
+{
+ G.Out(pdGendoc,"enter RTI1516ambPrivateRefs::sendTickRequestStop");
+
+ M_Tick_Request_Stop req, rep ;
+
+ try {
+ req.send(socketUn, msgBufSend);
+ }
+ catch (certi::NetworkError) {
+ std::cerr << "libRTI: exception: NetworkError (write)" <<
std::endl ;
+ throw rti1516::RTIinternalError(L"libRTI: Network Write Error");
+ }
+
+ try {
+ rep.receive(socketUn, msgBufReceive);
+ }
+ catch (certi::NetworkError) {
+ std::cerr << "libRTI: exception: NetworkError (read)" <<
std::endl ;
+ throw rti1516::RTIinternalError(L"libRTI: Network Read Error
waiting RTI reply");
+ }
+
+ // ignore the response, ignore exceptions
+ // rep->type == Message::TICK_REQUEST;
+
+ G.Out(pdGendoc,"exit RTI1516ambPrivateRefs::sendTickRequestStop");
+}
+
+// ----------------------------------------------------------------------------
+//! Process exception from received message.
+/*! When a message is received from RTIA, it can contains an exception.
+ This exception is processed by this module and a new exception is thrown.
+ */
+void
+RTI1516ambPrivateRefs::processException(Message *msg)
+{
+ D.Out(pdExcept, "num de l'exception : %d .", msg->getExceptionType());
+ switch(msg->getExceptionType()) {
+ case e_NO_EXCEPTION: {
+ } break ;
+
+ case e_ArrayIndexOutOfBounds: {
+ D.Out(pdExcept, "Throwing e_ArrayIndexOutOfBounds exception.");
+ // JvY: Changed name of exception
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_AsynchronousDeliveryAlreadyEnabled: {
+ D.Out(pdExcept, "Throwing e_AsynchronousDeliveryAlreadyEnabled
exception.");
+ throw
rti1516::AsynchronousDeliveryAlreadyEnabled(msg->getExceptionReasonW());
+ } break ;
+
+ case e_AsynchronousDeliveryAlreadyDisabled: {
+ D.Out(pdExcept, "Throwing e_AsynchronousDeliveryAlreadyDisabled
exception.");
+ throw
rti1516::AsynchronousDeliveryAlreadyDisabled(msg->getExceptionReasonW());
+ } break ;
+
+ case e_AttributeAlreadyOwned: {
+ D.Out(pdExcept, "Throwing e_AttributeAlreadyOwned exception.");
+ throw
rti1516::AttributeAlreadyOwned(msg->getExceptionReasonW());
+ } break ;
+
+ case e_AttributeAlreadyBeingAcquired: {
+ D.Out(pdExcept,
+ "Throwing e_AttributeAlreadyBeingAcquired
exception.");
+ throw
rti1516::AttributeAlreadyBeingAcquired(msg->getExceptionReasonW());
+ } break ;
+
+ case e_AttributeAlreadyBeingDivested: {
+ D.Out(pdExcept,
+ "Throwing e_AttributeAlreadyBeingDivested
exception.");
+ throw
rti1516::AttributeAlreadyBeingDivested(msg->getExceptionReasonW());
+ } break ;
+
+ case e_AttributeDivestitureWasNotRequested: {
+ D.Out(pdExcept,
+ "Throwing e_AttributeDivestitureWasNotRequested
exception.");
+ throw
rti1516::AttributeDivestitureWasNotRequested(msg->getExceptionReasonW());
+ } break ;
+
+ case e_AttributeAcquisitionWasNotRequested: {
+ D.Out(pdExcept,
+ "Throwing e_AttributeAcquisitionWasNotRequested
exception.");
+ throw
rti1516::AttributeAcquisitionWasNotRequested(msg->getExceptionReasonW());
+ } break ;
+
+ case e_AttributeNotDefined: {
+ D.Out(pdExcept, "Throwing e_AttributeNotDefined exception.");
+ throw rti1516::AttributeNotDefined(msg->getExceptionReasonW());
+ } break ;
+
+ case e_AttributeNotKnown: {
+ D.Out(pdExcept, "Throwing e_AttributeNotKnown exception.");
+ // JvY: Changed name of exception
+ throw
rti1516::AttributeNotRecognized(msg->getExceptionReasonW());
+ } break ;
+
+ case e_AttributeNotOwned: {
+ D.Out(pdExcept, "Throwing e_AttributeNotOwned exception.");
+ throw rti1516::AttributeNotOwned(msg->getExceptionReasonW());
+ } break ;
+
+ case e_AttributeNotPublished: {
+ D.Out(pdExcept, "Throwing e_AttributeNotPublished exception.");
+ throw
rti1516::AttributeNotPublished(msg->getExceptionReasonW());
+ } break ;
+
+ case e_AttributeNotSubscribed: {
+ D.Out(pdExcept, "Throwing e_AttributeNotSubscribed exception.");
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_ConcurrentAccessAttempted: {
+ D.Out(pdExcept, "Throwing e_ConcurrentAccessAttempted
exception.");
+ // JvY: Changed name of exception
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_CouldNotDiscover: {
+ D.Out(pdExcept, "Throwing e_CouldNotDiscover exception.");
+ throw rti1516::CouldNotDiscover(msg->getExceptionReasonW());
+ } break ;
+
+ case e_CouldNotOpenFED: {
+ D.Out(pdExcept, "Throwing e_CouldNotOpenFED exception.");
+ // JvY: Changed name of exception
+ throw rti1516::CouldNotOpenFDD(msg->getExceptionReasonW());
+ } break ;
+
+ case e_CouldNotOpenRID: {
+ D.Out(pdExcept, "Throwing e_CouldNotOpenRID exception.");
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_CouldNotRestore: {
+ D.Out(pdExcept, "Throwing e_CouldNotRestore exception.");
+ // JvY: Changed name of exception
+ throw
rti1516::CouldNotInitiateRestore(msg->getExceptionReasonW());
+ } break ;
+
+ case e_DeletePrivilegeNotHeld: {
+ D.Out(pdExcept, "Throwing e_DeletePrivilegeNotHeld exception.");
+ throw
rti1516::DeletePrivilegeNotHeld(msg->getExceptionReasonW());
+ } break ;
+
+ case e_ErrorReadingRID: {
+ D.Out(pdExcept, "Throwing e_ErrorReadingRID exception.");
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_ErrorReadingFED: {
+ D.Out(pdExcept, "Throwing e_ErrorReadingFED exception.");
+ // JvY: Changed name of exception
+ throw rti1516::ErrorReadingFDD(msg->getExceptionReasonW());
+ } break ;
+
+ case e_EventNotKnown: {
+ D.Out(pdExcept, "Throwing e_EventNotKnown exception.");
+ // JvY: Changed name of exception
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_FederateAlreadyPaused: {
+ D.Out(pdExcept, "Throwing e_FederateAlreadyPaused exception.");
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_FederateAlreadyExecutionMember: {
+ D.Out(pdExcept,
+ "Throwing e_FederateAlreadyExecutionMember
exception.");
+ throw
rti1516::FederateAlreadyExecutionMember(msg->getExceptionReasonW());
+ } break ;
+
+ case e_FederateDoesNotExist: {
+ D.Out(pdExcept, "Throwing e_FederateDoesNotExist exception.");
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_FederateInternalError: {
+ D.Out(pdExcept, "Throwing e_FederateInternalError exception.");
+ throw
rti1516::FederateInternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_FederateNameAlreadyInUse: {
+ D.Out(pdExcept, "Throwing e_FederateNameAlreadyInUse
exception.");
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_FederateNotExecutionMember: {
+ D.Out(pdExcept, "Throwing e_FederateNotExecutionMember
exception.");
+ throw
rti1516::FederateNotExecutionMember(msg->getExceptionReasonW());
+ } break ;
+
+ case e_FederateNotPaused: {
+ D.Out(pdExcept, "Throwing e_FederateNotPaused exception.");
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_FederateOwnsAttributes: {
+ D.Out(pdExcept, "Throwing e_FederateOwnsAttributes exception.");
+ throw
rti1516::FederateOwnsAttributes(msg->getExceptionReasonW());
+ } break ;
+
+ case e_FederatesCurrentlyJoined: {
+ D.Out(pdExcept, "Throwing e_FederatesCurrentlyJoined
exception.");
+ throw
rti1516::FederatesCurrentlyJoined(msg->getExceptionReasonW());
+ } break ;
+
+ case e_FederateWasNotAskedToReleaseAttribute: {
+ D.Out(pdExcept,
+ "Throwing
e_FederateWasNotAskedToReleaseAttribute exception.");
+ D.Out(pdDebug,
+ "Throwing
e_FederateWasNotAskedToReleaseAttribute exception.");
+ // JvY: Changed name of exception
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_FederationAlreadyPaused: {
+ D.Out(pdExcept, "Throwing e_FederationAlreadyPaused
exception.");
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_FederationExecutionAlreadyExists: {
+ D.Out(pdExcept, "Throwing e_FederationExecutionAlreadyExists
excep.");
+ throw
rti1516::FederationExecutionAlreadyExists(msg->getExceptionReasonW());
+ } break ;
+
+ case e_FederationExecutionDoesNotExist: {
+ D.Out(pdExcept, "Throwing e_FederationExecutionDoesNotExist
except.");
+ throw
rti1516::FederationExecutionDoesNotExist(msg->getExceptionReasonW());
+ } break ;
+
+ case e_FederationNotPaused: {
+ D.Out(pdExcept, "Throwing e_FederationNotPaused exception.");
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_FederationTimeAlreadyPassed: {
+ D.Out(pdExcept, "Throwing e_FederationTimeAlreadyPassed
exception.");
+ // JvY: Changed name of exception
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_FederateNotPublishing: {
+ D.Out(pdExcept, "Throwing e_FederateNotPublishing exception.");
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_FederateNotSubscribing: {
+ D.Out(pdExcept, "Throwing e_FederateNotSubscribing exception.");
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_RegionNotKnown: {
+ D.Out(pdExcept, "Throwing e_RegionNotKnown exception.");
+ // JvY: Changed name of exception
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_IDsupplyExhausted: {
+ D.Out(pdExcept, "Throwing e_IDsupplyExhausted exception.");
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_InteractionClassNotDefined: {
+ D.Out(pdExcept, "Throwing e_InteractionClassNotDefined
exception.");
+ throw
rti1516::InteractionClassNotDefined(msg->getExceptionReasonW());
+ } break ;
+
+ case e_InteractionClassNotKnown: {
+ D.Out(pdExcept, "Throwing e_InteractionClassNotKnown
exception.");
+ // JvY: Changed name of exception
+ throw
rti1516::InteractionClassNotRecognized(msg->getExceptionReasonW());
+ } break ;
+
+ case e_InteractionClassNotPublished: {
+ D.Out(pdExcept, "Throwing e_InteractionClassNotPublished
exception.");
+ throw
rti1516::InteractionClassNotPublished(msg->getExceptionReasonW());
+ } break ;
+
+ case e_InteractionParameterNotDefined: {
+ D.Out(pdExcept,
+ "Throwing e_InteractionParameterNotDefined
exception.");
+ throw
rti1516::InteractionParameterNotDefined(msg->getExceptionReasonW());
+ } break ;
+
+ case e_InteractionParameterNotKnown: {
+ D.Out(pdExcept, "Throwing e_InteractionParameterNotKnown
exception.");
+ // JvY: Changed name of exception
+ throw
rti1516::InteractionParameterNotRecognized(msg->getExceptionReasonW());
+ } break ;
+
+ case e_InvalidDivestitureCondition: {
+ D.Out(pdExcept, "Throwing e_InvalidDivestitureCondition
exception.");
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_InvalidExtents: {
+ D.Out(pdExcept, "Throwing e_InvalidExtents exception.");
+ // JvY: Changed name of exception
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_InvalidFederationTime: {
+ D.Out(pdExcept, "Throwing e_InvalidFederationTime exception.");
+ // JvY: Changed name of exception
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_InvalidFederationTimeDelta: {
+ D.Out(pdExcept, "Throwing e_InvalidFederationTimeDelta
exception.");
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_InvalidLookahead: {
+ D.Out(pdExcept, "Throwing e_InvalidLookahead.");
+ throw rti1516::InvalidLookahead(msg->getExceptionReasonW());
+ } break ;
+
+ case e_InvalidObjectHandle: {
+ D.Out(pdExcept, "Throwing e_InvalidObjectHandle exception.");
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_InvalidOrderingHandle: {
+ D.Out(pdExcept, "Throwing e_InvalidOrderingHandle exception.");
+ // JvY: Changed name of exception
+ throw rti1516::InvalidOrderType(msg->getExceptionReasonW());
+ } break ;
+
+ case e_InvalidResignAction: {
+ D.Out(pdExcept, "Throwing e_InvalidResignAction exception.");
+ // JvY: Changed name of exception
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_InvalidRetractionHandle: {
+ D.Out(pdExcept, "Throwing e_InvalidRetractionHandle
exception.");
+ throw
rti1516::InvalidRetractionHandle(msg->getExceptionReasonW());
+ } break ;
+
+ case e_InvalidRoutingSpace: {
+ D.Out(pdExcept, "Throwing e_InvalidRoutingSpace exception.");
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_InvalidTransportationHandle: {
+ D.Out(pdExcept, "Throwing e_InvalidTransportationHandle
exception.");
+ // JvY: Changed name of exception
+ throw
rti1516::InvalidTransportationType(msg->getExceptionReasonW());
+ } break ;
+
+ case e_MemoryExhausted: {
+ D.Out(pdExcept, "Throwing e_MemoryExhausted exception.");
+ // JvY: Changed name of exception
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_NameNotFound: {
+ D.Out(pdExcept, "Throwing e_NameNotFound exception.");
+ throw rti1516::NameNotFound(msg->getExceptionReasonW());
+ } break ;
+
+ case e_NoPauseRequested: {
+ D.Out(pdExcept, "Throwing e_NoPauseRequested exception.");
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_NoResumeRequested: {
+ D.Out(pdExcept, "Throwing e_NoResumeRequested exception.");
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_ObjectClassNotDefined: {
+ D.Out(pdExcept, "Throwing e_ObjectClassNotDefined exception.");
+ throw
rti1516::ObjectClassNotDefined(msg->getExceptionReasonW());
+ } break ;
+
+ case e_ObjectClassNotKnown: {
+ D.Out(pdExcept, "Throwing e_ObjectClassNotKnown exception.");
+ throw rti1516::ObjectClassNotKnown(msg->getExceptionReasonW());
+ } break ;
+
+ case e_ObjectClassNotPublished: {
+ D.Out(pdExcept, "Throwing e_ObjectClassNotPublished
exception.");
+ throw
rti1516::ObjectClassNotPublished(msg->getExceptionReasonW());
+ } break ;
+
+ case e_ObjectClassNotSubscribed: {
+ D.Out(pdExcept, "Throwing e_ObjectClassNotSubscribed
exception.");
+ // JvY: Changed name of exception
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_ObjectNotKnown: {
+ D.Out(pdExcept, "Throwing e_ObjectNotKnown exception.");
+ // JvY: Changed name of exception
+ throw
rti1516::ObjectInstanceNotKnown(msg->getExceptionReasonW());
+ } break ;
+
+ case e_ObjectAlreadyRegistered: {
+ D.Out(pdExcept, "Throwing e_ObjectAlreadyRegistered
exception.");
+ // JvY: Changed name of exception
+ throw
rti1516::ObjectInstanceNameInUse(msg->getExceptionReasonW());
+ } break ;
+
+ case e_RestoreInProgress: {
+ D.Out(pdExcept, "Throwing e_RestoreInProgress exception.");
+ throw rti1516::RestoreInProgress(msg->getExceptionReasonW());
+ } break ;
+
+ case e_RestoreNotRequested: {
+ D.Out(pdExcept, "Throwing e_RestoreNotRequested exception.");
+ throw rti1516::RestoreNotRequested(msg->getExceptionReasonW());
+ } break ;
+
+ case e_RTIinternalError: {
+ D.Out(pdExcept, "Throwing e_RTIinternalError exception.");
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_SpaceNotDefined: {
+ D.Out(pdExcept, "Throwing e_SpaceNotDefined exception.");
+ // JvY: Changed name of exception
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_SaveInProgress: {
+ D.Out(pdExcept, "Throwing e_SaveInProgress exception.");
+ throw rti1516::SaveInProgress(msg->getExceptionReasonW());
+ } break ;
+
+ case e_SaveNotInitiated: {
+ D.Out(pdExcept, "Throwing e_SaveNotInitiated exception.");
+ throw rti1516::SaveNotInitiated(msg->getExceptionReasonW());
+ } break ;
+
+ case e_SecurityError: {
+ D.Out(pdExcept, "Throwing e_SecurityError exception.");
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_SpecifiedSaveLabelDoesNotExist: {
+ D.Out(pdExcept,
+ "Throwing e_SpecifiedSaveLabelDoesNotExist
exception.");
+ throw
rti1516::SpecifiedSaveLabelDoesNotExist(msg->getExceptionReasonW());
+ } break ;
+
+ case e_TimeAdvanceAlreadyInProgress: {
+ D.Out(pdExcept, "Throwing e_TimeAdvanceAlreadyInProgress
exception.");
+ // JvY: Changed name of exception
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_TimeAdvanceWasNotInProgress: {
+ D.Out(pdExcept, "Throwing e_TimeAdvanceWasNotInProgress
exception.");
+ // JvY: Changed name of exception
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_TooManyIDsRequested: {
+ D.Out(pdExcept, "Throwing e_TooManyIDsRequested exception.");
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_UnableToPerformSave: {
+ D.Out(pdExcept, "Throwing e_UnableToPerformSave exception.");
+ throw rti1516::UnableToPerformSave(msg->getExceptionReasonW());
+ } break ;
+
+ case e_UnimplementedService: {
+ D.Out(pdExcept, "Throwing e_UnimplementedService exception.");
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_UnknownLabel: {
+ D.Out(pdExcept, "Throwing e_UnknownLabel exception.");
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_ValueCountExceeded: {
+ D.Out(pdExcept, "Throwing e_ValueCountExceeded exception.");
+ // JvY: Changed name of exception
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_ValueLengthExceeded: {
+ D.Out(pdExcept, "Throwing e_ValueLengthExceeded exception.");
+ // JvY: Changed name of exception
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+
+ case e_IllegalName: {
+ D.Out(pdExcept, "Throwing e_IllegalName exception.");
+ throw rti1516::IllegalName(msg->getExceptionReasonW());
+ } break;
+
+
+ default: {
+ D.Out(pdExcept, "Throwing unknown exception !");
+ std::cout << "LibRTI: Receiving unknown RTI exception." <<
std::endl;
+ throw rti1516::RTIinternalError(msg->getExceptionReasonW());
+ } break ;
+ }
+}
+
+#define CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(service) \
+ catch (rti1516::Exception &e) { \
+ std::wstringstream msg; \
+ msg << "Error in " << service << ": " << e.what(); \
+ throw rti1516::RTIinternalError(msg.str()); \
+ }
+
+void
+RTI1516ambPrivateRefs::callFederateAmbassador(Message *msg)
+throw (rti1516::RTIinternalError)
+{
+ switch (msg->getMessageType()) {
+
+ case Message::SYNCHRONIZATION_POINT_REGISTRATION_SUCCEEDED:
+ try {
+
fed_amb->synchronizationPointRegistrationSucceeded(msg->getLabelW());
+ }
+
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"synchronizationPointRegistrationSucceeded")
+ break ;
+
+ case Message::SYNCHRONIZATION_POINT_REGISTRATION_FAILED:
+ try {
+
fed_amb->synchronizationPointRegistrationFailed(msg->getLabelW(),
rti1516::RTI_DETECTED_FAILURE_DURING_SYNCHRONIZATION);
+ }
+
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"synchronizationPointRegistrationFailed")
+ break ;
+
+ case Message::ANNOUNCE_SYNCHRONIZATION_POINT:
+ try {
+ std::string tagString(msg->getTag());
+ rti1516::VariableLengthData
tagVarData(tagString.c_str(), tagString.length());
+
fed_amb->announceSynchronizationPoint(msg->getLabelW(),tagVarData);
+ }
+
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"announceSynchronizationPoint")
+ break ;
+
+ case Message::FEDERATION_SYNCHRONIZED:
+ try {
+ fed_amb->federationSynchronized(msg->getLabelW());
+ }
+ CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"federationSynchronized")
+ break ;
+
+ case Message::INITIATE_FEDERATE_SAVE:
+ try {
+ fed_amb->initiateFederateSave((msg->getLabelW()));
+ }
+ CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"initiateFederateSave")
+ break ;
+
+ case Message::FEDERATION_SAVED:
+ try {
+ fed_amb->federationSaved();
+ }
+ CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"federationSaved")
+ break ;
+
+ case Message::REQUEST_FEDERATION_RESTORE_SUCCEEDED:
+ try {
+ fed_amb->requestFederationRestoreSucceeded(
+ (msg->getLabelW()));
+ }
+
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"requestFederationRestoreSucceeded")
+ break ;
+
+ case Message::REQUEST_FEDERATION_RESTORE_FAILED:
+ try {
+
fed_amb->requestFederationRestoreFailed(msg->getLabelW());
+ }
+
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"requestFederationRestoreFailed")
+ break ;
+
+ case Message::FEDERATION_RESTORE_BEGUN:
+ try {
+ fed_amb->federationRestoreBegun();
+ }
+ CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"federationRestoreBegun")
+ break ;
+
+ case Message::INITIATE_FEDERATE_RESTORE:
+ try {
+ M_Initiate_Federate_Restore *IFR =
static_cast<M_Initiate_Federate_Restore *>(msg);
+ rti1516::FederateHandle rti1516Handle =
rti1516::FederateHandleFriend::createRTI1516Handle(IFR->getFederate());
+ fed_amb->initiateFederateRestore((IFR->getLabelW()),
rti1516Handle);
+ }
+ CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"initiateFederateRestore")
+ break ;
+
+ case Message::FEDERATION_RESTORED:
+ try {
+ fed_amb->federationRestored();
+ }
+ CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"federationRestored")
+ break ;
+
+ case Message::FEDERATION_NOT_RESTORED:
+ try {
+ // TODO Need to know reason
+
fed_amb->federationNotRestored(rti1516::RTI_UNABLE_TO_RESTORE);
+ }
+ CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"federationNotRestored")
+ break ;
+
+ case Message::START_REGISTRATION_FOR_OBJECT_CLASS:
+ try {
+ rti1516::ObjectClassHandle rti1516Handle =
rti1516::ObjectClassHandleFriend::createRTI1516Handle(static_cast<M_Start_Registration_For_Object_Class
*>(msg)->getObjectClass());
+ fed_amb->startRegistrationForObjectClass(rti1516Handle);
+ }
+
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"startRegistrationForObjectClass")
+ break ;
+
+ case Message::STOP_REGISTRATION_FOR_OBJECT_CLASS:
+ try {
+ rti1516::ObjectClassHandle rti1516Handle =
rti1516::ObjectClassHandleFriend::createRTI1516Handle(static_cast<M_Stop_Registration_For_Object_Class
*>(msg)->getObjectClass());
+ fed_amb->stopRegistrationForObjectClass(rti1516Handle);
+ }
+
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"stopRegistrationForObjectClass")
+ break ;
+
+ case Message::TURN_INTERACTIONS_ON:
+ try {
+ rti1516::InteractionClassHandle rti1516Handle =
rti1516::InteractionClassHandleFriend::createRTI1516Handle(static_cast<M_Turn_Interactions_On
*>(msg)->getInteractionClass());
+ fed_amb->turnInteractionsOn(rti1516Handle);
+ }
+ CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"turnInteractionsOn")
+ break ;
+
+ case Message::TURN_INTERACTIONS_OFF:
+ try {
+ rti1516::InteractionClassHandle rti1516Handle =
rti1516::InteractionClassHandleFriend::createRTI1516Handle(static_cast<M_Turn_Interactions_Off
*>(msg)->getInteractionClass());
+ fed_amb->turnInteractionsOff(rti1516Handle);
+ }
+ CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"turnInteractionsOff")
+ break ;
+
+ case Message::DISCOVER_OBJECT_INSTANCE:
+ try {
+ M_Discover_Object_Instance* DOI =
static_cast<M_Discover_Object_Instance *>(msg);
+ rti1516::ObjectInstanceHandle objectInstance =
rti1516::ObjectInstanceHandleFriend::createRTI1516Handle(DOI->getObject());
+ rti1516::ObjectClassHandle objectClass =
rti1516::ObjectClassHandleFriend::createRTI1516Handle(DOI->getObjectClass());
+ std::string str = DOI->getObjectName();
+ std::wstring str2(str.length(), L' '); // Make room for
characters
+ // Copy string to wstring.
+ std::copy(str.begin(), str.end(), str2.begin());
+
+ fed_amb->discoverObjectInstance(objectInstance,
+ objectClass,
+ str2);
+ }
+ CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"discoverObjectInstance")
+ break ;
+
+ case Message::REFLECT_ATTRIBUTE_VALUES:
+ try {
+ M_Reflect_Attribute_Values* RAV =
static_cast<M_Reflect_Attribute_Values *>(msg);
+ G.Out(pdGendoc," tick_kernel call to
reflectAttributeValues");
+
+ rti1516::ObjectInstanceHandle instance =
rti1516::ObjectInstanceHandleFriend::createRTI1516Handle(RAV->getObject());
+
+ rti1516::AttributeHandleValueMap *attributes =
getAHVMFromRequest(RAV);
+
+ std::string tagString(msg->getTag());
+ rti1516::VariableLengthData
tagVarData(tagString.c_str(), tagString.length());
+
+ if (msg->isDated()) {
+ uint64_t sn = RAV->getEventRetraction().getSN();
+ certi::FederateHandle certiHandle =
RAV->getEventRetraction().getSendingFederate();
+ rti1516::MessageRetractionHandle event =
rti1516::MessageRetractionHandleFriend::createRTI1516Handle(certiHandle, sn);
+
+ std::auto_ptr < rti1516::LogicalTime > fedTime
(new RTI1516fedTime(msg->getDate().getTime()));
+
+ fed_amb->reflectAttributeValues(instance,
//ObjectInstanceHandle
+ *attributes,
//AttributeHandleValueMap &
+ tagVarData,
//VariableLengthData &
+ rti1516::TIMESTAMP,
//OrderType (send)
+ rti1516::RELIABLE,
//TransportationType
+ *fedTime,
//LogicalTime &
+ rti1516::RECEIVE,
//OrderType (receive)
+ event
//MessageRetractionHandle
+ );
+ }
+ else {
+ fed_amb->reflectAttributeValues(instance,
+ *attributes,
+ tagVarData,
+ rti1516::RECEIVE,
+ rti1516::RELIABLE);
+ }
+ delete attributes ;
+ }
+ CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"reflectAttributeValues")
+ break ;
+
+ case Message::RECEIVE_INTERACTION:
+ try {
+ M_Receive_Interaction* RI =
static_cast<M_Receive_Interaction *>(msg);
+ rti1516::ParameterHandleValueMap *parameters =
getPHVMFromRequest(RI);
+
+ rti1516::InteractionClassHandle interactionHandle =
rti1516::InteractionClassHandleFriend::createRTI1516Handle(RI->getInteractionClass());
+
+ std::string tagString(msg->getTag());
+ rti1516::VariableLengthData
tagVarData(tagString.c_str(), tagString.length());
+
+ if (msg->isDated()) {
+ uint64_t sn = RI->getEventRetraction().getSN();
+ certi::FederateHandle certiHandle =
RI->getEventRetraction().getSendingFederate();
+ rti1516::MessageRetractionHandle event =
rti1516::MessageRetractionHandleFriend::createRTI1516Handle(certiHandle, sn);
+
+ std::auto_ptr < rti1516::LogicalTime > fedTime
(new RTI1516fedTime(msg->getDate().getTime()));
+
+ fed_amb->receiveInteraction(
+ interactionHandle,
// InteractionClassHandle
+ *parameters,
// ParameterHandleValueMap &
+ tagVarData,
// VariableLengthData &
+ rti1516::TIMESTAMP,
//OrderType (send)
+ rti1516::RELIABLE,
//TransportationType
+ *fedTime,
//LogicalTime &
+ rti1516::RECEIVE,
//OrderType (receive)
+ event
//MessageRetractionHandle
+ );
+ }
+ else {
+ fed_amb->receiveInteraction(
+ interactionHandle,
+ *parameters,
+ tagVarData,
+ rti1516::RECEIVE,
+ rti1516::RELIABLE);
+ }
+ delete parameters ;
+ }
+ CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"receiveInteraction")
+ break ;
+
+ case Message::REMOVE_OBJECT_INSTANCE:
+ try {
+ M_Remove_Object_Instance* ROI =
static_cast<M_Remove_Object_Instance *>(msg);
+
+ rti1516::ObjectInstanceHandle instance =
rti1516::ObjectInstanceHandleFriend::createRTI1516Handle(ROI->getObject());
+
+ std::string tagString(msg->getTag());
+ rti1516::VariableLengthData
tagVarData(tagString.c_str(), tagString.length());
+
+ if (msg->isDated()) {
+ uint64_t sn = ROI->getEventRetraction().getSN();
+ certi::FederateHandle certiHandle =
ROI->getEventRetraction().getSendingFederate();
+ rti1516::MessageRetractionHandle event =
rti1516::MessageRetractionHandleFriend::createRTI1516Handle(certiHandle, sn);
+
+ std::auto_ptr < rti1516::LogicalTime > fedTime
(new RTI1516fedTime(msg->getDate().getTime()));
+
+ fed_amb->removeObjectInstance(
+ instance,
+ tagVarData,
+ rti1516::TIMESTAMP,
+ *fedTime,
+ rti1516::RECEIVE,
+ event);
+ }
+ else {
+ fed_amb->removeObjectInstance(
+ instance,
+ tagVarData,
+ rti1516::RECEIVE);
+ }
+ }
+ CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"removeObjectInstance")
+ break ;
+
+ case Message::PROVIDE_ATTRIBUTE_VALUE_UPDATE:
+ try {
+ M_Provide_Attribute_Value_Update* PAVU =
static_cast<M_Provide_Attribute_Value_Update *>(msg);
+
+ rti1516::AttributeHandleSet *attributeSet =
getAHSFromRequest(PAVU);
+
+ rti1516::ObjectInstanceHandle instance =
rti1516::ObjectInstanceHandleFriend::createRTI1516Handle(PAVU->getObject());
+
+ std::string tag = PAVU->getTag();
+ rti1516::VariableLengthData tagVarData(tag.c_str(),
tag.size());
+
+
fed_amb->provideAttributeValueUpdate(instance,*attributeSet, tagVarData);
+ delete attributeSet ;
+ }
+
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"provideAttributeValueUpdate")
+ break ;
+
+ case Message::REQUEST_RETRACTION: {
+
+ } break ;
+
+ case Message::REQUEST_ATTRIBUTE_OWNERSHIP_ASSUMPTION:
+ try {
+ M_Request_Attribute_Ownership_Assumption* RAOA =
static_cast<M_Request_Attribute_Ownership_Assumption *>(msg);
+ rti1516::AttributeHandleSet *attributeSet =
getAHSFromRequest(RAOA);
+
+ rti1516::ObjectInstanceHandle instance =
rti1516::ObjectInstanceHandleFriend::createRTI1516Handle(RAOA->getObject());
+
+ std::string tag = RAOA->getTag();
+ rti1516::VariableLengthData tagVarData(tag.c_str(),
tag.size());
+
+ fed_amb->
+ requestAttributeOwnershipAssumption(instance,
+ *attributeSet,
+ tagVarData);
+ delete attributeSet ;
+ }
+
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"requestAttributeOwnershipAssumption")
+ break ;
+
+ case Message::REQUEST_ATTRIBUTE_OWNERSHIP_RELEASE:
+ try {
+ M_Request_Attribute_Ownership_Release* RAOR =
static_cast<M_Request_Attribute_Ownership_Release *>(msg);
+ rti1516::AttributeHandleSet *attributeSet =
getAHSFromRequest(RAOR);
+
+ rti1516::ObjectInstanceHandle instance =
rti1516::ObjectInstanceHandleFriend::createRTI1516Handle(RAOR->getObject());
+
+ std::string tag = RAOR->getTag();
+ rti1516::VariableLengthData tagVarData(tag.c_str(),
tag.size());
+
+ fed_amb->requestAttributeOwnershipRelease(
+ instance,
+ *attributeSet,
+ tagVarData);
+
+ delete attributeSet ;
+ }
+
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"requestAttributeOwnershipRelease")
+ break ;
+
+ case Message::ATTRIBUTE_OWNERSHIP_UNAVAILABLE:
+ try {
+ M_Attribute_Ownership_Unavailable* AOU =
static_cast<M_Attribute_Ownership_Unavailable *>(msg);
+
+ rti1516::AttributeHandleSet *attributeSet =
getAHSFromRequest(AOU);
+
+ rti1516::ObjectInstanceHandle instance =
rti1516::ObjectInstanceHandleFriend::createRTI1516Handle(AOU->getObject());
+
+ fed_amb->attributeOwnershipUnavailable(instance,
+ *attributeSet);
+
+ delete attributeSet ;
+ }
+
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"attributeOwnershipUnavailable")
+ break ;
+
+ case Message::ATTRIBUTE_OWNERSHIP_ACQUISITION_NOTIFICATION:
+ try {
+ M_Attribute_Ownership_Acquisition_Notification* AOAN =
static_cast<M_Attribute_Ownership_Acquisition_Notification *>(msg);
+
+ rti1516::AttributeHandleSet *attributeSet =
getAHSFromRequest(AOAN);
+
+ rti1516::ObjectInstanceHandle instance =
rti1516::ObjectInstanceHandleFriend::createRTI1516Handle(AOAN->getObject());
+
+ std::string tag = AOAN->getTag();
+ rti1516::VariableLengthData tagVarData(tag.c_str(),
tag.size());
+
+ fed_amb->attributeOwnershipAcquisitionNotification(
+ instance,
+ *attributeSet,
+ tagVarData);
+
+ delete attributeSet ;
+ }
+
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"attributeOwnershipAcquisitionNotification")
+ break ;
+
+ case Message::ATTRIBUTE_OWNERSHIP_DIVESTITURE_NOTIFICATION:
+ try {
+ M_Attribute_Ownership_Divestiture_Notification* AODN =
static_cast<M_Attribute_Ownership_Divestiture_Notification *>(msg);
+
+ rti1516::AttributeHandleSet *attributeSet =
getAHSFromRequest(AODN);
+
+ rti1516::ObjectInstanceHandle instance =
rti1516::ObjectInstanceHandleFriend::createRTI1516Handle(AODN->getObject());
+
+ // requestDivestitureConfirmation = 7.5, en zou
ontbreken in 1.3. JRE: klopt dit wel?
+ // Changed function name! Originally:
attributeOwnershipDivestitureNotification
+ fed_amb->requestDivestitureConfirmation(
+ instance,
+ *attributeSet);
+
+ delete attributeSet ;
+ }
+
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"attributeOwnershipDivestitureNotification")
+ break ;
+
+ case Message::CONFIRM_ATTRIBUTE_OWNERSHIP_ACQUISITION_CANCELLATION:
+ try {
+ M_Confirm_Attribute_Ownership_Acquisition_Cancellation*
CAOAC = static_cast<M_Confirm_Attribute_Ownership_Acquisition_Cancellation
*>(msg);
+
+ rti1516::AttributeHandleSet *attributeSet =
getAHSFromRequest(CAOAC);
+
+ rti1516::ObjectInstanceHandle instance =
rti1516::ObjectInstanceHandleFriend::createRTI1516Handle(CAOAC->getObject());
+
+
fed_amb->confirmAttributeOwnershipAcquisitionCancellation(
+ instance,
+ *attributeSet);
+
+ delete attributeSet ;
+ }
+
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"confirmAttributeOwnershipAcquisitionCancellation")
+ break ;
+
+ case Message::INFORM_ATTRIBUTE_OWNERSHIP:
+ try {
+ M_Inform_Attribute_Ownership* IAO =
static_cast<M_Inform_Attribute_Ownership *>(msg);
+ rti1516::ObjectInstanceHandle instance =
rti1516::ObjectInstanceHandleFriend::createRTI1516Handle(IAO->getObject());
+ rti1516::AttributeHandle attribute =
rti1516::AttributeHandleFriend::createRTI1516Handle(IAO->getAttribute());
+ rti1516::FederateHandle federate =
rti1516::FederateHandleFriend::createRTI1516Handle(IAO->getFederate());
+
+ fed_amb->
+ informAttributeOwnership(
+ instance,
+ attribute,
+ federate);
+ }
+
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"informAttributeOwnership")
+ break ;
+
+ case Message::ATTRIBUTE_IS_NOT_OWNED:
+ try {
+ M_Attribute_Is_Not_Owned* AINO =
static_cast<M_Attribute_Is_Not_Owned *>(msg);
+ rti1516::ObjectInstanceHandle instance =
rti1516::ObjectInstanceHandleFriend::createRTI1516Handle(AINO->getObject());
+ rti1516::AttributeHandle attribute =
rti1516::AttributeHandleFriend::createRTI1516Handle(AINO->getAttribute());
+
+ fed_amb->attributeIsNotOwned(
+ instance,
+ attribute);
+ }
+ CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"attributeIsNotOwned")
+ break ;
+
+ case Message::TIME_ADVANCE_GRANT:
+ try {
+
fed_amb->timeAdvanceGrant(RTI1516fedTime(msg->getDate().getTime()));
+ }
+ CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"timeAdvanceGrant")
+ break ;
+
+ case Message::TIME_REGULATION_ENABLED:
+ try {
+ std::auto_ptr < rti1516::LogicalTime > fedTime (new
RTI1516fedTime(msg->getDate().getTime()));
+ fed_amb->timeRegulationEnabled(*fedTime);
+ }
+ CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"timeRegulationEnabled")
+ break ;
+
+ case Message::TIME_CONSTRAINED_ENABLED:
+ try {
+ std::auto_ptr < rti1516::LogicalTime > fedTime (new
RTI1516fedTime(msg->getDate().getTime()));
+ fed_amb->timeConstrainedEnabled(*fedTime);
+ }
+ CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"timeConstrainedEnabled")
+ break ;
+
+ case Message::RESERVE_OBJECT_INSTANCE_NAME_SUCCEEDED:
+ try {
+ M_Reserve_Object_Instance_Name_Succeeded* ROINS =
static_cast<M_Reserve_Object_Instance_Name_Succeeded *>(msg);
+ std::string objName_s(ROINS->getObjectName());
+ std::wstring objName_ws(objName_s.begin(),
objName_s.end());
+
+
fed_amb->objectInstanceNameReservationSucceeded(objName_ws);
+ }
+
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"reserveObjectInstanceNameSucceeded")
+ break;
+
+ case Message::RESERVE_OBJECT_INSTANCE_NAME_FAILED:
+ try {
+ M_Reserve_Object_Instance_Name_Failed* ROINS =
static_cast<M_Reserve_Object_Instance_Name_Failed *>(msg);
+ std::string objName_s(ROINS->getObjectName());
+ std::wstring objName_ws(objName_s.begin(),
objName_s.end());
+
+
fed_amb->objectInstanceNameReservationFailed(objName_ws);
+ }
+
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"reserveObjectInstanceNameFailed")
+ break;
+
+ default:
+ leave("RTI service requested by RTI is unknown.");
+ }
+}
+
+// $Id: RTIambPrivateRefs.cpp,v 1.1 2014/03/03 16:41:51 erk Exp $
Index: RTIvariableLengthDataImplementation.h
===================================================================
RCS file: RTIvariableLengthDataImplementation.h
diff -N RTIvariableLengthDataImplementation.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ RTIvariableLengthDataImplementation.h 3 Mar 2014 16:41:51 -0000
1.1
@@ -0,0 +1,44 @@
+#ifndef RTI_VariableLengthDataImplementation_h
+#define RTI_VariableLengthDataImplementation_h
+
+namespace rti1516
+{
+ class VariableLengthDataImplementation
+ {
+ public:
+ VariableLengthDataImplementation();
+ // Caller is free to delete inData after the call
+ VariableLengthDataImplementation(void const * inData, unsigned
long inSize);
+ // Caller is free to delete rhs after the call
+
VariableLengthDataImplementation(VariableLengthDataImplementation const & rhs);
+
+ ~VariableLengthDataImplementation();
+
+ // Caller is free to delete rhs after the call
+ VariableLengthDataImplementation &
+ operator=(VariableLengthDataImplementation const & rhs);
+
+ // Caller is free to delete inData after the call
+ void setData(void const * inData, unsigned long inSize);
+
+ // Caller is responsible for ensuring that the data that is
+ // pointed to is valid for the lifetime of this object, or past
+ // the next time this object is given new data.
+ void setDataPointer(void* inData, unsigned long inSize);
+
+ // Caller gives up ownership of inData to this object.
+ // This object assumes the responsibility of deleting inData
+ // when it is no longer needed.
+ void takeDataPointer(void* inData, unsigned long inSize);
+
+ void const *getData() { return _data; }
+ unsigned long getSize() { return _size; }
+
+ private:
+ void *_data;
+ unsigned long _size;
+ bool _dataOwner;
+ };
+}
+
+#endif // RTI_VariableLengthDataImplementation_h
Index: Exception.cpp
===================================================================
RCS file: Exception.cpp
diff -N Exception.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Exception.cpp 3 Mar 2014 16:41:52 -0000 1.1
@@ -0,0 +1,172 @@
+// ----------------------------------------------------------------------------
+// CERTI - HLA RunTime Infrastructure
+// Copyright (C) 2002-2014 ONERA
+//
+// This file is part of CERTI-libRTI
+//
+// CERTI-libRTI is free software ; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License
+// as published by the Free Software Foundation ; either version 2 of
+// the License, or (at your option) any later version.
+//
+// CERTI-libRTI is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY ; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this program ; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA
+//
+// ----------------------------------------------------------------------------
+
+#include <RTI/Exception.h>
+#include <iostream>
+#include <sstream>
+
+namespace rti1516
+{
+Exception::Exception()
+{
+}
+
+Exception::Exception(Exception const & rhs)
+{
+ // Nothing to copy...?
+}
+
+Exception::~Exception()
+{
+}
+
+Exception &
+Exception::operator=(Exception const & rhs)
+{
+ // Nothing to copy...?
+ return *this;
+}
+
+std::wostream &
+operator << (std::wostream &stream, Exception const &e)
+{
+ return stream << e.what() << std::endl;
+}
+
+
+#define RTI_EXCEPTION_IMPL(A) \
+ A::A(std::wstring const & message) throw() \
+ : Exception() \
+ , _msg(message) \
+ { } \
+ std::wstring A::what() const throw() \
+ { \
+ std::wstringstream ss; \
+ ss << "rti1516::" #A ": " << _msg; \
+ return ss.str(); \
+ }
+
+RTI_EXCEPTION_IMPL(AsynchronousDeliveryAlreadyDisabled)
+RTI_EXCEPTION_IMPL(AsynchronousDeliveryAlreadyEnabled)
+RTI_EXCEPTION_IMPL(AttributeAcquisitionWasNotCanceled)
+RTI_EXCEPTION_IMPL(AttributeAcquisitionWasNotRequested)
+RTI_EXCEPTION_IMPL(AttributeAlreadyBeingAcquired)
+RTI_EXCEPTION_IMPL(AttributeAlreadyBeingDivested)
+RTI_EXCEPTION_IMPL(AttributeAlreadyOwned)
+RTI_EXCEPTION_IMPL(AttributeDivestitureWasNotRequested)
+RTI_EXCEPTION_IMPL(AttributeNotDefined)
+RTI_EXCEPTION_IMPL(AttributeNotOwned)
+RTI_EXCEPTION_IMPL(AttributeNotPublished)
+RTI_EXCEPTION_IMPL(AttributeNotRecognized)
+RTI_EXCEPTION_IMPL(AttributeNotSubscribed)
+RTI_EXCEPTION_IMPL(AttributeRelevanceAdvisorySwitchIsOff)
+RTI_EXCEPTION_IMPL(AttributeRelevanceAdvisorySwitchIsOn)
+RTI_EXCEPTION_IMPL(AttributeScopeAdvisorySwitchIsOff)
+RTI_EXCEPTION_IMPL(AttributeScopeAdvisorySwitchIsOn)
+RTI_EXCEPTION_IMPL(BadInitializationParameter)
+RTI_EXCEPTION_IMPL(CouldNotCreateLogicalTimeFactory)
+RTI_EXCEPTION_IMPL(CouldNotDecode)
+RTI_EXCEPTION_IMPL(CouldNotDiscover)
+RTI_EXCEPTION_IMPL(CouldNotEncode)
+RTI_EXCEPTION_IMPL(CouldNotOpenFDD)
+RTI_EXCEPTION_IMPL(CouldNotInitiateRestore)
+RTI_EXCEPTION_IMPL(DeletePrivilegeNotHeld)
+RTI_EXCEPTION_IMPL(RequestForTimeConstrainedPending)
+RTI_EXCEPTION_IMPL(NoRequestToEnableTimeConstrainedWasPending)
+RTI_EXCEPTION_IMPL(RequestForTimeRegulationPending)
+RTI_EXCEPTION_IMPL(NoRequestToEnableTimeRegulationWasPending)
+RTI_EXCEPTION_IMPL(ErrorReadingFDD)
+RTI_EXCEPTION_IMPL(FederateAlreadyExecutionMember)
+RTI_EXCEPTION_IMPL(FederateHasNotBegunSave)
+RTI_EXCEPTION_IMPL(FederateInternalError)
+RTI_EXCEPTION_IMPL(FederateNotExecutionMember)
+RTI_EXCEPTION_IMPL(FederateOwnsAttributes)
+RTI_EXCEPTION_IMPL(FederateServiceInvocationsAreBeingReportedViaMOM)
+RTI_EXCEPTION_IMPL(FederateUnableToUseTime)
+RTI_EXCEPTION_IMPL(FederatesCurrentlyJoined)
+RTI_EXCEPTION_IMPL(FederationExecutionAlreadyExists)
+RTI_EXCEPTION_IMPL(FederationExecutionDoesNotExist)
+RTI_EXCEPTION_IMPL(IllegalName)
+RTI_EXCEPTION_IMPL(IllegalTimeArithmetic)
+RTI_EXCEPTION_IMPL(InteractionClassNotDefined)
+RTI_EXCEPTION_IMPL(InteractionClassNotPublished)
+RTI_EXCEPTION_IMPL(InteractionClassNotRecognized)
+RTI_EXCEPTION_IMPL(InteractionClassNotSubscribed)
+RTI_EXCEPTION_IMPL(InteractionParameterNotDefined)
+RTI_EXCEPTION_IMPL(InteractionParameterNotRecognized)
+RTI_EXCEPTION_IMPL(InteractionRelevanceAdvisorySwitchIsOff)
+RTI_EXCEPTION_IMPL(InteractionRelevanceAdvisorySwitchIsOn)
+RTI_EXCEPTION_IMPL(InTimeAdvancingState)
+RTI_EXCEPTION_IMPL(InvalidAttributeHandle)
+RTI_EXCEPTION_IMPL(InvalidDimensionHandle)
+RTI_EXCEPTION_IMPL(InvalidFederateHandle)
+RTI_EXCEPTION_IMPL(InvalidInteractionClassHandle)
+RTI_EXCEPTION_IMPL(InvalidLogicalTime)
+RTI_EXCEPTION_IMPL(InvalidLogicalTimeInterval)
+RTI_EXCEPTION_IMPL(InvalidLookahead)
+RTI_EXCEPTION_IMPL(InvalidObjectClassHandle)
+RTI_EXCEPTION_IMPL(InvalidOrderName)
+RTI_EXCEPTION_IMPL(InvalidOrderType)
+RTI_EXCEPTION_IMPL(InvalidParameterHandle)
+RTI_EXCEPTION_IMPL(InvalidRangeBound)
+RTI_EXCEPTION_IMPL(InvalidRegion)
+RTI_EXCEPTION_IMPL(InvalidRegionContext)
+RTI_EXCEPTION_IMPL(InvalidRetractionHandle)
+RTI_EXCEPTION_IMPL(InvalidServiceGroup)
+RTI_EXCEPTION_IMPL(InvalidTransportationName)
+RTI_EXCEPTION_IMPL(InvalidTransportationType)
+RTI_EXCEPTION_IMPL(JoinedFederateIsNotInTimeAdvancingState)
+RTI_EXCEPTION_IMPL(LogicalTimeAlreadyPassed)
+RTI_EXCEPTION_IMPL(MessageCanNoLongerBeRetracted)
+RTI_EXCEPTION_IMPL(NameNotFound)
+RTI_EXCEPTION_IMPL(NoAcquisitionPending)
+RTI_EXCEPTION_IMPL(ObjectClassNotDefined)
+RTI_EXCEPTION_IMPL(ObjectClassNotKnown)
+RTI_EXCEPTION_IMPL(ObjectClassNotPublished)
+RTI_EXCEPTION_IMPL(ObjectClassRelevanceAdvisorySwitchIsOff)
+RTI_EXCEPTION_IMPL(ObjectClassRelevanceAdvisorySwitchIsOn)
+RTI_EXCEPTION_IMPL(ObjectInstanceNameInUse)
+RTI_EXCEPTION_IMPL(ObjectInstanceNameNotReserved)
+RTI_EXCEPTION_IMPL(ObjectInstanceNotKnown)
+RTI_EXCEPTION_IMPL(OwnershipAcquisitionPending)
+RTI_EXCEPTION_IMPL(RTIinternalError)
+RTI_EXCEPTION_IMPL(RegionDoesNotContainSpecifiedDimension)
+RTI_EXCEPTION_IMPL(RegionInUseForUpdateOrSubscription)
+RTI_EXCEPTION_IMPL(RegionNotCreatedByThisFederate)
+RTI_EXCEPTION_IMPL(RestoreInProgress)
+RTI_EXCEPTION_IMPL(RestoreNotRequested)
+RTI_EXCEPTION_IMPL(SaveInProgress)
+RTI_EXCEPTION_IMPL(SaveNotInitiated)
+RTI_EXCEPTION_IMPL(SpecifiedSaveLabelDoesNotExist)
+RTI_EXCEPTION_IMPL(SynchronizationPointLabelNotAnnounced)
+RTI_EXCEPTION_IMPL(TimeConstrainedAlreadyEnabled)
+RTI_EXCEPTION_IMPL(TimeConstrainedIsNotEnabled)
+RTI_EXCEPTION_IMPL(TimeRegulationAlreadyEnabled)
+RTI_EXCEPTION_IMPL(TimeRegulationIsNotEnabled)
+RTI_EXCEPTION_IMPL(UnableToPerformSave)
+RTI_EXCEPTION_IMPL(UnknownName)
+RTI_EXCEPTION_IMPL(InternalError)
+
+#undef RTI_EXCEPTION_IMPL
+
+} // end namespace rti1516
Index: RTIambTime.cpp
===================================================================
RCS file: RTIambTime.cpp
diff -N RTIambTime.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ RTIambTime.cpp 3 Mar 2014 16:41:52 -0000 1.1
@@ -0,0 +1,15 @@
+#include <RTI/certiLogicalTime.h>
+#include <RTI/certiLogicalTimeInterval.h>
+#include <RTI/certiLogicalTimeFactory.h>
+
+//rti1516::LogicalTime::~LogicalTime()
+//{
+//}
+//
+//rti1516::LogicalTimeInterval::~LogicalTimeInterval()
+//{
+//}
+//
+//rti1516::LogicalTimeFactory::~LogicalTimeFactory()
+//{
+//}
Index: RTI1516ambassador.h
===================================================================
RCS file: RTI1516ambassador.h
diff -N RTI1516ambassador.h
--- RTI1516ambassador.h 3 Mar 2014 15:18:21 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,1319 +0,0 @@
-// This interface is used to access the services of the RTI.
-
-#ifndef RTI_RTI1516ambassador_h
-#define RTI_RTI1516ambassador_h
-
-#include <RTI/RTIambassador.h>
-#include <RTI/RTIambassadorFactory.h>
-#include "RTI1516ambPrivateRefs.h"
-
-
-namespace rti1516
-{
- class RTI_EXPORT RTI1516ambassador : RTIambassador
- {
- friend std::auto_ptr< RTIambassador >
- RTIambassadorFactory::createRTIambassador(std::vector<
std::wstring > & args)
- throw (BadInitializationParameter, RTIinternalError);
-
- private:
- RTI1516ambPrivateRefs* privateRefs ;
-
- // Helper functions
- 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 ();
-
- public:
- virtual
- ~RTI1516ambassador();
- // throw ()
-
- // 4.2
- virtual void createFederationExecution
- (std::wstring const & federationExecutionName,
- std::wstring const & fullPathNameToTheFDDfile,
- std::wstring const & logicalTimeImplementationName =
L"")
- throw (FederationExecutionAlreadyExists,
- CouldNotOpenFDD,
- ErrorReadingFDD,
- CouldNotCreateLogicalTimeFactory,
- RTIinternalError);
-
- // 4.3
- virtual void destroyFederationExecution
- (std::wstring const & federationExecutionName)
- throw (FederatesCurrentlyJoined,
- FederationExecutionDoesNotExist,
- RTIinternalError);
-
- // 4.4
- virtual FederateHandle joinFederationExecution
- (std::wstring const & federateType,
- std::wstring const & federationExecutionName,
- FederateAmbassador & federateAmbassador)
- throw (FederateAlreadyExecutionMember,
- FederationExecutionDoesNotExist,
- SaveInProgress,
- RestoreInProgress,
- CouldNotCreateLogicalTimeFactory,
- RTIinternalError);
-
- // 4.5
- virtual void resignFederationExecution
- (ResignAction resignAction)
- throw (OwnershipAcquisitionPending,
- FederateOwnsAttributes,
- FederateNotExecutionMember,
- RTIinternalError);
-
- // 4.6
- virtual void registerFederationSynchronizationPoint
- (std::wstring const & label,
- VariableLengthData const & theUserSuppliedTag)
- throw (FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- virtual void registerFederationSynchronizationPoint
- (std::wstring const & label,
- VariableLengthData const & theUserSuppliedTag,
- FederateHandleSet const & syncSet)
- throw (FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 4.9
- virtual void synchronizationPointAchieved
- (std::wstring const & label)
- throw (SynchronizationPointLabelNotAnnounced,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 4.11
- virtual void requestFederationSave
- (std::wstring const & label)
- throw (FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- virtual void requestFederationSave
- (std::wstring const & label,
- LogicalTime const & theTime)
- throw (LogicalTimeAlreadyPassed,
- InvalidLogicalTime,
- FederateUnableToUseTime,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 4.13
- virtual void federateSaveBegun ()
- throw (SaveNotInitiated,
- FederateNotExecutionMember,
- RestoreInProgress,
- RTIinternalError);
-
- // 4.14
- virtual void federateSaveComplete ()
- throw (FederateHasNotBegunSave,
- FederateNotExecutionMember,
- RestoreInProgress,
- RTIinternalError);
-
- virtual void federateSaveNotComplete()
- throw (FederateHasNotBegunSave,
- FederateNotExecutionMember,
- RestoreInProgress,
- RTIinternalError);
-
- // 4.16
- virtual void queryFederationSaveStatus ()
- throw (FederateNotExecutionMember,
- RestoreInProgress,
- RTIinternalError);
-
- // 4.18
- virtual void requestFederationRestore
- (std::wstring const & label)
- throw (FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 4.22
- virtual void federateRestoreComplete ()
- throw (RestoreNotRequested,
- FederateNotExecutionMember,
- SaveInProgress,
- RTIinternalError);
-
- virtual void federateRestoreNotComplete ()
- throw (RestoreNotRequested,
- FederateNotExecutionMember,
- SaveInProgress,
- RTIinternalError);
-
- // 4.24
- virtual void queryFederationRestoreStatus ()
- throw (FederateNotExecutionMember,
- SaveInProgress,
- RTIinternalError);
-
- /////////////////////////////////////
- // Declaration Management Services //
- /////////////////////////////////////
-
- // 5.2
- virtual void publishObjectClassAttributes
- (ObjectClassHandle theClass,
- AttributeHandleSet const & attributeList)
- throw (ObjectClassNotDefined,
- AttributeNotDefined,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 5.3
- virtual void unpublishObjectClass
- (ObjectClassHandle theClass)
- throw (ObjectClassNotDefined,
- OwnershipAcquisitionPending,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- virtual void unpublishObjectClassAttributes
- (ObjectClassHandle theClass,
- AttributeHandleSet const & attributeList)
- throw (ObjectClassNotDefined,
- AttributeNotDefined,
- OwnershipAcquisitionPending,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 5.4
- virtual void publishInteractionClass
- (InteractionClassHandle theInteraction)
- throw (InteractionClassNotDefined,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 5.5
- virtual void unpublishInteractionClass
- (InteractionClassHandle theInteraction)
- throw (InteractionClassNotDefined,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 5.6
- virtual void subscribeObjectClassAttributes
- (ObjectClassHandle theClass,
- AttributeHandleSet const & attributeList,
- bool active = true)
- throw (ObjectClassNotDefined,
- AttributeNotDefined,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 5.7
- virtual void unsubscribeObjectClass
- (ObjectClassHandle theClass)
- throw (ObjectClassNotDefined,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- virtual void unsubscribeObjectClassAttributes
- (ObjectClassHandle theClass,
- AttributeHandleSet const & attributeList)
- throw (ObjectClassNotDefined,
- AttributeNotDefined,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 5.8
- virtual void subscribeInteractionClass
- (InteractionClassHandle theClass,
- bool active = true)
- throw (InteractionClassNotDefined,
- FederateServiceInvocationsAreBeingReportedViaMOM,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 5.9
- virtual void unsubscribeInteractionClass
- (InteractionClassHandle theClass)
- throw (InteractionClassNotDefined,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- ////////////////////////////////
- // Object Management Services //
- ////////////////////////////////
-
- // 6.2
- virtual void reserveObjectInstanceName
- (std::wstring const & theObjectInstanceName)
- throw (IllegalName,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 6.4
- virtual ObjectInstanceHandle registerObjectInstance
- (ObjectClassHandle theClass)
- throw (ObjectClassNotDefined,
- ObjectClassNotPublished,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- virtual ObjectInstanceHandle registerObjectInstance
- (ObjectClassHandle theClass,
- std::wstring const & theObjectInstanceName)
- throw (ObjectClassNotDefined,
- ObjectClassNotPublished,
- ObjectInstanceNameNotReserved,
- ObjectInstanceNameInUse,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 6.6
- virtual void updateAttributeValues
- (ObjectInstanceHandle theObject,
- AttributeHandleValueMap const & theAttributeValues,
- VariableLengthData const & theUserSuppliedTag)
- throw (ObjectInstanceNotKnown,
- AttributeNotDefined,
- AttributeNotOwned,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- virtual MessageRetractionHandle updateAttributeValues
- (ObjectInstanceHandle theObject,
- AttributeHandleValueMap const & theAttributeValues,
- VariableLengthData const & theUserSuppliedTag,
- LogicalTime const & theTime)
- throw (ObjectInstanceNotKnown,
- AttributeNotDefined,
- AttributeNotOwned,
- InvalidLogicalTime,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 6.8
- virtual void sendInteraction
- (InteractionClassHandle theInteraction,
- ParameterHandleValueMap const & theParameterValues,
- VariableLengthData const & theUserSuppliedTag)
- throw (InteractionClassNotPublished,
- InteractionClassNotDefined,
- InteractionParameterNotDefined,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- virtual MessageRetractionHandle sendInteraction
- (InteractionClassHandle theInteraction,
- ParameterHandleValueMap const & theParameterValues,
- VariableLengthData const & theUserSuppliedTag,
- LogicalTime const & theTime)
- throw (InteractionClassNotPublished,
- InteractionClassNotDefined,
- InteractionParameterNotDefined,
- InvalidLogicalTime,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 6.10
- virtual void deleteObjectInstance
- (ObjectInstanceHandle theObject,
- VariableLengthData const & theUserSuppliedTag)
- throw (DeletePrivilegeNotHeld,
- ObjectInstanceNotKnown,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- virtual MessageRetractionHandle deleteObjectInstance
- (ObjectInstanceHandle theObject,
- VariableLengthData const & theUserSuppliedTag,
- LogicalTime const & theTime)
- throw (DeletePrivilegeNotHeld,
- ObjectInstanceNotKnown,
- InvalidLogicalTime,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 6.12
- virtual void localDeleteObjectInstance
- (ObjectInstanceHandle theObject)
- throw (ObjectInstanceNotKnown,
- FederateOwnsAttributes,
- OwnershipAcquisitionPending,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 6.13
- virtual void changeAttributeTransportationType
- (ObjectInstanceHandle theObject,
- AttributeHandleSet const & theAttributes,
- TransportationType theType)
- throw (ObjectInstanceNotKnown,
- AttributeNotDefined,
- AttributeNotOwned,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 6.14
- virtual void changeInteractionTransportationType
- (InteractionClassHandle theClass,
- TransportationType theType)
- throw (InteractionClassNotDefined,
- InteractionClassNotPublished,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 6.17
- virtual void requestAttributeValueUpdate
- (ObjectInstanceHandle theObject,
- AttributeHandleSet const & theAttributes,
- VariableLengthData const & theUserSuppliedTag)
- throw (ObjectInstanceNotKnown,
- AttributeNotDefined,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- virtual void requestAttributeValueUpdate
- (ObjectClassHandle theClass,
- AttributeHandleSet const & theAttributes,
- VariableLengthData const & theUserSuppliedTag)
- throw (ObjectClassNotDefined,
- AttributeNotDefined,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- ///////////////////////////////////
- // Ownership Management Services //
- ///////////////////////////////////
- // 7.2
- virtual void unconditionalAttributeOwnershipDivestiture
- (ObjectInstanceHandle theObject,
- AttributeHandleSet const & theAttributes)
- throw (ObjectInstanceNotKnown,
- AttributeNotDefined,
- AttributeNotOwned,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 7.3
- virtual void negotiatedAttributeOwnershipDivestiture
- (ObjectInstanceHandle theObject,
- AttributeHandleSet const & theAttributes,
- VariableLengthData const & theUserSuppliedTag)
- throw (ObjectInstanceNotKnown,
- AttributeNotDefined,
- AttributeNotOwned,
- AttributeAlreadyBeingDivested,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 7.6
- virtual void confirmDivestiture
- (ObjectInstanceHandle theObject,
- AttributeHandleSet const & confirmedAttributes,
- VariableLengthData const & theUserSuppliedTag)
- throw (ObjectInstanceNotKnown,
- AttributeNotDefined,
- AttributeNotOwned,
- AttributeDivestitureWasNotRequested,
- NoAcquisitionPending,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 7.8
- virtual void attributeOwnershipAcquisition
- (ObjectInstanceHandle theObject,
- AttributeHandleSet const & desiredAttributes,
- VariableLengthData const & theUserSuppliedTag)
- throw (ObjectInstanceNotKnown,
- ObjectClassNotPublished,
- AttributeNotDefined,
- AttributeNotPublished,
- FederateOwnsAttributes,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 7.9
- virtual void attributeOwnershipAcquisitionIfAvailable
- (ObjectInstanceHandle theObject,
- AttributeHandleSet const & desiredAttributes)
- throw (ObjectInstanceNotKnown,
- ObjectClassNotPublished,
- AttributeNotDefined,
- AttributeNotPublished,
- FederateOwnsAttributes,
- AttributeAlreadyBeingAcquired,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 7.12
- virtual void attributeOwnershipDivestitureIfWanted
- (ObjectInstanceHandle theObject,
- AttributeHandleSet const & theAttributes,
- AttributeHandleSet & theDivestedAttributes) // filled
by RTI
- throw (ObjectInstanceNotKnown,
- AttributeNotDefined,
- AttributeNotOwned,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 7.13
- virtual void cancelNegotiatedAttributeOwnershipDivestiture
- (ObjectInstanceHandle theObject,
- AttributeHandleSet const & theAttributes)
- throw (ObjectInstanceNotKnown,
- AttributeNotDefined,
- AttributeNotOwned,
- AttributeDivestitureWasNotRequested,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 7.14
- virtual void cancelAttributeOwnershipAcquisition
- (ObjectInstanceHandle theObject,
- AttributeHandleSet const & theAttributes)
- throw (ObjectInstanceNotKnown,
- AttributeNotDefined,
- AttributeAlreadyOwned,
- AttributeAcquisitionWasNotRequested,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 7.16
- virtual void queryAttributeOwnership
- (ObjectInstanceHandle theObject,
- AttributeHandle theAttribute)
- throw (ObjectInstanceNotKnown,
- AttributeNotDefined,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 7.18
- virtual bool isAttributeOwnedByFederate
- (ObjectInstanceHandle theObject,
- AttributeHandle theAttribute)
- throw (ObjectInstanceNotKnown,
- AttributeNotDefined,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- //////////////////////////////
- // Time Management Services //
- //////////////////////////////
-
- // 8.2
- virtual void enableTimeRegulation
- (LogicalTimeInterval const & theLookahead)
- throw (TimeRegulationAlreadyEnabled,
- InvalidLookahead,
- InTimeAdvancingState,
- RequestForTimeRegulationPending,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 8.4
- virtual void disableTimeRegulation ()
- throw (TimeRegulationIsNotEnabled,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 8.5
- virtual void enableTimeConstrained ()
- throw (TimeConstrainedAlreadyEnabled,
- InTimeAdvancingState,
- RequestForTimeConstrainedPending,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 8.7
- virtual void disableTimeConstrained ()
- throw (TimeConstrainedIsNotEnabled,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 8.8
- virtual void timeAdvanceRequest
- (LogicalTime const & theTime)
- throw (InvalidLogicalTime,
- LogicalTimeAlreadyPassed,
- InTimeAdvancingState,
- RequestForTimeRegulationPending,
- RequestForTimeConstrainedPending,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 8.9
- virtual void timeAdvanceRequestAvailable
- (LogicalTime const & theTime)
- throw (InvalidLogicalTime,
- LogicalTimeAlreadyPassed,
- InTimeAdvancingState,
- RequestForTimeRegulationPending,
- RequestForTimeConstrainedPending,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 8.10
- virtual void nextMessageRequest
- (LogicalTime const & theTime)
- throw (InvalidLogicalTime,
- LogicalTimeAlreadyPassed,
- InTimeAdvancingState,
- RequestForTimeRegulationPending,
- RequestForTimeConstrainedPending,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 8.11
- virtual void nextMessageRequestAvailable
- (LogicalTime const & theTime)
- throw (InvalidLogicalTime,
- LogicalTimeAlreadyPassed,
- InTimeAdvancingState,
- RequestForTimeRegulationPending,
- RequestForTimeConstrainedPending,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 8.12
- virtual void flushQueueRequest
- (LogicalTime const & theTime)
- throw (InvalidLogicalTime,
- LogicalTimeAlreadyPassed,
- InTimeAdvancingState,
- RequestForTimeRegulationPending,
- RequestForTimeConstrainedPending,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 8.14
- virtual void enableAsynchronousDelivery ()
- throw (AsynchronousDeliveryAlreadyEnabled,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 8.15
- virtual void disableAsynchronousDelivery ()
- throw (AsynchronousDeliveryAlreadyDisabled,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 8.16
- virtual bool queryGALT (LogicalTime & theTime)
- throw (FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 8.17
- virtual void queryLogicalTime (LogicalTime & theTime)
- throw (FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 8.18
- virtual bool queryLITS (LogicalTime & theTime)
- throw (FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 8.19
- virtual void modifyLookahead
- (LogicalTimeInterval const & theLookahead)
- throw (TimeRegulationIsNotEnabled,
- InvalidLookahead,
- InTimeAdvancingState,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 8.20
- virtual void queryLookahead (LogicalTimeInterval & interval)
- throw (TimeRegulationIsNotEnabled,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 8.21
- virtual void retract
- (MessageRetractionHandle theHandle)
- throw (InvalidRetractionHandle,
- TimeRegulationIsNotEnabled,
- MessageCanNoLongerBeRetracted,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 8.23
- virtual void changeAttributeOrderType
- (ObjectInstanceHandle theObject,
- AttributeHandleSet const & theAttributes,
- OrderType theType)
- throw (ObjectInstanceNotKnown,
- AttributeNotDefined,
- AttributeNotOwned,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 8.24
- virtual void changeInteractionOrderType
- (InteractionClassHandle theClass,
- OrderType theType)
- throw (InteractionClassNotDefined,
- InteractionClassNotPublished,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- //////////////////////////////////
- // Data Distribution Management //
- //////////////////////////////////
-
- // 9.2
- virtual RegionHandle createRegion
- (DimensionHandleSet const & theDimensions)
- throw (InvalidDimensionHandle,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 9.3
- virtual void commitRegionModifications
- (RegionHandleSet const & theRegionHandleSet)
- throw (InvalidRegion,
- RegionNotCreatedByThisFederate,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 9.4
- virtual void deleteRegion
- (RegionHandle theRegion)
- throw (InvalidRegion,
- RegionNotCreatedByThisFederate,
- RegionInUseForUpdateOrSubscription,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 9.5
- virtual ObjectInstanceHandle registerObjectInstanceWithRegions
- (ObjectClassHandle theClass,
- AttributeHandleSetRegionHandleSetPairVector const &
- theAttributeHandleSetRegionHandleSetPairVector)
- throw (ObjectClassNotDefined,
- ObjectClassNotPublished,
- AttributeNotDefined,
- AttributeNotPublished,
- InvalidRegion,
- RegionNotCreatedByThisFederate,
- InvalidRegionContext,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- virtual ObjectInstanceHandle registerObjectInstanceWithRegions
- (ObjectClassHandle theClass,
- AttributeHandleSetRegionHandleSetPairVector const &
- theAttributeHandleSetRegionHandleSetPairVector,
- std::wstring const & theObjectInstanceName)
- throw (ObjectClassNotDefined,
- ObjectClassNotPublished,
- AttributeNotDefined,
- AttributeNotPublished,
- InvalidRegion,
- RegionNotCreatedByThisFederate,
- InvalidRegionContext,
- ObjectInstanceNameNotReserved,
- ObjectInstanceNameInUse,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 9.6
- virtual void associateRegionsForUpdates
- (ObjectInstanceHandle theObject,
- AttributeHandleSetRegionHandleSetPairVector const &
- theAttributeHandleSetRegionHandleSetPairVector)
- throw (ObjectInstanceNotKnown,
- AttributeNotDefined,
- InvalidRegion,
- RegionNotCreatedByThisFederate,
- InvalidRegionContext,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 9.7
- virtual void unassociateRegionsForUpdates
- (ObjectInstanceHandle theObject,
- AttributeHandleSetRegionHandleSetPairVector const &
- theAttributeHandleSetRegionHandleSetPairVector)
- throw (ObjectInstanceNotKnown,
- AttributeNotDefined,
- InvalidRegion,
- RegionNotCreatedByThisFederate,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 9.8
- virtual void subscribeObjectClassAttributesWithRegions
- (ObjectClassHandle theClass,
- AttributeHandleSetRegionHandleSetPairVector const &
- theAttributeHandleSetRegionHandleSetPairVector,
- bool active = true)
- throw (ObjectClassNotDefined,
- AttributeNotDefined,
- InvalidRegion,
- RegionNotCreatedByThisFederate,
- InvalidRegionContext,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 9.9
- virtual void unsubscribeObjectClassAttributesWithRegions
- (ObjectClassHandle theClass,
- AttributeHandleSetRegionHandleSetPairVector const &
- theAttributeHandleSetRegionHandleSetPairVector)
- throw (ObjectClassNotDefined,
- AttributeNotDefined,
- InvalidRegion,
- RegionNotCreatedByThisFederate,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 9.10
- virtual void subscribeInteractionClassWithRegions
- (InteractionClassHandle theClass,
- RegionHandleSet const & theRegionHandleSet,
- bool active = true)
- throw (InteractionClassNotDefined,
- InvalidRegion,
- RegionNotCreatedByThisFederate,
- InvalidRegionContext,
- FederateServiceInvocationsAreBeingReportedViaMOM,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 9.11
- virtual void unsubscribeInteractionClassWithRegions
- (InteractionClassHandle theClass,
- RegionHandleSet const & theRegionHandleSet)
- throw (InteractionClassNotDefined,
- InvalidRegion,
- RegionNotCreatedByThisFederate,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 9.12
- virtual void sendInteractionWithRegions
- (InteractionClassHandle theInteraction,
- ParameterHandleValueMap const & theParameterValues,
- RegionHandleSet const & theRegionHandleSet,
- VariableLengthData const & theUserSuppliedTag)
- throw (InteractionClassNotDefined,
- InteractionClassNotPublished,
- InteractionParameterNotDefined,
- InvalidRegion,
- RegionNotCreatedByThisFederate,
- InvalidRegionContext,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- virtual MessageRetractionHandle sendInteractionWithRegions
- (InteractionClassHandle theInteraction,
- ParameterHandleValueMap const & theParameterValues,
- RegionHandleSet const & theRegionHandleSet,
- VariableLengthData const & theUserSuppliedTag,
- LogicalTime const & theTime)
- throw (InteractionClassNotDefined,
- InteractionClassNotPublished,
- InteractionParameterNotDefined,
- InvalidRegion,
- RegionNotCreatedByThisFederate,
- InvalidRegionContext,
- InvalidLogicalTime,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 9.13
- virtual void requestAttributeValueUpdateWithRegions
- (ObjectClassHandle theClass,
- AttributeHandleSetRegionHandleSetPairVector const &
theSet,
- VariableLengthData const & theUserSuppliedTag)
- throw (ObjectClassNotDefined,
- AttributeNotDefined,
- InvalidRegion,
- RegionNotCreatedByThisFederate,
- InvalidRegionContext,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- //////////////////////////
- // RTI Support Services //
- //////////////////////////
-
- // 10.2
- virtual ObjectClassHandle getObjectClassHandle
- (std::wstring const & theName)
- throw (NameNotFound,
- FederateNotExecutionMember,
- RTIinternalError);
-
- // 10.3
- virtual std::wstring getObjectClassName
- (ObjectClassHandle theHandle)
- throw (InvalidObjectClassHandle,
- FederateNotExecutionMember,
- RTIinternalError);
-
- // 10.4
- virtual AttributeHandle getAttributeHandle
- (ObjectClassHandle whichClass,
- std::wstring const & theAttributeName)
- throw (InvalidObjectClassHandle,
- NameNotFound,
- FederateNotExecutionMember,
- RTIinternalError);
-
- // 10.5
- virtual std::wstring getAttributeName
- (ObjectClassHandle whichClass,
- AttributeHandle theHandle)
- throw (InvalidObjectClassHandle,
- InvalidAttributeHandle,
- AttributeNotDefined,
- FederateNotExecutionMember,
- RTIinternalError);
-
- // 10.6
- virtual InteractionClassHandle getInteractionClassHandle
- (std::wstring const & theName)
- throw (NameNotFound,
- FederateNotExecutionMember,
- RTIinternalError);
-
- // 10.7
- virtual std::wstring getInteractionClassName
- (InteractionClassHandle theHandle)
- throw (InvalidInteractionClassHandle,
- FederateNotExecutionMember,
- RTIinternalError);
-
- // 10.8
- virtual ParameterHandle getParameterHandle
- (InteractionClassHandle whichClass,
- std::wstring const & theName)
- throw (InvalidInteractionClassHandle,
- NameNotFound,
- FederateNotExecutionMember,
- RTIinternalError);
-
- // 10.9
- virtual std::wstring getParameterName
- (InteractionClassHandle whichClass,
- ParameterHandle theHandle)
- throw (InvalidInteractionClassHandle,
- InvalidParameterHandle,
- InteractionParameterNotDefined,
- FederateNotExecutionMember,
- RTIinternalError);
-
- // 10.10
- virtual ObjectInstanceHandle getObjectInstanceHandle
- (std::wstring const & theName)
- throw (ObjectInstanceNotKnown,
- FederateNotExecutionMember,
- RTIinternalError);
-
- // 10.11
- virtual std::wstring getObjectInstanceName
- (ObjectInstanceHandle theHandle)
- throw (ObjectInstanceNotKnown,
- FederateNotExecutionMember,
- RTIinternalError);
-
- // 10.12
- virtual DimensionHandle getDimensionHandle
- (std::wstring const & theName)
- throw (NameNotFound,
- FederateNotExecutionMember,
- RTIinternalError);
-
- // 10.13
- virtual std::wstring getDimensionName
- (DimensionHandle theHandle)
- throw (InvalidDimensionHandle,
- FederateNotExecutionMember,
- RTIinternalError);
-
- // 10.14
- virtual unsigned long getDimensionUpperBound
- (DimensionHandle theHandle)
- throw (InvalidDimensionHandle,
- FederateNotExecutionMember,
- RTIinternalError);
-
- // 10.15
- virtual DimensionHandleSet
getAvailableDimensionsForClassAttribute
- (ObjectClassHandle theClass,
- AttributeHandle theHandle)
- throw (InvalidObjectClassHandle,
- InvalidAttributeHandle,
- AttributeNotDefined,
- FederateNotExecutionMember,
- RTIinternalError);
-
- // 10.16
- virtual ObjectClassHandle getKnownObjectClassHandle
- (ObjectInstanceHandle theObject)
- throw (ObjectInstanceNotKnown,
- FederateNotExecutionMember,
- RTIinternalError);
-
- // 10.17
- virtual DimensionHandleSet
getAvailableDimensionsForInteractionClass
- (InteractionClassHandle theClass)
- throw (InvalidInteractionClassHandle,
- FederateNotExecutionMember,
- RTIinternalError);
-
- // 10.18
- virtual TransportationType getTransportationType
- (std::wstring const & transportationName)
- throw (InvalidTransportationName,
- FederateNotExecutionMember,
- RTIinternalError);
-
- // 10.19
- virtual std::wstring getTransportationName
- (TransportationType transportationType)
- throw (InvalidTransportationType,
- FederateNotExecutionMember,
- RTIinternalError);
-
- // 10.20
- virtual OrderType getOrderType
- (std::wstring const & orderName)
- throw (InvalidOrderName,
- FederateNotExecutionMember,
- RTIinternalError);
-
- // 10.21
- virtual std::wstring getOrderName
- (OrderType orderType)
- throw (InvalidOrderType,
- FederateNotExecutionMember,
- RTIinternalError);
-
- // 10.22
- virtual void enableObjectClassRelevanceAdvisorySwitch ()
- throw (ObjectClassRelevanceAdvisorySwitchIsOn,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 10.23
- virtual void disableObjectClassRelevanceAdvisorySwitch ()
- throw (ObjectClassRelevanceAdvisorySwitchIsOff,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 10.24
- virtual void enableAttributeRelevanceAdvisorySwitch ()
- throw (AttributeRelevanceAdvisorySwitchIsOn,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 10.25
- virtual void disableAttributeRelevanceAdvisorySwitch ()
- throw (AttributeRelevanceAdvisorySwitchIsOff,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 10.26
- virtual void enableAttributeScopeAdvisorySwitch ()
- throw (AttributeScopeAdvisorySwitchIsOn,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 10.27
- virtual void disableAttributeScopeAdvisorySwitch ()
- throw (AttributeScopeAdvisorySwitchIsOff,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 10.28
- virtual void enableInteractionRelevanceAdvisorySwitch ()
- throw (InteractionRelevanceAdvisorySwitchIsOn,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 10.29
- virtual void disableInteractionRelevanceAdvisorySwitch ()
- throw (InteractionRelevanceAdvisorySwitchIsOff,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 10.30
- virtual
- DimensionHandleSet getDimensionHandleSet
- (RegionHandle theRegionHandle)
- throw (InvalidRegion,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 10.31
- virtual
- RangeBounds getRangeBounds
- (RegionHandle theRegionHandle,
- DimensionHandle theDimensionHandle)
- throw (InvalidRegion,
- RegionDoesNotContainSpecifiedDimension,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 10.32
- virtual void setRangeBounds
- (RegionHandle theRegionHandle,
- DimensionHandle theDimensionHandle,
- RangeBounds const & theRangeBounds)
- throw (InvalidRegion,
- RegionNotCreatedByThisFederate,
- RegionDoesNotContainSpecifiedDimension,
- InvalidRangeBound,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 10.33
- virtual unsigned long normalizeFederateHandle
- (FederateHandle theFederateHandle)
- throw (FederateNotExecutionMember,
- InvalidFederateHandle,
- RTIinternalError);
-
- // 10.34
- virtual unsigned long normalizeServiceGroup
- (ServiceGroupIndicator theServiceGroup)
- throw (FederateNotExecutionMember,
- InvalidServiceGroup,
- RTIinternalError);
-
- // 10.37
- virtual bool evokeCallback(double
approximateMinimumTimeInSeconds)
- throw (FederateNotExecutionMember,
- RTIinternalError);
-
- // 10.38
- virtual bool evokeMultipleCallbacks(double
approximateMinimumTimeInSeconds,
- double approximateMaximumTimeInSeconds)
- throw (FederateNotExecutionMember,
- RTIinternalError);
-
- // 10.39
- virtual void enableCallbacks ()
- throw (FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- // 10.40
- virtual void disableCallbacks ()
- throw (FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError);
-
- virtual FederateHandle decodeFederateHandle(
- VariableLengthData const & encodedValue) const;
-
- virtual ObjectClassHandle decodeObjectClassHandle(
- VariableLengthData const & encodedValue) const;
-
- virtual InteractionClassHandle decodeInteractionClassHandle(
- VariableLengthData const & encodedValue) const;
-
- virtual ObjectInstanceHandle decodeObjectInstanceHandle(
- VariableLengthData const & encodedValue) const;
-
- virtual AttributeHandle decodeAttributeHandle(
- VariableLengthData const & encodedValue) const;
-
- virtual ParameterHandle decodeParameterHandle(
- VariableLengthData const & encodedValue) const;
-
- virtual DimensionHandle decodeDimensionHandle(
- VariableLengthData const & encodedValue) const;
-
- virtual MessageRetractionHandle decodeMessageRetractionHandle(
- VariableLengthData const & encodedValue) const;
-
- virtual RegionHandle decodeRegionHandle(
- VariableLengthData const & encodedValue) const;
-
- };
-}
-
-#endif // RTI_RTI1516ambassador_h
Index: RTI1516variableLengthData.cpp
===================================================================
RCS file: RTI1516variableLengthData.cpp
diff -N RTI1516variableLengthData.cpp
--- RTI1516variableLengthData.cpp 3 Mar 2014 15:18:22 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,202 +0,0 @@
-#include <RTI/VariableLengthData.h>
-#include "RTI1516variableLengthDataImplementation.h"
-#include <stdlib.h>
-#include <string.h>
-
-namespace rti1516
-{
- // ******************************************************
- // ********* VariableLengthData implementation **********
- // ******************************************************
-
- VariableLengthData::VariableLengthData()
- : _impl(0)
- {
- }
-
- // Caller is free to delete inData after the call
- VariableLengthData::VariableLengthData(void const * inData, unsigned
long inSize)
- : _impl(0)
- {
- _impl = new VariableLengthDataImplementation(inData, inSize);
- }
-
- // Caller is free to delete rhs after the call
- VariableLengthData::VariableLengthData(VariableLengthData const & rhs)
- : _impl(0)
- {
- _impl = new VariableLengthDataImplementation(*(rhs._impl));
- }
-
- VariableLengthData::~VariableLengthData()
- {
- delete _impl;
- }
-
- VariableLengthData &
- VariableLengthData::operator=(VariableLengthData const & rhs)
- {
- // Beware of self assignment
- if (this != &rhs)
- {
- delete _impl;
- _impl = new
VariableLengthDataImplementation(*(rhs._impl));
- }
-
- return *this;
- }
-
- void const *
- VariableLengthData::data() const
- {
- if (_impl != 0)
- {
- return _impl->getData();
- } else
- {
- return 0;
- }
- }
- unsigned long
- VariableLengthData::size() const
- {
- if (_impl != 0)
- {
- return _impl->getSize();
- } else
- {
- return 0;
- }
- }
-
- // Caller is free to delete inData after the call
- void VariableLengthData::setData(void const * inData, unsigned long
inSize)
- {
- if (_impl != 0)
- {
- _impl->setData(inData, inSize);
- } else
- {
- _impl = new VariableLengthDataImplementation(inData,
inSize);
- }
- }
-
- // Caller is responsible for ensuring that the data that is
- // pointed to is valid for the lifetime of this object, or past
- // the next time this object is given new data.
- void VariableLengthData::setDataPointer(void* inData, unsigned long
inSize)
- {
- if (_impl == 0)
- {
- _impl = new VariableLengthDataImplementation();
- }
- _impl->setDataPointer(inData, inSize);
- }
-
- // Caller gives up ownership of inData to this object.
- // This object assumes the responsibility of deleting inData
- // when it is no longer needed.
- void VariableLengthData::takeDataPointer(void* inData, unsigned long
inSize)
- {
- if (_impl == 0)
- {
- _impl = new VariableLengthDataImplementation();
- }
- _impl->takeDataPointer(inData, inSize);
- }
-
- // ********************************************************************
- // ********* VariableLengthDataImplementation implementation **********
- // ********************************************************************
-
- VariableLengthDataImplementation::VariableLengthDataImplementation()
- : _data(0)
- , _size(0)
- , _dataOwner(false)
- {
- }
-
- // Caller is free to delete inData after the call
- VariableLengthDataImplementation::VariableLengthDataImplementation(void
const * inData, unsigned long inSize)
- : _data(0)
- , _size(inSize)
- , _dataOwner(true)
- {
- _data = malloc(inSize+1);
- memcpy(_data, inData, _size);
- }
-
- // Caller is free to delete rhs after the call
-
VariableLengthDataImplementation::VariableLengthDataImplementation(VariableLengthDataImplementation
const & rhs)
- : _data(0)
- , _size(rhs._size)
- , _dataOwner(true)
- {
- _data = malloc(rhs._size);
- memcpy(_data, rhs._data, _size);
- }
-
- VariableLengthDataImplementation::~VariableLengthDataImplementation()
- {
- if (_data && _dataOwner)
- {
- free(_data);
- }
- }
-
- // Caller is free to delete rhs after the call
- VariableLengthDataImplementation &
-
VariableLengthDataImplementation::operator=(VariableLengthDataImplementation
const & rhs)
- {
- // Beware of self assignment
- if (this != &rhs)
- {
- setData(rhs._data, rhs._size);
- }
-
- return *this;
- }
-
- // Caller is free to delete inData after the call
- void VariableLengthDataImplementation::setData(void const * inData,
unsigned long inSize)
- {
- if (_data && _dataOwner)
- {
- free(_data);
- }
- _size = inSize;
- _dataOwner = true;
- _data = malloc(_size);
- memcpy(_data, inData, _size);
- }
-
- // Caller is responsible for ensuring that the data that is
- // pointed to is valid for the lifetime of this object, or past
- // the next time this object is given new data.
- void VariableLengthDataImplementation::setDataPointer(void* inData,
unsigned long inSize)
- {
- if (_data && _dataOwner)
- {
- free(_data);
- }
- _size = inSize;
- _dataOwner = false;
- _data = inData;
- }
-
- // Caller gives up ownership of inData to this object.
- // This object assumes the responsibility of deleting inData
- // when it is no longer needed.
- void VariableLengthDataImplementation::takeDataPointer(void* inData,
unsigned long inSize)
- {
- if (_data && _dataOwner)
- {
- free(_data);
- }
- _size = inSize;
- _dataOwner = true;
- _data = inData;
- }
-
-
-} // end namespace rti1516
Index: RTI1516exception.cpp
===================================================================
RCS file: RTI1516exception.cpp
diff -N RTI1516exception.cpp
--- RTI1516exception.cpp 3 Mar 2014 15:18:21 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,144 +0,0 @@
-#include <RTI/Exception.h>
-#include <iostream>
-
-namespace rti1516
-{
- Exception::Exception()
- {
- }
-
- Exception::Exception(Exception const & rhs)
- {
- // Nothing to copy...?
- }
-
- Exception::~Exception()
- {
- }
-
- Exception &
- Exception::operator=(Exception const & rhs)
- {
- // Nothing to copy...?
- return *this;
- }
-
- std::wostream &
- operator << (std::wostream &stream, Exception const &e)
- {
- return stream << e.what() << std::endl;
- }
-
-
-#define RTI_EXCEPTION_IMPL(A) \
- A::A(std::wstring const & message) throw() \
- : Exception() \
- , _msg(message) \
- { } \
- std::wstring A::what() const throw() \
- { return _msg; }
-
- RTI_EXCEPTION_IMPL(AsynchronousDeliveryAlreadyDisabled)
- RTI_EXCEPTION_IMPL(AsynchronousDeliveryAlreadyEnabled)
- RTI_EXCEPTION_IMPL(AttributeAcquisitionWasNotCanceled)
- RTI_EXCEPTION_IMPL(AttributeAcquisitionWasNotRequested)
- RTI_EXCEPTION_IMPL(AttributeAlreadyBeingAcquired)
- RTI_EXCEPTION_IMPL(AttributeAlreadyBeingDivested)
- RTI_EXCEPTION_IMPL(AttributeAlreadyOwned)
- RTI_EXCEPTION_IMPL(AttributeDivestitureWasNotRequested)
- RTI_EXCEPTION_IMPL(AttributeNotDefined)
- RTI_EXCEPTION_IMPL(AttributeNotOwned)
- RTI_EXCEPTION_IMPL(AttributeNotPublished)
- RTI_EXCEPTION_IMPL(AttributeNotRecognized)
- RTI_EXCEPTION_IMPL(AttributeNotSubscribed)
- RTI_EXCEPTION_IMPL(AttributeRelevanceAdvisorySwitchIsOff)
- RTI_EXCEPTION_IMPL(AttributeRelevanceAdvisorySwitchIsOn)
- RTI_EXCEPTION_IMPL(AttributeScopeAdvisorySwitchIsOff)
- RTI_EXCEPTION_IMPL(AttributeScopeAdvisorySwitchIsOn)
- RTI_EXCEPTION_IMPL(BadInitializationParameter)
- RTI_EXCEPTION_IMPL(CouldNotCreateLogicalTimeFactory)
- RTI_EXCEPTION_IMPL(CouldNotDecode)
- RTI_EXCEPTION_IMPL(CouldNotDiscover)
- RTI_EXCEPTION_IMPL(CouldNotEncode)
- RTI_EXCEPTION_IMPL(CouldNotOpenFDD)
- RTI_EXCEPTION_IMPL(CouldNotInitiateRestore)
- RTI_EXCEPTION_IMPL(DeletePrivilegeNotHeld)
- RTI_EXCEPTION_IMPL(RequestForTimeConstrainedPending)
- RTI_EXCEPTION_IMPL(NoRequestToEnableTimeConstrainedWasPending)
- RTI_EXCEPTION_IMPL(RequestForTimeRegulationPending)
- RTI_EXCEPTION_IMPL(NoRequestToEnableTimeRegulationWasPending)
- RTI_EXCEPTION_IMPL(ErrorReadingFDD)
- RTI_EXCEPTION_IMPL(FederateAlreadyExecutionMember)
- RTI_EXCEPTION_IMPL(FederateHasNotBegunSave)
- RTI_EXCEPTION_IMPL(FederateInternalError)
- RTI_EXCEPTION_IMPL(FederateNotExecutionMember)
- RTI_EXCEPTION_IMPL(FederateOwnsAttributes)
- RTI_EXCEPTION_IMPL(FederateServiceInvocationsAreBeingReportedViaMOM)
- RTI_EXCEPTION_IMPL(FederateUnableToUseTime)
- RTI_EXCEPTION_IMPL(FederatesCurrentlyJoined)
- RTI_EXCEPTION_IMPL(FederationExecutionAlreadyExists)
- RTI_EXCEPTION_IMPL(FederationExecutionDoesNotExist)
- RTI_EXCEPTION_IMPL(IllegalName)
- RTI_EXCEPTION_IMPL(IllegalTimeArithmetic)
- RTI_EXCEPTION_IMPL(InteractionClassNotDefined)
- RTI_EXCEPTION_IMPL(InteractionClassNotPublished)
- RTI_EXCEPTION_IMPL(InteractionClassNotRecognized)
- RTI_EXCEPTION_IMPL(InteractionClassNotSubscribed)
- RTI_EXCEPTION_IMPL(InteractionParameterNotDefined)
- RTI_EXCEPTION_IMPL(InteractionParameterNotRecognized)
- RTI_EXCEPTION_IMPL(InteractionRelevanceAdvisorySwitchIsOff)
- RTI_EXCEPTION_IMPL(InteractionRelevanceAdvisorySwitchIsOn)
- RTI_EXCEPTION_IMPL(InTimeAdvancingState)
- RTI_EXCEPTION_IMPL(InvalidAttributeHandle)
- RTI_EXCEPTION_IMPL(InvalidDimensionHandle)
- RTI_EXCEPTION_IMPL(InvalidFederateHandle)
- RTI_EXCEPTION_IMPL(InvalidInteractionClassHandle)
- RTI_EXCEPTION_IMPL(InvalidLogicalTime)
- RTI_EXCEPTION_IMPL(InvalidLogicalTimeInterval)
- RTI_EXCEPTION_IMPL(InvalidLookahead)
- RTI_EXCEPTION_IMPL(InvalidObjectClassHandle)
- RTI_EXCEPTION_IMPL(InvalidOrderName)
- RTI_EXCEPTION_IMPL(InvalidOrderType)
- RTI_EXCEPTION_IMPL(InvalidParameterHandle)
- RTI_EXCEPTION_IMPL(InvalidRangeBound)
- RTI_EXCEPTION_IMPL(InvalidRegion)
- RTI_EXCEPTION_IMPL(InvalidRegionContext)
- RTI_EXCEPTION_IMPL(InvalidRetractionHandle)
- RTI_EXCEPTION_IMPL(InvalidServiceGroup)
- RTI_EXCEPTION_IMPL(InvalidTransportationName)
- RTI_EXCEPTION_IMPL(InvalidTransportationType)
- RTI_EXCEPTION_IMPL(JoinedFederateIsNotInTimeAdvancingState)
- RTI_EXCEPTION_IMPL(LogicalTimeAlreadyPassed)
- RTI_EXCEPTION_IMPL(MessageCanNoLongerBeRetracted)
- RTI_EXCEPTION_IMPL(NameNotFound)
- RTI_EXCEPTION_IMPL(NoAcquisitionPending)
- RTI_EXCEPTION_IMPL(ObjectClassNotDefined)
- RTI_EXCEPTION_IMPL(ObjectClassNotKnown)
- RTI_EXCEPTION_IMPL(ObjectClassNotPublished)
- RTI_EXCEPTION_IMPL(ObjectClassRelevanceAdvisorySwitchIsOff)
- RTI_EXCEPTION_IMPL(ObjectClassRelevanceAdvisorySwitchIsOn)
- RTI_EXCEPTION_IMPL(ObjectInstanceNameInUse)
- RTI_EXCEPTION_IMPL(ObjectInstanceNameNotReserved)
- RTI_EXCEPTION_IMPL(ObjectInstanceNotKnown)
- RTI_EXCEPTION_IMPL(OwnershipAcquisitionPending)
- RTI_EXCEPTION_IMPL(RTIinternalError)
- RTI_EXCEPTION_IMPL(RegionDoesNotContainSpecifiedDimension)
- RTI_EXCEPTION_IMPL(RegionInUseForUpdateOrSubscription)
- RTI_EXCEPTION_IMPL(RegionNotCreatedByThisFederate)
- RTI_EXCEPTION_IMPL(RestoreInProgress)
- RTI_EXCEPTION_IMPL(RestoreNotRequested)
- RTI_EXCEPTION_IMPL(SaveInProgress)
- RTI_EXCEPTION_IMPL(SaveNotInitiated)
- RTI_EXCEPTION_IMPL(SpecifiedSaveLabelDoesNotExist)
- RTI_EXCEPTION_IMPL(SynchronizationPointLabelNotAnnounced)
- RTI_EXCEPTION_IMPL(TimeConstrainedAlreadyEnabled)
- RTI_EXCEPTION_IMPL(TimeConstrainedIsNotEnabled)
- RTI_EXCEPTION_IMPL(TimeRegulationAlreadyEnabled)
- RTI_EXCEPTION_IMPL(TimeRegulationIsNotEnabled)
- RTI_EXCEPTION_IMPL(UnableToPerformSave)
- RTI_EXCEPTION_IMPL(UnknownName)
- RTI_EXCEPTION_IMPL(InternalError)
-
-#undef RTI_EXCEPTION_IMPL_IMPL
-
-} // end namespace rti1516
Index: RTI1516HandleFactory.h
===================================================================
RCS file: RTI1516HandleFactory.h
diff -N RTI1516HandleFactory.h
--- RTI1516HandleFactory.h 3 Mar 2014 15:18:21 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,92 +0,0 @@
-#ifndef RTI_RTI1516HandleFactory_h
-#define RTI_RTI1516HandleFactory_h
-
-#include <set>
-#include <map>
-#include <vector>
-#include <list>
-#include "certi.hh"
-#include "GAV.hh"
-#include <RTI/Typedefs.h>
-#include "RTI1516HandleImplementation.h"
-#include "M_Classes.hh"
-
-
-template<class I>
-struct certi_cast
-{
- template<class R>
- const I& operator()(const R& imp)
- {
- try {
- return dynamic_cast<const I&>(imp);
- }
- catch (...)
- {
- throw rti1516::RTIinternalError(L"Incompatible object on input.");
- }
- }
-
- template<class R>
- I& operator()(R& imp)
- {
- try {
- return dynamic_cast<I&>(imp);
- }
- catch (...)
- {
- throw rti1516::RTIinternalError(L"Incompatible object on input.");
- }
- }
-};
-
-#define DEFINE_HANDLE_FRIEND_CLASS(HandleKind) \
-
\
-/* Forward declaration for the RTI-internal class */ \
-/* used to implement a specific kind of handle */ \
-class HandleKind;
\
-class HandleKind##Implementation; \
-
\
-/* Each handle class generated by this macro provides the */ \
-/* following interface */ \
-class RTI_EXPORT HandleKind##Friend \
-{ \
-public: \
- static HandleKind createRTI1516Handle(const certi::Handle & certiHandle);
\
- static HandleKind createRTI1516Handle(const rti1516::VariableLengthData &
encodedValue); \
- static certi::Handle toCertiHandle(const HandleKind & rti1516Handle);
\
-
\
-private: \
- HandleKind##Friend(); \
- ~HandleKind##Friend(); \
-
\
-}; \
-
-namespace rti1516
-{
-
- // All of the RTI API's HandleFriend classes are defined
- // by invoking the macro above.
- DEFINE_HANDLE_FRIEND_CLASS(FederateHandle)
- DEFINE_HANDLE_FRIEND_CLASS(ObjectClassHandle)
- DEFINE_HANDLE_FRIEND_CLASS(InteractionClassHandle)
- DEFINE_HANDLE_FRIEND_CLASS(ObjectInstanceHandle)
- DEFINE_HANDLE_FRIEND_CLASS(AttributeHandle)
- DEFINE_HANDLE_FRIEND_CLASS(ParameterHandle)
- DEFINE_HANDLE_FRIEND_CLASS(DimensionHandle)
- //DEFINE_HANDLE_FRIEND_CLASS(MessageRetractionHandle)
- DEFINE_HANDLE_FRIEND_CLASS(RegionHandle)
-
- class MessageRetractionHandleFriend {
- public:
- static MessageRetractionHandle createRTI1516Handle(const
certi::Handle & certiHandle, uint64_t serialNr);
- static MessageRetractionHandle createRTI1516Handle(const
rti1516::VariableLengthData & encodedValue);
- static certi::EventRetraction createEventRetraction(const
rti1516::MessageRetractionHandle & messageRetractionHandle);
- private:
- MessageRetractionHandleFriend();
- ~MessageRetractionHandleFriend();
- };
-
-}
-
-#endif // RTI_RTI1516HandleFactory_h
Index: RTI1516ambTime.cpp
===================================================================
RCS file: RTI1516ambTime.cpp
diff -N RTI1516ambTime.cpp
--- RTI1516ambTime.cpp 3 Mar 2014 15:18:22 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,15 +0,0 @@
-#include <RTI/certiLogicalTime.h>
-#include <RTI/certiLogicalTimeInterval.h>
-#include <RTI/certiLogicalTimeFactory.h>
-
-//rti1516::LogicalTime::~LogicalTime()
-//{
-//}
-//
-//rti1516::LogicalTimeInterval::~LogicalTimeInterval()
-//{
-//}
-//
-//rti1516::LogicalTimeFactory::~LogicalTimeFactory()
-//{
-//}
Index: RTI1516HandleImplementation.h
===================================================================
RCS file: RTI1516HandleImplementation.h
diff -N RTI1516HandleImplementation.h
--- RTI1516HandleImplementation.h 3 Mar 2014 15:18:21 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,157 +0,0 @@
-#ifndef RTI_HandleImplementation_h
-#define RTI_HandleImplementation_h
-
-#include <RTI/SpecificConfig.h>
-#include <RTI/Exception.h>
-#include <RTI/VariableLengthData.h>
-#include <string>
-
-// TODO Text below should be fixed. (Copied from Handle definition macro.)
-// The following macro is used to define each of the Handle classes
-// that are used by the RTI's API, e.g. AttributeHandle, ParameterHandle, etc.
-// Each kind of handle contains the same set of operators and functions, but
-// each is a separate class for type safety. The encode method can be used to
-// generate an encoded value for a handle, that can be sent to other federates
-// as an attribute or parameter. (Use RTIambassador functions to reconstruct
a
-// handle from an encoded value). RTI implementations contain definitions
-// for each kind of the HandleKindImplementation classes (e.g.
-// AttributeHandleImplementation), but these classes are not needed by
-// federate code.
-
-typedef unsigned long ULong ;
-
-namespace rti1516
-{
- class RTI_EXPORT HandleImplementation
- {
- protected:
- /* Constructs an invalid handle */
- HandleImplementation();
-
- public:
- HandleImplementation(HandleImplementation const & rhs);
-
- explicit
- HandleImplementation(VariableLengthData const & encodedValue);
-
- virtual ~HandleImplementation()
- throw();
-
- /* Indicates whether this handle is valid */
- virtual bool isValid() const;
-
- /* Generate an encoded value that can be used to send */
- /* handles to other federates in updates or interactions. */
- virtual VariableLengthData encode() const;
-
- /* Alternate encode for directly filling a buffer */
- virtual unsigned long encodedLength() const;
- virtual unsigned long encode(
- void* buffer, unsigned long bufferSize) const
- throw (CouldNotEncode);
-
- virtual std::wstring toString() const;
-
- ULong getValue() const
- { return _value; }
-
- void setValue(ULong val)
- { _value = val; }
-
- protected:
- ULong _value;
- };
-}
-
-#define DEFINE_HANDLE_IMPLEMENTATION_CLASS(HandleKind) \
- \
-/* Each handle class generated by this macro provides the */ \
-/* following interface */ \
-class RTI_EXPORT HandleKind##Implementation : public HandleImplementation \
-{ \
-public: \
- \
- /* Constructs an invalid handle */ \
- HandleKind##Implementation();
\
-
\
- HandleKind##Implementation(HandleKind##Implementation const & rhs);
\
-
\
- explicit
\
- HandleKind##Implementation(VariableLengthData const & encodedValue);
\
-
\
- virtual ~HandleKind##Implementation()
\
- throw();
\
-
\
- HandleKind##Implementation &
\
- operator=(HandleKind##Implementation const & rhs);
\
-
\
- /* All invalid handles are equivalent */
\
- virtual bool operator==(HandleKind##Implementation const & rhs) const;
\
- virtual bool operator!=(HandleKind##Implementation const & rhs) const;
\
- virtual bool operator< (HandleKind##Implementation const & rhs) const;
\
-};
\
-
-
-namespace rti1516
-{
-
-// All of the RTI API's Handle classes are defined
-// by invoking the macro above.
-DEFINE_HANDLE_IMPLEMENTATION_CLASS(FederateHandle)
-DEFINE_HANDLE_IMPLEMENTATION_CLASS(ObjectClassHandle)
-DEFINE_HANDLE_IMPLEMENTATION_CLASS(InteractionClassHandle)
-DEFINE_HANDLE_IMPLEMENTATION_CLASS(ObjectInstanceHandle)
-DEFINE_HANDLE_IMPLEMENTATION_CLASS(AttributeHandle)
-DEFINE_HANDLE_IMPLEMENTATION_CLASS(ParameterHandle)
-DEFINE_HANDLE_IMPLEMENTATION_CLASS(DimensionHandle)
-DEFINE_HANDLE_IMPLEMENTATION_CLASS(RegionHandle)
-
-
-class MessageRetractionHandleImplementation : public HandleImplementation
-{
- public:
-
- /* Constructs an invalid handle */
- MessageRetractionHandleImplementation();
-
-
MessageRetractionHandleImplementation(MessageRetractionHandleImplementation
const & rhs);
-
- explicit
- MessageRetractionHandleImplementation(VariableLengthData const &
encodedValue);
-
- virtual ~MessageRetractionHandleImplementation()
- throw();
-
- virtual MessageRetractionHandleImplementation &
- operator=(MessageRetractionHandleImplementation const & rhs);
-
- /* All invalid handles are equivalent */
- virtual bool operator==(MessageRetractionHandleImplementation const
& rhs) const;
- virtual bool operator!=(MessageRetractionHandleImplementation const
& rhs) const;
- virtual bool operator< (MessageRetractionHandleImplementation const
& rhs) const;
-
- /* Generate an encoded value that can be used to send */
- /* handles to other federates in updates or interactions. */
- virtual VariableLengthData encode() const;
-
- /* Alternate encode for directly filling a buffer */
- virtual unsigned long encodedLength() const;
- virtual unsigned long encode(
- void* buffer, unsigned long bufferSize) const
- throw (CouldNotEncode);
-
- ULong getSerialNum() const
- { return _serialNum; }
-
- void setSerialNum(ULong sn)
- { _serialNum = sn; }
-
- protected:
- ULong _serialNum;
-};
-
-
-}
-
-#endif // RTI_HandleImplementation_h
-
Index: RTI1516fedAmbassador.cpp
===================================================================
RCS file: RTI1516fedAmbassador.cpp
diff -N RTI1516fedAmbassador.cpp
--- RTI1516fedAmbassador.cpp 3 Mar 2014 15:18:21 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,10 +0,0 @@
-#include <RTI/FederateAmbassador.h>
-#include <RTI/NullFederateAmbassador.h>
-
-rti1516::FederateAmbassador::FederateAmbassador() throw (FederateInternalError)
-{
-}
-
-rti1516::FederateAmbassador::~FederateAmbassador() throw()
-{
-}
Index: RTI1516ambPrivateRefs.cpp
===================================================================
RCS file: RTI1516ambPrivateRefs.cpp
diff -N RTI1516ambPrivateRefs.cpp
--- RTI1516ambPrivateRefs.cpp 3 Mar 2014 15:18:22 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,1208 +0,0 @@
-// ----------------------------------------------------------------------------
-// CERTI - HLA RunTime Infrastructure
-// Copyright (C) 2002-2005 ONERA
-//
-// This file is part of CERTI-libRTI
-//
-// CERTI-libRTI is free software ; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License
-// as published by the Free Software Foundation ; either version 2 of
-// the License, or (at your option) any later version.
-//
-// CERTI-libRTI is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY ; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this program ; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA
-//
-// $Id: RTI1516ambPrivateRefs.cpp,v 1.1 2014/03/03 15:18:22 erk Exp $
-// ----------------------------------------------------------------------------
-
-#include <config.h>
-#include "RTI1516ambPrivateRefs.h"
-//#include "RTItypesImp.hh"
-#include "RTI1516HandleImplementation.h"
-
-#include <RTI/Exception.h>
-#include <RTI/certiLogicalTime.h>
-#include <RTI/certiLogicalTimeInterval.h>
-#include <RTI/certiLogicalTimeFactory.h>
-#include "RTI1516HandleFactory.h"
-#include "RTI1516fedTime.h"
-
-#include "PrettyDebug.hh"
-#include "M_Classes.hh"
-#include <sstream>
-#include <iostream>
-
-namespace {
-static PrettyDebug D("LIBRTI", __FILE__);
-static PrettyDebug G("GENDOC",__FILE__);
-
-template<typename T>
-std::vector<std::pair<AttributeHandle, AttributeValue_t> >
-getAHVPSFromRequest(T* request)
-{
- uint32_t size = request->getAttributesSize();
- std::vector<std::pair<AttributeHandle, AttributeValue_t> > result;
- result.resize(size);
-
- for (uint32_t i = 0 ; i < size ; ++i) {
- result[i].first = request->getAttributes(i);
- result[i].second.assign(request->getValues(i).data(),
request->getValues(i).length());
- }
-
- return result;
-}
-
-template<typename T>
-std::vector<std::pair<rti1516::ParameterHandle, ParameterValue_t> >
-getPHVPSFromRequest(T* request)
-{
- uint32_t size = request->getParametersSize();
-
- std::vector<std::pair<rti1516::ParameterHandle, ParameterValue_t> >
result;
- result.resize(size);
-
- for (uint32_t i = 0 ; i < size ; ++i) {
- result[i].first = request->getParameters(i);
- result[i].second.assign(request->getValues(i).data(),
request->getValues(i).length());
- }
-
- return result;
-}
-
-template<typename T>
-rti1516::AttributeHandleValueMap *
-getAHVMFromRequest(T* request)
-{
- uint32_t size = request->getAttributesSize();
- rti1516::AttributeHandleValueMap *result = new
rti1516::AttributeHandleValueMap();
-
- for (uint32_t i = 0 ; i < size ; ++i) {
- rti1516::AttributeHandle attribute =
rti1516::AttributeHandleFriend::createRTI1516Handle(request->getAttributes(i));
- rti1516::VariableLengthData
varData(&(request->getValues(i)[0]), request->getValues(i).size());
-
result->insert(std::pair<rti1516::AttributeHandle,rti1516::VariableLengthData>(attribute,
varData));
- }
-
- return result;
-}
-
-template<typename T>
-rti1516::ParameterHandleValueMap *
-getPHVMFromRequest(T* request)
-{
- uint32_t size = request->getParametersSize();
- rti1516::ParameterHandleValueMap *result = new
rti1516::ParameterHandleValueMap();
-
- for (uint32_t i = 0 ; i < size ; ++i) {
- rti1516::ParameterHandle parameter =
rti1516::ParameterHandleFriend::createRTI1516Handle(request->getParameters(i));
- rti1516::VariableLengthData
varData(&(request->getValues(i)[0]), request->getValues(i).size());
-
result->insert(std::pair<rti1516::ParameterHandle,rti1516::VariableLengthData>(parameter,
varData));
- }
-
- return result;
-}
-
-template<typename T>
-rti1516::AttributeHandleSet *
-getAHSFromRequest(T* request)
-{
- uint32_t size = request->getAttributesSize();
- rti1516::AttributeHandleSet *result = new rti1516::AttributeHandleSet();
-
- for (uint32_t i = 0 ; i < size ; ++i) {
- rti1516::AttributeHandle attribute =
rti1516::AttributeHandleFriend::createRTI1516Handle(request->getAttributes(i));
- result->insert(attribute);
- }
-
- return result;
-}
-
-std::auto_ptr< rti1516::LogicalTime >
-getLogicalTime()
-throw ( rti1516::RTIinternalError )
-{
- std::auto_ptr< rti1516::LogicalTimeFactory > timeFactory =
rti1516::LogicalTimeFactoryFactory::makeLogicalTimeFactory(L"");
- if (timeFactory.get() != 0)
- {
- return timeFactory->makeLogicalTime();
- } else
- {
- throw rti1516::RTIinternalError(L"Could not create
LogicalTimeFactory");
- }
-}
-
-} // End anonymous namespace
-
-RTI1516ambPrivateRefs::RTI1516ambPrivateRefs()
-{
- fed_amb = NULL;
-#ifdef _WIN32
- handle_RTIA = (HANDLE)-1;
-#else
- pid_RTIA = (pid_t)-1;
-#endif
- is_reentrant = false;
- _theRootObj = NULL;
- socketUn = NULL;
-}
-
-RTI1516ambPrivateRefs::~RTI1516ambPrivateRefs()
-{
- delete socketUn ;
-}
-
-// ----------------------------------------------------------------------------
-void
-RTI1516ambPrivateRefs::leave(const char *msg) throw (rti1516::RTIinternalError)
-{
- std::wstringstream smsg;
- smsg << "RTI called leave because <" <<msg<<">";
- throw rti1516::RTIinternalError(smsg.str());
-}
-
-// ----------------------------------------------------------------------------
-void
-RTI1516ambPrivateRefs::executeService(Message *req, Message *rep)
-{
- G.Out(pdGendoc,"enter
RTI1516ambPrivateRefs::executeService(%s,%s)",req->getMessageName(),rep->getMessageName());
-
- D.Out(pdDebug, "sending request to RTIA.");
-
- try {
- req->send(socketUn,msgBufSend);
- }
- catch (certi::NetworkError) {
- std::cerr << "libRTI: exception: NetworkError (write)" <<
std::endl ;
- if ( req->getMessageType() == certi::Message::CLOSE_CONNEXION)
- {
- std::cerr << "libRTI: Could not execute 'Close
connexion' service (Network error). Service request ignored." << std::endl;
- return;
- } else
- {
- throw rti1516::RTIinternalError(L"libRTI: Network Write
Error");
- }
- }
-
- D.Out(pdDebug, "waiting RTIA reply.");
-
- // waiting RTI reply.
- try {
- rep->receive(socketUn,msgBufReceive);
- }
- catch (certi::NetworkError) {
- std::cerr << "libRTI: exception: NetworkError (read)" <<
std::endl ;
- throw rti1516::RTIinternalError(L"libRTI: Network Read Error
waiting RTI reply");
- }
-
- D.Out(pdDebug, "RTIA reply received.");
-
-
- 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");
- }
-
- D.Out(pdDebug, "processing returned exception (from reply).");
- // the services may only throw exceptions defined in the HLA standard
- // the RTIA is responsible for sending 'allowed' exceptions only
- processException(rep);
-
- D.Out(pdDebug, "exception processed.");
- G.Out(pdGendoc,"exit RTI1516ambPrivateRefs::executeService");
-}
-
-void
-RTI1516ambPrivateRefs::sendTickRequestStop()
-{
- G.Out(pdGendoc,"enter RTI1516ambPrivateRefs::sendTickRequestStop");
-
- M_Tick_Request_Stop req, rep ;
-
- try {
- req.send(socketUn, msgBufSend);
- }
- catch (certi::NetworkError) {
- std::cerr << "libRTI: exception: NetworkError (write)" <<
std::endl ;
- throw rti1516::RTIinternalError(L"libRTI: Network Write Error");
- }
-
- try {
- rep.receive(socketUn, msgBufReceive);
- }
- catch (certi::NetworkError) {
- std::cerr << "libRTI: exception: NetworkError (read)" <<
std::endl ;
- throw rti1516::RTIinternalError(L"libRTI: Network Read Error
waiting RTI reply");
- }
-
- // ignore the response, ignore exceptions
- // rep->type == Message::TICK_REQUEST;
-
- G.Out(pdGendoc,"exit RTI1516ambPrivateRefs::sendTickRequestStop");
-}
-
-// ----------------------------------------------------------------------------
-//! Process exception from received message.
-/*! When a message is received from RTIA, it can contains an exception.
- This exception is processed by this module and a new exception is thrown.
- */
-void
-RTI1516ambPrivateRefs::processException(Message *msg)
-{
- D.Out(pdExcept, "num de l'exception : %d .", msg->getExceptionType());
- switch(msg->getExceptionType()) {
- case e_NO_EXCEPTION: {
- } break ;
-
- case e_ArrayIndexOutOfBounds: {
- D.Out(pdExcept, "Throwing e_ArrayIndexOutOfBounds exception.");
- // JvY: Changed name of exception
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_AsynchronousDeliveryAlreadyEnabled: {
- D.Out(pdExcept, "Throwing e_AsynchronousDeliveryAlreadyEnabled
exception.");
- throw
rti1516::AsynchronousDeliveryAlreadyEnabled(msg->getExceptionReasonW());
- } break ;
-
- case e_AsynchronousDeliveryAlreadyDisabled: {
- D.Out(pdExcept, "Throwing e_AsynchronousDeliveryAlreadyDisabled
exception.");
- throw
rti1516::AsynchronousDeliveryAlreadyDisabled(msg->getExceptionReasonW());
- } break ;
-
- case e_AttributeAlreadyOwned: {
- D.Out(pdExcept, "Throwing e_AttributeAlreadyOwned exception.");
- throw
rti1516::AttributeAlreadyOwned(msg->getExceptionReasonW());
- } break ;
-
- case e_AttributeAlreadyBeingAcquired: {
- D.Out(pdExcept,
- "Throwing e_AttributeAlreadyBeingAcquired
exception.");
- throw
rti1516::AttributeAlreadyBeingAcquired(msg->getExceptionReasonW());
- } break ;
-
- case e_AttributeAlreadyBeingDivested: {
- D.Out(pdExcept,
- "Throwing e_AttributeAlreadyBeingDivested
exception.");
- throw
rti1516::AttributeAlreadyBeingDivested(msg->getExceptionReasonW());
- } break ;
-
- case e_AttributeDivestitureWasNotRequested: {
- D.Out(pdExcept,
- "Throwing e_AttributeDivestitureWasNotRequested
exception.");
- throw
rti1516::AttributeDivestitureWasNotRequested(msg->getExceptionReasonW());
- } break ;
-
- case e_AttributeAcquisitionWasNotRequested: {
- D.Out(pdExcept,
- "Throwing e_AttributeAcquisitionWasNotRequested
exception.");
- throw
rti1516::AttributeAcquisitionWasNotRequested(msg->getExceptionReasonW());
- } break ;
-
- case e_AttributeNotDefined: {
- D.Out(pdExcept, "Throwing e_AttributeNotDefined exception.");
- throw rti1516::AttributeNotDefined(msg->getExceptionReasonW());
- } break ;
-
- case e_AttributeNotKnown: {
- D.Out(pdExcept, "Throwing e_AttributeNotKnown exception.");
- // JvY: Changed name of exception
- throw
rti1516::AttributeNotRecognized(msg->getExceptionReasonW());
- } break ;
-
- case e_AttributeNotOwned: {
- D.Out(pdExcept, "Throwing e_AttributeNotOwned exception.");
- throw rti1516::AttributeNotOwned(msg->getExceptionReasonW());
- } break ;
-
- case e_AttributeNotPublished: {
- D.Out(pdExcept, "Throwing e_AttributeNotPublished exception.");
- throw
rti1516::AttributeNotPublished(msg->getExceptionReasonW());
- } break ;
-
- case e_AttributeNotSubscribed: {
- D.Out(pdExcept, "Throwing e_AttributeNotSubscribed exception.");
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_ConcurrentAccessAttempted: {
- D.Out(pdExcept, "Throwing e_ConcurrentAccessAttempted
exception.");
- // JvY: Changed name of exception
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_CouldNotDiscover: {
- D.Out(pdExcept, "Throwing e_CouldNotDiscover exception.");
- throw rti1516::CouldNotDiscover(msg->getExceptionReasonW());
- } break ;
-
- case e_CouldNotOpenFED: {
- D.Out(pdExcept, "Throwing e_CouldNotOpenFED exception.");
- // JvY: Changed name of exception
- throw rti1516::CouldNotOpenFDD(msg->getExceptionReasonW());
- } break ;
-
- case e_CouldNotOpenRID: {
- D.Out(pdExcept, "Throwing e_CouldNotOpenRID exception.");
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_CouldNotRestore: {
- D.Out(pdExcept, "Throwing e_CouldNotRestore exception.");
- // JvY: Changed name of exception
- throw
rti1516::CouldNotInitiateRestore(msg->getExceptionReasonW());
- } break ;
-
- case e_DeletePrivilegeNotHeld: {
- D.Out(pdExcept, "Throwing e_DeletePrivilegeNotHeld exception.");
- throw
rti1516::DeletePrivilegeNotHeld(msg->getExceptionReasonW());
- } break ;
-
- case e_ErrorReadingRID: {
- D.Out(pdExcept, "Throwing e_ErrorReadingRID exception.");
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_ErrorReadingFED: {
- D.Out(pdExcept, "Throwing e_ErrorReadingFED exception.");
- // JvY: Changed name of exception
- throw rti1516::ErrorReadingFDD(msg->getExceptionReasonW());
- } break ;
-
- case e_EventNotKnown: {
- D.Out(pdExcept, "Throwing e_EventNotKnown exception.");
- // JvY: Changed name of exception
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_FederateAlreadyPaused: {
- D.Out(pdExcept, "Throwing e_FederateAlreadyPaused exception.");
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_FederateAlreadyExecutionMember: {
- D.Out(pdExcept,
- "Throwing e_FederateAlreadyExecutionMember
exception.");
- throw
rti1516::FederateAlreadyExecutionMember(msg->getExceptionReasonW());
- } break ;
-
- case e_FederateDoesNotExist: {
- D.Out(pdExcept, "Throwing e_FederateDoesNotExist exception.");
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_FederateInternalError: {
- D.Out(pdExcept, "Throwing e_FederateInternalError exception.");
- throw
rti1516::FederateInternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_FederateNameAlreadyInUse: {
- D.Out(pdExcept, "Throwing e_FederateNameAlreadyInUse
exception.");
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_FederateNotExecutionMember: {
- D.Out(pdExcept, "Throwing e_FederateNotExecutionMember
exception.");
- throw
rti1516::FederateNotExecutionMember(msg->getExceptionReasonW());
- } break ;
-
- case e_FederateNotPaused: {
- D.Out(pdExcept, "Throwing e_FederateNotPaused exception.");
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_FederateOwnsAttributes: {
- D.Out(pdExcept, "Throwing e_FederateOwnsAttributes exception.");
- throw
rti1516::FederateOwnsAttributes(msg->getExceptionReasonW());
- } break ;
-
- case e_FederatesCurrentlyJoined: {
- D.Out(pdExcept, "Throwing e_FederatesCurrentlyJoined
exception.");
- throw
rti1516::FederatesCurrentlyJoined(msg->getExceptionReasonW());
- } break ;
-
- case e_FederateWasNotAskedToReleaseAttribute: {
- D.Out(pdExcept,
- "Throwing
e_FederateWasNotAskedToReleaseAttribute exception.");
- D.Out(pdDebug,
- "Throwing
e_FederateWasNotAskedToReleaseAttribute exception.");
- // JvY: Changed name of exception
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_FederationAlreadyPaused: {
- D.Out(pdExcept, "Throwing e_FederationAlreadyPaused
exception.");
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_FederationExecutionAlreadyExists: {
- D.Out(pdExcept, "Throwing e_FederationExecutionAlreadyExists
excep.");
- throw
rti1516::FederationExecutionAlreadyExists(msg->getExceptionReasonW());
- } break ;
-
- case e_FederationExecutionDoesNotExist: {
- D.Out(pdExcept, "Throwing e_FederationExecutionDoesNotExist
except.");
- throw
rti1516::FederationExecutionDoesNotExist(msg->getExceptionReasonW());
- } break ;
-
- case e_FederationNotPaused: {
- D.Out(pdExcept, "Throwing e_FederationNotPaused exception.");
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_FederationTimeAlreadyPassed: {
- D.Out(pdExcept, "Throwing e_FederationTimeAlreadyPassed
exception.");
- // JvY: Changed name of exception
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_FederateNotPublishing: {
- D.Out(pdExcept, "Throwing e_FederateNotPublishing exception.");
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_FederateNotSubscribing: {
- D.Out(pdExcept, "Throwing e_FederateNotSubscribing exception.");
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_RegionNotKnown: {
- D.Out(pdExcept, "Throwing e_RegionNotKnown exception.");
- // JvY: Changed name of exception
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_IDsupplyExhausted: {
- D.Out(pdExcept, "Throwing e_IDsupplyExhausted exception.");
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_InteractionClassNotDefined: {
- D.Out(pdExcept, "Throwing e_InteractionClassNotDefined
exception.");
- throw
rti1516::InteractionClassNotDefined(msg->getExceptionReasonW());
- } break ;
-
- case e_InteractionClassNotKnown: {
- D.Out(pdExcept, "Throwing e_InteractionClassNotKnown
exception.");
- // JvY: Changed name of exception
- throw
rti1516::InteractionClassNotRecognized(msg->getExceptionReasonW());
- } break ;
-
- case e_InteractionClassNotPublished: {
- D.Out(pdExcept, "Throwing e_InteractionClassNotPublished
exception.");
- throw
rti1516::InteractionClassNotPublished(msg->getExceptionReasonW());
- } break ;
-
- case e_InteractionParameterNotDefined: {
- D.Out(pdExcept,
- "Throwing e_InteractionParameterNotDefined
exception.");
- throw
rti1516::InteractionParameterNotDefined(msg->getExceptionReasonW());
- } break ;
-
- case e_InteractionParameterNotKnown: {
- D.Out(pdExcept, "Throwing e_InteractionParameterNotKnown
exception.");
- // JvY: Changed name of exception
- throw
rti1516::InteractionParameterNotRecognized(msg->getExceptionReasonW());
- } break ;
-
- case e_InvalidDivestitureCondition: {
- D.Out(pdExcept, "Throwing e_InvalidDivestitureCondition
exception.");
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_InvalidExtents: {
- D.Out(pdExcept, "Throwing e_InvalidExtents exception.");
- // JvY: Changed name of exception
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_InvalidFederationTime: {
- D.Out(pdExcept, "Throwing e_InvalidFederationTime exception.");
- // JvY: Changed name of exception
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_InvalidFederationTimeDelta: {
- D.Out(pdExcept, "Throwing e_InvalidFederationTimeDelta
exception.");
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_InvalidLookahead: {
- D.Out(pdExcept, "Throwing e_InvalidLookahead.");
- throw rti1516::InvalidLookahead(msg->getExceptionReasonW());
- } break ;
-
- case e_InvalidObjectHandle: {
- D.Out(pdExcept, "Throwing e_InvalidObjectHandle exception.");
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_InvalidOrderingHandle: {
- D.Out(pdExcept, "Throwing e_InvalidOrderingHandle exception.");
- // JvY: Changed name of exception
- throw rti1516::InvalidOrderType(msg->getExceptionReasonW());
- } break ;
-
- case e_InvalidResignAction: {
- D.Out(pdExcept, "Throwing e_InvalidResignAction exception.");
- // JvY: Changed name of exception
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_InvalidRetractionHandle: {
- D.Out(pdExcept, "Throwing e_InvalidRetractionHandle
exception.");
- throw
rti1516::InvalidRetractionHandle(msg->getExceptionReasonW());
- } break ;
-
- case e_InvalidRoutingSpace: {
- D.Out(pdExcept, "Throwing e_InvalidRoutingSpace exception.");
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_InvalidTransportationHandle: {
- D.Out(pdExcept, "Throwing e_InvalidTransportationHandle
exception.");
- // JvY: Changed name of exception
- throw
rti1516::InvalidTransportationType(msg->getExceptionReasonW());
- } break ;
-
- case e_MemoryExhausted: {
- D.Out(pdExcept, "Throwing e_MemoryExhausted exception.");
- // JvY: Changed name of exception
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_NameNotFound: {
- D.Out(pdExcept, "Throwing e_NameNotFound exception.");
- throw rti1516::NameNotFound(msg->getExceptionReasonW());
- } break ;
-
- case e_NoPauseRequested: {
- D.Out(pdExcept, "Throwing e_NoPauseRequested exception.");
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_NoResumeRequested: {
- D.Out(pdExcept, "Throwing e_NoResumeRequested exception.");
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_ObjectClassNotDefined: {
- D.Out(pdExcept, "Throwing e_ObjectClassNotDefined exception.");
- throw
rti1516::ObjectClassNotDefined(msg->getExceptionReasonW());
- } break ;
-
- case e_ObjectClassNotKnown: {
- D.Out(pdExcept, "Throwing e_ObjectClassNotKnown exception.");
- throw rti1516::ObjectClassNotKnown(msg->getExceptionReasonW());
- } break ;
-
- case e_ObjectClassNotPublished: {
- D.Out(pdExcept, "Throwing e_ObjectClassNotPublished
exception.");
- throw
rti1516::ObjectClassNotPublished(msg->getExceptionReasonW());
- } break ;
-
- case e_ObjectClassNotSubscribed: {
- D.Out(pdExcept, "Throwing e_ObjectClassNotSubscribed
exception.");
- // JvY: Changed name of exception
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_ObjectNotKnown: {
- D.Out(pdExcept, "Throwing e_ObjectNotKnown exception.");
- // JvY: Changed name of exception
- throw
rti1516::ObjectInstanceNotKnown(msg->getExceptionReasonW());
- } break ;
-
- case e_ObjectAlreadyRegistered: {
- D.Out(pdExcept, "Throwing e_ObjectAlreadyRegistered
exception.");
- // JvY: Changed name of exception
- throw
rti1516::ObjectInstanceNameInUse(msg->getExceptionReasonW());
- } break ;
-
- case e_RestoreInProgress: {
- D.Out(pdExcept, "Throwing e_RestoreInProgress exception.");
- throw rti1516::RestoreInProgress(msg->getExceptionReasonW());
- } break ;
-
- case e_RestoreNotRequested: {
- D.Out(pdExcept, "Throwing e_RestoreNotRequested exception.");
- throw rti1516::RestoreNotRequested(msg->getExceptionReasonW());
- } break ;
-
- case e_RTIinternalError: {
- D.Out(pdExcept, "Throwing e_RTIinternalError exception.");
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_SpaceNotDefined: {
- D.Out(pdExcept, "Throwing e_SpaceNotDefined exception.");
- // JvY: Changed name of exception
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_SaveInProgress: {
- D.Out(pdExcept, "Throwing e_SaveInProgress exception.");
- throw rti1516::SaveInProgress(msg->getExceptionReasonW());
- } break ;
-
- case e_SaveNotInitiated: {
- D.Out(pdExcept, "Throwing e_SaveNotInitiated exception.");
- throw rti1516::SaveNotInitiated(msg->getExceptionReasonW());
- } break ;
-
- case e_SecurityError: {
- D.Out(pdExcept, "Throwing e_SecurityError exception.");
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_SpecifiedSaveLabelDoesNotExist: {
- D.Out(pdExcept,
- "Throwing e_SpecifiedSaveLabelDoesNotExist
exception.");
- throw
rti1516::SpecifiedSaveLabelDoesNotExist(msg->getExceptionReasonW());
- } break ;
-
- case e_TimeAdvanceAlreadyInProgress: {
- D.Out(pdExcept, "Throwing e_TimeAdvanceAlreadyInProgress
exception.");
- // JvY: Changed name of exception
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_TimeAdvanceWasNotInProgress: {
- D.Out(pdExcept, "Throwing e_TimeAdvanceWasNotInProgress
exception.");
- // JvY: Changed name of exception
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_TooManyIDsRequested: {
- D.Out(pdExcept, "Throwing e_TooManyIDsRequested exception.");
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_UnableToPerformSave: {
- D.Out(pdExcept, "Throwing e_UnableToPerformSave exception.");
- throw rti1516::UnableToPerformSave(msg->getExceptionReasonW());
- } break ;
-
- case e_UnimplementedService: {
- D.Out(pdExcept, "Throwing e_UnimplementedService exception.");
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_UnknownLabel: {
- D.Out(pdExcept, "Throwing e_UnknownLabel exception.");
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_ValueCountExceeded: {
- D.Out(pdExcept, "Throwing e_ValueCountExceeded exception.");
- // JvY: Changed name of exception
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_ValueLengthExceeded: {
- D.Out(pdExcept, "Throwing e_ValueLengthExceeded exception.");
- // JvY: Changed name of exception
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
-
- case e_IllegalName: {
- D.Out(pdExcept, "Throwing e_IllegalName exception.");
- throw rti1516::IllegalName(msg->getExceptionReasonW());
- } break;
-
-
- default: {
- D.Out(pdExcept, "Throwing unknown exception !");
- std::cout << "LibRTI: Receiving unknown RTI exception." <<
std::endl;
- throw rti1516::RTIinternalError(msg->getExceptionReasonW());
- } break ;
- }
-}
-
-#define CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(service) \
- catch (rti1516::Exception &e) { \
- std::wstringstream msg; \
- msg << "Error in " << service << ": " << e.what(); \
- throw rti1516::RTIinternalError(msg.str()); \
- }
-
-void
-RTI1516ambPrivateRefs::callFederateAmbassador(Message *msg)
-throw (rti1516::RTIinternalError)
-{
- switch (msg->getMessageType()) {
-
- case Message::SYNCHRONIZATION_POINT_REGISTRATION_SUCCEEDED:
- try {
-
fed_amb->synchronizationPointRegistrationSucceeded(msg->getLabelW());
- }
-
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"synchronizationPointRegistrationSucceeded")
- break ;
-
- case Message::SYNCHRONIZATION_POINT_REGISTRATION_FAILED:
- try {
-
fed_amb->synchronizationPointRegistrationFailed(msg->getLabelW(),
rti1516::RTI_DETECTED_FAILURE_DURING_SYNCHRONIZATION);
- }
-
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"synchronizationPointRegistrationFailed")
- break ;
-
- case Message::ANNOUNCE_SYNCHRONIZATION_POINT:
- try {
- std::string tagString(msg->getTag());
- rti1516::VariableLengthData
tagVarData(tagString.c_str(), tagString.length());
-
fed_amb->announceSynchronizationPoint(msg->getLabelW(),tagVarData);
- }
-
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"announceSynchronizationPoint")
- break ;
-
- case Message::FEDERATION_SYNCHRONIZED:
- try {
- fed_amb->federationSynchronized(msg->getLabelW());
- }
- CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"federationSynchronized")
- break ;
-
- case Message::INITIATE_FEDERATE_SAVE:
- try {
- fed_amb->initiateFederateSave((msg->getLabelW()));
- }
- CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"initiateFederateSave")
- break ;
-
- case Message::FEDERATION_SAVED:
- try {
- fed_amb->federationSaved();
- }
- CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"federationSaved")
- break ;
-
- case Message::REQUEST_FEDERATION_RESTORE_SUCCEEDED:
- try {
- fed_amb->requestFederationRestoreSucceeded(
- (msg->getLabelW()));
- }
-
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"requestFederationRestoreSucceeded")
- break ;
-
- case Message::REQUEST_FEDERATION_RESTORE_FAILED:
- try {
-
fed_amb->requestFederationRestoreFailed(msg->getLabelW());
- }
-
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"requestFederationRestoreFailed")
- break ;
-
- case Message::FEDERATION_RESTORE_BEGUN:
- try {
- fed_amb->federationRestoreBegun();
- }
- CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"federationRestoreBegun")
- break ;
-
- case Message::INITIATE_FEDERATE_RESTORE:
- try {
- M_Initiate_Federate_Restore *IFR =
static_cast<M_Initiate_Federate_Restore *>(msg);
- rti1516::FederateHandle rti1516Handle =
rti1516::FederateHandleFriend::createRTI1516Handle(IFR->getFederate());
- fed_amb->initiateFederateRestore((IFR->getLabelW()),
rti1516Handle);
- }
- CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"initiateFederateRestore")
- break ;
-
- case Message::FEDERATION_RESTORED:
- try {
- fed_amb->federationRestored();
- }
- CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"federationRestored")
- break ;
-
- case Message::FEDERATION_NOT_RESTORED:
- try {
- // TODO Need to know reason
-
fed_amb->federationNotRestored(rti1516::RTI_UNABLE_TO_RESTORE);
- }
- CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"federationNotRestored")
- break ;
-
- case Message::START_REGISTRATION_FOR_OBJECT_CLASS:
- try {
- rti1516::ObjectClassHandle rti1516Handle =
rti1516::ObjectClassHandleFriend::createRTI1516Handle(static_cast<M_Start_Registration_For_Object_Class
*>(msg)->getObjectClass());
- fed_amb->startRegistrationForObjectClass(rti1516Handle);
- }
-
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"startRegistrationForObjectClass")
- break ;
-
- case Message::STOP_REGISTRATION_FOR_OBJECT_CLASS:
- try {
- rti1516::ObjectClassHandle rti1516Handle =
rti1516::ObjectClassHandleFriend::createRTI1516Handle(static_cast<M_Stop_Registration_For_Object_Class
*>(msg)->getObjectClass());
- fed_amb->stopRegistrationForObjectClass(rti1516Handle);
- }
-
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"stopRegistrationForObjectClass")
- break ;
-
- case Message::TURN_INTERACTIONS_ON:
- try {
- rti1516::InteractionClassHandle rti1516Handle =
rti1516::InteractionClassHandleFriend::createRTI1516Handle(static_cast<M_Turn_Interactions_On
*>(msg)->getInteractionClass());
- fed_amb->turnInteractionsOn(rti1516Handle);
- }
- CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"turnInteractionsOn")
- break ;
-
- case Message::TURN_INTERACTIONS_OFF:
- try {
- rti1516::InteractionClassHandle rti1516Handle =
rti1516::InteractionClassHandleFriend::createRTI1516Handle(static_cast<M_Turn_Interactions_Off
*>(msg)->getInteractionClass());
- fed_amb->turnInteractionsOff(rti1516Handle);
- }
- CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"turnInteractionsOff")
- break ;
-
- case Message::DISCOVER_OBJECT_INSTANCE:
- try {
- M_Discover_Object_Instance* DOI =
static_cast<M_Discover_Object_Instance *>(msg);
- rti1516::ObjectInstanceHandle objectInstance =
rti1516::ObjectInstanceHandleFriend::createRTI1516Handle(DOI->getObject());
- rti1516::ObjectClassHandle objectClass =
rti1516::ObjectClassHandleFriend::createRTI1516Handle(DOI->getObjectClass());
- std::string str = DOI->getObjectName();
- std::wstring str2(str.length(), L' '); // Make room for
characters
- // Copy string to wstring.
- std::copy(str.begin(), str.end(), str2.begin());
-
- fed_amb->discoverObjectInstance(objectInstance,
- objectClass,
- str2);
- }
- CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"discoverObjectInstance")
- break ;
-
- case Message::REFLECT_ATTRIBUTE_VALUES:
- try {
- M_Reflect_Attribute_Values* RAV =
static_cast<M_Reflect_Attribute_Values *>(msg);
- G.Out(pdGendoc," tick_kernel call to
reflectAttributeValues");
-
- rti1516::ObjectInstanceHandle instance =
rti1516::ObjectInstanceHandleFriend::createRTI1516Handle(RAV->getObject());
-
- rti1516::AttributeHandleValueMap *attributes =
getAHVMFromRequest(RAV);
-
- std::string tagString(msg->getTag());
- rti1516::VariableLengthData
tagVarData(tagString.c_str(), tagString.length());
-
- if (msg->isDated()) {
- uint64_t sn = RAV->getEventRetraction().getSN();
- certi::FederateHandle certiHandle =
RAV->getEventRetraction().getSendingFederate();
- rti1516::MessageRetractionHandle event =
rti1516::MessageRetractionHandleFriend::createRTI1516Handle(certiHandle, sn);
-
- std::auto_ptr < rti1516::LogicalTime > fedTime
(new RTI1516fedTime(msg->getDate().getTime()));
-
- fed_amb->reflectAttributeValues(instance,
//ObjectInstanceHandle
- *attributes,
//AttributeHandleValueMap &
- tagVarData,
//VariableLengthData &
- rti1516::TIMESTAMP,
//OrderType (send)
- rti1516::RELIABLE,
//TransportationType
- *fedTime,
//LogicalTime &
- rti1516::RECEIVE,
//OrderType (receive)
- event
//MessageRetractionHandle
- );
- }
- else {
- fed_amb->reflectAttributeValues(instance,
- *attributes,
- tagVarData,
- rti1516::RECEIVE,
- rti1516::RELIABLE);
- }
- delete attributes ;
- }
- CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"reflectAttributeValues")
- break ;
-
- case Message::RECEIVE_INTERACTION:
- try {
- M_Receive_Interaction* RI =
static_cast<M_Receive_Interaction *>(msg);
- rti1516::ParameterHandleValueMap *parameters =
getPHVMFromRequest(RI);
-
- rti1516::InteractionClassHandle interactionHandle =
rti1516::InteractionClassHandleFriend::createRTI1516Handle(RI->getInteractionClass());
-
- std::string tagString(msg->getTag());
- rti1516::VariableLengthData
tagVarData(tagString.c_str(), tagString.length());
-
- if (msg->isDated()) {
- uint64_t sn = RI->getEventRetraction().getSN();
- certi::FederateHandle certiHandle =
RI->getEventRetraction().getSendingFederate();
- rti1516::MessageRetractionHandle event =
rti1516::MessageRetractionHandleFriend::createRTI1516Handle(certiHandle, sn);
-
- std::auto_ptr < rti1516::LogicalTime > fedTime
(new RTI1516fedTime(msg->getDate().getTime()));
-
- fed_amb->receiveInteraction(
- interactionHandle,
// InteractionClassHandle
- *parameters,
// ParameterHandleValueMap &
- tagVarData,
// VariableLengthData &
- rti1516::TIMESTAMP,
//OrderType (send)
- rti1516::RELIABLE,
//TransportationType
- *fedTime,
//LogicalTime &
- rti1516::RECEIVE,
//OrderType (receive)
- event
//MessageRetractionHandle
- );
- }
- else {
- fed_amb->receiveInteraction(
- interactionHandle,
- *parameters,
- tagVarData,
- rti1516::RECEIVE,
- rti1516::RELIABLE);
- }
- delete parameters ;
- }
- CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"receiveInteraction")
- break ;
-
- case Message::REMOVE_OBJECT_INSTANCE:
- try {
- M_Remove_Object_Instance* ROI =
static_cast<M_Remove_Object_Instance *>(msg);
-
- rti1516::ObjectInstanceHandle instance =
rti1516::ObjectInstanceHandleFriend::createRTI1516Handle(ROI->getObject());
-
- std::string tagString(msg->getTag());
- rti1516::VariableLengthData
tagVarData(tagString.c_str(), tagString.length());
-
- if (msg->isDated()) {
- uint64_t sn = ROI->getEventRetraction().getSN();
- certi::FederateHandle certiHandle =
ROI->getEventRetraction().getSendingFederate();
- rti1516::MessageRetractionHandle event =
rti1516::MessageRetractionHandleFriend::createRTI1516Handle(certiHandle, sn);
-
- std::auto_ptr < rti1516::LogicalTime > fedTime
(new RTI1516fedTime(msg->getDate().getTime()));
-
- fed_amb->removeObjectInstance(
- instance,
- tagVarData,
- rti1516::TIMESTAMP,
- *fedTime,
- rti1516::RECEIVE,
- event);
- }
- else {
- fed_amb->removeObjectInstance(
- instance,
- tagVarData,
- rti1516::RECEIVE);
- }
- }
- CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"removeObjectInstance")
- break ;
-
- case Message::PROVIDE_ATTRIBUTE_VALUE_UPDATE:
- try {
- M_Provide_Attribute_Value_Update* PAVU =
static_cast<M_Provide_Attribute_Value_Update *>(msg);
-
- rti1516::AttributeHandleSet *attributeSet =
getAHSFromRequest(PAVU);
-
- rti1516::ObjectInstanceHandle instance =
rti1516::ObjectInstanceHandleFriend::createRTI1516Handle(PAVU->getObject());
-
- std::string tag = PAVU->getTag();
- rti1516::VariableLengthData tagVarData(tag.c_str(),
tag.size());
-
-
fed_amb->provideAttributeValueUpdate(instance,*attributeSet, tagVarData);
- delete attributeSet ;
- }
-
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"provideAttributeValueUpdate")
- break ;
-
- case Message::REQUEST_RETRACTION: {
-
- } break ;
-
- case Message::REQUEST_ATTRIBUTE_OWNERSHIP_ASSUMPTION:
- try {
- M_Request_Attribute_Ownership_Assumption* RAOA =
static_cast<M_Request_Attribute_Ownership_Assumption *>(msg);
- rti1516::AttributeHandleSet *attributeSet =
getAHSFromRequest(RAOA);
-
- rti1516::ObjectInstanceHandle instance =
rti1516::ObjectInstanceHandleFriend::createRTI1516Handle(RAOA->getObject());
-
- std::string tag = RAOA->getTag();
- rti1516::VariableLengthData tagVarData(tag.c_str(),
tag.size());
-
- fed_amb->
- requestAttributeOwnershipAssumption(instance,
- *attributeSet,
- tagVarData);
- delete attributeSet ;
- }
-
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"requestAttributeOwnershipAssumption")
- break ;
-
- case Message::REQUEST_ATTRIBUTE_OWNERSHIP_RELEASE:
- try {
- M_Request_Attribute_Ownership_Release* RAOR =
static_cast<M_Request_Attribute_Ownership_Release *>(msg);
- rti1516::AttributeHandleSet *attributeSet =
getAHSFromRequest(RAOR);
-
- rti1516::ObjectInstanceHandle instance =
rti1516::ObjectInstanceHandleFriend::createRTI1516Handle(RAOR->getObject());
-
- std::string tag = RAOR->getTag();
- rti1516::VariableLengthData tagVarData(tag.c_str(),
tag.size());
-
- fed_amb->requestAttributeOwnershipRelease(
- instance,
- *attributeSet,
- tagVarData);
-
- delete attributeSet ;
- }
-
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"requestAttributeOwnershipRelease")
- break ;
-
- case Message::ATTRIBUTE_OWNERSHIP_UNAVAILABLE:
- try {
- M_Attribute_Ownership_Unavailable* AOU =
static_cast<M_Attribute_Ownership_Unavailable *>(msg);
-
- rti1516::AttributeHandleSet *attributeSet =
getAHSFromRequest(AOU);
-
- rti1516::ObjectInstanceHandle instance =
rti1516::ObjectInstanceHandleFriend::createRTI1516Handle(AOU->getObject());
-
- fed_amb->attributeOwnershipUnavailable(instance,
- *attributeSet);
-
- delete attributeSet ;
- }
-
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"attributeOwnershipUnavailable")
- break ;
-
- case Message::ATTRIBUTE_OWNERSHIP_ACQUISITION_NOTIFICATION:
- try {
- M_Attribute_Ownership_Acquisition_Notification* AOAN =
static_cast<M_Attribute_Ownership_Acquisition_Notification *>(msg);
-
- rti1516::AttributeHandleSet *attributeSet =
getAHSFromRequest(AOAN);
-
- rti1516::ObjectInstanceHandle instance =
rti1516::ObjectInstanceHandleFriend::createRTI1516Handle(AOAN->getObject());
-
- std::string tag = AOAN->getTag();
- rti1516::VariableLengthData tagVarData(tag.c_str(),
tag.size());
-
- fed_amb->attributeOwnershipAcquisitionNotification(
- instance,
- *attributeSet,
- tagVarData);
-
- delete attributeSet ;
- }
-
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"attributeOwnershipAcquisitionNotification")
- break ;
-
- case Message::ATTRIBUTE_OWNERSHIP_DIVESTITURE_NOTIFICATION:
- try {
- M_Attribute_Ownership_Divestiture_Notification* AODN =
static_cast<M_Attribute_Ownership_Divestiture_Notification *>(msg);
-
- rti1516::AttributeHandleSet *attributeSet =
getAHSFromRequest(AODN);
-
- rti1516::ObjectInstanceHandle instance =
rti1516::ObjectInstanceHandleFriend::createRTI1516Handle(AODN->getObject());
-
- // requestDivestitureConfirmation = 7.5, en zou
ontbreken in 1.3. JRE: klopt dit wel?
- // Changed function name! Originally:
attributeOwnershipDivestitureNotification
- fed_amb->requestDivestitureConfirmation(
- instance,
- *attributeSet);
-
- delete attributeSet ;
- }
-
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"attributeOwnershipDivestitureNotification")
- break ;
-
- case Message::CONFIRM_ATTRIBUTE_OWNERSHIP_ACQUISITION_CANCELLATION:
- try {
- M_Confirm_Attribute_Ownership_Acquisition_Cancellation*
CAOAC = static_cast<M_Confirm_Attribute_Ownership_Acquisition_Cancellation
*>(msg);
-
- rti1516::AttributeHandleSet *attributeSet =
getAHSFromRequest(CAOAC);
-
- rti1516::ObjectInstanceHandle instance =
rti1516::ObjectInstanceHandleFriend::createRTI1516Handle(CAOAC->getObject());
-
-
fed_amb->confirmAttributeOwnershipAcquisitionCancellation(
- instance,
- *attributeSet);
-
- delete attributeSet ;
- }
-
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"confirmAttributeOwnershipAcquisitionCancellation")
- break ;
-
- case Message::INFORM_ATTRIBUTE_OWNERSHIP:
- try {
- M_Inform_Attribute_Ownership* IAO =
static_cast<M_Inform_Attribute_Ownership *>(msg);
- rti1516::ObjectInstanceHandle instance =
rti1516::ObjectInstanceHandleFriend::createRTI1516Handle(IAO->getObject());
- rti1516::AttributeHandle attribute =
rti1516::AttributeHandleFriend::createRTI1516Handle(IAO->getAttribute());
- rti1516::FederateHandle federate =
rti1516::FederateHandleFriend::createRTI1516Handle(IAO->getFederate());
-
- fed_amb->
- informAttributeOwnership(
- instance,
- attribute,
- federate);
- }
-
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"informAttributeOwnership")
- break ;
-
- case Message::ATTRIBUTE_IS_NOT_OWNED:
- try {
- M_Attribute_Is_Not_Owned* AINO =
static_cast<M_Attribute_Is_Not_Owned *>(msg);
- rti1516::ObjectInstanceHandle instance =
rti1516::ObjectInstanceHandleFriend::createRTI1516Handle(AINO->getObject());
- rti1516::AttributeHandle attribute =
rti1516::AttributeHandleFriend::createRTI1516Handle(AINO->getAttribute());
-
- fed_amb->attributeIsNotOwned(
- instance,
- attribute);
- }
- CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"attributeIsNotOwned")
- break ;
-
- case Message::TIME_ADVANCE_GRANT:
- try {
-
fed_amb->timeAdvanceGrant(RTI1516fedTime(msg->getDate().getTime()));
- }
- CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"timeAdvanceGrant")
- break ;
-
- case Message::TIME_REGULATION_ENABLED:
- try {
- std::auto_ptr < rti1516::LogicalTime > fedTime (new
RTI1516fedTime(msg->getDate().getTime()));
- fed_amb->timeRegulationEnabled(*fedTime);
- }
- CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"timeRegulationEnabled")
- break ;
-
- case Message::TIME_CONSTRAINED_ENABLED:
- try {
- std::auto_ptr < rti1516::LogicalTime > fedTime (new
RTI1516fedTime(msg->getDate().getTime()));
- fed_amb->timeConstrainedEnabled(*fedTime);
- }
- CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"timeConstrainedEnabled")
- break ;
-
- case Message::RESERVE_OBJECT_INSTANCE_NAME_SUCCEEDED:
- try {
- M_Reserve_Object_Instance_Name_Succeeded* ROINS =
static_cast<M_Reserve_Object_Instance_Name_Succeeded *>(msg);
- std::string objName_s(ROINS->getObjectName());
- std::wstring objName_ws(objName_s.begin(),
objName_s.end());
-
-
fed_amb->objectInstanceNameReservationSucceeded(objName_ws);
- }
-
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"reserveObjectInstanceNameSucceeded")
- break;
-
- case Message::RESERVE_OBJECT_INSTANCE_NAME_FAILED:
- try {
- M_Reserve_Object_Instance_Name_Failed* ROINS =
static_cast<M_Reserve_Object_Instance_Name_Failed *>(msg);
- std::string objName_s(ROINS->getObjectName());
- std::wstring objName_ws(objName_s.begin(),
objName_s.end());
-
-
fed_amb->objectInstanceNameReservationFailed(objName_ws);
- }
-
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(L"reserveObjectInstanceNameFailed")
- break;
-
- default:
- leave("RTI service requested by RTI is unknown.");
- }
-}
-
-// $Id: RTI1516ambPrivateRefs.cpp,v 1.1 2014/03/03 15:18:22 erk Exp $
Index: RTI1516Handle.cpp
===================================================================
RCS file: RTI1516Handle.cpp
diff -N RTI1516Handle.cpp
--- RTI1516Handle.cpp 3 Mar 2014 15:18:21 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,143 +0,0 @@
-#include <sstream>
-#include <RTI/Handle.h>
-#include "RTI1516HandleImplementation.h"
-
-namespace rti1516
-{
-
-#define DECLARE_HANDLE_CLASS(HandleKind) \
- \
- /* Constructs an invalid handle */ \
- HandleKind::HandleKind() \
- : _impl(0) \
- { \
- } \
- \
- HandleKind::HandleKind(HandleKind##Implementation* impl) \
- : _impl(0) \
- { \
- _impl = impl; \
- } \
- \
- HandleKind::HandleKind(VariableLengthData const & encodedValue) \
- : _impl(0) \
- { \
- _impl = new HandleKind##Implementation(encodedValue); \
- } \
- \
- HandleKind::~HandleKind() \
- throw() \
- { \
- delete _impl; \
- } \
- \
- HandleKind::HandleKind(HandleKind const & rhs) \
- : _impl(0) \
- { \
- if ( rhs._impl != 0)
\
- _impl = new HandleKind##Implementation(*rhs._impl); \
- } \
- \
- HandleKind & \
- HandleKind::operator=(HandleKind const & rhs) \
- { \
- if (this != &rhs) \
- { \
- delete _impl; \
- if ( 0 != rhs._impl ) \
- _impl = new
HandleKind##Implementation(*(rhs._impl)); \
- else
\
- _impl = 0;
\
- } \
- return *this; \
- } \
- \
- /* Indicates whether this handle is valid */ \
- bool HandleKind::isValid() const \
- { \
- if (_impl == 0) \
- return false; \
- else \
- return _impl->isValid(); \
- }
\
- \
- /* All invalid handles are equivalent */ \
- bool HandleKind::operator==(HandleKind const & rhs) const \
- { \
- if (_impl == 0 || rhs.getImplementation() == 0)
\
- return false;
\
- else
\
- return ((*_impl)==(*rhs.getImplementation()));
\
- } \
- bool HandleKind::operator!=(HandleKind const & rhs) const \
- { \
- if (_impl == 0 || rhs.getImplementation() == 0)
\
- return false;
\
- else
\
- return ((*_impl)!=(*rhs.getImplementation()));
\
- } \
- bool HandleKind::operator< (HandleKind const & rhs) const \
- { \
- if (_impl == 0 || rhs.getImplementation() == 0)
\
- return false;
\
- else
\
- return ((*_impl)<(*rhs.getImplementation()));
\
- } \
- \
- /* Generate an encoded value that can be used to send */ \
- /* handles to other federates in updates or interactions. */ \
- VariableLengthData HandleKind::encode() const \
- { \
- return _impl->encode(); \
- } \
- \
- /* Alternate encode for directly filling a buffer */ \
- unsigned long HandleKind::encodedLength() const \
- { \
- return _impl->encodedLength(); \
- } \
- unsigned long HandleKind::encode( \
- void* buffer, unsigned long bufferSize) const \
- throw (CouldNotEncode) \
- { \
- return _impl->encode( buffer, bufferSize ); \
- } \
- \
- std::wstring HandleKind::toString() const \
- {
\
- if (_impl == NULL) return L"";
\
- std::wstring implStr = _impl->toString();
\
- std::wstringstream ss;
\
- ss << #HandleKind << "_" << implStr;
\
- return ss.str(); \
- } \
- \
- const HandleKind##Implementation* HandleKind::getImplementation() const
\
- { \
- return _impl; \
- } \
- \
- HandleKind##Implementation* HandleKind::getImplementation() \
- { \
- return _impl; \
- } \
- \
- /* Output operator for Handles */ \
- std::wostream & \
- operator << (std::wostream &str, HandleKind const &h) \
- { \
- return str; \
- } \
- /* end DECLARE_HANDLE_CLASS */
-
-DECLARE_HANDLE_CLASS(FederateHandle)
-DECLARE_HANDLE_CLASS(ObjectClassHandle)
-DECLARE_HANDLE_CLASS(InteractionClassHandle)
-DECLARE_HANDLE_CLASS(ObjectInstanceHandle)
-DECLARE_HANDLE_CLASS(AttributeHandle)
-DECLARE_HANDLE_CLASS(ParameterHandle)
-DECLARE_HANDLE_CLASS(DimensionHandle)
-DECLARE_HANDLE_CLASS(MessageRetractionHandle)
-DECLARE_HANDLE_CLASS(RegionHandle)
-
-} // end namespace rti1516
Index: RTI1516variableLengthDataImplementation.h
===================================================================
RCS file: RTI1516variableLengthDataImplementation.h
diff -N RTI1516variableLengthDataImplementation.h
--- RTI1516variableLengthDataImplementation.h 3 Mar 2014 15:18:21 -0000
1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,44 +0,0 @@
-#ifndef RTI_VariableLengthDataImplementation_h
-#define RTI_VariableLengthDataImplementation_h
-
-namespace rti1516
-{
- class VariableLengthDataImplementation
- {
- public:
- VariableLengthDataImplementation();
- // Caller is free to delete inData after the call
- VariableLengthDataImplementation(void const * inData, unsigned
long inSize);
- // Caller is free to delete rhs after the call
-
VariableLengthDataImplementation(VariableLengthDataImplementation const & rhs);
-
- ~VariableLengthDataImplementation();
-
- // Caller is free to delete rhs after the call
- VariableLengthDataImplementation &
- operator=(VariableLengthDataImplementation const & rhs);
-
- // Caller is free to delete inData after the call
- void setData(void const * inData, unsigned long inSize);
-
- // Caller is responsible for ensuring that the data that is
- // pointed to is valid for the lifetime of this object, or past
- // the next time this object is given new data.
- void setDataPointer(void* inData, unsigned long inSize);
-
- // Caller gives up ownership of inData to this object.
- // This object assumes the responsibility of deleting inData
- // when it is no longer needed.
- void takeDataPointer(void* inData, unsigned long inSize);
-
- void const *getData() { return _data; }
- unsigned long getSize() { return _size; }
-
- private:
- void *_data;
- unsigned long _size;
- bool _dataOwner;
- };
-}
-
-#endif // RTI_VariableLengthDataImplementation_h
Index: RTI1516ambassadorFactory.cpp
===================================================================
RCS file: RTI1516ambassadorFactory.cpp
diff -N RTI1516ambassadorFactory.cpp
--- RTI1516ambassadorFactory.cpp 3 Mar 2014 15:18:22 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,229 +0,0 @@
-//#include "RTI/RTI1516.h"
-
-#include <RTI/RTIambassadorFactory.h>
-#include <memory>
-#include <iostream>
-#include <cstdlib>
-#include <cerrno>
-#include <cstring>
-#ifndef _WIN32
-#include <csignal>
-#include <unistd.h>
-#endif
-
-#include "PrettyDebug.hh"
-#include "RTI1516ambassador.h"
-
-#include "M_Classes.hh"
-
-#include "config.h"
-
-rti1516::RTIambassadorFactory::RTIambassadorFactory()
-{
-}
-
-rti1516::RTIambassadorFactory::~RTIambassadorFactory()
-throw ()
-{
-}
-
-namespace {
- static PrettyDebug D1516("LIBRTI1516", __FILE__);
- static PrettyDebug G1516("GENDOC1516",__FILE__) ;
-}
-
-std::auto_ptr< rti1516::RTIambassador >
-rti1516::RTIambassadorFactory::createRTIambassador(std::vector< std::wstring >
& args)
-throw (BadInitializationParameter,
- RTIinternalError)
-{
- rti1516::RTI1516ambassador* p_ambassador(new
rti1516::RTI1516ambassador());
-
- std::auto_ptr< rti1516::RTIambassador > ap_ambassador(p_ambassador);
-
- G1516.Out(pdGendoc,"enter RTIambassador::RTIambassador");
- PrettyDebug::setFederateName( "LibRTI::UnjoinedFederate" );
- std::wstringstream msg;
-
- p_ambassador->privateRefs = new RTI1516ambPrivateRefs();
-
- 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))
- rtiaList.push_back(std::string(env));
- env = getenv("CERTI_HOME");
- if (env && strlen(env))
- rtiaList.push_back(std::string(env) + "/bin/rtia");
- rtiaList.push_back(PACKAGE_INSTALL_PREFIX "/bin/rtia");
- rtiaList.push_back("rtia");
-
-#if defined(RTIA_USE_TCP)
- int port = p_ambassador->privateRefs->socketUn->listenUN();
- if (port == -1) {
- D1516.Out( pdError, "Cannot listen to RTIA connection. Abort."
);
- throw rti1516::RTIinternalError(L"Cannot listen to RTIA
connection" );
- }
-#else
- int pipeFd = p_ambassador->privateRefs->socketUn->socketpair();
- if (pipeFd == -1) {
- D1516.Out( pdError, "Cannot get socketpair to RTIA connection.
Abort." );
- throw rti1516::RTIinternalError( L"Cannot get socketpair to
RTIA connection" );
- }
-#endif
-
-#ifdef _WIN32
- STARTUPINFO si;
- PROCESS_INFORMATION pi;
-
- ZeroMemory( &si, sizeof(si) );
- si.cb = sizeof(si);
- ZeroMemory( &pi, sizeof(pi) );
-
-#ifndef RTIA_CONSOLE_SHOW
- /*
- * Avoid displaying console window
- * when running RTIA.
- */
- si.dwFlags = STARTF_USESHOWWINDOW;
- si.wShowWindow = SW_HIDE;
-#endif
-
-#if !defined(RTIA_USE_TCP)
- SOCKET newPipeFd;
- if (!DuplicateHandle(GetCurrentProcess(),
- (HANDLE)pipeFd,
- GetCurrentProcess(),
- (HANDLE*)&newPipeFd,
- 0,
- TRUE, // Inheritable
- DUPLICATE_SAME_ACCESS)) {
- D1516.Out( pdError, "Cannot duplicate socket for RTIA
connection. Abort." );
- throw rti1516::RTIinternalError( L"Cannot duplicate
socket for RTIA connection. Abort." );
- }
-#endif
-
- bool success = false;
- for (unsigned i = 0; i < rtiaList.size(); ++i) {
- std::stringstream stream;
-#if defined(RTIA_USE_TCP)
- stream << rtiaList[i] << ".exe -p " << port;
-#else
- stream << rtiaList[i] << ".exe -f " << newPipeFd;
-#endif
-
- // Start the child process.
- if (CreateProcess( NULL, // No module name (use command line).
- (char*)stream.str().c_str(), // Command line.
- NULL, // Process
handle not inheritable.
- NULL, // Thread
handle not inheritable.
- TRUE, // Set handle
inheritance to TRUE.
- 0, // No creation
flags.
- NULL, // Use parent's
environment block.
- NULL, // Use parent's
starting directory.
- &si, // Pointer to
STARTUPINFO structure.
- &pi )) // Pointer to
PROCESS_INFORMATION structure.
- {
- success = true;
- break;
- }
- }
- if (!success) {
- msg << "CreateProcess - GetLastError()=<"
- << GetLastError() <<"> "
- << "Cannot connect to RTIA.exe";
- throw rti1516::RTIinternalError(msg.str());
- }
-
- p_ambassador->privateRefs->handle_RTIA = pi.hProcess;
-
-#if !defined(RTIA_USE_TCP)
- closesocket(pipeFd);
- closesocket(newPipeFd);
-#endif
-
-#else
-
- sigset_t nset, oset;
- // temporarily block termination signals
- // note: this is to prevent child processes from receiving termination
signals
- sigemptyset(&nset);
- sigaddset(&nset, SIGINT);
- sigprocmask(SIG_BLOCK, &nset, &oset);
-
- switch((p_ambassador->privateRefs->pid_RTIA = fork())) {
- case -1: // fork failed.
- perror("fork");
- // unbock the above blocked signals
- sigprocmask(SIG_SETMASK, &oset, NULL);
-#if !defined(RTIA_USE_TCP)
- close(pipeFd);
-#endif
- throw rti1516::RTIinternalError(wstringize() << "fork failed in
RTIambassador constructor");
- break ;
-
- case 0: // child process (RTIA).
- // close all open filedescriptors except the pipe one
- for (int fdmax = sysconf(_SC_OPEN_MAX), fd = 3; fd < fdmax;
++fd) {
-#if !defined(RTIA_USE_TCP)
- if (fd == pipeFd)
- continue;
-#endif
- close(fd);
- }
- for (unsigned i = 0; i < rtiaList.size(); ++i)
- {
- std::stringstream stream;
-#if defined(RTIA_USE_TCP)
- stream << port;
- execlp(rtiaList[i].c_str(), rtiaList[i].c_str(), "-p",
stream.str().c_str(), NULL);
-#else
- stream << pipeFd;
- execlp(rtiaList[i].c_str(), rtiaList[i].c_str(), "-f",
stream.str().c_str(), NULL);
-#endif
- }
- // unbock the above blocked signals
- sigprocmask(SIG_SETMASK, &oset, NULL);
- msg << "Could not launch RTIA process (execlp): "
- << strerror(errno)
- << std::endl
- << "Maybe RTIA is not in search PATH environment.";
- throw rti1516::RTIinternalError(msg.str().c_str());
-
- default: // father process (Federe).
- // unbock the above blocked signals
- sigprocmask(SIG_SETMASK, &oset, NULL);
-#if !defined(RTIA_USE_TCP)
- close(pipeFd);
-#endif
- break ;
- }
-#endif
-
-#if defined(RTIA_USE_TCP)
- if (p_ambassador->privateRefs->socketUn->acceptUN(10*1000) == -1) {
-#ifdef _WIN32
- TerminateProcess(p_ambassador->privateRefs->handle_RTIA, 0);
-#else
- kill(p_ambassador->privateRefs->pid_RTIA, SIGINT );
-#endif
- throw rti1516::RTIinternalError( wstringize() << "Cannot
connect to RTIA" );
- }
-#endif
-
- 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);
-
- G1516.Out(pdGendoc,"exit RTIambassador::RTIambassador");
-
- return ap_ambassador;
-}
-
-//} // end namespace rti1516
Index: RTI1516HandleImplementation.cpp
===================================================================
RCS file: RTI1516HandleImplementation.cpp
diff -N RTI1516HandleImplementation.cpp
--- RTI1516HandleImplementation.cpp 3 Mar 2014 15:18:21 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,281 +0,0 @@
-#include <RTI/Handle.h>
-#include <limits.h>
-#include <sstream>
-#include <cstring>
-#include "RTI1516HandleImplementation.h"
-
-namespace rti1516
-{
-
- /* Constructs an invalid handle */
- HandleImplementation::HandleImplementation()
- : _value(ULONG_MAX)
- {
- }
-
- HandleImplementation::HandleImplementation(VariableLengthData const &
encodedValue)
- : _value(ULONG_MAX)
- {
- ULong val = 0;
- const size_t size = sizeof(val);
- unsigned char buf[size];
-
- if (encodedValue.size() != size) {
- throw CouldNotDecode(L"Encoded value has an unexpected
size.");
- }
-
- memcpy(&val, encodedValue.data(), size);
- for(uint32_t i = 0; i < sizeof(val); i++)
- {
- buf[size-i-1] = (char) val & 0xFF;
- val = val >> 8;
- }
-
- //copy buffer to _value
- ULong newValue;
- memcpy(&newValue, buf, size);
- _value = newValue;
- }
-
- HandleImplementation::~HandleImplementation()
- throw()
- {
- }
-
- HandleImplementation::HandleImplementation(HandleImplementation const &
rhs)
- : _value(ULONG_MAX)
- {
- _value = rhs._value;
- }
-
- /* Indicates whether this handle is valid */
- bool HandleImplementation::isValid() const
- {
- if (_value == ULONG_MAX)
- return false;
- else
- return true;
- }
-
- /* Generate an encoded value that can be used to send */
- /* handles to other federates in updates or interactions. */
- VariableLengthData HandleImplementation::encode() const
- {
- unsigned char buf[sizeof(_value)];
- encode(buf, sizeof(_value));
- VariableLengthData c(buf, sizeof(_value));
- return c;
- }
-
- /* Alternate encode for directly filling a buffer */
- unsigned long HandleImplementation::encodedLength() const
- {
- return sizeof(_value);
- }
- unsigned long HandleImplementation::encode(
- void* buffer, unsigned long bufferSize) const
- throw (CouldNotEncode)
- {
- if (bufferSize < sizeof(_value))
- throw CouldNotEncode(L"Not enough room in buffer to
encode handle");
-
- unsigned long val = _value;
- char *buf = (char *) buffer;
- for(uint32_t i = 0; i < sizeof(_value); i++)
- {
- buf[sizeof(_value)-i-1] = (char) val & 0xFF;
- val = val >> 8;
- }
- return sizeof(_value);
- }
-
- std::wstring HandleImplementation::toString() const
- {
- std::wostringstream ost;
- ost << _value;
- return ost.str();
- }
-
-
-
-#define DECLARE_HANDLE_IMPLEMENTATION_CLASS(HIK) \
- \
- /* Constructs an invalid handle */ \
- HIK::HIK() \
- : HandleImplementation() \
- { \
- } \
- \
- HIK::HIK(VariableLengthData const & encodedValue) \
- : HandleImplementation(encodedValue) \
- { \
- \
- } \
- \
- HIK::~HIK() \
- throw() \
- { \
- } \
- \
- HIK::HIK(HIK const & rhs) \
- { \
- _value = rhs._value;
\
- } \
- \
- HIK & HIK::operator=(HIK const & rhs) \
- { \
- if (this != &rhs) \
- { \
- _value = rhs._value; \
- } \
- return *this; \
- } \
- \
- \
- /* All invalid handles are equivalent */ \
- bool HIK::operator==(HIK const & rhs) const \
- { \
- return _value == rhs._value; \
- } \
- bool HIK::operator!=(HIK const & rhs) const \
- { \
- return _value != rhs._value; \
- } \
- bool HIK::operator< (HIK const & rhs) const \
- { \
- return _value < rhs._value; \
- } \
- \
- /* end DECLARE_HANDLE_IMPLEMENTATION_CLASS */
-
-
-DECLARE_HANDLE_IMPLEMENTATION_CLASS(FederateHandleImplementation)
-DECLARE_HANDLE_IMPLEMENTATION_CLASS(ObjectClassHandleImplementation)
-DECLARE_HANDLE_IMPLEMENTATION_CLASS(InteractionClassHandleImplementation)
-DECLARE_HANDLE_IMPLEMENTATION_CLASS(ObjectInstanceHandleImplementation)
-DECLARE_HANDLE_IMPLEMENTATION_CLASS(AttributeHandleImplementation)
-DECLARE_HANDLE_IMPLEMENTATION_CLASS(ParameterHandleImplementation)
-DECLARE_HANDLE_IMPLEMENTATION_CLASS(DimensionHandleImplementation)
-//DECLARE_HANDLE_IMPLEMENTATION_CLASS(MessageRetractionHandleImplementation)
-DECLARE_HANDLE_IMPLEMENTATION_CLASS(RegionHandleImplementation)
-
-
-MessageRetractionHandleImplementation::MessageRetractionHandleImplementation()
-: HandleImplementation()
-{
-}
-
-MessageRetractionHandleImplementation::MessageRetractionHandleImplementation(MessageRetractionHandleImplementation
const & rhs)
-{
- _value = rhs._value;
-}
-
-MessageRetractionHandleImplementation::MessageRetractionHandleImplementation(VariableLengthData
const & encodedValue)
-{
- ULong val1 = 0;
- ULong val2 = 0;
- const size_t size = sizeof(val1);
- unsigned char buf1[size];
- unsigned char buf2[size];
-
- if (encodedValue.size() != 2*size) {
- throw CouldNotDecode(L"Encoded value has an unexpected size.");
- }
-
- memcpy(&val1, encodedValue.data(), size);
- memcpy(&val2, (ULong*)encodedValue.data() + 1 , size);
-
- // _value
- for(uint32_t i = 0; i < sizeof(val1); i++)
- {
- buf1[size-i-1] = (char) val1 & 0xFF;
- val1 = val1 >> 8;
- }
- //copy buf1 to _value
- ULong newValue;
- memcpy(&newValue, buf1, size);
- _value = newValue;
-
- // _serialNum
- for(uint32_t i = 0; i < sizeof(val2); i++)
- {
- buf2[size-i-1] = (char) val2 & 0xFF;
- val2 = val2 >> 8;
- }
- //copy buf2 to _serailNum
- ULong newSerialNum;
- memcpy(&newSerialNum, buf2, size);
- _serialNum = newSerialNum;
-}
-
-MessageRetractionHandleImplementation::~MessageRetractionHandleImplementation()
-throw()
-{
-}
-
-MessageRetractionHandleImplementation &
MessageRetractionHandleImplementation::operator=(MessageRetractionHandleImplementation
const & rhs)
-{
- if (this != &rhs) {
- _value = rhs._value;
- }
- return *this;
-}
-
-bool
MessageRetractionHandleImplementation::operator==(MessageRetractionHandleImplementation
const & rhs) const
-{
- bool isEqual = (_value == rhs._value) && (_serialNum == rhs._serialNum);
- return isEqual;
-}
-
-bool
MessageRetractionHandleImplementation::operator!=(MessageRetractionHandleImplementation
const & rhs) const
-{
- bool isEqual = (_value == rhs._value) && (_serialNum == rhs._serialNum);
- return !isEqual;
-}
-
-bool MessageRetractionHandleImplementation::operator<
(MessageRetractionHandleImplementation const & rhs) const
-{
- return _value < rhs._value;
-}
-
-/* Generate an encoded value that can be used to send */
-/* handles to other federates in updates or interactions. */
-VariableLengthData MessageRetractionHandleImplementation::encode() const
-{
- unsigned char buf[ sizeof(_value) + sizeof(_serialNum) ];
- encode(buf, sizeof(_value) + sizeof(_serialNum) );
- VariableLengthData c(buf, sizeof(_value) + sizeof(_serialNum) );
- return c;
-}
-
-/* Alternate encode for directly filling a buffer */
-unsigned long MessageRetractionHandleImplementation::encodedLength() const
-{
- return sizeof(_value) + sizeof(_serialNum);
-}
-
-unsigned long MessageRetractionHandleImplementation::encode(
-void* buffer, unsigned long bufferSize) const
-throw (CouldNotEncode)
-{
- if ( bufferSize < (sizeof(_value)+sizeof(_serialNum)) )
- throw CouldNotEncode(L"Not enough room in buffer to encode
handle");
-
- unsigned long val = _value;
- unsigned long serialNum = _serialNum;
- char *buf = (char *) buffer;
- for(uint32_t i = 0; i < sizeof(_value); i++)
- {
- buf[sizeof(_value)-i-1] = (char) val & 0xFF;
- val = val >> 8;
- }
- for(uint32_t i = 0; i < sizeof(_serialNum); i++)
- {
- buf[sizeof(_value)+sizeof(_serialNum)-i-1] = (char) serialNum &
0xFF;
- serialNum = serialNum >> 8;
- }
- return sizeof(_value) + sizeof(_serialNum);
-}
-
-
-} // end namespace rti1516
Index: RTI1516ambassador.cpp
===================================================================
RCS file: RTI1516ambassador.cpp
diff -N RTI1516ambassador.cpp
--- RTI1516ambassador.cpp 3 Mar 2014 15:18:21 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,2858 +0,0 @@
-#include "RTI1516ambassador.h"
-#include <RTI/RangeBounds.h>
-
-#ifndef _WIN32
-#include <cstdlib>
-#include <cstring>
-#endif
-
-#include "PrettyDebug.hh"
-
-#include "M_Classes.hh"
-#include "RTI1516HandleFactory.h"
-#include "RTI1516fedTime.h"
-
-#include <algorithm>
-
-namespace {
-
-static PrettyDebug D("LIBRTI", __FILE__);
-static PrettyDebug G("GENDOC",__FILE__) ;
-
-}
-
-namespace rti1516
-{
- /* Deletor Object */
- template <class T>
- struct Deletor {
- void operator() (T* e) {delete e;};
- };
-
- /* Helper functions */
- template<typename T>
- void
- RTI1516ambassador::assignPHVMAndExecuteService(const
rti1516::ParameterHandleValueMap &PHVM, T &req, T &rep) {
-
- 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);
- certi::ParameterValue_t paramValue;
- paramValue.resize(it->second.size());
- memcpy(&(paramValue[0]), it->second.data(),
it->second.size());
- req.setValues(paramValue, i);
- }
- privateRefs->executeService(&req, &rep);
- }
-
- template<typename T>
- void
- RTI1516ambassador::assignAHVMAndExecuteService(const
rti1516::AttributeHandleValueMap &AHVM, T &req, T &rep) {
-
- 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);
- certi::AttributeValue_t attrValue;
- attrValue.resize(it->second.size());
- memcpy(&(attrValue[0]), it->second.data(),
it->second.size());
- req.setValues(attrValue, i);
- }
- privateRefs->executeService(&req, &rep);
- }
-
- 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);
- }
- privateRefs->executeService(&req, &rep);
- }
-
- std::string varLengthDataAsString(VariableLengthData varLengthData) {
- std::string retVal( (char*)varLengthData.data(),
varLengthData.size() );
- return retVal;
- }
-
- certi::TransportType
toCertiTransportationType(rti1516::TransportationType theType) {
- return (theType == rti1516::RELIABLE) ? certi::RELIABLE :
certi::BEST_EFFORT;
- }
- rti1516::TransportationType
toRTI1516TransportationType(certi::TransportType theType) {
- return (theType == certi::RELIABLE) ? rti1516::RELIABLE :
rti1516::BEST_EFFORT;
- }
- certi::OrderType toCertiOrderType(rti1516::OrderType theType) {
- return (theType == rti1516::RECEIVE) ? certi::RECEIVE :
certi::TIMESTAMP;
- }
- rti1516::OrderType toRTI1516OrderType(certi::OrderType theType) {
- return (theType == certi::RECEIVE) ? rti1516::RECEIVE :
rti1516::TIMESTAMP;
- }
- /* end of Helper functions */
-
- RTIambassador::RTIambassador() throw()
- {
- }
-
- RTIambassador::~RTIambassador()
- {
- }
-
-
- RTI1516ambassador::RTI1516ambassador() throw()
- : privateRefs(0)
- {
- }
-
- RTI1516ambassador::~RTI1516ambassador()
- {
- certi::M_Close_Connexion req, rep ;
-
- G.Out(pdGendoc," ====>executeService CLOSE_CONNEXION");
- privateRefs->executeService(&req, &rep);
- // after the response is received, the privateRefs->socketUn
must not be used
-
- delete privateRefs;
- }
-
- //
----------------------------------------------------------------------------
- //! Generic callback evocation (CERTI extension).
- /*! Blocks up to "minimum" seconds until a callback delivery and then
evokes a
- * single callback.
- * @return true if additional callbacks pending, false otherwise
- */
- bool RTI1516ambassador::__tick_kernel(bool multiple, TickTime minimum,
TickTime maximum)
- throw (rti1516::SpecifiedSaveLabelDoesNotExist,
- rti1516::RTIinternalError)
- {
- 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);
-
- try {
-
vers_RTI.send(privateRefs->socketUn,privateRefs->msgBufSend);
- }
- catch (NetworkError &e) {
- 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);
- }
-
- // Read response(s) from the local RTIA until
Message::TICK_REQUEST is received.
- while (1) {
- try {
-
vers_Fed.reset(M_Factory::receive(privateRefs->socketUn));
- }
- catch (NetworkError &e) {
- std::stringstream msg;
- msg << "NetworkError in tick() while receiving
response: " << e._reason;
- std::wstring message(msg.str().begin(),
msg.str().end());
- throw RTIinternalError(message);
- }
-
- // 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.get());
- }
- return
static_cast<M_Tick_Request*>(vers_Fed.get())->getMultiple();
- }
-
- try {
- // Otherwise, the RTI calls a
FederateAmbassador service.
-
privateRefs->callFederateAmbassador(vers_Fed.get());
- }
- catch (RTIinternalError&) {
- // RTIA awaits TICK_REQUEST_NEXT, terminate the
tick() processing
- privateRefs->sendTickRequestStop();
- // ignore the response and re-throw the
original exception
- throw;
- }
-
- try {
- // Request next callback from the RTIA
- M_Tick_Request_Next tick_next;
- tick_next.send(privateRefs->socketUn,
privateRefs->msgBufSend);
- }
- catch (NetworkError &e) {
- std::stringstream msg;
- msg << "NetworkError in tick() while sending
TICK_REQUEST_NEXT: " << e._reason;
-
- std::wstring message(msg.str().begin(),
msg.str().end());
- throw RTIinternalError(message);
- }
- } // while(1)
- }
-
- // 4.2
- void RTI1516ambassador::createFederationExecution
- (std::wstring const & federationExecutionName,
- std::wstring const & fullPathNameToTheFDDfile,
- std::wstring const & logicalTimeImplementationName)
- throw (FederationExecutionAlreadyExists,
- CouldNotOpenFDD,
- ErrorReadingFDD,
- CouldNotCreateLogicalTimeFactory,
- RTIinternalError)
- {
- /* TODO */
- certi::M_Create_Federation_Execution req, rep ;
-
- G.Out(pdGendoc,"enter
RTI1516ambassador::createFederationExecution");
- std::string
federationExecutionNameAsString(federationExecutionName.begin(),
federationExecutionName.end());
- req.setFederationName(federationExecutionNameAsString);
-
- std::string
fullPathNameToTheFDDfileAsString(fullPathNameToTheFDDfile.begin(),
fullPathNameToTheFDDfile.end());
- req.setFEDid(fullPathNameToTheFDDfileAsString);
-
- /*#ifdef _WIN32
- if(!stricmp(FED,executionName)) {
- #else
- if(!strcasecmp(FED,exeName)) {
- #endif
- }*/
- G.Out(pdGendoc," ====>executeService
CREATE_FEDERATION_EXECUTION");
-
- privateRefs->executeService(&req, &rep);
-
- G.Out(pdGendoc,"exit
RTI1516ambassador::createFederationExecution");
-
- // TODO What to do with the 'logicalTimeImplementationName'?
Can't find it's use in SISO-STD-004.1-2004
- // Only exists in C++ interface.
- // Ignored for now.
- }
-
- // 4.3
- void RTI1516ambassador::destroyFederationExecution
- (std::wstring const & federationExecutionName)
- throw (FederatesCurrentlyJoined,
- FederationExecutionDoesNotExist,
- RTIinternalError)
- {
- M_Destroy_Federation_Execution req, rep ;
-
- G.Out(pdGendoc,"enter
RTI1516ambassador::destroyFederationExecution");
-
- std::string
federationExecutionNameAsString(federationExecutionName.begin(),
federationExecutionName.end());
- req.setFederationName(federationExecutionNameAsString);
-
- G.Out(pdGendoc," ====>executeService
DESTROY_FEDERATION_EXECUTION");
-
- privateRefs->executeService(&req, &rep);
-
- G.Out(pdGendoc,"exit
RTI1516ambassador::destroyFederationExecution");
- }
-
- // 4.4
- FederateHandle RTI1516ambassador::joinFederationExecution
- (std::wstring const & federateType,
- std::wstring const & federationExecutionName,
- FederateAmbassador & federateAmbassador)
- throw (FederateAlreadyExecutionMember,
- FederationExecutionDoesNotExist,
- SaveInProgress,
- RestoreInProgress,
- CouldNotCreateLogicalTimeFactory,
- RTIinternalError)
- {
- M_Join_Federation_Execution req, rep ;
-
- G.Out(pdGendoc,"enter
RTI1516ambassador::joinFederationExecution");
-
- if ( &federateType == NULL || federateType.length() <= 0 ) {
- throw RTIinternalError(L"Incorrect or empty federate
name");
- }
- std::string federateTypeAsString(federateType.begin(),
federateType.end());
-
- if ( &federationExecutionName == NULL ||
federationExecutionName.length() <= 0 )
- throw RTIinternalError(L"Incorrect or empty federation
name");
- std::string
federationExecutionNameAsString(federationExecutionName.begin(),
federationExecutionName.end());
-
- privateRefs->fed_amb = &federateAmbassador ;
-
- req.setFederateName(federateTypeAsString);
- req.setFederationName(federationExecutionNameAsString);
- G.Out(pdGendoc," ====>executeService
JOIN_FEDERATION_EXECUTION");
- privateRefs->executeService(&req, &rep);
- G.Out(pdGendoc,"exit
RTI1516ambassador::joinFederationExecution");
- PrettyDebug::setFederateName(
"LibRTI::"+std::string(federateTypeAsString));
-
- certi::FederateHandle certiFederateHandle = rep.getFederate();
- rti1516::FederateHandle rti1516FederateHandle =
rti1516::FederateHandleFriend::createRTI1516Handle(certiFederateHandle);
-
- return rti1516FederateHandle;
- }
-
- // 4.5
- void RTI1516ambassador::resignFederationExecution
- (ResignAction resignAction)
- throw (OwnershipAcquisitionPending,
- FederateOwnsAttributes,
- FederateNotExecutionMember,
- RTIinternalError)
- {
- 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);
- G.Out(pdGendoc," ====>executeService
RESIGN_FEDERATION_EXECUTION");
- privateRefs->executeService(&req, &rep);
- G.Out(pdGendoc,"exit
RTI1516ambassador::resignFederationExecution");
- }
-
- // 4.6
- void RTI1516ambassador::registerFederationSynchronizationPoint
- (std::wstring const & label,
- VariableLengthData const & theUserSuppliedTag)
- throw (FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- 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);
- // no federate set
- req.setFederateSetSize(0);
- if ( &theUserSuppliedTag == NULL || theUserSuppliedTag.data()
== NULL )
- {
- throw RTIinternalError (L"Calling
registerFederationSynchronizationPoint with Tag NULL");
- }
- req.setTag(varLengthDataAsString(theUserSuppliedTag));
- G.Out(pdGendoc," ====>executeService
REGISTER_FEDERATION_SYNCHRONIZATION_POINT");
- privateRefs->executeService(&req, &rep);
-
- G.Out(pdGendoc,"exit
RTI1516ambassador::registerFederationSynchronizationPoint for all federates");
- }
-
- void RTI1516ambassador::registerFederationSynchronizationPoint
- (std::wstring const & label,
- VariableLengthData const & theUserSuppliedTag,
- FederateHandleSet const & syncSet)
- throw (FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- 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);
- if ( &theUserSuppliedTag == NULL || theUserSuppliedTag.data()
== NULL )
- {
- throw RTIinternalError (L"Calling
registerFederationSynchronizationPoint with Tag NULL");
- }
- 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());
-
- uint32_t i = 0;
- for ( rti1516::FederateHandleSet::const_iterator it =
syncSet.begin(); it != syncSet.end(); it++, ++i)
- {
-
req.setFederateSet(FederateHandleFriend::toCertiHandle(*it),i);
- }
-
- G.Out(pdGendoc," ====>executeService
REGISTER_FEDERATION_SYNCHRONIZATION_POINT");
- privateRefs->executeService(&req, &rep);
-
- G.Out(pdGendoc,"exit
RTI1516ambassador::registerFederationSynchronizationPoint for some federates");
- }
-
- // 4.9
- void RTI1516ambassador::synchronizationPointAchieved
- (std::wstring const & label)
- throw (SynchronizationPointLabelNotAnnounced,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Synchronization_Point_Achieved req, rep ;
-
- G.Out(pdGendoc,"enter
RTI1516ambassador::synchronizationPointAchieved");
-
- std::string labelString(label.begin(), label.end());
- req.setLabel(labelString);
-
- G.Out(pdGendoc," ====>executeService
SYNCHRONIZATION_POINT_ACHIEVED");
- privateRefs->executeService(&req, &rep);
-
- G.Out(pdGendoc,"exit
RTI1516ambassador::synchronizationPointAchieved");
- }
-
- // 4.11
- void RTI1516ambassador::requestFederationSave
- (std::wstring const & label)
- throw (FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Request_Federation_Save req, rep ;
-
- G.Out(pdGendoc,"enter RTI1516ambassador::requestFederationSave
without time");
-
- std::string labelString(label.begin(), label.end());
- req.setLabel(labelString);
- G.Out(pdGendoc," ====>executeService
REQUEST_FEDERATION_SAVE");
-
- privateRefs->executeService(&req, &rep);
- G.Out(pdGendoc,"exit RTI1516ambassador::requestFederationSave
without time");
- }
-
- void RTI1516ambassador::requestFederationSave
- (std::wstring const & label,
- LogicalTime const & theTime)
- throw (LogicalTimeAlreadyPassed,
- InvalidLogicalTime,
- FederateUnableToUseTime,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- 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);
-
- std::string labelString(label.begin(), label.end());
- req.setLabel(labelString);
-
- G.Out(pdGendoc," ====>executeService
REQUEST_FEDERATION_SAVE");
- privateRefs->executeService(&req, &rep);
-
- G.Out(pdGendoc,"exit RTI1516ambassador::requestFederationSave
with time");
- }
-
- // 4.13
- void RTI1516ambassador::federateSaveBegun ()
- throw (SaveNotInitiated,
- FederateNotExecutionMember,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Federate_Save_Begun req, rep ;
-
- G.Out(pdGendoc,"enter RTI1516ambassador::federateSaveBegun");
-
- G.Out(pdGendoc," ====>executeService FEDERATE_SAVE_BEGUN");
- privateRefs->executeService(&req, &rep);
-
- G.Out(pdGendoc,"exit RTI1516ambassador::federateSaveBegun");
- }
-
- // 4.14
- void RTI1516ambassador::federateSaveComplete ()
- throw (FederateHasNotBegunSave,
- FederateNotExecutionMember,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Federate_Save_Complete req, rep ;
-
- G.Out(pdGendoc,"enter RTI1516ambassador::federateSaveComplete");
- G.Out(pdGendoc," ====>executeService
FEDERATE_SAVE_COMPLETE");
- privateRefs->executeService(&req, &rep);
- G.Out(pdGendoc,"exit RTI1516ambassador::federateSaveComplete");
- }
-
- void RTI1516ambassador::federateSaveNotComplete()
- throw (FederateHasNotBegunSave,
- FederateNotExecutionMember,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Federate_Save_Not_Complete req, rep ;
-
- G.Out(pdGendoc,"enter
RTI1516ambassador::federateSaveNotComplete");
- G.Out(pdGendoc," ====>executeService
FEDERATE_SAVE_NOT_COMPLETE");
- privateRefs->executeService(&req, &rep);
-
- G.Out(pdGendoc,"exit
RTI1516ambassador::federateSaveNotComplete");
- }
-
- // 4.16
- void RTI1516ambassador::queryFederationSaveStatus ()
- throw (FederateNotExecutionMember,
- RestoreInProgress,
- RTIinternalError)
- {
- /* TODO */
- throw RTIinternalError(L"Not yet implemented");
- }
-
- // 4.18
- void RTI1516ambassador::requestFederationRestore
- (std::wstring const & label)
- throw (FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Request_Federation_Restore req, rep ;
-
- G.Out(pdGendoc,"enter
RTI1516ambassador::requestFederationRestore");
- std::string labelString(label.begin(), label.end());
- req.setLabel(labelString);
- G.Out(pdGendoc," ====>executeService
REQUEST_FEDERATION_RESTORE");
- privateRefs->executeService(&req, &rep);
- G.Out(pdGendoc,"exit
RTI1516ambassador::requestFederationRestore");
- }
-
- // 4.22
- void RTI1516ambassador::federateRestoreComplete ()
- throw (RestoreNotRequested,
- FederateNotExecutionMember,
- SaveInProgress,
- RTIinternalError)
- {
- M_Federate_Restore_Complete req, rep ;
-
- G.Out(pdGendoc,"enter
RTI1516ambassador::federateRestoreComplete");
-
- G.Out(pdGendoc," ====>executeService
FEDERATE_RESTORE_COMPLETE");
- privateRefs->executeService(&req, &rep);
- G.Out(pdGendoc,"exit
RTI1516ambassador::federateRestoreComplete");
- }
-
- void RTI1516ambassador::federateRestoreNotComplete ()
- throw (RestoreNotRequested,
- FederateNotExecutionMember,
- SaveInProgress,
- RTIinternalError)
- {
- M_Federate_Restore_Not_Complete req, rep ;
-
- G.Out(pdGendoc,"enter
RTI1516ambassador::federateRestoreNotComplete");
- G.Out(pdGendoc," ====>executeService
FEDERATE_RESTORE_NOT_COMPLETE");
-
- privateRefs->executeService(&req, &rep);
- G.Out(pdGendoc,"exit
RTI1516ambassador::federateRestoreNotComplete");
- }
-
- // 4.24
- void RTI1516ambassador::queryFederationRestoreStatus ()
- throw (FederateNotExecutionMember,
- SaveInProgress,
- RTIinternalError)
- {
- /* TODO */
- throw RTIinternalError(L"Not yet implemented");
- }
-
- /////////////////////////////////////
- // Declaration Management Services //
- /////////////////////////////////////
-
- // 5.2
- void RTI1516ambassador::publishObjectClassAttributes
- (ObjectClassHandle theClass,
- rti1516::AttributeHandleSet const & attributeList)
- throw (ObjectClassNotDefined,
- AttributeNotDefined,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Publish_Object_Class req, rep ;
- G.Out(pdGendoc,"enter RTI1516ambassador::publishObjectClass");
-
- const certi::ObjectClassHandle objectClassHandle =
ObjectClassHandleFriend::toCertiHandle(theClass);
- req.setObjectClass(objectClassHandle);
-
- 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);
- }
- G.Out(pdGendoc," ====>executeService
PUBLISH_OBJECT_CLASS");
- privateRefs->executeService(&req, &rep);
- G.Out(pdGendoc,"exit RTI1516ambassador::publishObjectClass");
- }
-
- // 5.3
- void RTI1516ambassador::unpublishObjectClass
- (ObjectClassHandle theClass)
- throw (ObjectClassNotDefined,
- OwnershipAcquisitionPending,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Unpublish_Object_Class req, rep ;
- G.Out(pdGendoc,"enter RTI1516ambassador::unpublishObjectClass");
-
- const certi::ObjectClassHandle objectClassHandle =
ObjectClassHandleFriend::toCertiHandle(theClass);
- req.setObjectClass(objectClassHandle);
- G.Out(pdGendoc," ====>executeService
UNPUBLISH_OBJECT_CLASS");
- privateRefs->executeService(&req, &rep);
- G.Out(pdGendoc,"exit RTI1516ambassador::unpublishObjectClass");
- }
-
- void RTI1516ambassador::unpublishObjectClassAttributes
- (ObjectClassHandle theClass,
- AttributeHandleSet const & attributeList)
- throw (ObjectClassNotDefined,
- AttributeNotDefined,
- OwnershipAcquisitionPending,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- /* TODO */
- throw RTIinternalError(L"Not yet implemented");
- }
-
- // 5.4
- void RTI1516ambassador::publishInteractionClass
- (InteractionClassHandle theInteraction)
- throw (InteractionClassNotDefined,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Publish_Interaction_Class req, rep ;
- const certi::InteractionClassHandle classHandle =
InteractionClassHandleFriend::toCertiHandle(theInteraction);
- req.setInteractionClass(classHandle);
- G.Out(pdGendoc," ====>executeService
PUBLISH_INTERACTION_CLASS");
- privateRefs->executeService(&req, &rep);
- }
-
- // 5.5
- void RTI1516ambassador::unpublishInteractionClass
- (InteractionClassHandle theInteraction)
- throw (InteractionClassNotDefined,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Unpublish_Interaction_Class req, rep ;
- const certi::InteractionClassHandle classHandle =
InteractionClassHandleFriend::toCertiHandle(theInteraction);
- req.setInteractionClass(classHandle);
-
- privateRefs->executeService(&req, &rep);
- }
-
- // 5.6
- void RTI1516ambassador::subscribeObjectClassAttributes
- (ObjectClassHandle theClass,
- AttributeHandleSet const & attributeList,
- bool active)
- throw (ObjectClassNotDefined,
- AttributeNotDefined,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Subscribe_Object_Class_Attributes req, rep ;
- G.Out(pdGendoc,"enter
RTI1516ambassador::subscribeObjectClassAttributes");
-
- const certi::ObjectClassHandle objectClassHandle =
ObjectClassHandleFriend::toCertiHandle(theClass);
- req.setObjectClass(objectClassHandle);
-
- 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.setActive(active);
-
- privateRefs->executeService(&req, &rep);
- G.Out(pdGendoc,"exit
RTI1516ambassador::subscribeObjectClassAttributes");
- }
-
- // 5.7
- void RTI1516ambassador::unsubscribeObjectClass
- (ObjectClassHandle theClass)
- throw (ObjectClassNotDefined,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Unsubscribe_Object_Class req, rep ;
-
- const certi::ObjectClassHandle objectClassHandle =
ObjectClassHandleFriend::toCertiHandle(theClass);
- req.setObjectClass(objectClassHandle);
-
- privateRefs->executeService(&req, &rep);
- }
-
- void RTI1516ambassador::unsubscribeObjectClassAttributes
- (ObjectClassHandle theClass,
- AttributeHandleSet const & attributeList)
- throw (ObjectClassNotDefined,
- AttributeNotDefined,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- /* TODO */
- throw RTIinternalError(L"Not yet implemented");
- }
-
- // 5.8
- void RTI1516ambassador::subscribeInteractionClass
- (InteractionClassHandle theClass,
- bool active)
- throw (InteractionClassNotDefined,
- FederateServiceInvocationsAreBeingReportedViaMOM,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Subscribe_Interaction_Class req, rep ;
- const certi::InteractionClassHandle classHandle =
InteractionClassHandleFriend::toCertiHandle(theClass);
- req.setInteractionClass(classHandle);
-
- privateRefs->executeService(&req, &rep);
- }
-
- // 5.9
- void RTI1516ambassador::unsubscribeInteractionClass
- (InteractionClassHandle theClass)
- throw (InteractionClassNotDefined,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Unsubscribe_Interaction_Class req, rep ;
-
- const certi::InteractionClassHandle classHandle =
InteractionClassHandleFriend::toCertiHandle(theClass);
- req.setInteractionClass(classHandle);
-
- privateRefs->executeService(&req, &rep);
- }
-
- ////////////////////////////////
- // Object Management Services //
- ////////////////////////////////
-
- // 6.2
- void RTI1516ambassador::reserveObjectInstanceName
- (std::wstring const & theObjectInstanceName)
- throw (IllegalName,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Reserve_Object_Instance_Name req, rep;
-
- std::string objInstanceName(theObjectInstanceName.begin(),
theObjectInstanceName.end());
- req.setObjectName(objInstanceName);
- privateRefs->executeService(&req, &rep);
- }
-
- // 6.4
- ObjectInstanceHandle RTI1516ambassador::registerObjectInstance
- (ObjectClassHandle theClass)
- throw (ObjectClassNotDefined,
- ObjectClassNotPublished,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Register_Object_Instance req, rep ;
-
-
req.setObjectClass(rti1516::ObjectClassHandleFriend::toCertiHandle(theClass));
- privateRefs->executeService(&req, &rep);
- return
rti1516::ObjectInstanceHandleFriend::createRTI1516Handle(rep.getObject());
- }
-
- ObjectInstanceHandle RTI1516ambassador::registerObjectInstance
- (ObjectClassHandle theClass,
- std::wstring const & theObjectInstanceName)
- throw (ObjectClassNotDefined,
- ObjectClassNotPublished,
- ObjectInstanceNameNotReserved,
- ObjectInstanceNameInUse,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Register_Object_Instance req, rep ;
-
- std::string nameString(theObjectInstanceName.begin(),
theObjectInstanceName.end());
- req.setObjectName(nameString);
-
req.setObjectClass(rti1516::ObjectClassHandleFriend::toCertiHandle(theClass));
- privateRefs->executeService(&req, &rep);
-
- return
rti1516::ObjectInstanceHandleFriend::createRTI1516Handle(rep.getObject());
- }
-
- // 6.6
- void RTI1516ambassador::updateAttributeValues
- (ObjectInstanceHandle theObject,
- AttributeHandleValueMap const & theAttributeValues,
- VariableLengthData const & theUserSuppliedTag)
- throw (ObjectInstanceNotKnown,
- AttributeNotDefined,
- AttributeNotOwned,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- G.Out(pdGendoc,"enter RTI1516ambassador::updateAttributeValues
without time");
- M_Update_Attribute_Values req, rep ;
-
-
req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
- if ( &theUserSuppliedTag == NULL || theUserSuppliedTag.data()
== NULL)
- {
- throw RTIinternalError(L"Calling updateAttributeValues
with Tag NULL");
- }
-
- req.setTag(varLengthDataAsString(theUserSuppliedTag));
-
- assignAHVMAndExecuteService(theAttributeValues, req, rep);
-
- G.Out(pdGendoc,"exit RTI1516ambassador::updateAttributeValues
without time");
- }
-
- MessageRetractionHandle RTI1516ambassador::updateAttributeValues
- (ObjectInstanceHandle theObject,
- AttributeHandleValueMap const & theAttributeValues,
- VariableLengthData const & theUserSuppliedTag,
- LogicalTime const & theTime)
- throw (ObjectInstanceNotKnown,
- AttributeNotDefined,
- AttributeNotOwned,
- InvalidLogicalTime,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- G.Out(pdGendoc,"enter RTI1516ambassador::updateAttributeValues
with time");
- M_Update_Attribute_Values req, rep ;
-
-
req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
-
- certi::FederationTime
certiFedTime(certi_cast<RTI1516fedTime>()(theTime).getFedTime());
- req.setDate(certiFedTime);
-
- if ( &theUserSuppliedTag == NULL || theUserSuppliedTag.data()
== NULL)
- {
- throw RTIinternalError(L"Calling updateAttributeValues
with Tag NULL");
- }
-
- req.setTag(varLengthDataAsString(theUserSuppliedTag));
-
- assignAHVMAndExecuteService(theAttributeValues, req, rep);
-
- G.Out(pdGendoc,"return
RTI1516ambassador::updateAttributeValues with time");
- certi::FederateHandle certiHandle =
rep.getEventRetraction().getSendingFederate();
- uint64_t serialNum = rep.getEventRetraction().getSN();
- return
rti1516::MessageRetractionHandleFriend::createRTI1516Handle(certiHandle,
serialNum);
- }
-
- // 6.8
- void RTI1516ambassador::sendInteraction
- (InteractionClassHandle theInteraction,
- ParameterHandleValueMap const & theParameterValues,
- VariableLengthData const & theUserSuppliedTag)
- throw (InteractionClassNotPublished,
- InteractionClassNotDefined,
- InteractionParameterNotDefined,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Send_Interaction req, rep ;
-
- const certi::InteractionClassHandle classHandle =
InteractionClassHandleFriend::toCertiHandle(theInteraction);
- req.setInteractionClass(classHandle);
-
- if (&theUserSuppliedTag == NULL || theUserSuppliedTag.data() ==
NULL )
- {
- throw RTIinternalError (L"Calling sendIntercation with
Tag NULL") ;
- }
-
- req.setTag(varLengthDataAsString(theUserSuppliedTag));
- req.setRegion(0);
-
- assignPHVMAndExecuteService(theParameterValues, req, rep);
- }
-
- MessageRetractionHandle RTI1516ambassador::sendInteraction
- (InteractionClassHandle theInteraction,
- ParameterHandleValueMap const & theParameterValues,
- VariableLengthData const & theUserSuppliedTag,
- LogicalTime const & theTime)
- throw (InteractionClassNotPublished,
- InteractionClassNotDefined,
- InteractionParameterNotDefined,
- InvalidLogicalTime,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Send_Interaction req, rep ;
-
- const certi::InteractionClassHandle classHandle =
InteractionClassHandleFriend::toCertiHandle(theInteraction);
- req.setInteractionClass(classHandle);
-
- certi::FederationTime
certiFedTime(certi_cast<RTI1516fedTime>()(theTime).getFedTime());
- req.setDate(certiFedTime);
-
- if (&theUserSuppliedTag == NULL || theUserSuppliedTag.data() ==
NULL ) {
- throw RTIinternalError(L"Calling sendInteraction with
Tag NULL") ;
- }
-
- req.setTag(varLengthDataAsString(theUserSuppliedTag));
- req.setRegion(0);
-
- 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;
- }
-
- // 6.10
- void RTI1516ambassador::deleteObjectInstance
- (ObjectInstanceHandle theObject,
- VariableLengthData const & theUserSuppliedTag)
- throw (DeletePrivilegeNotHeld,
- ObjectInstanceNotKnown,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Delete_Object_Instance req, rep ;
-
-
req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
- if ( &theUserSuppliedTag == NULL || theUserSuppliedTag.data()
== NULL)
- {
- throw RTIinternalError(L"Calling deleteObjectInstance
with Tag NULL") ;
- }
-
- req.setTag(varLengthDataAsString(theUserSuppliedTag));
-
- privateRefs->executeService(&req, &rep);
- }
-
- MessageRetractionHandle RTI1516ambassador::deleteObjectInstance
- (ObjectInstanceHandle theObject,
- VariableLengthData const & theUserSuppliedTag,
- LogicalTime const & theTime)
- throw (DeletePrivilegeNotHeld,
- ObjectInstanceNotKnown,
- InvalidLogicalTime,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Delete_Object_Instance req, rep ;
-
-
req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
-
- certi::FederationTime
certiFedTime(certi_cast<RTI1516fedTime>()(theTime).getFedTime());
- req.setDate(certiFedTime);
-
- if ( &theUserSuppliedTag == NULL || theUserSuppliedTag.data()
== NULL)
- {
- throw RTIinternalError(L"Calling deleteObjectInstance
with Tag NULL") ;
- }
-
- req.setTag(varLengthDataAsString(theUserSuppliedTag));
-
- privateRefs->executeService(&req, &rep);
-
- certi::FederateHandle certiHandle =
rep.getEventRetraction().getSendingFederate();
- uint64_t serialNum = rep.getEventRetraction().getSN();
- return
rti1516::MessageRetractionHandleFriend::createRTI1516Handle(certiHandle,
serialNum);
- }
-
- // 6.12
- void RTI1516ambassador::localDeleteObjectInstance
- (ObjectInstanceHandle theObject)
- throw (ObjectInstanceNotKnown,
- FederateOwnsAttributes,
- OwnershipAcquisitionPending,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- throw RTIinternalError(L"unimplemented service
localDeleteObjectInstance");
- M_Local_Delete_Object_Instance req, rep ;
-
-
req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
- privateRefs->executeService(&req, &rep);
- }
-
- // 6.13
- void RTI1516ambassador::changeAttributeTransportationType
- (ObjectInstanceHandle theObject,
- AttributeHandleSet const & theAttributes,
- TransportationType theType)
- throw (ObjectInstanceNotKnown,
- AttributeNotDefined,
- AttributeNotOwned,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Change_Attribute_Transportation_Type req, rep ;
-
req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
- req.setTransportationType(toCertiTransportationType(theType));
-
- 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);
- }
-
- privateRefs->executeService(&req, &rep);
- }
-
- // 6.14
- void RTI1516ambassador::changeInteractionTransportationType
- (InteractionClassHandle theClass,
- TransportationType theType)
- throw (InteractionClassNotDefined,
- InteractionClassNotPublished,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Change_Interaction_Transportation_Type req, rep ;
-
-
req.setInteractionClass(rti1516::InteractionClassHandleFriend::toCertiHandle(theClass));
- req.setTransportationType(toCertiTransportationType(theType));
-
- privateRefs->executeService(&req, &rep);
- }
-
- // 6.17
- void RTI1516ambassador::requestAttributeValueUpdate
- (ObjectInstanceHandle theObject,
- AttributeHandleSet const & theAttributes,
- VariableLengthData const & theUserSuppliedTag)
- throw (ObjectInstanceNotKnown,
- AttributeNotDefined,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Request_Object_Attribute_Value_Update req, rep ;
-
- G.Out(pdGendoc,"enter
RTI1516ambassador::requestObjectAttributeValueUpdate");
-
req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
-
- size_t attr_num = theAttributes.size();
- 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.setTag(varLengthDataAsString(theUserSuppliedTag));
-
- privateRefs->executeService(&req, &rep);
- G.Out(pdGendoc,"exit
RTI1516ambassador::requestObjectAttributeValueUpdate");
- }
-
- void RTI1516ambassador::requestAttributeValueUpdate
- (ObjectClassHandle theClass,
- AttributeHandleSet const & theAttributes,
- VariableLengthData const & theUserSuppliedTag)
- throw (ObjectClassNotDefined,
- AttributeNotDefined,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Request_Class_Attribute_Value_Update req, rep ;
- G.Out(pdGendoc,"enter
RTI1516ambassador::requestClassAttributeValueUpdate");
-
req.setObjectClass(rti1516::ObjectClassHandleFriend::toCertiHandle(theClass));
-
- assignAHSAndExecuteService(theAttributes, req, rep);
-
- G.Out(pdGendoc,"exit
RTI1516ambassador::requestClassAttributeValueUpdate");
- }
-
- ///////////////////////////////////
- // Ownership Management Services //
- ///////////////////////////////////
- // 7.2
- void RTI1516ambassador::unconditionalAttributeOwnershipDivestiture
- (ObjectInstanceHandle theObject,
- AttributeHandleSet const & theAttributes)
- throw (ObjectInstanceNotKnown,
- AttributeNotDefined,
- AttributeNotOwned,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Unconditional_Attribute_Ownership_Divestiture req, rep ;
-
req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
-
- 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);
- }
-
- privateRefs->executeService(&req, &rep);
- }
-
- // 7.3
- void RTI1516ambassador::negotiatedAttributeOwnershipDivestiture
- (ObjectInstanceHandle theObject,
- AttributeHandleSet const & theAttributes,
- VariableLengthData const & theUserSuppliedTag)
- throw (ObjectInstanceNotKnown,
- AttributeNotDefined,
- AttributeNotOwned,
- AttributeAlreadyBeingDivested,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- 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.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);
- }
-
- privateRefs->executeService(&req, &rep);
- }
-
- // 7.6
- void RTI1516ambassador::confirmDivestiture
- (ObjectInstanceHandle theObject,
- AttributeHandleSet const & confirmedAttributes,
- VariableLengthData const & theUserSuppliedTag)
- throw (ObjectInstanceNotKnown,
- AttributeNotDefined,
- AttributeNotOwned,
- AttributeDivestitureWasNotRequested,
- NoAcquisitionPending,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- /* TODO */
- throw RTIinternalError(L"Not yet implemented");
- }
-
- // 7.8
- void RTI1516ambassador::attributeOwnershipAcquisition
- (ObjectInstanceHandle theObject,
- AttributeHandleSet const & desiredAttributes,
- VariableLengthData const & theUserSuppliedTag)
- throw (ObjectInstanceNotKnown,
- ObjectClassNotPublished,
- AttributeNotDefined,
- AttributeNotPublished,
- FederateOwnsAttributes,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Attribute_Ownership_Acquisition req, rep ;
-
-
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.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);
- }
-
- privateRefs->executeService(&req, &rep);
- }
-
- // 7.9
- void RTI1516ambassador::attributeOwnershipAcquisitionIfAvailable
- (ObjectInstanceHandle theObject,
- AttributeHandleSet const & desiredAttributes)
- throw (ObjectInstanceNotKnown,
- ObjectClassNotPublished,
- AttributeNotDefined,
- AttributeNotPublished,
- FederateOwnsAttributes,
- AttributeAlreadyBeingAcquired,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Attribute_Ownership_Acquisition_If_Available req, rep ;
-
-
req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
-
- 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);
- }
-
- privateRefs->executeService(&req, &rep);
- }
-
- // 7.12 (in RTI1.3 this function is called:
AttributeOwnershipReleaseResponse)
- void RTI1516ambassador::attributeOwnershipDivestitureIfWanted
- (ObjectInstanceHandle theObject,
- AttributeHandleSet const & theAttributes,
- AttributeHandleSet & theDivestedAttributes) // filled by RTI
- throw (ObjectInstanceNotKnown,
- AttributeNotDefined,
- AttributeNotOwned,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Attribute_Ownership_Release_Response req, rep ;
-
-
req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
-
- assignAHSAndExecuteService(theAttributes, req, rep);
-
- 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]));
- }
- }
-
- }
-
- // 7.13
- void RTI1516ambassador::cancelNegotiatedAttributeOwnershipDivestiture
- (ObjectInstanceHandle theObject,
- AttributeHandleSet const & theAttributes)
- throw (ObjectInstanceNotKnown,
- AttributeNotDefined,
- AttributeNotOwned,
- AttributeDivestitureWasNotRequested,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Cancel_Negotiated_Attribute_Ownership_Divestiture req, rep ;
-
-
req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
-
- 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);
- }
-
- privateRefs->executeService(&req, &rep);
- }
-
- // 7.14
- void RTI1516ambassador::cancelAttributeOwnershipAcquisition
- (ObjectInstanceHandle theObject,
- AttributeHandleSet const & theAttributes)
- throw (ObjectInstanceNotKnown,
- AttributeNotDefined,
- AttributeAlreadyOwned,
- AttributeAcquisitionWasNotRequested,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Cancel_Attribute_Ownership_Acquisition req, rep ;
-
-
req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
-
- 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);
- }
-
- privateRefs->executeService(&req, &rep);
- }
-
- // 7.16
- void RTI1516ambassador::queryAttributeOwnership
- (ObjectInstanceHandle theObject,
- AttributeHandle theAttribute)
- throw (ObjectInstanceNotKnown,
- AttributeNotDefined,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Query_Attribute_Ownership req, rep ;
-
-
req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
-
req.setAttribute(rti1516::AttributeHandleFriend::toCertiHandle(theAttribute));
-
- privateRefs->executeService(&req, &rep);
- }
-
- // 7.18
- bool RTI1516ambassador::isAttributeOwnedByFederate
- (ObjectInstanceHandle theObject,
- AttributeHandle theAttribute)
- throw (ObjectInstanceNotKnown,
- AttributeNotDefined,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Is_Attribute_Owned_By_Federate req, rep ;
-
-
req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
-
req.setAttribute(rti1516::AttributeHandleFriend::toCertiHandle(theAttribute));
-
- privateRefs->executeService(&req, &rep);
-
- return (rep.getTag() == "RTI_TRUE") ? true : false;
- }
-
- //////////////////////////////
- // Time Management Services //
- //////////////////////////////
-
- // 8.2
- void RTI1516ambassador::enableTimeRegulation
- (LogicalTimeInterval const & theLookahead)
- throw (TimeRegulationAlreadyEnabled,
- InvalidLookahead,
- InTimeAdvancingState,
- RequestForTimeRegulationPending,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Enable_Time_Regulation req, rep ;
-
-
//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
- 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
- void RTI1516ambassador::disableTimeRegulation ()
- throw (TimeRegulationIsNotEnabled,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Disable_Time_Regulation req, rep ;
-
- privateRefs->executeService(&req, &rep);
- }
-
- // 8.5
- void RTI1516ambassador::enableTimeConstrained ()
- throw (TimeConstrainedAlreadyEnabled,
- InTimeAdvancingState,
- RequestForTimeConstrainedPending,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Enable_Time_Constrained req, rep ;
- privateRefs->executeService(&req, &rep);
- }
-
- // 8.7
- void RTI1516ambassador::disableTimeConstrained ()
- throw (TimeConstrainedIsNotEnabled,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Disable_Time_Constrained req, rep ;
- privateRefs->executeService(&req, &rep);
- }
-
- // 8.8
- void RTI1516ambassador::timeAdvanceRequest
- (LogicalTime const & theTime)
- throw (InvalidLogicalTime,
- LogicalTimeAlreadyPassed,
- InTimeAdvancingState,
- RequestForTimeRegulationPending,
- RequestForTimeConstrainedPending,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Time_Advance_Request req, rep ;
-
- certi::FederationTime
certiFedTime(certi_cast<RTI1516fedTime>()(theTime).getFedTime());
- req.setDate(certiFedTime);
- privateRefs->executeService(&req, &rep);
- }
-
- // 8.9
- void RTI1516ambassador::timeAdvanceRequestAvailable
- (LogicalTime const & theTime)
- throw (InvalidLogicalTime,
- LogicalTimeAlreadyPassed,
- InTimeAdvancingState,
- RequestForTimeRegulationPending,
- RequestForTimeConstrainedPending,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Time_Advance_Request_Available req, rep ;
-
- certi::FederationTime
certiFedTime(certi_cast<RTI1516fedTime>()(theTime).getFedTime());
- req.setDate(certiFedTime);
-
- privateRefs->executeService(&req, &rep);
- }
-
- // 8.10
- void RTI1516ambassador::nextMessageRequest
- (LogicalTime const & theTime)
- throw (InvalidLogicalTime,
- LogicalTimeAlreadyPassed,
- InTimeAdvancingState,
- RequestForTimeRegulationPending,
- RequestForTimeConstrainedPending,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Next_Event_Request req, rep ;
-
- certi::FederationTime
certiFedTime(certi_cast<RTI1516fedTime>()(theTime).getFedTime());
- req.setDate(certiFedTime);
-
- privateRefs->executeService(&req, &rep);
- }
-
- // 8.11
- void RTI1516ambassador::nextMessageRequestAvailable
- (LogicalTime const & theTime)
- throw (InvalidLogicalTime,
- LogicalTimeAlreadyPassed,
- InTimeAdvancingState,
- RequestForTimeRegulationPending,
- RequestForTimeConstrainedPending,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Next_Event_Request_Available req, rep ;
-
- certi::FederationTime
certiFedTime(certi_cast<RTI1516fedTime>()(theTime).getFedTime());
- req.setDate(certiFedTime);
-
- privateRefs->executeService(&req, &rep);
- }
-
- // 8.12
- void RTI1516ambassador::flushQueueRequest
- (LogicalTime const & theTime)
- throw (InvalidLogicalTime,
- LogicalTimeAlreadyPassed,
- InTimeAdvancingState,
- RequestForTimeRegulationPending,
- RequestForTimeConstrainedPending,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- // JvY: Implementation copied from previous CERTI
implementation, including immediate throw.
- throw RTIinternalError(L"Unimplemented Service
flushQueueRequest");
- M_Flush_Queue_Request req, rep ;
-
- certi::FederationTime
certiFedTime(certi_cast<RTI1516fedTime>()(theTime).getFedTime());
- req.setDate(certiFedTime);
-
- privateRefs->executeService(&req, &rep);
- }
-
- // 8.14
- void RTI1516ambassador::enableAsynchronousDelivery ()
- throw (AsynchronousDeliveryAlreadyEnabled,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- // throw AsynchronousDeliveryAlreadyEnabled("Default value (non
HLA)");
-
- M_Enable_Asynchronous_Delivery req, rep ;
-
- privateRefs->executeService(&req, &rep);
- }
-
- // 8.15
- void RTI1516ambassador::disableAsynchronousDelivery ()
- throw (AsynchronousDeliveryAlreadyDisabled,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Disable_Asynchronous_Delivery req, rep ;
-
- privateRefs->executeService(&req, &rep);
- }
-
- // 8.16
- bool RTI1516ambassador::queryGALT (LogicalTime & theTime)
- throw (FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- //TODO JRE: goed testen! Is GALT wel precies het zelfde als
LBTS?
- M_Query_Lbts req, rep ;
-
- privateRefs->executeService(&req, &rep);
-
- //TODO JRE: goed testen of deze return value wel klopt!
- 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();
-
- return true;
- }
-
- // 8.17
- void RTI1516ambassador::queryLogicalTime (LogicalTime & theTime)
- throw (FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Query_Federate_Time req, rep ;
-
- privateRefs->executeService(&req, &rep);
-
- // JvY: TODO Controleren of dit blijft werken met andere
tijdsimplementaties
- certi_cast<RTI1516fedTime>()(theTime) = rep.getDate().getTime();
- }
-
- // 8.18
- bool RTI1516ambassador::queryLITS (LogicalTime & theTime)
- throw (FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- //TODO JRE: goed testen! Is LITS wel precies het zelfde als
QueryMinNextEventTime?
- M_Query_Min_Next_Event_Time req, rep ;
-
- privateRefs->executeService(&req, &rep);
-
- //TODO JRE: goed testen of deze return value wel klopt!
- 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();
-
- return true;
- }
-
- // 8.19
- void RTI1516ambassador::modifyLookahead
- (LogicalTimeInterval const & theLookahead)
- throw (TimeRegulationIsNotEnabled,
- InvalidLookahead,
- InTimeAdvancingState,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- /* TODO */
- throw RTIinternalError(L"Not yet implemented");
- }
-
- // 8.20
- void RTI1516ambassador::queryLookahead (LogicalTimeInterval & interval)
- throw (TimeRegulationIsNotEnabled,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- /* TODO */
- throw RTIinternalError(L"Not yet implemented");
- }
-
- // 8.21
- void RTI1516ambassador::retract
- (MessageRetractionHandle theHandle)
- throw (InvalidRetractionHandle,
- TimeRegulationIsNotEnabled,
- MessageCanNoLongerBeRetracted,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- throw RTIinternalError(L"Unimplemented Service retract");
- M_Retract req, rep ;
-
- certi::EventRetraction event =
rti1516::MessageRetractionHandleFriend::createEventRetraction(theHandle);
- req.setEventRetraction(event);
-
- privateRefs->executeService(&req, &rep);
- }
-
- // 8.23
- void RTI1516ambassador::changeAttributeOrderType
- (ObjectInstanceHandle theObject,
- AttributeHandleSet const & theAttributes,
- OrderType theType)
- throw (ObjectInstanceNotKnown,
- AttributeNotDefined,
- AttributeNotOwned,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Change_Attribute_Order_Type req, rep ;
-
-
req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
- req.setOrder(rti1516::toCertiOrderType(theType));
-
- assignAHSAndExecuteService(theAttributes, req, rep);
- }
-
- // 8.24
- void RTI1516ambassador::changeInteractionOrderType
- (InteractionClassHandle theClass,
- OrderType theType)
- throw (InteractionClassNotDefined,
- InteractionClassNotPublished,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Change_Interaction_Order_Type req, rep ;
-
-
req.setInteractionClass(rti1516::InteractionClassHandleFriend::toCertiHandle(theClass));
- req.setOrder(rti1516::toCertiOrderType(theType));
-
- privateRefs->executeService(&req, &rep);
- }
-
- //////////////////////////////////
- // Data Distribution Management //
- //////////////////////////////////
-
- // 9.2
- RegionHandle RTI1516ambassador::createRegion
- (DimensionHandleSet const & theDimensions)
- throw (InvalidDimensionHandle,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- /* TODO */
- throw RTIinternalError(L"Not yet implemented");
- }
-
- // 9.3
- void RTI1516ambassador::commitRegionModifications
- (RegionHandleSet const & theRegionHandleSet)
- throw (InvalidRegion,
- RegionNotCreatedByThisFederate,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- /* TODO */
- throw RTIinternalError(L"Not yet implemented");
- }
-
- // 9.4
- void RTI1516ambassador::deleteRegion
- (RegionHandle theRegion)
- throw (InvalidRegion,
- RegionNotCreatedByThisFederate,
- RegionInUseForUpdateOrSubscription,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- /* TODO */
- throw RTIinternalError(L"Not yet implemented");
- }
-
- // 9.5
- ObjectInstanceHandle
RTI1516ambassador::registerObjectInstanceWithRegions
- (ObjectClassHandle theClass,
- AttributeHandleSetRegionHandleSetPairVector const &
- theAttributeHandleSetRegionHandleSetPairVector)
- throw (ObjectClassNotDefined,
- ObjectClassNotPublished,
- AttributeNotDefined,
- AttributeNotPublished,
- InvalidRegion,
- RegionNotCreatedByThisFederate,
- InvalidRegionContext,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- /* TODO */
- throw RTIinternalError(L"Not yet implemented");
- }
-
- ObjectInstanceHandle
RTI1516ambassador::registerObjectInstanceWithRegions
- (ObjectClassHandle theClass,
- AttributeHandleSetRegionHandleSetPairVector const &
- theAttributeHandleSetRegionHandleSetPairVector,
- std::wstring const & theObjectInstanceName)
- throw (ObjectClassNotDefined,
- ObjectClassNotPublished,
- AttributeNotDefined,
- AttributeNotPublished,
- InvalidRegion,
- RegionNotCreatedByThisFederate,
- InvalidRegionContext,
- ObjectInstanceNameNotReserved,
- ObjectInstanceNameInUse,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- /* TODO */
- throw RTIinternalError(L"Not yet implemented");
- }
-
- // 9.6
- void RTI1516ambassador::associateRegionsForUpdates
- (ObjectInstanceHandle theObject,
- AttributeHandleSetRegionHandleSetPairVector const &
- theAttributeHandleSetRegionHandleSetPairVector)
- throw (ObjectInstanceNotKnown,
- AttributeNotDefined,
- InvalidRegion,
- RegionNotCreatedByThisFederate,
- InvalidRegionContext,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- /* TODO */
- throw RTIinternalError(L"Not yet implemented");
- }
-
- // 9.7
- void RTI1516ambassador::unassociateRegionsForUpdates
- (ObjectInstanceHandle theObject,
- AttributeHandleSetRegionHandleSetPairVector const &
- theAttributeHandleSetRegionHandleSetPairVector)
- throw (ObjectInstanceNotKnown,
- AttributeNotDefined,
- InvalidRegion,
- RegionNotCreatedByThisFederate,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- /* TODO */
- throw RTIinternalError(L"Not yet implemented");
- }
-
- // 9.8
- void RTI1516ambassador::subscribeObjectClassAttributesWithRegions
- (ObjectClassHandle theClass,
- AttributeHandleSetRegionHandleSetPairVector const &
- theAttributeHandleSetRegionHandleSetPairVector,
- bool active)
- throw (ObjectClassNotDefined,
- AttributeNotDefined,
- InvalidRegion,
- RegionNotCreatedByThisFederate,
- InvalidRegionContext,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- /* TODO */
- throw RTIinternalError(L"Not yet implemented");
- }
-
- // 9.9
- void RTI1516ambassador::unsubscribeObjectClassAttributesWithRegions
- (ObjectClassHandle theClass,
- AttributeHandleSetRegionHandleSetPairVector const &
- theAttributeHandleSetRegionHandleSetPairVector)
- throw (ObjectClassNotDefined,
- AttributeNotDefined,
- InvalidRegion,
- RegionNotCreatedByThisFederate,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- /* TODO */
- throw RTIinternalError(L"Not yet implemented");
- }
-
- // 9.10
- void RTI1516ambassador::subscribeInteractionClassWithRegions
- (InteractionClassHandle theClass,
- RegionHandleSet const & theRegionHandleSet,
- bool active)
- throw (InteractionClassNotDefined,
- InvalidRegion,
- RegionNotCreatedByThisFederate,
- InvalidRegionContext,
- FederateServiceInvocationsAreBeingReportedViaMOM,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- /* TODO */
- throw RTIinternalError(L"Not yet implemented");
- }
-
- // 9.11
- void RTI1516ambassador::unsubscribeInteractionClassWithRegions
- (InteractionClassHandle theClass,
- RegionHandleSet const & theRegionHandleSet)
- throw (InteractionClassNotDefined,
- InvalidRegion,
- RegionNotCreatedByThisFederate,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- /* TODO */
- throw RTIinternalError(L"Not yet implemented");
- }
-
- // 9.12
- void RTI1516ambassador::sendInteractionWithRegions
- (InteractionClassHandle theInteraction,
- ParameterHandleValueMap const & theParameterValues,
- RegionHandleSet const & theRegionHandleSet,
- VariableLengthData const & theUserSuppliedTag)
- throw (InteractionClassNotDefined,
- InteractionClassNotPublished,
- InteractionParameterNotDefined,
- InvalidRegion,
- RegionNotCreatedByThisFederate,
- InvalidRegionContext,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- /* TODO */
- throw RTIinternalError(L"Not yet implemented");
- }
-
- MessageRetractionHandle RTI1516ambassador::sendInteractionWithRegions
- (InteractionClassHandle theInteraction,
- ParameterHandleValueMap const & theParameterValues,
- RegionHandleSet const & theRegionHandleSet,
- VariableLengthData const & theUserSuppliedTag,
- LogicalTime const & theTime)
- throw (InteractionClassNotDefined,
- InteractionClassNotPublished,
- InteractionParameterNotDefined,
- InvalidRegion,
- RegionNotCreatedByThisFederate,
- InvalidRegionContext,
- InvalidLogicalTime,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- /* TODO */
- throw RTIinternalError(L"Not yet implemented");
- }
-
- // 9.13
- void RTI1516ambassador::requestAttributeValueUpdateWithRegions
- (ObjectClassHandle theClass,
- AttributeHandleSetRegionHandleSetPairVector const & theSet,
- VariableLengthData const & theUserSuppliedTag)
- throw (ObjectClassNotDefined,
- AttributeNotDefined,
- InvalidRegion,
- RegionNotCreatedByThisFederate,
- InvalidRegionContext,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- /* TODO */
- throw RTIinternalError(L"Not yet implemented");
- }
-
- //////////////////////////
- // RTI Support Services //
- //////////////////////////
-
- // 10.2
- ObjectClassHandle RTI1516ambassador::getObjectClassHandle
- (std::wstring const & theName)
- throw (NameNotFound,
- FederateNotExecutionMember,
- RTIinternalError)
- {
- M_Get_Object_Class_Handle req, rep ;
-
- G.Out(pdGendoc,"enter RTI1516ambassador::getObjectClassHandle");
-
- std::string nameAsString(theName.begin(), theName.end());
- req.setClassName(nameAsString);
- privateRefs->executeService(&req, &rep);
-
- G.Out(pdGendoc,"exit RTI1516ambassador::getObjectClassHandle");
- rti1516::ObjectClassHandle rti1516Handle =
ObjectClassHandleFriend::createRTI1516Handle(rep.getObjectClass());
-
- return rti1516Handle;
- }
-
- // 10.3
- std::wstring RTI1516ambassador::getObjectClassName
- (ObjectClassHandle theHandle)
- throw (InvalidObjectClassHandle,
- FederateNotExecutionMember,
- RTIinternalError)
- {
- M_Get_Object_Class_Name req, rep ;
-
- certi::ObjectClassHandle certiHandle =
ObjectClassHandleFriend::toCertiHandle(theHandle);
- req.setObjectClass(certiHandle);
- try {
- privateRefs->executeService(&req, &rep);
- } catch (rti1516::ObjectClassNotDefined &e)
- {
- throw rti1516::InvalidObjectClassHandle(e.what());
- }
-
- std::string nameString = rep.getClassName();
- std::wstring nameWString(nameString.begin(), nameString.end());
-
- //return hla_strdup(rep.getClassName());
- return nameWString;
- }
-
- // 10.4
- AttributeHandle RTI1516ambassador::getAttributeHandle
- (ObjectClassHandle whichClass,
- std::wstring const & theAttributeName)
- throw (InvalidObjectClassHandle,
- NameNotFound,
- FederateNotExecutionMember,
- RTIinternalError)
- {
- G.Out(pdGendoc,"enter
RTI::RTI1516ambassador::getAttributeHandle");
- M_Get_Attribute_Handle req, rep ;
-
- std::string nameAsString(theAttributeName.begin(),
theAttributeName.end());
- req.setAttributeName(nameAsString);
-
req.setObjectClass(rti1516::ObjectClassHandleFriend::toCertiHandle(whichClass));
-
- try {
- privateRefs->executeService(&req, &rep);
- } catch (rti1516::ObjectClassNotDefined &e)
- {
- if ( ! whichClass.isValid() ) {
- throw
rti1516::InvalidObjectClassHandle(e.what());
- } else {
- throw rti1516::NameNotFound(e.what());
- }
- }
-
-
-
- G.Out(pdGendoc,"exit
RTI::RTI1516ambassador::getAttributeHandle");
- return
rti1516::AttributeHandleFriend::createRTI1516Handle(rep.getAttribute());
- }
-
- // 10.5
- std::wstring RTI1516ambassador::getAttributeName
- (ObjectClassHandle whichClass,
- AttributeHandle theHandle)
- throw (InvalidObjectClassHandle,
- InvalidAttributeHandle,
- AttributeNotDefined,
- FederateNotExecutionMember,
- RTIinternalError)
- {
- M_Get_Attribute_Name req, rep ;
-
-
req.setAttribute(rti1516::AttributeHandleFriend::toCertiHandle(theHandle));
-
req.setObjectClass(rti1516::ObjectClassHandleFriend::toCertiHandle(whichClass));
- try {
- privateRefs->executeService(&req, &rep);
- } catch (rti1516::ObjectClassNotDefined &e)
- {
- if ( !whichClass.isValid() )
- {
- throw
rti1516::InvalidObjectClassHandle(e.what());
- } else
- {
- throw;
- }
- } catch ( rti1516::AttributeNotDefined &e)
- {
- if (! theHandle.isValid() )
- {
- throw rti1516::InvalidAttributeHandle(e.what());
- } else
- {
- throw;
- }
- }
-
- //return hla_strdup(rep.getAttributeName());
-
- std::string nameString = rep.getAttributeName();
- std::wstring nameWString(nameString.begin(), nameString.end());
-
- return nameWString;
- }
-
- // 10.6
- InteractionClassHandle RTI1516ambassador::getInteractionClassHandle
- (std::wstring const & theName)
- throw (NameNotFound,
- FederateNotExecutionMember,
- RTIinternalError)
- {
- M_Get_Interaction_Class_Handle req, rep ;
- std::string nameString(theName.begin(), theName.end());
- req.setClassName(nameString);
-
- privateRefs->executeService(&req, &rep);
-
- return
rti1516::InteractionClassHandleFriend::createRTI1516Handle(rep.getInteractionClass());
- }
-
- // 10.7
- std::wstring RTI1516ambassador::getInteractionClassName
- (InteractionClassHandle theHandle)
- throw (InvalidInteractionClassHandle,
- FederateNotExecutionMember,
- RTIinternalError)
- {
- M_Get_Interaction_Class_Name req, rep ;
-
req.setInteractionClass(rti1516::InteractionClassHandleFriend::toCertiHandle(theHandle));
- try {
- privateRefs->executeService(&req, &rep);
- } catch (rti1516::InteractionClassNotDefined &e)
- {
- if ( !theHandle.isValid() )
- {
- throw
rti1516::InvalidInteractionClassHandle(e.what());
- } else
- {
- throw;
- }
- }
-
- //return hla_strdup(rep.getClassName());
- std::string nameString = rep.getClassName();
- std::wstring nameWString(nameString.begin(), nameString.end());
-
- return nameWString;
- }
-
- // 10.8
- ParameterHandle RTI1516ambassador::getParameterHandle
- (InteractionClassHandle whichClass,
- std::wstring const & theName)
- throw (InvalidInteractionClassHandle,
- NameNotFound,
- FederateNotExecutionMember,
- RTIinternalError)
- {
- M_Get_Parameter_Handle req, rep ;
- std::string nameString(theName.begin(), theName.end());
- req.setParameterName(nameString);
-
req.setInteractionClass(rti1516::InteractionClassHandleFriend::toCertiHandle(whichClass));
-
- try {
- privateRefs->executeService(&req, &rep);
- } catch (rti1516::InteractionClassNotDefined &e)
- {
- if ( !whichClass.isValid() )
- {
- throw
rti1516::InvalidInteractionClassHandle(e.what());
- } else
- {
- throw;
- }
- }
-
- return
rti1516::ParameterHandleFriend::createRTI1516Handle(rep.getParameter());
- }
-
- // 10.9
- std::wstring RTI1516ambassador::getParameterName
- (InteractionClassHandle whichClass,
- ParameterHandle theHandle)
- throw (InvalidInteractionClassHandle,
- InvalidParameterHandle,
- InteractionParameterNotDefined,
- FederateNotExecutionMember,
- RTIinternalError)
- {
- M_Get_Parameter_Name req, rep ;
-
-
req.setParameter(rti1516::ParameterHandleFriend::toCertiHandle(theHandle));
-
req.setInteractionClass(rti1516::InteractionClassHandleFriend::toCertiHandle(whichClass));
-
- try {
- privateRefs->executeService(&req, &rep);
- } catch (rti1516::InteractionClassNotDefined &e)
- {
- if ( !whichClass.isValid() )
- {
- throw
rti1516::InvalidInteractionClassHandle(e.what());
- } else
- {
- throw;
- }
- }
-
- //return hla_strdup(rep.getParameterName());
- std::string nameString = rep.getParameterName();
- std::wstring nameWString(nameString.begin(), nameString.end());
-
- return nameWString;
- }
-
- // 10.10
- ObjectInstanceHandle RTI1516ambassador::getObjectInstanceHandle
- (std::wstring const & theName)
- throw (ObjectInstanceNotKnown,
- FederateNotExecutionMember,
- RTIinternalError)
- {
- M_Get_Object_Instance_Handle req, rep ;
- std::string nameString(theName.begin(), theName.end());
- req.setObjectInstanceName(nameString);
-
- privateRefs->executeService(&req, &rep);
- return
rti1516::ObjectInstanceHandleFriend::createRTI1516Handle(rep.getObject());
- }
-
- // 10.11
- std::wstring RTI1516ambassador::getObjectInstanceName
- (ObjectInstanceHandle theHandle)
- throw (ObjectInstanceNotKnown,
- FederateNotExecutionMember,
- RTIinternalError)
- {
- 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::wstring nameWString(nameString.begin(), nameString.end());
-
- return nameWString;
- }
-
- // 10.12
- DimensionHandle RTI1516ambassador::getDimensionHandle
- (std::wstring const & theName)
- throw (NameNotFound,
- FederateNotExecutionMember,
- RTIinternalError)
- {
- 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???
- privateRefs->executeService(&req, &rep);
- return
rti1516::DimensionHandleFriend::createRTI1516Handle(rep.getDimension());
- }
-
- // 10.13
- std::wstring RTI1516ambassador::getDimensionName
- (DimensionHandle theHandle)
- throw (InvalidDimensionHandle,
- FederateNotExecutionMember,
- RTIinternalError)
- {
- M_Get_Dimension_Name 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::wstring nameWString(nameString.begin(), nameString.end());
-
- return nameWString;
- }
-
- // 10.14
- unsigned long RTI1516ambassador::getDimensionUpperBound
- (DimensionHandle theHandle)
- throw (InvalidDimensionHandle,
- FederateNotExecutionMember,
- RTIinternalError)
- {
- /* TODO */
- throw RTIinternalError(L"Not yet implemented");
- }
-
- // 10.15
- DimensionHandleSet
RTI1516ambassador::getAvailableDimensionsForClassAttribute
- (ObjectClassHandle theClass,
- AttributeHandle theHandle)
- throw (InvalidObjectClassHandle,
- InvalidAttributeHandle,
- AttributeNotDefined,
- FederateNotExecutionMember,
- RTIinternalError)
- {
- M_Get_Attribute_Space_Handle req, 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 address@hidden
- //return rep.getSpace();
- DimensionHandleSet invalidSet;
- return invalidSet;
- }
-
- // 10.16
- ObjectClassHandle RTI1516ambassador::getKnownObjectClassHandle
- (ObjectInstanceHandle theObject)
- throw (ObjectInstanceNotKnown,
- FederateNotExecutionMember,
- RTIinternalError)
- {
- M_Get_Object_Class req, rep ;
-
-
req.setObject(rti1516::ObjectInstanceHandleFriend::toCertiHandle(theObject));
- privateRefs->executeService(&req, &rep);
- return
rti1516::ObjectClassHandleFriend::createRTI1516Handle(rep.getObjectClass());
- }
-
- // 10.17
- DimensionHandleSet
RTI1516ambassador::getAvailableDimensionsForInteractionClass
- (InteractionClassHandle theClass)
- throw (InvalidInteractionClassHandle,
- FederateNotExecutionMember,
- RTIinternalError)
- {
- M_Get_Interaction_Space_Handle req, rep ;
-
-
req.setInteractionClass(rti1516::InteractionClassHandleFriend::toCertiHandle(theClass));
- this->privateRefs->executeService(&req, &rep);
-
- //JRE TODO: Use space handle to to get the address@hidden
- //return rep.getSpace();
- DimensionHandleSet invalidSet;
- return invalidSet;
- }
-
- // 10.18
- TransportationType RTI1516ambassador::getTransportationType
- (std::wstring const & transportationName)
- throw (InvalidTransportationName,
- FederateNotExecutionMember,
- RTIinternalError)
- {
- M_Get_Transportation_Handle req, rep ;
- std::string nameString(transportationName.begin(),
transportationName.end());
- req.setTransportationName(nameString);
- privateRefs->executeService(&req, &rep);
-
- return
rti1516::toRTI1516TransportationType(rep.getTransportation());
- }
-
- // 10.19
- std::wstring RTI1516ambassador::getTransportationName
- (TransportationType transportationType)
- throw (InvalidTransportationType,
- FederateNotExecutionMember,
- RTIinternalError)
- {
- M_Get_Transportation_Name req, rep ;
-
-
req.setTransportation(rti1516::toCertiTransportationType(transportationType));
- privateRefs->executeService(&req, &rep);
-
- //return hla_strdup(rep.getTransportationName());
- std::string nameString = rep.getTransportationName();
- std::wstring nameWString(nameString.begin(), nameString.end());
-
- return nameWString;
- }
-
- // 10.20
- OrderType RTI1516ambassador::getOrderType
- (std::wstring const & orderName)
- throw (InvalidOrderName,
- FederateNotExecutionMember,
- RTIinternalError)
- {
- M_Get_Ordering_Handle req, rep ;
-
- std::string nameAsString(orderName.begin(), orderName.end());
- req.setOrderingName(nameAsString);
- privateRefs->executeService(&req, &rep);
-
- return rti1516::toRTI1516OrderType(rep.getOrdering());
- }
-
- // 10.21
- std::wstring RTI1516ambassador::getOrderName
- (OrderType orderType)
- throw (InvalidOrderType,
- FederateNotExecutionMember,
- RTIinternalError)
- {
- M_Get_Ordering_Name req, rep ;
-
- req.setOrdering(rti1516::toCertiOrderType(orderType));
- privateRefs->executeService(&req, &rep);
-
- //return hla_strdup(rep.getOrderingName());
- std::string nameString = rep.getOrderingName();
- std::wstring nameWString(nameString.begin(), nameString.end());
-
- return nameWString;
- }
-
- // 10.22
- /**
- * Sets the ClassRelevanceAdvisory (CRA) switch to true. The switch
- * state is hold on the RTIG side. That's why the message
- * ENABLE_CLASS_RELEVANCE_ADVISORY_SWITCH
- * is transmitted to RTIA. RTIA transmits the message towards RTIG.
- *
- * By default, the CRA switch is true. This causes a delivery of the
- * federate service startRegistrationForObjectClass to a publisher
- * if there are any new subscribers for the federates published object
- * classes. If there are no more subscribers a publisher gets the
- * federate service stopRegistrationForObjectClass.
- *
- * By disabling the CRA switch the federate is no longer informed by
- * subscriptions to its published object classes, i.e. the federate
- * services startRegistrationForObjectClass and
- * stopRegistrationForObjectClass respectively are not invoked.
- * @see disableClassRelevanceAdvisorySwitch()
- */
- void RTI1516ambassador::enableObjectClassRelevanceAdvisorySwitch ()
- throw (ObjectClassRelevanceAdvisorySwitchIsOn,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Enable_Class_Relevance_Advisory_Switch req, rep ;
- privateRefs->executeService(&req, &rep);
- }
-
- // 10.23
- /**
- * Sets the ClassRelevanceAdvisory (CRA) switch to false. The switch
- * state is hold on the RTIG side. That's why the message
- * DISABLE_CLASS_RELEVANCE_ADVISORY_SWITCH
- * is transmitted to RTIA. RTIA transmits the message towards RTIG.
- *
- * By default, the CRA switch is true. This causes a delivery of the
- * federate service startRegistrationForObjectClass to a publisher
- * if there are any new subscribers for the federates published object
- * classes. If there are no more subscribers a publisher gets the
- * federate service stopRegistrationForObjectClass.
- * @see enableClassRelevanceAdvisorySwitch()
- *
- * By disabling the CRA switch the federate is no longer informed by
- * subscriptions to its published object classes, i.e. the federate
- * services startRegistrationForObjectClass and
- * stopRegistrationForObjectClass respectively are not invoked.
- */
- void RTI1516ambassador::disableObjectClassRelevanceAdvisorySwitch ()
- throw (ObjectClassRelevanceAdvisorySwitchIsOff,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Disable_Class_Relevance_Advisory_Switch req, rep ;
- privateRefs->executeService(&req, &rep);
- }
-
- // 10.24
- /**
- * Sets the AttributeRelevanceAdvisory (ARA) switch to true. The switch
- * state is hold on the RTIG side. That's why the message
- * ENABLE_ATTRIBUTE_RELEVANCE_ADVISORY_SWITCH
- * is transmitted to RTIA. RTIA transmits the message towards RTIG.
- *
- * By default, the ARA switch is false. When enabling the ARA switch
- * the federate is informed by the federate service
- * turnUpdatesOnForObjectInstance of new object instances within remote
- * federates actively subscribed to its published attributes. If there
- * are no active subscribers for a set of instance-attributes the
federate
- * receives the federate service turnUpdatesOffForObjectInstance.
- *
- * By disabling the ARA switch the federate is no longer informed by
- * subscriptions to its published attributes, i.e. the federate
- * services turnUpdatesOnForObjectInstance and
- * turnUpdatesOffForObjectInstance respectively are not invoked.
- * @see disableAttributeRelevanceAdvisorySwitch()
- */
- void RTI1516ambassador::enableAttributeRelevanceAdvisorySwitch ()
- throw (AttributeRelevanceAdvisorySwitchIsOn,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Enable_Attribute_Relevance_Advisory_Switch req, rep ;
- privateRefs->executeService(&req, &rep);
- }
-
- // 10.25
- /**
- * Sets the AttributeRelevanceAdvisory (ARA) switch to false. The
switch
- * state is hold on the RTIG side. That's why the message
- * DISABLE_ATTRIBUTE_RELEVANCE_ADVISORY_SWITCH
- * is transmitted to RTIA. RTIA transmits the message towards RTIG.
- *
- * By default, the ARA switch is false. When enabling the ARA switch
- * the federate is informed by the federate service
- * turnUpdatesOnForObjectInstance of new object instances within remote
- * federates actively subscribed to its published attributes. If there
- * are no active subscribers for a set of instance-attributes the
federate
- * receives the federate service turnUpdatesOffForObjectInstance.
- * @see enableAttributeRelevanceAdvisorySwitch()
- *
- * By disabling the ARA switch the federate is no longer informed by
- * subscriptions to its published attributes, i.e. the federate
- * services turnUpdatesOnForObjectInstance and
- * turnUpdatesOffForObjectInstance respectively are not invoked.
- */
- void RTI1516ambassador::disableAttributeRelevanceAdvisorySwitch ()
- throw (AttributeRelevanceAdvisorySwitchIsOff,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Disable_Attribute_Relevance_Advisory_Switch req, rep ;
- privateRefs->executeService(&req, &rep);
- }
-
- // 10.26
- /**
- * Sets the AttributeScopeAdvisory (ASA) switch to true. The switch
state
- * is hold on the RTIG side. That's why the message
- * ENABLE_ATTRIBUTE_SCOPE_ADVISORY_SWITCH
- * is transmitted to RTIA. RTIA transmits the message towards RTIG.
- *
- * By default, the ASA switch is false. When enabling the ASA switch
- * the federate is informed by the federate services
- * attributesInScope and attributesOutScope respectively of discovered
- * or registrated but not owned attribute-instances intersecting or
- * leaving its subscription regions.
- *
- * By disabling the ASA switch the federate is no longer informed of
- * changes in attribute-instance scope, i.e. the federate
- * services attributesInScope and attributesOutScope respectively are
- * not invoked.
- * @see disableAttributeScopeAdvisorySwitch()
- */
- void RTI1516ambassador::enableAttributeScopeAdvisorySwitch ()
- throw (AttributeScopeAdvisorySwitchIsOn,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Enable_Attribute_Scope_Advisory_Switch req, rep ;
- privateRefs->executeService(&req, &rep);
- }
-
- // 10.27
- /**
- * Sets the AttributeScopeAdvisory (ASA) switch to false. The switch
state
- * is hold on the RTIG side. That's why the message
- * DISABLE_ATTRIBUTE_SCOPE_ADVISORY_SWITCH
- * is transmitted to RTIA. RTIA transmits the message towards RTIG.
- *
- * By default, the ASA switch is false. When enabling the ASA switch
- * the federate is informed by the federate services
- * attributesInScope and attributesOutScope respectively of discovered
- * or registrated but not owned attribute-instances intersecting or
- * leaving its subscription regions.
- * @see enableAttributeScopeAdvisorySwitch()
- *
- * By disabling the ASA switch the federate is no longer informed of
- * changes in attribute-instance scope, i.e. the federate
- * services attributesInScope and attributesOutScope respectively are
- * not invoked.
- */
- void RTI1516ambassador::disableAttributeScopeAdvisorySwitch ()
- throw (AttributeScopeAdvisorySwitchIsOff,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Disable_Attribute_Scope_Advisory_Switch req, rep ;
- privateRefs->executeService(&req, &rep);
- }
-
- // 10.28
- /**
- * Sets the InteractionRelevanceAdvisory (IRA) switch to true. The
switch
- * state is hold on the RTIG side. That's why the message
- * ENABLE_INTERACTION_RELEVANCE_ADVISORY_SWITCH
- * is transmitted to RTIA. RTIA transmits the message towards RTIG.
- *
- * By default, the IRA switch is true. This causes a delivery of the
- * federate service turnInteractionsOn to a publisher if there are
- * any new subscribers for the federates published interaction
- * classes. If there are no more subscribers a publisher gets the
- * federate service turnInteractionsOff().
- *
- * By disabling the IRA switch the federate is no longer informed by
- * subscriptions to its published interaction classes, i.e. the
federate
- * services turnInteractionsOn and turnInteractionsOff respectively are
- * not invoked.
- * @see disableInteractionRelevanceAdvisorySwitch()
- */
- void RTI1516ambassador::enableInteractionRelevanceAdvisorySwitch ()
- throw (InteractionRelevanceAdvisorySwitchIsOn,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Enable_Interaction_Relevance_Advisory_Switch req, rep ;
- privateRefs->executeService(&req, &rep);
- }
-
- // 10.29
- /**
- * Sets the InteractionRelevanceAdvisory (IRA) switch to false. The
switch
- * state is hold on the RTIG side. That's why the message
- * DISABLE_INTERACTION_RELEVANCE_ADVISORY_SWITCH
- * is transmitted to RTIA. RTIA transmits the message towards RTIG.
- *
- * By default, the IRA switch is true. This causes a delivery of the
- * federate service turnInteractionsOn to a publisher if there are
- * any new subscribers for the federates published interaction
- * classes. If there are no more subscribers a publisher gets the
- * federate service turnInteractionsOff().
- * @see enableInteractionRelevanceAdvisorySwitch()
- *
- * By disabling the IRA switch the federate is no longer informed by
- * subscriptions to its published interaction classes, i.e. the
federate
- * services turnInteractionsOn and turnInteractionsOff respectively are
- * not invoked.
- */
- void RTI1516ambassador::disableInteractionRelevanceAdvisorySwitch ()
- throw (InteractionRelevanceAdvisorySwitchIsOff,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- M_Disable_Interaction_Relevance_Advisory_Switch req, rep ;
- privateRefs->executeService(&req, &rep);
- }
-
- // 10.30
-
- DimensionHandleSet RTI1516ambassador::getDimensionHandleSet
- (RegionHandle theRegionHandle)
- throw (InvalidRegion,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- /* TODO */
- throw RTIinternalError(L"Not yet implemented");
- }
-
- // 10.31
-
- RangeBounds RTI1516ambassador::getRangeBounds
- (RegionHandle theRegionHandle,
- DimensionHandle theDimensionHandle)
- throw (InvalidRegion,
- RegionDoesNotContainSpecifiedDimension,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- /* TODO */
- throw RTIinternalError(L"Not yet implemented");
- }
-
- // 10.32
- void RTI1516ambassador::setRangeBounds
- (RegionHandle theRegionHandle,
- DimensionHandle theDimensionHandle,
- RangeBounds const & theRangeBounds)
- throw (InvalidRegion,
- RegionNotCreatedByThisFederate,
- RegionDoesNotContainSpecifiedDimension,
- InvalidRangeBound,
- FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- /* TODO */
- throw RTIinternalError(L"Not yet implemented");
- }
-
- // 10.33
- unsigned long RTI1516ambassador::normalizeFederateHandle
- (FederateHandle theFederateHandle)
- throw (FederateNotExecutionMember,
- InvalidFederateHandle,
- RTIinternalError)
- {
- /* TODO */
- throw RTIinternalError(L"Not yet implemented");
- }
-
- // 10.34
- unsigned long RTI1516ambassador::normalizeServiceGroup
- (ServiceGroupIndicator theServiceGroup)
- throw (FederateNotExecutionMember,
- InvalidServiceGroup,
- RTIinternalError)
- {
- /* TODO */
- throw RTIinternalError(L"Not yet implemented");
- }
-
- // 10.37
- bool RTI1516ambassador::evokeCallback(double
approximateMinimumTimeInSeconds)
- throw (FederateNotExecutionMember,
- RTIinternalError)
- {
- return __tick_kernel(false, approximateMinimumTimeInSeconds,
approximateMinimumTimeInSeconds);
- }
-
- // 10.38
- bool RTI1516ambassador::evokeMultipleCallbacks(double
approximateMinimumTimeInSeconds,
- double approximateMaximumTimeInSeconds)
- throw (FederateNotExecutionMember,
- RTIinternalError)
- {
- return __tick_kernel(true, approximateMinimumTimeInSeconds,
approximateMaximumTimeInSeconds);
- }
-
- // 10.39
- void RTI1516ambassador::enableCallbacks ()
- throw (FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- /* TODO */
- throw RTIinternalError(L"Not yet implemented");
- }
-
- // 10.40
- void RTI1516ambassador::disableCallbacks ()
- throw (FederateNotExecutionMember,
- SaveInProgress,
- RestoreInProgress,
- RTIinternalError)
- {
- /* TODO */
- throw RTIinternalError(L"Not yet implemented");
- }
-
- FederateHandle RTI1516ambassador::decodeFederateHandle(
- VariableLengthData const & encodedValue) const
- {
- return
rti1516::FederateHandleFriend::createRTI1516Handle(encodedValue);
- }
-
- ObjectClassHandle RTI1516ambassador::decodeObjectClassHandle(
- VariableLengthData const & encodedValue) const
- {
- return
rti1516::ObjectClassHandleFriend::createRTI1516Handle(encodedValue);
- }
-
- InteractionClassHandle RTI1516ambassador::decodeInteractionClassHandle(
- VariableLengthData const & encodedValue) const
- {
- return
rti1516::InteractionClassHandleFriend::createRTI1516Handle(encodedValue);
- }
-
- ObjectInstanceHandle RTI1516ambassador::decodeObjectInstanceHandle(
- VariableLengthData const & encodedValue) const
- {
- return
rti1516::ObjectInstanceHandleFriend::createRTI1516Handle(encodedValue);
- }
-
- AttributeHandle RTI1516ambassador::decodeAttributeHandle(
- VariableLengthData const & encodedValue) const
- {
- return
rti1516::AttributeHandleFriend::createRTI1516Handle(encodedValue);
- }
-
- ParameterHandle RTI1516ambassador::decodeParameterHandle(
- VariableLengthData const & encodedValue) const
- {
- return
rti1516::ParameterHandleFriend::createRTI1516Handle(encodedValue);
- }
-
- DimensionHandle RTI1516ambassador::decodeDimensionHandle(
- VariableLengthData const & encodedValue) const
- {
- return
rti1516::DimensionHandleFriend::createRTI1516Handle(encodedValue);
- }
-
- MessageRetractionHandle
RTI1516ambassador::decodeMessageRetractionHandle(
- VariableLengthData const & encodedValue) const
- {
- return
rti1516::MessageRetractionHandleFriend::createRTI1516Handle(encodedValue);
- }
-
- RegionHandle RTI1516ambassador::decodeRegionHandle(
- VariableLengthData const & encodedValue) const
- {
- return
rti1516::RegionHandleFriend::createRTI1516Handle(encodedValue);
- }
-
-
-
-
-
-} // end namespace rti1516
Index: RTI1516HandleFactory.cpp
===================================================================
RCS file: RTI1516HandleFactory.cpp
diff -N RTI1516HandleFactory.cpp
--- RTI1516HandleFactory.cpp 3 Mar 2014 15:18:22 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,76 +0,0 @@
-#include "RTI1516HandleFactory.h"
-
-
-#define DECLARE_HANDLE_FRIEND_CLASS(HandleKind)
\
-
\
- HandleKind HandleKind##Friend::createRTI1516Handle(const certi::Handle &
certiHandle) \
- {
\
- HandleKind##Implementation* handleImpl = new
HandleKind##Implementation(); \
- handleImpl->setValue(certiHandle);
\
- HandleKind rti1516Handle(handleImpl);
\
- return rti1516Handle;
\
- }
\
-
\
- HandleKind HandleKind##Friend::createRTI1516Handle(const
rti1516::VariableLengthData & encodedValue)\
- {
\
- HandleKind rti1516Handle(encodedValue);
\
- return rti1516Handle;
\
- }
\
-
\
- certi::Handle HandleKind##Friend::toCertiHandle(const HandleKind &
rti1516Handle) \
- {
\
- certi::Handle certiHandle;
\
- if (rti1516Handle.isValid())
\
- {
\
- const HandleKind##Implementation* handleImpl =
rti1516Handle.getImplementation(); \
- certiHandle = handleImpl->getValue();
\
- } else {
\
- certiHandle = 0;
\
- }
\
- return certiHandle;
\
- }
\
-
\
- HandleKind##Friend::HandleKind##Friend() {}
\
- HandleKind##Friend::~HandleKind##Friend() {}
\
-
-/* end of DECLARE_HANDLE_FRIEND_CLASS */
-
-namespace rti1516
-{
-
-// All of the RTI API's HandleFriend classes are defined
-// by invoking the macro above.
-DECLARE_HANDLE_FRIEND_CLASS(FederateHandle)
-DECLARE_HANDLE_FRIEND_CLASS(ObjectClassHandle)
-DECLARE_HANDLE_FRIEND_CLASS(InteractionClassHandle)
-DECLARE_HANDLE_FRIEND_CLASS(ObjectInstanceHandle)
-DECLARE_HANDLE_FRIEND_CLASS(AttributeHandle)
-DECLARE_HANDLE_FRIEND_CLASS(ParameterHandle)
-DECLARE_HANDLE_FRIEND_CLASS(DimensionHandle)
-//DECLARE_HANDLE_FRIEND_CLASS(MessageRetractionHandle)
-DECLARE_HANDLE_FRIEND_CLASS(RegionHandle)
-
-MessageRetractionHandle
MessageRetractionHandleFriend::createRTI1516Handle(const certi::Handle &
certiHandle, uint64_t serialNr) {
- MessageRetractionHandleImplementation* handleImpl = new
MessageRetractionHandleImplementation();
- handleImpl->setValue(certiHandle);
- handleImpl->setSerialNum(serialNr);
- MessageRetractionHandle rti1516Handle(handleImpl);
- return rti1516Handle;
-}
-MessageRetractionHandle
MessageRetractionHandleFriend::createRTI1516Handle(const
rti1516::VariableLengthData & encodedValue) {
- MessageRetractionHandle rti1516Handle(encodedValue);
- return rti1516Handle;
-}
-certi::EventRetraction
MessageRetractionHandleFriend::createEventRetraction(const
rti1516::MessageRetractionHandle & messageRetractionHandle) {
- const MessageRetractionHandleImplementation* handleImpl =
messageRetractionHandle.getImplementation();
- certi::EventRetraction eventRetraction;
- eventRetraction.setSendingFederate( handleImpl->getValue() );
- eventRetraction.setSN( handleImpl->getSerialNum() );
- return eventRetraction;
-}
-MessageRetractionHandleFriend::MessageRetractionHandleFriend() {}
-MessageRetractionHandleFriend::~MessageRetractionHandleFriend() {}
-
-
-}
-
Index: RTI1516ambPrivateRefs.h
===================================================================
RCS file: RTI1516ambPrivateRefs.h
diff -N RTI1516ambPrivateRefs.h
--- RTI1516ambPrivateRefs.h 3 Mar 2014 15:18:23 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,62 +0,0 @@
-// ----------------------------------------------------------------------------
-// CERTI - HLA RunTime Infrastructure
-// Copyright (C) 2002-2005 ONERA
-//
-// This file is part of CERTI-libRTI
-//
-// CERTI-libRTI is free software ; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License
-// as published by the Free Software Foundation ; either version 2 of
-// the License, or (at your option) any later version.
-//
-// CERTI-libRTI is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY ; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this program ; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA
-//
-// $Id: RTI1516ambPrivateRefs.h,v 1.1 2014/03/03 15:18:23 erk Exp $
-// ----------------------------------------------------------------------------
-
-#include <RTI/certiRTI1516.h>
-#include "Message.hh"
-#include "RootObject.hh"
-#include "MessageBuffer.hh"
-
-using namespace certi ;
-
-class RTI1516ambPrivateRefs
-{
-public:
- RTI1516ambPrivateRefs();
- ~RTI1516ambPrivateRefs();
-
- 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);
-
-#ifdef _WIN32
- HANDLE handle_RTIA;
-#else
- pid_t pid_RTIA ; //!< pid associated with rtia fork (private).
-#endif
-
- //! Federate Ambassador reference for module calls.
- rti1516::FederateAmbassador *fed_amb ;
-
- //! used to prevent reentrant calls (see tick() and executeService()).
- bool is_reentrant ;
-
- RootObject *_theRootObj ;
-
- SocketUN *socketUn ;
- MessageBuffer msgBufSend,msgBufReceive ;
-};
-
-// $Id: RTI1516ambPrivateRefs.h,v 1.1 2014/03/03 15:18:23 erk Exp $
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [certi-cvs] certi/libRTI/ieee1516-2000 LogicalTimeDouble.h ...,
CERTI CVS commits <=