[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[certi-cvs] certi/libRTI CMakeLists.txt ieee1516-2000/RTI15...
From: |
CERTI CVS commits |
Subject: |
[certi-cvs] certi/libRTI CMakeLists.txt ieee1516-2000/RTI15... |
Date: |
Mon, 03 Mar 2014 15:18:25 +0000 |
CVSROOT: /sources/certi
Module name: certi
Changes by: Eric NOULARD <erk> 14/03/03 15:18:24
Modified files:
libRTI : CMakeLists.txt
Added files:
libRTI/ieee1516-2000: RTI1516ambassador.h RTI1516exception.cpp
RTI1516HandleFactory.h
RTI1516HandleImplementation.h
RTI1516fedAmbassador.cpp RTI1516Handle.cpp
RTI1516variableLengthDataImplementation.h
RTI1516HandleImplementation.cpp
RTI1516ambassador.cpp RTI1516fedTime.h
RTI1516variableLengthData.cpp
LogicalTimeDouble.h RTI1516ambTime.cpp
RTI1516ambPrivateRefs.cpp
RTI1516ambassadorFactory.cpp
RTI1516fedTime.cpp
RTI1516HandleFactory.cpp CMakeLists.txt
RTI1516ambPrivateRefs.h
LogicalTimeDouble.cpp
libRTI/hla-1_3 : RTIambPrivateRefs.hh RTIambassador.cc
TestFedTime.cc RTItypes.cc RTItypesImp.hh
RTIambPrivateRefs.cc RTIfedTime.cc
RTItypesImp.cc CMakeLists.txt
libRTI/ieee1516-2010: CMakeLists.txt RTI1516fedTime.h
Removed files:
libRTI : LogicalTimeDouble.cpp RTI1516ambassador.h
RTI1516variableLengthData.cpp
RTI1516ambPrivateRefs.h RTI1516exception.cpp
RTI1516ambassadorFactory.cpp
RTI1516HandleFactory.cpp RTIambassador.cc
RTI1516fedAmbassador.cpp TestFedTime.cc
RTItypesImp.cc RTItypes.cc RTI1516Handle.cpp
RTI1516ambPrivateRefs.cpp
RTI1516HandleImplementation.cpp
RTI1516fedTime.h RTI1516fedTime.cpp
RTIambPrivateRefs.cc LogicalTimeDouble.h
RTIfedTime.cc RTI1516ambTime.cpp
RTI1516variableLengthDataImplementation.h
RTI1516HandleImplementation.h RTItypesImp.hh
RTI1516HandleFactory.h RTI1516ambassador.cpp
RTIambPrivateRefs.hh
Log message:
Split-up standard specific files in separate directories.
One for existing hla-1_3
One for existing ieee1516-2000
One for the forthcoming ieee1516-2010.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/CMakeLists.txt?cvsroot=certi&r1=1.31&r2=1.32
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/LogicalTimeDouble.cpp?cvsroot=certi&r1=1.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTI1516ambassador.h?cvsroot=certi&r1=1.3&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTI1516variableLengthData.cpp?cvsroot=certi&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTI1516ambPrivateRefs.h?cvsroot=certi&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTI1516exception.cpp?cvsroot=certi&r1=1.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTI1516ambassadorFactory.cpp?cvsroot=certi&r1=1.7&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTI1516HandleFactory.cpp?cvsroot=certi&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTIambassador.cc?cvsroot=certi&r1=3.128&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTI1516fedAmbassador.cpp?cvsroot=certi&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/TestFedTime.cc?cvsroot=certi&r1=3.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTItypesImp.cc?cvsroot=certi&r1=3.10&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTItypes.cc?cvsroot=certi&r1=1.6&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTI1516Handle.cpp?cvsroot=certi&r1=1.3&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTI1516ambPrivateRefs.cpp?cvsroot=certi&r1=1.5&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTI1516HandleImplementation.cpp?cvsroot=certi&r1=1.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTI1516fedTime.h?cvsroot=certi&r1=1.3&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTI1516fedTime.cpp?cvsroot=certi&r1=1.5&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTIambPrivateRefs.cc?cvsroot=certi&r1=3.29&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/LogicalTimeDouble.h?cvsroot=certi&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTIfedTime.cc?cvsroot=certi&r1=3.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTI1516ambTime.cpp?cvsroot=certi&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTI1516variableLengthDataImplementation.h?cvsroot=certi&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTI1516HandleImplementation.h?cvsroot=certi&r1=1.4&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTItypesImp.hh?cvsroot=certi&r1=3.5&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTI1516HandleFactory.h?cvsroot=certi&r1=1.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTI1516ambassador.cpp?cvsroot=certi&r1=1.10&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTIambPrivateRefs.hh?cvsroot=certi&r1=3.10&r2=0
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTI1516ambassador.h?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTI1516exception.cpp?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTI1516HandleFactory.h?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTI1516HandleImplementation.h?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTI1516fedAmbassador.cpp?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTI1516Handle.cpp?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTI1516variableLengthDataImplementation.h?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTI1516HandleImplementation.cpp?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTI1516ambassador.cpp?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTI1516fedTime.h?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTI1516variableLengthData.cpp?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/LogicalTimeDouble.h?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTI1516ambTime.cpp?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTI1516ambPrivateRefs.cpp?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTI1516ambassadorFactory.cpp?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTI1516fedTime.cpp?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTI1516HandleFactory.cpp?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/CMakeLists.txt?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/RTI1516ambPrivateRefs.h?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2000/LogicalTimeDouble.cpp?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/hla-1_3/RTIambPrivateRefs.hh?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/hla-1_3/RTIambassador.cc?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/hla-1_3/TestFedTime.cc?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/hla-1_3/RTItypes.cc?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/hla-1_3/RTItypesImp.hh?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/hla-1_3/RTIambPrivateRefs.cc?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/hla-1_3/RTIfedTime.cc?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/hla-1_3/RTItypesImp.cc?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/hla-1_3/CMakeLists.txt?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2010/CMakeLists.txt?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/ieee1516-2010/RTI1516fedTime.h?cvsroot=certi&rev=1.1
Patches:
Index: CMakeLists.txt
===================================================================
RCS file: /sources/certi/certi/libRTI/CMakeLists.txt,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- CMakeLists.txt 3 Mar 2014 14:26:03 -0000 1.31
+++ CMakeLists.txt 3 Mar 2014 15:18:20 -0000 1.32
@@ -1,259 +1,10 @@
-include_directories(${CMAKE_SOURCE_DIR}/libCERTI)
-
-##########################################################
-# VariableLengthData
-# This STATIC library is necessary on Windows in order
-# to avoid circular dependencies
-##########################################################
-if (WIN32)
- set(VARDATA1516_SRCS
- RTI1516variableLengthData.cpp
- RTI1516variableLengthDataImplementation.h
- ../include/ieee1516-2000/RTI/VariableLengthData.h
- )
-
- source_group("Source Files\\VarData" FILES ${VARDATA1516_SRCS})
-
- add_library(VarData1516 STATIC ${VARDATA1516_SRCS})
- target_link_libraries(VarData1516)
- set_target_properties(VarData1516 PROPERTIES PROJECT_LABEL LibVarData1516)
- set_target_properties(VarData1516 PROPERTIES COMPILE_FLAGS
"-DRTI_DISABLE_WARNINGS -DSTATIC_RTI")
- set_target_properties(VarData1516 PROPERTIES INCLUDE_DIRECTORIES
-
"${CMAKE_SOURCE_DIR}/include/ieee1516-2000;${CMAKE_SOURCE_DIR}/include;${CMAKE_SOURCE_DIR}/libCERTI;${CMAKE_BINARY_DIR}/")
-
- # There shouldn't be any def file for STATIC library since this is not a DLL
- # Commenting out next line.
- #if (MINGW)
- # set_target_properties(VarData1516 PROPERTIES LINK_FLAGS
"-Wl,--output-def,${LIBRARY_OUTPUT_PATH}/libVarData1516.def")
- # install(FILES ${LIBRARY_OUTPUT_PATH}/libVarData1516.def
- # DESTINATION lib)
- #endif (MINGW)
- # There shouldn't be any SOVERSION as well
- #set_target_properties(VarData1516 PROPERTIES VERSION 1.0.0 SOVERSION 1)
- set(VarData1516Target "VarData1516")
-else()
- set(VarData1516Target "")
-endif (WIN32)
-
-##########################
-# RTI1516
-##########################
-
-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
- )
-
-set(RTI1516_LIB_INCLUDE
- ${CMAKE_BINARY_DIR}/include/hla-1_3/RTItypes.hh
- ../include/ieee1516-2000/RTI/Enums.h
- ../include/ieee1516-2000/RTI/Exception.h
- ../include/ieee1516-2000/RTI/FederateAmbassador.h
- ../include/ieee1516-2000/RTI/Handle.h
- ../include/ieee1516-2000/RTI/LogicalTime.h
- ../include/ieee1516-2000/RTI/LogicalTimeFactory.h
- ../include/ieee1516-2000/RTI/LogicalTimeInterval.h
- ../include/ieee1516-2000/RTI/NullFederateAmbassador.h
- ../include/ieee1516-2000/RTI/RangeBounds.h
- ../include/ieee1516-2000/RTI/RTI1516.h
- ../include/ieee1516-2000/RTI/RTIambassador.h
- ../include/ieee1516-2000/RTI/RTIambassadorFactory.h
- ../include/ieee1516-2000/RTI/SpecificConfig.h
- ../include/ieee1516-2000/RTI/Typedefs.h
- ../include/ieee1516-2000/RTI/VariableLengthData.h
-)
-
-set(RTI_LIB_SRCS
- RTIambassador.cc
- RTIambPrivateRefs.cc
- RTIambPrivateRefs.hh
- RTItypes.cc
- RTItypesImp.cc
- RTItypesImp.hh
- )
-
-set(RTI_LIB_INCLUDE
- ../include/hla-1_3/baseTypes.hh
- ../include/certi.hh
- ../include/hla-1_3/federateAmbServices.hh
- ../include/hla-1_3/NullFederateAmbassador.hh
- ../include/hla-1_3/RTI.hh
- ../include/hla-1_3/RTIambServices.hh
- ${CMAKE_BINARY_DIR}/include/hla-1_3/RTItypes.hh
-)
-
-#SOURCE_GROUP("RTI\\Header" FILES ${RTI_LIB_INCLUDE})
-
-add_library(RTI ${RTI_LIB_SRCS} ${RTI_LIB_INCLUDE})
-set_target_properties(RTI PROPERTIES INCLUDE_DIRECTORIES
-
"${CMAKE_SOURCE_DIR}/include/hla-1_3;${CMAKE_BINARY_DIR}/;${CMAKE_BINARY_DIR}/include/hla-1_3;${CMAKE_SOURCE_DIR}/include;${CMAKE_SOURCE_DIR}/libCERTI")
-target_link_libraries(RTI CERTI FedTime)
-
-IF (BUILD_LEGACY_LIBRTI)
- MESSAGE(STATUS "libRTI variant: CERTI legacy")
- SET_TARGET_PROPERTIES(RTI PROPERTIES OUTPUT_NAME "RTI")
- SET_TARGET_PROPERTIES(RTI PROPERTIES COMPILE_FLAGS "-DLEGACY_LIBRTI")
-ELSE (BUILD_LEGACY_LIBRTI)
- MESSAGE(STATUS "libRTI variant: HLA 1.3 NG")
- IF (WIN32 AND CERTI_RTING_DLL_USE_LIB_PREFIX)
- SET_TARGET_PROPERTIES(RTI PROPERTIES OUTPUT_NAME "libRTI-NG")
- ELSE()
- SET_TARGET_PROPERTIES(RTI PROPERTIES OUTPUT_NAME "RTI-NG")
- ENDIF()
- SET_TARGET_PROPERTIES(RTI PROPERTIES COMPILE_FLAGS "-DHLA13NG_LIBRTI")
-ENDIF (BUILD_LEGACY_LIBRTI)
-SET_TARGET_PROPERTIES(RTI PROPERTIES VERSION 1.0.0 SOVERSION 1)
-IF (MINGW)
- SET_TARGET_PROPERTIES(RTI PROPERTIES LINK_FLAGS
"-Wl,--output-def,${LIBRARY_OUTPUT_PATH}/libRTI.def")
- INSTALL(FILES ${LIBRARY_OUTPUT_PATH}/libRTI.def
- DESTINATION lib)
-ENDIF (MINGW)
-
-
-add_library(RTI1516 ${RTI1516_LIB_SRCS} ${RTI1516_LIB_INCLUDE})
-set_target_properties(RTI1516 PROPERTIES INCLUDE_DIRECTORIES
-
"${CMAKE_SOURCE_DIR}/include/ieee1516-2000;${CMAKE_SOURCE_DIR}/include;${CMAKE_SOURCE_DIR}/libCERTI;${CMAKE_BINARY_DIR}/")
-# Incorrect line
-#TARGET_LINK_LIBRARIES(RTI1516 CERTI)
-# Correct line
-target_link_libraries(RTI1516 CERTI FedTime1516)
-
-message(STATUS "libRTI variant: HLA 1516")
-set_target_properties(RTI1516 PROPERTIES OUTPUT_NAME "RTI1516")
-set_target_properties(RTI1516 PROPERTIES COMPILE_FLAGS "-DHLA13NG_LIBRTI
-DRTI_DISABLE_WARNINGS -DBUILDING_RTI")
-set_target_properties(RTI1516 PROPERTIES VERSION 1.0.0 SOVERSION 1)
-IF (MINGW)
- set_target_properties(RTI1516 PROPERTIES LINK_FLAGS
"-Wl,--output-def,${LIBRARY_OUTPUT_PATH}/libRTI1516.def")
- install(FILES ${LIBRARY_OUTPUT_PATH}/libRTI1516.def DESTINATION lib)
-ENDIF (MINGW)
-
-##################################################################
-# Lib FedTime
-# A replacement lib FedTime may be provided by the user
-# CERTI is provided one. The lib FedTime depends on libRTI
-# since it inherits from the RTI::FedTime abstract class.
-##################################################################
-IF(CMAKE_COMPILER_IS_GNUCC)
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long")
-ENDIF(CMAKE_COMPILER_IS_GNUCC)
-IF(CMAKE_COMPILER_IS_GNUCXX)
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-long-long")
-ENDIF(CMAKE_COMPILER_IS_GNUCXX)
-
-include_directories(${CMAKE_SOURCE_DIR}/libHLA)
-set(FEDTIME_SRCS
- RTIfedTime.cc
- ${CMAKE_SOURCE_DIR}/include/hla-1_3/fedtime.hh
-)
-
-source_group("Source Files\\FedTime" FILES ${FEDTIME_SRCS})
-
-add_library(FedTime ${FEDTIME_SRCS})
-set_target_properties(FedTime PROPERTIES INCLUDE_DIRECTORIES
-
"${CMAKE_SOURCE_DIR}/include/hla-1_3;${CMAKE_SOURCE_DIR}/include/;${CMAKE_BINARY_DIR}/include/hla-1_3;${CMAKE_SOURCE_DIR}/libCERTI")
-# Correct line
-target_link_libraries(FedTime)
-# Incorrect line
-# (at least the dependency exists but we cannot specify that
-# because we would generate a circular deps RTI-->FedTime-->RTI)
-#TARGET_LINK_LIBRARIES(FedTime RTI)
-
-IF (WIN32 AND CERTI_RTING_DLL_USE_LIB_PREFIX)
- SET_TARGET_PROPERTIES(FedTime PROPERTIES OUTPUT_NAME "libFedTime")
-ENDIF()
-
-SET_TARGET_PROPERTIES(FedTime PROPERTIES PROJECT_LABEL LibFedTime)
-IF (MINGW)
- SET_TARGET_PROPERTIES(FedTime PROPERTIES LINK_FLAGS
"-Wl,--output-def,${LIBRARY_OUTPUT_PATH}/libFedTime.def")
- INSTALL(FILES ${LIBRARY_OUTPUT_PATH}/libFedTime.def
- DESTINATION lib)
-ENDIF (MINGW)
-
-SET_TARGET_PROPERTIES(FedTime PROPERTIES VERSION 1.0.0 SOVERSION 1)
-
-set(TestFedTime_SRCS
- TestFedTime.cc
-)
-add_executable(TestFedTime ${TestFedTime_SRCS})
-set_target_properties(TestFedTime PROPERTIES INCLUDE_DIRECTORIES
-
"${CMAKE_SOURCE_DIR}/include/hla-1_3;${CMAKE_SOURCE_DIR}/include/;${CMAKE_BINARY_DIR}/include/hla-1_3")
-target_link_libraries(TestFedTime FedTime RTI)
-add_test(NAME TestLibFedTime COMMAND $<TARGET_FILE:TestFedTime>)
-
-##########################################################
-SET(FEDTIME1516_SRCS
- ../include/ieee1516-2000/RTI/certiLogicalTime.h
- ../include/ieee1516-2000/RTI/certiLogicalTimeInterval.h
- ../include/ieee1516-2000/RTI/certiLogicalTimeFactory.h
- RTI1516fedTime.h
- RTI1516fedTime.cpp
-)
-
-
-IF (BUILD_WITH_EXTRA_LOGICAL_TIME)
- LIST(APPEND FEDTIME1516_SRC
- LogicalTimeDouble.h
- LogicalTimeDouble.cpp
- )
-ENDIF(BUILD_WITH_EXTRA_LOGICAL_TIME)
-
-SOURCE_GROUP("Source Files\\FedTime" FILES ${FEDTIME1516_SRCS})
-
-add_library(FedTime1516 ${FEDTIME1516_SRCS})
-set_target_properties(FedTime1516 PROPERTIES INCLUDE_DIRECTORIES
-
"${CMAKE_SOURCE_DIR}/include/ieee1516-2000;${CMAKE_SOURCE_DIR}/include")
-# Correct line
-TARGET_LINK_LIBRARIES(FedTime1516 ${VarData1516Target})
-# Incorrect line
-# (at least the dependency exists but we cannot specify that
-# because we would generate a circular deps RTI1516-->FedTime1516-->RTI1516)
-#TARGET_LINK_LIBRARIES(FedTime1516 RTI1516)
-
-SET_TARGET_PROPERTIES(FedTime1516 PROPERTIES PROJECT_LABEL LibFedTime1516)
-SET_TARGET_PROPERTIES(FedTime1516 PROPERTIES COMPILE_FLAGS "-DBUILDING_FEDTIME
-DRTI_DISABLE_WARNINGS -DSTATIC_RTI")
-
-IF (MINGW)
- SET_TARGET_PROPERTIES(FedTime1516 PROPERTIES LINK_FLAGS
"-Wl,--output-def,${LIBRARY_OUTPUT_PATH}/libFedTime1516.def")
- INSTALL(FILES ${LIBRARY_OUTPUT_PATH}/libFedTime1516.def
- DESTINATION lib)
-ENDIF (MINGW)
-
-SET_TARGET_PROPERTIES(FedTime1516 PROPERTIES VERSION 1.0.0 SOVERSION 1)
-
-SET(TestFedTime1516_SRCS
- TestFedTime.cc
-)
-
-#ADD_EXECUTABLE(TestFedTime1516 ${TestFedTime1516_SRCS})
-
-# TODO: Should link with RTI1516 lib, instead of base RTI lib
-#TARGET_LINK_LIBRARIES(TestFedTime1516 FedTime1516 RTI1516)
-
-#ADD_TEST(TestLibFedTime1516 COMMAND $<TARGET_FILE:TestFedTime1516>)
-
-
-# Install rules for both libRTI-NG and libFedTime
-INSTALL(TARGETS RTI FedTime RTI1516 FedTime1516 ${VarData1516Target}
- EXPORT CERTIDepends
- RUNTIME DESTINATION bin
- LIBRARY DESTINATION lib
- ARCHIVE DESTINATION lib)
-
-# mimic install directory structure in the binary tree in order to ease the
linking
-# of builtin test (i.e. testFederate)
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/RTI1516fedTime.h
${CMAKE_BINARY_DIR}/include/ieee1516-2000/RTI/RTI1516fedTime.h COPYONLY)
-install(FILES RTI1516fedTime.h DESTINATION include/ieee1516-2000/RTI)
-install(FILES RTI1516fedTime.h DESTINATION include/ieee1516-2010/RTI)
+# Include directories common to all standards
+include_directories(${CMAKE_SOURCE_DIR}/libCERTI) # for libCERTI :-)
+include_directories(${CMAKE_SOURCE_DIR}/libHLA) # for MessageBuffer
+include_directories(${CMAKE_BINARY_DIR}) # for the config.h file
+# Standard specific includes will then be added in the concerned directory
+
+# Process standard specific libRTI implementation
+add_subdirectory(hla-1_3)
+add_subdirectory(ieee1516-2000)
+add_subdirectory(ieee1516-2010)
\ No newline at end of file
Index: ieee1516-2000/RTI1516ambassador.h
===================================================================
RCS file: ieee1516-2000/RTI1516ambassador.h
diff -N ieee1516-2000/RTI1516ambassador.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ieee1516-2000/RTI1516ambassador.h 3 Mar 2014 15:18:21 -0000 1.1
@@ -0,0 +1,1319 @@
+// 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: ieee1516-2000/RTI1516exception.cpp
===================================================================
RCS file: ieee1516-2000/RTI1516exception.cpp
diff -N ieee1516-2000/RTI1516exception.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ieee1516-2000/RTI1516exception.cpp 3 Mar 2014 15:18:21 -0000 1.1
@@ -0,0 +1,144 @@
+#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: ieee1516-2000/RTI1516HandleFactory.h
===================================================================
RCS file: ieee1516-2000/RTI1516HandleFactory.h
diff -N ieee1516-2000/RTI1516HandleFactory.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ieee1516-2000/RTI1516HandleFactory.h 3 Mar 2014 15:18:21 -0000
1.1
@@ -0,0 +1,92 @@
+#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: ieee1516-2000/RTI1516HandleImplementation.h
===================================================================
RCS file: ieee1516-2000/RTI1516HandleImplementation.h
diff -N ieee1516-2000/RTI1516HandleImplementation.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ieee1516-2000/RTI1516HandleImplementation.h 3 Mar 2014 15:18:21 -0000
1.1
@@ -0,0 +1,157 @@
+#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: ieee1516-2000/RTI1516fedAmbassador.cpp
===================================================================
RCS file: ieee1516-2000/RTI1516fedAmbassador.cpp
diff -N ieee1516-2000/RTI1516fedAmbassador.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ieee1516-2000/RTI1516fedAmbassador.cpp 3 Mar 2014 15:18:21 -0000
1.1
@@ -0,0 +1,10 @@
+#include <RTI/FederateAmbassador.h>
+#include <RTI/NullFederateAmbassador.h>
+
+rti1516::FederateAmbassador::FederateAmbassador() throw (FederateInternalError)
+{
+}
+
+rti1516::FederateAmbassador::~FederateAmbassador() throw()
+{
+}
Index: ieee1516-2000/RTI1516Handle.cpp
===================================================================
RCS file: ieee1516-2000/RTI1516Handle.cpp
diff -N ieee1516-2000/RTI1516Handle.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ieee1516-2000/RTI1516Handle.cpp 3 Mar 2014 15:18:21 -0000 1.1
@@ -0,0 +1,143 @@
+#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: ieee1516-2000/RTI1516variableLengthDataImplementation.h
===================================================================
RCS file: ieee1516-2000/RTI1516variableLengthDataImplementation.h
diff -N ieee1516-2000/RTI1516variableLengthDataImplementation.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ieee1516-2000/RTI1516variableLengthDataImplementation.h 3 Mar 2014
15:18:21 -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: ieee1516-2000/RTI1516HandleImplementation.cpp
===================================================================
RCS file: ieee1516-2000/RTI1516HandleImplementation.cpp
diff -N ieee1516-2000/RTI1516HandleImplementation.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ieee1516-2000/RTI1516HandleImplementation.cpp 3 Mar 2014 15:18:21
-0000 1.1
@@ -0,0 +1,281 @@
+#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: ieee1516-2000/RTI1516ambassador.cpp
===================================================================
RCS file: ieee1516-2000/RTI1516ambassador.cpp
diff -N ieee1516-2000/RTI1516ambassador.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ieee1516-2000/RTI1516ambassador.cpp 3 Mar 2014 15:18:21 -0000 1.1
@@ -0,0 +1,2858 @@
+#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: ieee1516-2000/RTI1516fedTime.h
===================================================================
RCS file: ieee1516-2000/RTI1516fedTime.h
diff -N ieee1516-2000/RTI1516fedTime.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ieee1516-2000/RTI1516fedTime.h 3 Mar 2014 15:18:21 -0000 1.1
@@ -0,0 +1,335 @@
+#ifndef RTI1516_FEDTIME_H
+#define RTI1516_FEDTIME_H
+
+#include <RTI/certiLogicalTime.h>
+#include <RTI/certiLogicalTimeInterval.h>
+#include <RTI/certiLogicalTimeFactory.h>
+
+namespace rti1516 {
+ class VariableLengthData;
+}
+
+class FEDTIME_EXPORT RTI1516fedTime : public rti1516::LogicalTime
+{
+public:
+ RTI1516fedTime(double timeVal);
+ RTI1516fedTime(const RTI1516fedTime &other);
+
+ virtual ~RTI1516fedTime()
+ throw ();
+
+ virtual
+ void
+ setInitial();
+
+ virtual
+ bool
+ isInitial() const;
+
+ virtual
+ void
+ setFinal();
+
+ virtual
+ bool
+ isFinal() const;
+
+ virtual
+ rti1516::LogicalTime &
+ operator=(rti1516::LogicalTime const & value)
+ throw (rti1516::InvalidLogicalTime);
+
+ virtual
+ RTI1516fedTime &
+ operator=(RTI1516fedTime const & value)
+ throw ();
+
+ virtual
+ rti1516::LogicalTime &
+ operator+=(rti1516::LogicalTimeInterval const & addend)
+ throw (rti1516::IllegalTimeArithmetic,
rti1516::InvalidLogicalTimeInterval);
+
+ virtual
+ rti1516::LogicalTime &
+ operator-=(rti1516::LogicalTimeInterval const & subtrahend)
+ throw (rti1516::IllegalTimeArithmetic,
rti1516::InvalidLogicalTimeInterval);
+
+ virtual
+ bool
+ operator>(rti1516::LogicalTime const & value) const
+ throw (rti1516::InvalidLogicalTime);
+
+ virtual
+ bool
+ operator<(rti1516::LogicalTime const & value) const
+ throw (rti1516::InvalidLogicalTime);
+
+ virtual
+ bool
+ operator==(rti1516::LogicalTime const & value) const
+ throw (rti1516::InvalidLogicalTime);
+
+ virtual
+ bool
+ operator>=(rti1516::LogicalTime const & value) const
+ throw (rti1516::InvalidLogicalTime);
+
+ virtual
+ bool
+ operator<=(rti1516::LogicalTime const & value) const
+ throw (rti1516::InvalidLogicalTime);
+
+ // Generates an encoded value that can be used to send
+ // LogicalTimes to other federates in updates or interactions
+ // Not implemented.
+ virtual
+ rti1516::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 (rti1516::CouldNotEncode);
+
+ // Decode encodedLogicalTime into self
+ // Not implemented.
+ virtual
+ void
+ decode(rti1516::VariableLengthData const & encodedLogicalTime)
+ throw (rti1516::InternalError,
+ rti1516::CouldNotDecode);
+
+ // Alternate decode that reads directly from a buffer
+ virtual
+ void
+ decode(void* buffer, unsigned long bufferSize)
+ throw (rti1516::InternalError,
+ rti1516::CouldNotDecode);
+
+ virtual
+ std::wstring
+ toString() const;
+
+ // Returns the name of the implementation, as needed by
+ // createFederationExecution.
+ virtual
+ std::wstring
+ implementationName() const;
+
+ double getFedTime() const
+ { return _fedTime; }
+
+ bool isInfinity() const
+ { return _fedTime == _positiveInfinity; }
+
+
+private:
+ double _fedTime;
+ double _zero;
+ double _epsilon;
+ double _positiveInfinity;
+
+}; // class RTI_EXPORT_FEDTIME RTI1516fedTime
+
+class FEDTIME_EXPORT RTI1516fedTimeInterval : public
rti1516::LogicalTimeInterval
+{
+public:
+ RTI1516fedTimeInterval(double timeVal);
+ RTI1516fedTimeInterval(const RTI1516fedTimeInterval &other);
+
+ virtual
+ ~RTI1516fedTimeInterval()
+ throw ();
+
+ virtual
+ void
+ setZero();
+
+ virtual
+ bool
+ isZero() const;
+
+ virtual
+ void
+ setEpsilon();
+
+ virtual
+ bool
+ isEpsilon() const;
+
+ virtual
+ rti1516::LogicalTimeInterval &
+ operator=(rti1516::LogicalTimeInterval const & value)
+ throw (rti1516::InvalidLogicalTimeInterval);
+
+ virtual
+ RTI1516fedTimeInterval &
+ operator=(RTI1516fedTimeInterval const & other)
+ throw ();
+
+ // Set self to the difference between two LogicalTimes
+ virtual
+ void
+ setToDifference(rti1516::LogicalTime const & minuend,
+ rti1516::LogicalTime const& subtrahend)
+ throw (rti1516::InvalidLogicalTime);
+
+ virtual
+ rti1516::LogicalTimeInterval &
+ operator+=(rti1516::LogicalTimeInterval const & addend)
+ throw (rti1516::InvalidLogicalTimeInterval);
+
+ virtual
+ rti1516::LogicalTimeInterval &
+ operator-=(rti1516::LogicalTimeInterval const & subtrahend)
+ throw (rti1516::InvalidLogicalTimeInterval);
+
+ virtual
+ bool
+ operator>(rti1516::LogicalTimeInterval const & value) const
+ throw (rti1516::InvalidLogicalTimeInterval);
+
+ virtual
+ bool
+ operator<(rti1516::LogicalTimeInterval const & value) const
+ throw (rti1516::InvalidLogicalTimeInterval);
+
+ virtual
+ bool
+ operator==(rti1516::LogicalTimeInterval const & value) const
+ throw (rti1516::InvalidLogicalTimeInterval);
+
+ virtual
+ bool
+ operator>=(rti1516::LogicalTimeInterval const & value) const
+ throw (rti1516::InvalidLogicalTimeInterval);
+
+ virtual
+ bool
+ operator<=(rti1516::LogicalTimeInterval const & value) const
+ throw (rti1516::InvalidLogicalTimeInterval);
+
+ // Generates an encoded value that can be used to send
+ // LogicalTimeIntervals to other federates in updates or interactions
+ // Not implemented.
+ virtual
+ rti1516::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 (rti1516::CouldNotEncode);
+
+ // Decode encodedValue into self
+ // Not implemented.
+ virtual
+ void
+ decode(rti1516::VariableLengthData const & encodedValue)
+ throw (rti1516::InternalError, rti1516::CouldNotDecode);
+
+ // Alternate decode that reads directly from a buffer
+ virtual
+ void
+ decode(void* buffer, unsigned long bufferSize)
+ throw (rti1516::InternalError, rti1516::CouldNotDecode);
+
+ virtual
+ std::wstring
+ toString() const;
+
+ // Returns the name of the implementation, as needed by
+ // createFederationExecution.
+ virtual
+ std::wstring
+ implementationName() const;
+
+ double getInterval() const
+ { return _fedInterval; }
+
+ double getEpsilon() const
+ { return _epsilon; }
+
+private:
+ double _fedInterval;
+ double _zero;
+ double _epsilon;
+ double _positiveInfinity;
+
+}; // class FEDTIME_EXPORT RTI1516fedTimeInterval
+
+class FEDTIME_EXPORT RTI1516fedTimeFactory : public rti1516::LogicalTimeFactory
+{
+public:
+ virtual
+ ~RTI1516fedTimeFactory()
+ throw ();
+
+ // Returns a LogicalTime with a value of "initial"
+ virtual
+ std::auto_ptr< rti1516::LogicalTime >
+ makeLogicalTime()
+ throw (rti1516::InternalError);
+
+ virtual
+ std::auto_ptr< rti1516::LogicalTime >
+ makeLogicalTime(double timeVal)
+ throw (rti1516::InternalError);
+
+ // Returns a LogicalTimeInterval with a value of "zero"
+ virtual
+ std::auto_ptr< rti1516::LogicalTimeInterval >
+ makeLogicalTimeInterval()
+ throw (rti1516::InternalError);
+
+ virtual
+ std::auto_ptr< rti1516::LogicalTimeInterval >
+ makeLogicalTimeInterval(double timeInterval)
+ throw (rti1516::InternalError);
+
+private:
+ friend class rti1516::LogicalTimeFactoryFactory;
+
+ // Private constructor - Only for LogicalTimeFactoryFactory to access.
+ RTI1516fedTimeFactory()
+ throw();
+
+}; // class FEDTIME_EXPORT RTI1516fedTimeFactory
+
+
+
+// The LogicalTimeFactoryFactory must also be implemented by the
+// federate. The definition is copied here (though commented out)
+// for reference.
+
+//namespace rti1516
+//{
+// class FEDTIME_EXPORT LogicalTimeFactoryFactory
+// {
+// public:
+//
+// // The name is used to choose among several LogicalTimeFactories that
might
+// // be present in the fedtime library. Each federation chooses its
+// // implementation by passing the appropriate name to
createFederationExecution.
+// // If the supplied name is the empty string, a default
LogicalTimeFactory is
+// // returned. If the supplied implementation name does not match any
name
+// // supported by the library, then a NULL pointer is returned.
+// static std::auto_ptr< LogicalTimeFactory >
+// makeLogicalTimeFactory(std::wstring const & implementationName);
+// };
+//}
+
+
+
+
+# endif // RTI1516_FED_TIME_H
Index: ieee1516-2000/RTI1516variableLengthData.cpp
===================================================================
RCS file: ieee1516-2000/RTI1516variableLengthData.cpp
diff -N ieee1516-2000/RTI1516variableLengthData.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ieee1516-2000/RTI1516variableLengthData.cpp 3 Mar 2014 15:18:22 -0000
1.1
@@ -0,0 +1,202 @@
+#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: ieee1516-2000/LogicalTimeDouble.h
===================================================================
RCS file: ieee1516-2000/LogicalTimeDouble.h
diff -N ieee1516-2000/LogicalTimeDouble.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ieee1516-2000/LogicalTimeDouble.h 3 Mar 2014 15:18:22 -0000 1.1
@@ -0,0 +1,415 @@
+#ifndef LogicalTimeDouble_INCLUDED
+#define LogicalTimeDouble_INCLUDED
+
+#ifdef _WIN32
+#pragma warning(disable:4290)
+#endif
+
+// Standard integer types.
+#ifdef _MSC_VER
+#ifndef FAKED_INTTYPES_DEFINED
+#define FAKED_INTTYPES_DEFINED
+typedef unsigned __int64 uint64_t;
+typedef signed __int64 int64_t;
+typedef unsigned __int32 uint32_t;
+typedef signed __int32 int32_t;
+typedef unsigned __int16 uint16_t;
+typedef signed __int16 int16_t;
+typedef unsigned __int8 uint8_t;
+typedef signed __int8 int8_t;
+typedef short int int_least16_t;
+#endif
+#else
+#include <inttypes.h>
+#endif
+
+#include "RTI/certiLogicalTime.h"
+#include "RTI/certiLogicalTimeInterval.h"
+#include "RTI/certiLogicalTimeFactory.h"
+
+// Microsoft has not implemented the swprintf function according
+// to the ISO C standard. However, they have a function _snwprintf
+// that matches the standardized prototype for swprintf.
+#ifdef _WIN32
+#define swprintf _snwprintf
+#endif
+
+class RTI_EXPORT_FEDTIME LogicalTimeDouble : public rti1516::LogicalTime
+{
+public:
+ LogicalTimeDouble(double value);
+
+ virtual ~LogicalTimeDouble()
+ throw ();
+
+ virtual void setInitial();
+
+ virtual bool isInitial() const;
+
+ virtual void setFinal();
+
+ virtual bool isFinal() const;
+
+ virtual long getSeconds() const;
+ virtual int getMicros() const;
+
+ virtual void setTo(rti1516::LogicalTime const & value)
+ throw (rti1516::InvalidLogicalTime);
+
+ virtual void increaseBy(rti1516::LogicalTimeInterval const & addend)
+ throw (rti1516::IllegalTimeArithmetic,
rti1516::InvalidLogicalTimeInterval);
+
+ virtual void decreaseBy(rti1516::LogicalTimeInterval const & subtrahend)
+ throw (rti1516::IllegalTimeArithmetic,
rti1516::InvalidLogicalTimeInterval);
+
+ virtual std::auto_ptr< rti1516::LogicalTimeInterval >
subtract(rti1516::LogicalTime const & subtrahend) const
+ throw (rti1516::InvalidLogicalTime);
+
+ virtual bool isGreaterThan(rti1516::LogicalTime const & value) const
+ throw (rti1516::InvalidLogicalTime);
+
+ virtual bool isLessThan(rti1516::LogicalTime const & value) const
+ throw (rti1516::InvalidLogicalTime);
+
+ virtual bool isEqualTo(rti1516::LogicalTime const & value) const
+ throw (rti1516::InvalidLogicalTime);
+
+ virtual bool isGreaterThanOrEqualTo(rti1516::LogicalTime const & value)
const
+ throw (rti1516::InvalidLogicalTime);
+
+ virtual bool isLessThanOrEqualTo(rti1516::LogicalTime const & value) const
+ throw (rti1516::InvalidLogicalTime);
+
+ // JvY Begin
+ virtual
+ rti1516::LogicalTime &
+ operator=(rti1516::LogicalTime const & value)
+ throw (rti1516::InvalidLogicalTime);
+
+ virtual
+ LogicalTimeDouble &
+ operator=(LogicalTimeDouble const & value)
+ throw (rti1516::InvalidLogicalTime);
+
+
+ virtual
+ rti1516::LogicalTime &
+ operator+=(rti1516::LogicalTimeInterval const & addend)
+ throw (rti1516::IllegalTimeArithmetic,
rti1516::InvalidLogicalTimeInterval)
+ {
+ increaseBy(addend);
+ return *this;
+ }
+
+ virtual
+ rti1516::LogicalTime &
+ operator-=(rti1516::LogicalTimeInterval const & subtrahend)
+ throw (rti1516::IllegalTimeArithmetic,
rti1516::InvalidLogicalTimeInterval)
+ {
+ decreaseBy(subtrahend);
+ return *this;
+ }
+
+ virtual
+ bool
+ operator>(rti1516::LogicalTime const & value) const
+ throw (rti1516::InvalidLogicalTime)
+ {
+ return isGreaterThan(value);
+ }
+
+ virtual
+ bool
+ operator<(rti1516::LogicalTime const & value) const
+ throw (rti1516::InvalidLogicalTime)
+ {
+ return isLessThan(value);
+ }
+
+ virtual
+ bool
+ operator>=(rti1516::LogicalTime const & value) const
+ throw (rti1516::InvalidLogicalTime)
+ {
+ return isGreaterThanOrEqualTo(value);
+ }
+
+ virtual
+ bool
+ operator<=(rti1516::LogicalTime const & value) const
+ throw (rti1516::InvalidLogicalTime)
+ {
+ return isLessThanOrEqualTo(value);
+ }
+
+ // Generates an encoded value that can be used to send
+ // LogicalTimes to other federates in updates or interactions
+ virtual rti1516::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 (rti1516::CouldNotEncode);
+
+ // Decode encodedLogicalTime into self
+ virtual void decode(rti1516::VariableLengthData const & encodedLogicalTime)
+ throw (rti1516::InternalError,
+ rti1516::CouldNotDecode);
+
+ // Alternate decode that reads directly from a buffer
+ virtual void decode(void* buffer, unsigned long bufferSize)
+ throw (rti1516::InternalError,
+ rti1516::CouldNotDecode);
+
+ // Returns the name of the implementation, as needed by
+ // createFederationExecution.
+ virtual std::wstring implementationName() const
+ {
+ return L"BITS_LogicalTimeDouble";
+ }
+
+ // JvY End
+
+ //virtual std::auto_ptr< rti1516::EncodedLogicalTime > encode() const;
+
+ virtual std::wstring toString() const;
+
+ virtual bool operator==(LogicalTime const & left) const
+ throw (rti1516::InvalidLogicalTime);
+
+ virtual int64_t toMilliseconds() const;
+
+private:
+ explicit LogicalTimeDouble(int64_t value);
+
+ int64_t _value;
+
+ friend class LogicalTimeDoubleFactory;
+ friend class LogicalTimeFactoryDouble;
+};
+
+class RTI_EXPORT_FEDTIME LogicalTimeIntervalDouble : public
rti1516::LogicalTimeInterval
+{
+public:
+ LogicalTimeIntervalDouble(double value);
+
+ virtual ~LogicalTimeIntervalDouble()
+ throw ();
+
+ virtual void setZero();
+
+ virtual bool isZero() const;
+
+ virtual void setEpsilon();
+
+ virtual bool isEpsilon() const;
+
+ virtual long getSeconds() const;
+ virtual int getMicros() const;
+
+ virtual void setTo(rti1516::LogicalTimeInterval const & value)
+ throw (rti1516::InvalidLogicalTimeInterval);
+
+ virtual std::auto_ptr< rti1516::LogicalTimeInterval >
subtract(rti1516::LogicalTimeInterval const & subtrahend) const
+ throw (rti1516::InvalidLogicalTimeInterval);
+
+ virtual bool isGreaterThan(rti1516::LogicalTimeInterval const & value) const
+ throw (rti1516::InvalidLogicalTimeInterval);
+
+ virtual bool isLessThan(rti1516::LogicalTimeInterval const & value) const
+ throw (rti1516::InvalidLogicalTimeInterval);
+
+ virtual bool isEqualTo(rti1516::LogicalTimeInterval const & value) const
+ throw (rti1516::InvalidLogicalTimeInterval);
+
+ virtual bool isGreaterThanOrEqualTo(rti1516::LogicalTimeInterval const &
value) const
+ throw (rti1516::InvalidLogicalTimeInterval);
+
+ virtual bool isLessThanOrEqualTo(rti1516::LogicalTimeInterval const &
value) const
+ throw (rti1516::InvalidLogicalTimeInterval);
+
+ //virtual std::auto_ptr< rti1516::EncodedLogicalTimeInterval > encode()
const;
+
+ virtual std::wstring toString() const;
+
+ // JvY Begin
+ virtual
+ LogicalTimeInterval &
+ operator=(rti1516::LogicalTimeInterval const & value)
+ throw (rti1516::InvalidLogicalTimeInterval)
+ {
+ setTo(value);
+ return *this;
+ }
+
+
+ // Set self to the difference between two LogicalTimes
+ virtual
+ void
+ setToDifference(rti1516::LogicalTime const & minuend,
+ rti1516::LogicalTime const& subtrahend)
+ throw (rti1516::InvalidLogicalTime);
+
+ virtual
+ rti1516::LogicalTimeInterval &
+ operator+=(rti1516::LogicalTimeInterval const & addend)
+ throw (rti1516::InvalidLogicalTimeInterval);
+
+ virtual
+ rti1516::LogicalTimeInterval &
+ operator-=(rti1516::LogicalTimeInterval const & subtrahend)
+ throw (rti1516::InvalidLogicalTimeInterval);
+
+ virtual
+ bool
+ operator>(rti1516::LogicalTimeInterval const & value) const
+ throw (rti1516::InvalidLogicalTimeInterval)
+ {
+ return isGreaterThan(value);
+ }
+
+ virtual
+ bool
+ operator<(rti1516::LogicalTimeInterval const & value) const
+ throw (rti1516::InvalidLogicalTimeInterval)
+ {
+ return isLessThan(value);
+ }
+
+ virtual
+ bool
+ operator==(rti1516::LogicalTimeInterval const & value) const
+ throw (rti1516::InvalidLogicalTimeInterval)
+ {
+ return isEqualTo(value);
+ }
+
+ virtual
+ bool
+ operator>=(rti1516::LogicalTimeInterval const & value) const
+ throw (rti1516::InvalidLogicalTimeInterval)
+ {
+ return isGreaterThanOrEqualTo(value);
+ }
+
+ virtual
+ bool
+ operator<=(rti1516::LogicalTimeInterval const & value) const
+ throw (rti1516::InvalidLogicalTimeInterval)
+ {
+ return isLessThanOrEqualTo(value);
+ }
+
+ // Generates an encoded value that can be used to send
+ // LogicalTimeIntervals to other federates in updates or interactions
+ virtual rti1516::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 (rti1516::CouldNotEncode);
+
+ // Decode encodedValue into self
+ virtual void decode(rti1516::VariableLengthData const & encodedValue)
+ throw (rti1516::InternalError,
+ rti1516::CouldNotDecode);
+
+ // Alternate decode that reads directly from a buffer
+ virtual void decode(void* buffer, unsigned long bufferSize)
+ throw (rti1516::InternalError,
+ rti1516::CouldNotDecode);
+
+ // Returns the name of the implementation, as needed by
+ // createFederationExecution.
+ virtual std::wstring implementationName() const
+ {
+ return L"BITS_LogicalTimeIntervalDouble";
+ }
+
+ // JvY End
+
+private:
+ explicit LogicalTimeIntervalDouble(int64_t value);
+
+ int64_t _value;
+
+ friend class LogicalTimeDouble;
+ friend class LogicalTimeDoubleFactory;
+ friend class LogicalTimeFactoryDouble;
+ friend class LogicalTimeIntervalDoubleFactory;
+ friend class LogicalTimeIntervalFactoryDouble;
+};
+
+
+class RTI_EXPORT_FEDTIME LogicalTimeDoubleFactory : public
rti1516::LogicalTimeFactory
+{
+public:
+ virtual ~LogicalTimeDoubleFactory()
+ throw ();
+
+ virtual std::auto_ptr< rti1516::LogicalTime > makeInitial()
+ throw (rti1516::InternalError);
+
+ // Returns a LogicalTime with a value of "initial"
+ virtual
+ std::auto_ptr< rti1516::LogicalTime >
+ makeLogicalTime()
+ throw (rti1516::InternalError)
+ {
+ return makeInitial();
+ }
+
+ // Returns a LogicalTimeInterval with a value of "zero"
+ virtual
+ std::auto_ptr< rti1516::LogicalTimeInterval >
+ makeLogicalTimeInterval()
+ throw (rti1516::InternalError)
+ {
+ return makeZero();
+ }
+
+ virtual std::auto_ptr< rti1516::LogicalTimeInterval > makeZero()
+ throw (rti1516::InternalError);
+
+ virtual std::auto_ptr< rti1516::LogicalTimeInterval > epsilon()
+ throw (rti1516::InternalError);
+
+ //virtual std::auto_ptr< rti1516::LogicalTime >
decode(rti1516::EncodedLogicalTime const & encodedLogicalTime)
+ // throw (rti1516::InternalError, rti1516::CouldNotDecode);
+};
+
+class RTI_EXPORT_FEDTIME LogicalTimeFactoryDouble : public
LogicalTimeDoubleFactory
+{
+public:
+ virtual ~LogicalTimeFactoryDouble()
+ throw ();
+
+};
+
+class RTI_EXPORT_FEDTIME LogicalTimeIntervalDoubleFactory : public
LogicalTimeDoubleFactory
+{
+public:
+ virtual ~LogicalTimeIntervalDoubleFactory()
+ throw ();
+
+};
+
+class RTI_EXPORT_FEDTIME LogicalTimeIntervalFactoryDouble : public
LogicalTimeDoubleFactory
+{
+public:
+ virtual ~LogicalTimeIntervalFactoryDouble()
+ throw ()
+ {
+ }
+
+};
+
+class RTI_EXPORT_FEDTIME LogicalTimeDoubleFactoryFactory : public
rti1516::LogicalTimeFactoryFactory
+{
+public:
+ static std::auto_ptr< rti1516::LogicalTimeFactory >
+ makeLogicalTimeFactory(std::wstring const & implementationName);
+
+};
+
+#endif // LogicalTimeDouble_INCLUDED
Index: ieee1516-2000/RTI1516ambTime.cpp
===================================================================
RCS file: ieee1516-2000/RTI1516ambTime.cpp
diff -N ieee1516-2000/RTI1516ambTime.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ieee1516-2000/RTI1516ambTime.cpp 3 Mar 2014 15:18:22 -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: ieee1516-2000/RTI1516ambPrivateRefs.cpp
===================================================================
RCS file: ieee1516-2000/RTI1516ambPrivateRefs.cpp
diff -N ieee1516-2000/RTI1516ambPrivateRefs.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ieee1516-2000/RTI1516ambPrivateRefs.cpp 3 Mar 2014 15:18:22 -0000
1.1
@@ -0,0 +1,1208 @@
+// ----------------------------------------------------------------------------
+// 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: ieee1516-2000/RTI1516ambassadorFactory.cpp
===================================================================
RCS file: ieee1516-2000/RTI1516ambassadorFactory.cpp
diff -N ieee1516-2000/RTI1516ambassadorFactory.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ieee1516-2000/RTI1516ambassadorFactory.cpp 3 Mar 2014 15:18:22 -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 "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: ieee1516-2000/RTI1516fedTime.cpp
===================================================================
RCS file: ieee1516-2000/RTI1516fedTime.cpp
diff -N ieee1516-2000/RTI1516fedTime.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ieee1516-2000/RTI1516fedTime.cpp 3 Mar 2014 15:18:22 -0000 1.1
@@ -0,0 +1,849 @@
+#include <RTI/certiLogicalTime.h>
+#include <RTI/certiLogicalTimeInterval.h>
+#include <RTI/certiLogicalTimeFactory.h>
+
+#include <limits>
+#include <memory>
+#include <cstdlib>
+#include <cstring>
+
+#include "RTI1516fedTime.h"
+#include "certi.hh"
+
+rti1516::LogicalTime &
+rti1516::LogicalTime::operator=(rti1516::LogicalTime const & value)
+throw (rti1516::InvalidLogicalTime)
+{
+ throw std::wstring(L"Operator should be overloaded");
+ //throw rti1516::InvalidLogicalTime(L"Operator should be overloaded");
+}
+
+rti1516::LogicalTimeInterval &
+rti1516::LogicalTimeInterval::operator=(rti1516::LogicalTimeInterval const &
value)
+throw (rti1516::InvalidLogicalTimeInterval)
+{
+ throw std::wstring(L"Operator should be overloaded");
+ //throw rti1516::InvalidLogicalTimeInterval(L"Operator should be
overloaded");
+}
+
+
+/////////////////////////////////////////////////////////////
+//------------------- RTI1516fedTime ----------------------//
+/////////////////////////////////////////////////////////////
+
+
+RTI1516fedTime::RTI1516fedTime(double timeVal)
+: _fedTime(timeVal)
+, _zero(0)
+, _epsilon(std::numeric_limits<double>::epsilon())
+, _positiveInfinity(std::numeric_limits<double>::infinity())
+{
+}
+
+RTI1516fedTime::RTI1516fedTime(const RTI1516fedTime &other)
+: _fedTime(other._fedTime)
+, _zero(other._zero)
+, _epsilon(other._epsilon)
+, _positiveInfinity(other._positiveInfinity)
+{
+}
+
+RTI1516fedTime::~RTI1516fedTime()
+throw ()
+{
+}
+
+
+void
+RTI1516fedTime::setInitial()
+{
+ _fedTime = (0);
+ _zero = (0);
+ _epsilon = (std::numeric_limits<double>::epsilon());
+ _positiveInfinity = (std::numeric_limits<double>::infinity());
+}
+
+
+bool
+RTI1516fedTime::isInitial() const
+{
+ return (_fedTime == _zero);
+}
+
+
+void
+RTI1516fedTime::setFinal()
+{
+ _fedTime = (0);
+ _zero = (0);
+ _epsilon = (std::numeric_limits<double>::epsilon());
+ _positiveInfinity = (std::numeric_limits<double>::infinity());
+}
+
+
+bool
+RTI1516fedTime::isFinal() const
+{
+ return (_fedTime == _zero);
+}
+
+
+rti1516::LogicalTime &
+RTI1516fedTime::operator=(rti1516::LogicalTime const & value)
+throw (rti1516::InvalidLogicalTime)
+{
+ if (this != &value)
+ {
+ const RTI1516fedTime * other = dynamic_cast<const
RTI1516fedTime *>(&value);
+ if (other == NULL)
+ {
+#if defined(_WIN32)
+ throw std::wstring(L"Different LogicalTime
implementation");
+ //throw rti1516::InvalidLogicalTime(L"Different
LogicalTime implementation");
+#else
+ //throw rti1516::InvalidLogicalTime(L"Different
LogicalTime implementation");
+#endif
+ } else
+ {
+ _fedTime = other->_fedTime;
+ _zero = other->_zero;
+ _epsilon = other->_epsilon;
+ _positiveInfinity = other->_positiveInfinity;
+ }
+ }
+
+ return *this;
+}
+
+RTI1516fedTime &
+RTI1516fedTime::operator=(RTI1516fedTime const & other)
+throw ()
+{
+ if (this != &other)
+ {
+ _fedTime = other._fedTime;
+ _zero = other._zero;
+ _epsilon = other._epsilon;
+ _positiveInfinity = other._positiveInfinity;
+ }
+ return *this;
+}
+
+
+rti1516::LogicalTime &
+RTI1516fedTime::operator+=(rti1516::LogicalTimeInterval const & value)
+throw (rti1516::IllegalTimeArithmetic, rti1516::InvalidLogicalTimeInterval)
+{
+ const RTI1516fedTimeInterval * other = dynamic_cast<const
RTI1516fedTimeInterval *>(&value);
+ if (other == NULL)
+ {
+#if defined(_WIN32)
+ throw std::wstring(L"Different LogicalTime implementation");
+#else
+ //throw rti1516::InvalidLogicalTime(L"Different LogicalTime
implementation");
+#endif
+ } else
+ {
+ _fedTime += other->getInterval();
+ }
+
+ return *this;
+}
+
+
+rti1516::LogicalTime &
+RTI1516fedTime::operator-=(rti1516::LogicalTimeInterval const & value)
+throw (rti1516::IllegalTimeArithmetic, rti1516::InvalidLogicalTimeInterval)
+{
+ const RTI1516fedTimeInterval * other = dynamic_cast<const
RTI1516fedTimeInterval *>(&value);
+ if (other == NULL)
+ {
+#if defined(_WIN32)
+ throw std::wstring(L"Different LogicalTime implementation");
+#else
+ //throw rti1516::InvalidLogicalTime(L"Different LogicalTime
implementation");
+#endif
+ } else
+ {
+ _fedTime -= other->getInterval();
+ }
+
+ return *this;
+}
+
+
+bool
+RTI1516fedTime::operator>(rti1516::LogicalTime const & value) const
+throw (rti1516::InvalidLogicalTime)
+{
+ const RTI1516fedTime * other = dynamic_cast<const RTI1516fedTime
*>(&value);
+ if (other == NULL)
+ {
+#if defined(_WIN32)
+ throw std::wstring(L"Different LogicalTime implementation");
+#else
+ //throw rti1516::InvalidLogicalTime(L"Different LogicalTime
implementation");
+#endif
+ } else
+ {
+ return _fedTime > other->_fedTime;
+ }
+ return false;
+}
+
+
+bool
+RTI1516fedTime::operator<(rti1516::LogicalTime const & value) const
+throw (rti1516::InvalidLogicalTime)
+{
+ const RTI1516fedTime * other = dynamic_cast<const RTI1516fedTime
*>(&value);
+ if (other == NULL)
+ {
+#if defined(_WIN32)
+ throw std::wstring(L"Different LogicalTime implementation");
+#else
+ //throw rti1516::InvalidLogicalTime(L"Different LogicalTime
implementation");
+#endif
+ } else
+ {
+ return _fedTime < other->_fedTime;
+ }
+ return false;
+}
+
+
+bool
+RTI1516fedTime::operator==(rti1516::LogicalTime const & value) const
+throw (rti1516::InvalidLogicalTime)
+{
+ const RTI1516fedTime * other = dynamic_cast<const RTI1516fedTime
*>(&value);
+ if (other == NULL)
+ {
+#if defined(_WIN32)
+ throw std::wstring(L"Different LogicalTime implementation");
+#else
+ //throw rti1516::InvalidLogicalTime(L"Different LogicalTime
implementation");
+#endif
+ } else
+ {
+ // TODO Should use epsilon during comparison
+ return _fedTime == other->_fedTime;
+ }
+ return false;
+}
+
+
+bool
+RTI1516fedTime::operator>=(rti1516::LogicalTime const & value) const
+throw (rti1516::InvalidLogicalTime)
+{
+ const RTI1516fedTime * other = dynamic_cast<const RTI1516fedTime
*>(&value);
+ if (other == NULL)
+ {
+#if defined(_WIN32)
+ throw std::wstring(L"Different LogicalTime implementation");
+#else
+ //throw rti1516::InvalidLogicalTime(L"Different LogicalTime
implementation");
+#endif
+ } else
+ {
+ return _fedTime >= other->_fedTime;
+ }
+ return false;
+}
+
+
+bool
+RTI1516fedTime::operator<=(rti1516::LogicalTime const & value) const
+throw (rti1516::InvalidLogicalTime)
+{
+ const RTI1516fedTime * other = dynamic_cast<const RTI1516fedTime
*>(&value);
+ if (other == NULL)
+ {
+#if defined(_WIN32)
+ throw std::wstring(L"Different LogicalTime implementation");
+#else
+ //throw rti1516::InvalidLogicalTime(L"Different LogicalTime
implementation");
+#endif
+ } else
+ {
+ return _fedTime <= other->_fedTime;
+ }
+ return false;
+}
+
+// Generates an encoded value that can be used to send
+// LogicalTimes to other federates in updates or interactions
+
+rti1516::VariableLengthData
+RTI1516fedTime::encode() const
+{
+ uint64_t value;
+#ifdef HOST_IS_BIG_ENDIAN
+ memcpy(&value, &_fedTime, sizeof(double));
+#else
+ value = CERTI_ENCODE_DOUBLE_TO_UINT64BE(&_fedTime);
+#endif
+ return rti1516::VariableLengthData(&value,sizeof(uint64_t));
+}
+
+// Alternate encode for directly filling a buffer
+
+unsigned long
+RTI1516fedTime::encodedLength() const
+{
+ return sizeof(double);
+}
+
+
+unsigned long
+RTI1516fedTime::encode(void* buffer, unsigned long bufferSize) const
+throw (rti1516::CouldNotEncode)
+{
+ if (bufferSize >= sizeof(double))
+ {
+#ifdef HOST_IS_BIG_ENDIAN
+ memcpy(buffer, &_fedTime, sizeof(double));
+#else
+ uint64_t value;
+ value = CERTI_ENCODE_DOUBLE_TO_UINT64BE(&_fedTime);
+ memcpy(buffer,&value,sizeof(double));
+#endif
+ return sizeof(double);
+ } else
+ {
+#if defined(_WIN32)
+ throw std::wstring(L"Not enough space in buffer to encode
RTI1516fedTime");
+#else
+ return 0;
+ //throw rti1516::CouldNotEncode(L"Not enough space in buffer to
encode RTI1516fedTime");
+#endif
+ }
+}
+
+// Decode encodedLogicalTime into self
+
+void
+RTI1516fedTime::decode(rti1516::VariableLengthData const & encodedLogicalTime)
+throw (rti1516::InternalError,
+ rti1516::CouldNotDecode)
+{
+ union ud {
+ double dv;
+ uint64_t uv;
+ } value;
+#ifdef HOST_IS_BIG_ENDIAN
+ memcpy(&(value.uv), encodedLogicalTime.data(), sizeof(double));
+#else
+ value.uv = CERTI_DECODE_DOUBLE_FROM_UINT64BE(encodedLogicalTime.data());
+#endif
+ _fedTime = value.dv;
+}
+
+// Alternate decode that reads directly from a buffer
+
+void
+RTI1516fedTime::decode(void* buffer, unsigned long bufferSize)
+throw (rti1516::InternalError,
+ rti1516::CouldNotDecode)
+{
+ if (bufferSize >= sizeof(double))
+ {
+ union ud {
+ double dv;
+ uint64_t uv;
+ } value;
+ value.uv = CERTI_DECODE_DOUBLE_FROM_UINT64BE(buffer);
+ _fedTime = value.dv;
+ } else
+ {
+#if defined(_WIN32) && defined(_MSC_VER)
+ throw std::wstring(L"Not enough space in buffer to decode
RTI1516fedTime");
+#else
+ //throw rti1516::CouldNotEncode(L"Not enough space in buffer to
decode RTI1516fedTime");
+#endif
+ }
+}
+
+
+std::wstring
+RTI1516fedTime::toString() const
+{
+ std::wstringstream stream;
+
+ stream << _fedTime;
+
+ return stream.str();
+}
+
+// Returns the name of the implementation, as needed by
+// createFederationExecution.
+
+std::wstring
+RTI1516fedTime::implementationName() const
+{
+ static std::wstring implName(L"certiFedTime1516");
+ return implName;
+}
+
+
+/////////////////////////////////////////////////////////////
+//--------------- RTI1516fedTimeInterval ------------------//
+/////////////////////////////////////////////////////////////
+
+RTI1516fedTimeInterval::RTI1516fedTimeInterval(double timeVal)
+: _fedInterval(timeVal)
+, _zero(0)
+, _epsilon(std::numeric_limits<double>::epsilon())
+, _positiveInfinity(std::numeric_limits<double>::infinity())
+{
+}
+
+RTI1516fedTimeInterval::RTI1516fedTimeInterval(const RTI1516fedTimeInterval
&other)
+: _fedInterval(other._fedInterval)
+, _zero(other._zero)
+, _epsilon(other._epsilon)
+, _positiveInfinity(other._positiveInfinity)
+{
+}
+
+
+RTI1516fedTimeInterval::~RTI1516fedTimeInterval()
+throw ()
+{
+}
+
+
+void
+RTI1516fedTimeInterval::setZero()
+{
+ _fedInterval = _zero;
+}
+
+
+bool
+RTI1516fedTimeInterval::isZero() const
+{
+ return _fedInterval == _zero;
+}
+
+
+void
+RTI1516fedTimeInterval::setEpsilon()
+{
+ _epsilon = (std::numeric_limits<double>::epsilon());
+}
+
+
+bool
+RTI1516fedTimeInterval::isEpsilon() const
+{
+
+ return abs(_fedInterval) <= abs(_epsilon);
+}
+
+
+rti1516::LogicalTimeInterval &
+RTI1516fedTimeInterval::operator=(rti1516::LogicalTimeInterval const & value)
+throw (rti1516::InvalidLogicalTimeInterval)
+{
+ if (this != &value)
+ {
+ const RTI1516fedTimeInterval * other = dynamic_cast<const
RTI1516fedTimeInterval *>(&value);
+ if (other == NULL)
+ {
+#if defined(_WIN32) && defined(_MSC_VER)
+ throw std::wstring(L"Different LogicalTimeInterval
implementation");
+#else
+ //throw rti1516::InvalidLogicalTimeInterval(L"Different
LogicalTimeInterval implementation");
+#endif
+ } else
+ {
+ _fedInterval = other->_fedInterval;
+ _zero = other->_zero;
+ _epsilon = other->_epsilon;
+ _positiveInfinity = other->_positiveInfinity;
+ }
+ }
+
+ return *this;
+}
+
+RTI1516fedTimeInterval &
+RTI1516fedTimeInterval::operator=(RTI1516fedTimeInterval const & other)
+throw ()
+{
+ if (this != &other)
+ {
+ _fedInterval = other._fedInterval;
+ _zero = other._zero;
+ _epsilon = other._epsilon;
+ _positiveInfinity = other._positiveInfinity;
+ }
+ return *this;
+}
+
+
+// Set self to the difference between two LogicalTimes
+
+void
+RTI1516fedTimeInterval::setToDifference(rti1516::LogicalTime const & minuend,
+
rti1516::LogicalTime const& subtrahend)
+
throw (rti1516::InvalidLogicalTime)
+{
+ const RTI1516fedTime * val1 = dynamic_cast<const RTI1516fedTime
*>(&minuend);
+ const RTI1516fedTime * val2 = dynamic_cast<const RTI1516fedTime
*>(&subtrahend);
+
+ if (val1 == 0 && val2 == 0)
+ {
+ // Both wrong
+ std::wstring message(L"First and second argument are different
LogicalTime implementations.");
+#if defined(_WIN32) && defined(_MSC_VER)
+ throw message;
+#else
+ //throw rti1516::InvalidLogicalTime(message);
+#endif
+ } else if (val1 == 0)
+ {
+ // first wrong
+ std::wstring message(L"First argument uses a different
LogicalTime implementations.");
+#if defined(_WIN32) && defined(_MSC_VER)
+ throw message;
+#else
+ //throw rti1516::InvalidLogicalTime(message);
+#endif
+ } else if (val2 == 0)
+ {
+ // second wrong
+ std::wstring message(L"Second argument uses a different
LogicalTime implementations.");
+#if defined(_WIN32) && defined(_MSC_VER)
+ throw message;
+#else
+ //throw rti1516::InvalidLogicalTime(message);
+#endif
+ } else
+ {
+ // Both correct
+ // TODO Should handle infinity?
+ _fedInterval = val1->getFedTime() - val2->getFedTime();
+ }
+} /* end of RTI1516fedTimeInterval::setToDifference */
+
+
+rti1516::LogicalTimeInterval &
+RTI1516fedTimeInterval::operator+=(rti1516::LogicalTimeInterval const & value)
+throw (rti1516::InvalidLogicalTimeInterval)
+{
+ const RTI1516fedTimeInterval * other = dynamic_cast<const
RTI1516fedTimeInterval *>(&value);
+ if (other == NULL)
+ {
+#if defined(_WIN32) && defined(_MSC_VER)
+ throw std::wstring(L"Different LogicalTimeInterval
implementation");
+#else
+ //throw rti1516::InvalidLogicalTimeInterval(L"Different
LogicalTimeInterval implementation");
+#endif
+ } else
+ {
+ _fedInterval += other->getInterval();
+ }
+ return *this;
+}
+
+
+rti1516::LogicalTimeInterval &
+RTI1516fedTimeInterval::operator-=(rti1516::LogicalTimeInterval const & value)
+throw (rti1516::InvalidLogicalTimeInterval)
+{
+ const RTI1516fedTimeInterval * other = dynamic_cast<const
RTI1516fedTimeInterval *>(&value);
+ if (other == NULL)
+ {
+#if defined(_WIN32) && defined(_MSC_VER)
+ throw std::wstring(L"Different LogicalTimeInterval
implementation");
+#else
+ //throw rti1516::InvalidLogicalTimeInterval(L"Different
LogicalTimeInterval implementation");
+#endif
+ } else
+ {
+ _fedInterval -= other->getInterval();
+ }
+ return *this;
+}
+
+
+bool
+RTI1516fedTimeInterval::operator>(rti1516::LogicalTimeInterval const & value)
const
+throw (rti1516::InvalidLogicalTimeInterval)
+{
+ const RTI1516fedTimeInterval * other = dynamic_cast<const
RTI1516fedTimeInterval *>(&value);
+ if (other == NULL)
+ {
+#if defined(_WIN32) && defined(_MSC_VER)
+ throw std::wstring(L"Different LogicalTimeInterval
implementation");
+#else
+ //throw rti1516::InvalidLogicalTimeInterval(L"Different
LogicalTimeInterval implementation");
+#endif
+ } else
+ {
+ return getInterval() > other->getInterval();
+ }
+ return false;
+} /* end of RTI1516fedTimeInterval::operator> */
+
+
+bool
+RTI1516fedTimeInterval::operator<(rti1516::LogicalTimeInterval const & value)
const
+throw (rti1516::InvalidLogicalTimeInterval)
+{
+ const RTI1516fedTimeInterval * other = dynamic_cast<const
RTI1516fedTimeInterval *>(&value);
+ if (other == NULL)
+ {
+#if defined(_WIN32) && defined(_MSC_VER)
+ throw std::wstring(L"Different LogicalTimeInterval
implementation");
+#else
+ //throw rti1516::InvalidLogicalTimeInterval(L"Different
LogicalTimeInterval implementation");
+#endif
+ } else
+ {
+ return getInterval() > other->getInterval();
+ }
+ return false;
+}
+
+
+bool
+RTI1516fedTimeInterval::operator==(rti1516::LogicalTimeInterval const & value)
const
+throw (rti1516::InvalidLogicalTimeInterval)
+{
+ const RTI1516fedTimeInterval * other = dynamic_cast<const
RTI1516fedTimeInterval *>(&value);
+ if (other == NULL)
+ {
+#if defined(_WIN32) && defined(_MSC_VER)
+ throw std::wstring(L"Different LogicalTimeInterval
implementation");
+#else
+ //throw rti1516::InvalidLogicalTimeInterval(L"Different
LogicalTimeInterval implementation");
+#endif
+ } else
+ {
+ return getInterval() == other->getInterval();
+ }
+ return false;
+}
+
+
+bool
+RTI1516fedTimeInterval::operator>=(rti1516::LogicalTimeInterval const & value)
const
+throw (rti1516::InvalidLogicalTimeInterval)
+{
+ const RTI1516fedTimeInterval * other = dynamic_cast<const
RTI1516fedTimeInterval *>(&value);
+ if (other == NULL)
+ {
+#if defined(_WIN32) && defined(_MSC_VER)
+ throw std::wstring(L"Different LogicalTimeInterval
implementation");
+#else
+ //throw rti1516::InvalidLogicalTimeInterval(L"Different
LogicalTimeInterval implementation");
+#endif
+ } else
+ {
+ return getInterval() >= other->getInterval();
+ }
+ return false;
+}
+
+
+bool
+RTI1516fedTimeInterval::operator<=(rti1516::LogicalTimeInterval const & value)
const
+throw (rti1516::InvalidLogicalTimeInterval)
+{
+ const RTI1516fedTimeInterval * other = dynamic_cast<const
RTI1516fedTimeInterval *>(&value);
+ if (other == NULL)
+ {
+#if defined(_WIN32) && defined(_MSC_VER)
+ throw std::wstring(L"Different LogicalTimeInterval
implementation");
+#else
+ //throw rti1516::InvalidLogicalTimeInterval(L"Different
LogicalTimeInterval implementation");
+#endif
+ } else
+ {
+ return getInterval() <= other->getInterval();
+ }
+ return false;
+}
+
+// Generates an encoded value that can be used to send
+// LogicalTimeIntervals to other federates in updates or interactions
+
+rti1516::VariableLengthData
+RTI1516fedTimeInterval::encode() const
+{
+ uint64_t value;
+#ifdef HOST_IS_BIG_ENDIAN
+ memcpy(&value, &_fedTime, sizeof(double));
+#else
+ value = CERTI_ENCODE_DOUBLE_TO_UINT64BE(&_fedInterval);
+#endif
+ return rti1516::VariableLengthData(&value,sizeof(uint64_t));
+}
+
+// Alternate encode for directly filling a buffer
+
+unsigned long
+RTI1516fedTimeInterval::encodedLength() const
+{
+ return sizeof(double);
+}
+
+
+unsigned long
+RTI1516fedTimeInterval::encode(void* buffer, unsigned long bufferSize) const
+throw (rti1516::CouldNotEncode)
+{
+ if (bufferSize >= sizeof(double))
+ {
+#ifdef HOST_IS_BIG_ENDIAN
+ memcpy(buffer, &_fedInterval, sizeof(double));
+#else
+ uint64_t value;
+ value = CERTI_ENCODE_DOUBLE_TO_UINT64BE(&_fedInterval);
+ memcpy(buffer,&value,sizeof(double));
+#endif
+ return sizeof(double);
+ } else
+ {
+#if defined(_WIN32) && defined(_MSC_VER)
+ throw std::wstring(L"Not enough space in buffer to encode
RTI1516fedTimeInterval");
+#else
+ //throw rti1516::CouldNotEncode(L"Not enough space in buffer to
encode RTI1516fedTimeInterval");
+#endif
+ }
+ return false;
+}
+
+// Decode encodedValue into self
+
+void
+RTI1516fedTimeInterval::decode(rti1516::VariableLengthData const &
encodedValue)
+throw (rti1516::InternalError, rti1516::CouldNotDecode)
+{
+ union ud {
+ double dv;
+ uint64_t uv;
+ } value;
+#ifdef HOST_IS_BIG_ENDIAN
+ memcpy(&(value.uv), encodedValue.data(), sizeof(double));
+#else
+ value.uv = CERTI_DECODE_DOUBLE_FROM_UINT64BE(encodedValue.data());
+#endif
+ _fedInterval = value.dv;
+}
+
+// Alternate decode that reads directly from a buffer
+
+void
+RTI1516fedTimeInterval::decode(void* buffer, unsigned long bufferSize)
+throw (rti1516::InternalError, rti1516::CouldNotDecode)
+{
+ if (bufferSize >= sizeof(double))
+ {
+ union ud {
+ double dv;
+ uint64_t uv;
+ } value;
+ value.uv = CERTI_DECODE_DOUBLE_FROM_UINT64BE(buffer);
+ _fedInterval = value.dv;
+ } else
+ {
+#if defined(_WIN32) && defined(_MSC_VER)
+ throw std::wstring(L"Not enough space in buffer to decode
RTI1516fedTimeInterval");
+#else
+ //throw rti1516::CouldNotEncode(L"Not enough space in buffer to
decode RTI1516fedTimeInterval");
+#endif
+ }
+}
+
+
+std::wstring
+RTI1516fedTimeInterval::toString() const
+{
+ std::wstringstream stream;
+ stream << _fedInterval;
+
+ return stream.str();
+}
+
+// Returns the name of the implementation, as needed by
+// createFederationExecution.
+
+std::wstring
+RTI1516fedTimeInterval::implementationName() const
+{
+ static std::wstring implName(L"certiFedTime1516");
+ return implName;
+}
+
+
+/////////////////////////////////////////////////////////////
+//---------------- RTI1516fedTimeFactory ------------------//
+/////////////////////////////////////////////////////////////
+
+RTI1516fedTimeFactory::RTI1516fedTimeFactory()
+throw ()
+{
+}
+
+
+RTI1516fedTimeFactory::~RTI1516fedTimeFactory()
+throw ()
+{
+}
+
+// Returns a LogicalTime with a value of "initial"
+
+std::auto_ptr< rti1516::LogicalTime >
+RTI1516fedTimeFactory::makeLogicalTime()
+throw (rti1516::InternalError)
+{
+ RTI1516fedTime *fedTime = new RTI1516fedTime(0);
+
+ return std::auto_ptr< rti1516::LogicalTime >(fedTime);
+}
+
+
+std::auto_ptr< rti1516::LogicalTime >
+RTI1516fedTimeFactory::makeLogicalTime(double timeVal)
+throw (rti1516::InternalError)
+{
+ RTI1516fedTime *fedTime = new RTI1516fedTime(timeVal);
+
+ return std::auto_ptr< rti1516::LogicalTime >(fedTime);
+}
+
+// Returns a LogicalTimeInterval with a value of "zero"
+
+std::auto_ptr< rti1516::LogicalTimeInterval >
+RTI1516fedTimeFactory::makeLogicalTimeInterval()
+throw (rti1516::InternalError)
+{
+ RTI1516fedTimeInterval *fedTimeInterval = new RTI1516fedTimeInterval(0);
+
+ return std::auto_ptr< rti1516::LogicalTimeInterval >(fedTimeInterval);
+}
+
+
+std::auto_ptr< rti1516::LogicalTimeInterval >
+RTI1516fedTimeFactory::makeLogicalTimeInterval(double timeInterval)
+throw (rti1516::InternalError)
+{
+ RTI1516fedTimeInterval *fedTimeInterval = new
RTI1516fedTimeInterval(timeInterval);
+
+ return std::auto_ptr< rti1516::LogicalTimeInterval >(fedTimeInterval);
+}
+
+
+
+std::auto_ptr< rti1516::LogicalTimeFactory >
+rti1516::LogicalTimeFactoryFactory::makeLogicalTimeFactory(std::wstring const
& implementationName)
+{
+ RTI1516fedTimeFactory *fedTimeFactory = new RTI1516fedTimeFactory();
+
+ return std::auto_ptr< rti1516::LogicalTimeFactory >(fedTimeFactory);
+}
Index: ieee1516-2000/RTI1516HandleFactory.cpp
===================================================================
RCS file: ieee1516-2000/RTI1516HandleFactory.cpp
diff -N ieee1516-2000/RTI1516HandleFactory.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ieee1516-2000/RTI1516HandleFactory.cpp 3 Mar 2014 15:18:22 -0000
1.1
@@ -0,0 +1,76 @@
+#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: ieee1516-2000/CMakeLists.txt
===================================================================
RCS file: ieee1516-2000/CMakeLists.txt
diff -N ieee1516-2000/CMakeLists.txt
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ieee1516-2000/CMakeLists.txt 3 Mar 2014 15:18:22 -0000 1.1
@@ -0,0 +1,156 @@
+# Add standard specific include directory
+include_directories(${CMAKE_SOURCE_DIR}/include/ieee1516-2000)
+include_directories(${CMAKE_BINARY_DIR}/include/ieee1516-2000)
+
+##########################################################
+# VariableLengthData
+# This STATIC library is necessary on Windows in order
+# to avoid circular dependencies
+# FIXME
+# may be we can use CMakeOBJECT library instead
+# FIXME
+##########################################################
+if (WIN32)
+ set(VARDATA1516_SRCS
+ RTI1516variableLengthData.cpp
+ RTI1516variableLengthDataImplementation.h
+ ${CMAKE_SOURCE_DIR}/include/ieee1516-2000/RTI/VariableLengthData.h
+ )
+
+ source_group("Source Files\\VarData" FILES ${VARDATA1516_SRCS})
+
+ add_library(VarData1516 STATIC ${VARDATA1516_SRCS})
+ target_link_libraries(VarData1516)
+ set_target_properties(VarData1516 PROPERTIES PROJECT_LABEL LibVarData1516)
+ set_target_properties(VarData1516 PROPERTIES COMPILE_FLAGS
"-DRTI_DISABLE_WARNINGS -DSTATIC_RTI")
+ # There shouldn't be any def file for STATIC library since this is not a DLL
+ # Commenting out next line.
+ #if (MINGW)
+ # set_target_properties(VarData1516 PROPERTIES LINK_FLAGS
"-Wl,--output-def,${LIBRARY_OUTPUT_PATH}/libVarData1516.def")
+ # install(FILES ${LIBRARY_OUTPUT_PATH}/libVarData1516.def
+ # DESTINATION lib)
+ #endif (MINGW)
+ # There shouldn't be any SOVERSION as well
+ #set_target_properties(VarData1516 PROPERTIES VERSION 1.0.0 SOVERSION 1)
+ set(VarData1516Target "VarData1516")
+else()
+ set(VarData1516Target "")
+endif (WIN32)
+
+##########################
+# RTI1516
+##########################
+
+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
+ )
+
+set(RTI1516_LIB_INCLUDE
+ ${CMAKE_BINARY_DIR}/include/hla-1_3/RTItypes.hh
+ ${CMAKE_SOURCE_DIR}/include/ieee1516-2000/RTI/Enums.h
+ ${CMAKE_SOURCE_DIR}/include/ieee1516-2000/RTI/Exception.h
+ ${CMAKE_SOURCE_DIR}/include/ieee1516-2000/RTI/FederateAmbassador.h
+ ${CMAKE_SOURCE_DIR}/include/ieee1516-2000/RTI/Handle.h
+ ${CMAKE_SOURCE_DIR}/include/ieee1516-2000/RTI/LogicalTime.h
+ ${CMAKE_SOURCE_DIR}/include/ieee1516-2000/RTI/LogicalTimeFactory.h
+ ${CMAKE_SOURCE_DIR}/include/ieee1516-2000/RTI/LogicalTimeInterval.h
+ ${CMAKE_SOURCE_DIR}/include/ieee1516-2000/RTI/NullFederateAmbassador.h
+ ${CMAKE_SOURCE_DIR}/include/ieee1516-2000/RTI/RangeBounds.h
+ ${CMAKE_SOURCE_DIR}/include/ieee1516-2000/RTI/RTI1516.h
+ ${CMAKE_SOURCE_DIR}/include/ieee1516-2000/RTI/RTIambassador.h
+ ${CMAKE_SOURCE_DIR}/include/ieee1516-2000/RTI/RTIambassadorFactory.h
+ ${CMAKE_SOURCE_DIR}/include/ieee1516-2000/RTI/SpecificConfig.h
+ ${CMAKE_SOURCE_DIR}/include/ieee1516-2000/RTI/Typedefs.h
+ ${CMAKE_SOURCE_DIR}/include/ieee1516-2000/RTI/VariableLengthData.h
+)
+
+add_library(RTI1516 ${RTI1516_LIB_SRCS} ${RTI1516_LIB_INCLUDE})
+# Incorrect line
+#target_link_libraries(RTI1516 CERTI)
+# Correct line
+target_link_libraries(RTI1516 CERTI FedTime1516)
+install(FILES RTI1516fedTime.h DESTINATION include/ieee1516-2010/RTI)
+message(STATUS "libRTI variant: HLA 1516")
+set_target_properties(RTI1516 PROPERTIES OUTPUT_NAME "RTI1516")
+set_target_properties(RTI1516 PROPERTIES COMPILE_FLAGS "-DHLA13NG_LIBRTI
-DRTI_DISABLE_WARNINGS -DBUILDING_RTI")
+set_target_properties(RTI1516 PROPERTIES VERSION 1.0.0 SOVERSION 1)
+if (MINGW)
+ set_target_properties(RTI1516 PROPERTIES LINK_FLAGS
"-Wl,--output-def,${LIBRARY_OUTPUT_PATH}/libRTI1516.def")
+ install(FILES ${LIBRARY_OUTPUT_PATH}/libRTI1516.def DESTINATION lib)
+endif (MINGW)
+
+
+##########################################################
+set(FEDTIME1516_SRCS
+ ${CMAKE_SOURCE_DIR}/include/ieee1516-2000/RTI/certiLogicalTime.h
+ ${CMAKE_SOURCE_DIR}/include/ieee1516-2000/RTI/certiLogicalTimeInterval.h
+ ${CMAKE_SOURCE_DIR}/include/ieee1516-2000/RTI/certiLogicalTimeFactory.h
+ RTI1516fedTime.h
+ RTI1516fedTime.cpp
+ )
+
+if (BUILD_WITH_EXTRA_LOGICAL_TIME)
+ list(APPEND FEDTIME1516_SRC
+ LogicalTimeDouble.h
+ LogicalTimeDouble.cpp
+ )
+endif(BUILD_WITH_EXTRA_LOGICAL_TIME)
+
+source_group("Source Files\\FedTime" FILES ${FEDTIME1516_SRCS})
+
+add_library(FedTime1516 ${FEDTIME1516_SRCS})
+# Correct line
+target_link_libraries(FedTime1516 ${VarData1516Target})
+# Incorrect line
+# (at least the dependency exists but we cannot specify that
+# because we would generate a circular deps RTI1516-->FedTime1516-->RTI1516)
+#target_link_libraries(FedTime1516 RTI1516)
+
+set_target_properties(FedTime1516 PROPERTIES PROJECT_LABEL LibFedTime1516)
+set_target_properties(FedTime1516 PROPERTIES COMPILE_FLAGS "-DBUILDING_FEDTIME
-DRTI_DISABLE_WARNINGS -DSTATIC_RTI")
+
+if(MINGW)
+ set_target_properties(FedTime1516 PROPERTIES LINK_FLAGS
"-Wl,--output-def,${LIBRARY_OUTPUT_PATH}/libFedTime1516.def")
+ install(FILES ${LIBRARY_OUTPUT_PATH}/libFedTime1516.def
+ DESTINATION lib)
+endif(MINGW)
+
+set_target_properties(FedTime1516 PROPERTIES VERSION 1.0.0 SOVERSION 1)
+
+set(TestFedTime1516_SRCS
+ TestFedTime.cc
+)
+
+#ADD_EXECUTABLE(TestFedTime1516 ${TestFedTime1516_SRCS})
+
+# TODO: Should link with RTI1516 lib, instead of base RTI lib
+#target_link_libraries(TestFedTime1516 FedTime1516 RTI1516)
+
+#ADD_TEST(TestLibFedTime1516 COMMAND $<TARGET_FILE:TestFedTime1516>)
+
+
+# Install rules for both libRTI156 and libFedTime1516
+install(TARGETS RTI1516 FedTime1516 ${VarData1516Target}
+ EXPORT CERTIDepends
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib)
+
+# mimic install directory structure in the binary tree in order to ease the
linking
+# of builtin test (i.e. testFederate)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/RTI1516fedTime.h
${CMAKE_BINARY_DIR}/include/ieee1516-2000/RTI/RTI1516fedTime.h COPYONLY)
+install(FILES RTI1516fedTime.h DESTINATION include/ieee1516-2000/RTI)
Index: ieee1516-2000/RTI1516ambPrivateRefs.h
===================================================================
RCS file: ieee1516-2000/RTI1516ambPrivateRefs.h
diff -N ieee1516-2000/RTI1516ambPrivateRefs.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ieee1516-2000/RTI1516ambPrivateRefs.h 3 Mar 2014 15:18:23 -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: 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 $
Index: ieee1516-2000/LogicalTimeDouble.cpp
===================================================================
RCS file: ieee1516-2000/LogicalTimeDouble.cpp
diff -N ieee1516-2000/LogicalTimeDouble.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ieee1516-2000/LogicalTimeDouble.cpp 3 Mar 2014 15:18:23 -0000 1.1
@@ -0,0 +1,733 @@
+#ifdef _WIN32
+#pragma warning(disable : 4786)
+#pragma warning(disable:4290)
+#endif
+
+#include "RTI/certiRTI1516.h"
+//#include "RTI/EncodedLogicalTime.h"
+//#include "RTI/EncodedLogicalTimeInterval.h"
+
+#include "LogicalTimeDouble.h"
+
+#include <cmath>
+#include <climits>
+#include <typeinfo>
+
+/*
+namespace
+{
+ class MyEncodedLogicalTime : public rti1516::EncodedLogicalTime
+ {
+ private:
+ rti1516::VariableLengthValueClass _value;
+ void* _data;
+ size_t _size;
+ public:
+ MyEncodedLogicalTime(const void* data, size_t size) :
+ _value(data, size)
+ {
+ }
+ virtual ~MyEncodedLogicalTime() throw () {}
+
+ virtual void const * data() const
+ {
+ return _value.data();
+ }
+ virtual size_t size() const
+ {
+ return _value.size();
+ }
+ };
+
+ class MyEncodedLogicalTimeInterval : public
rti1516::EncodedLogicalTimeInterval
+ {
+ private:
+ rti1516::VariableLengthValueClass _value;
+ void* _data;
+ size_t _size;
+ public:
+ MyEncodedLogicalTimeInterval(const void* data, size_t size) :
+ _value(data, size)
+ {
+ }
+ virtual ~MyEncodedLogicalTimeInterval() throw () {}
+
+ virtual void const * data() const
+ {
+ return _value.data();
+ }
+ virtual size_t size() const
+ {
+ return _value.size();
+ }
+ };
+}
+*/
+
+#ifdef __GNUC__
+const int64_t MAX_VALUE = LONG_LONG_MAX;
+#else
+const int64_t MAX_VALUE = 9223372036854775807;
+#endif
+const int64_t MULTIPLIER = 1000000;
+
+LogicalTimeDouble::LogicalTimeDouble(double value)
+{
+ int64_t seconds = (long)floor(value);
+ int64_t micros = (long)fmod(value * MULTIPLIER, (double)MULTIPLIER);
+
+ _value = seconds * MULTIPLIER + micros;
+}
+
+LogicalTimeDouble::LogicalTimeDouble(int64_t value) :
+ _value(value)
+{
+}
+
+LogicalTimeDouble::~LogicalTimeDouble()
+ throw ()
+{
+}
+
+void LogicalTimeDouble::setInitial()
+{
+ _value = 0;
+}
+
+bool LogicalTimeDouble::isInitial() const
+{
+ return _value == 0;
+}
+
+void LogicalTimeDouble::setFinal()
+{
+ _value = MAX_VALUE;
+}
+
+bool LogicalTimeDouble::isFinal() const
+{
+ return _value == MAX_VALUE;
+}
+
+void LogicalTimeDouble::setTo(rti1516::LogicalTime const & value)
+throw (rti1516::InvalidLogicalTime)
+{
+ try {
+ const LogicalTimeDouble& p = dynamic_cast<const
LogicalTimeDouble&>(value);
+ _value = p._value;
+ } catch (std::bad_cast)
+ {
+ throw std::wstring(L"Invalid LogicalTimeDouble");
+ //throw rti1516::InvalidLogicalTime(L"Invalid
LogicalTimeDouble");
+ }
+}
+
+rti1516::LogicalTime &
+LogicalTimeDouble::operator=(rti1516::LogicalTime const & value)
+throw (rti1516::InvalidLogicalTime)
+{
+ setTo(value);
+ return *this;
+}
+
+LogicalTimeDouble &
+LogicalTimeDouble::operator=(LogicalTimeDouble const & value)
+throw (rti1516::InvalidLogicalTime)
+{
+ setTo(value);
+ return *this;
+}
+
+
+
+
+
+void LogicalTimeDouble::increaseBy(rti1516::LogicalTimeInterval const & addend)
+throw (rti1516::IllegalTimeArithmetic, rti1516::InvalidLogicalTimeInterval)
+{
+ try {
+ const LogicalTimeIntervalDouble& p = dynamic_cast<const
LogicalTimeIntervalDouble&>(addend);
+ _value += p._value;
+ } catch (std::bad_cast)
+ {
+ throw std::wstring(L"Invalid LogicalTimeDouble");
+ //throw rti1516::InvalidLogicalTimeInterval(L"Invalid
LogicalTimeDouble");
+ }
+}
+
+void LogicalTimeDouble::decreaseBy(rti1516::LogicalTimeInterval const &
subtrahend)
+throw (rti1516::IllegalTimeArithmetic, rti1516::InvalidLogicalTimeInterval)
+{
+ try {
+ const LogicalTimeIntervalDouble& p = dynamic_cast<const
LogicalTimeIntervalDouble&>(subtrahend);
+ _value -= p._value;
+ } catch (std::bad_cast)
+ {
+ throw std::wstring(L"Invalid LogicalTimeDouble");
+ //throw rti1516::InvalidLogicalTimeInterval(L"Invalid
LogicalTimeDouble");
+ }
+
+}
+
+std::auto_ptr< rti1516::LogicalTimeInterval >
LogicalTimeDouble::subtract(rti1516::LogicalTime const & subtrahend) const
+throw (rti1516::InvalidLogicalTime)
+{
+ try {
+ const LogicalTimeDouble& p = dynamic_cast<const
LogicalTimeDouble&>(subtrahend);
+ return std::auto_ptr< rti1516::LogicalTimeInterval >(new
LogicalTimeIntervalDouble(_value - p._value));
+ } catch (std::bad_cast)
+ {
+ throw std::wstring(L"Invalid LogicalTimeDouble");
+ //throw rti1516::InvalidLogicalTime(L"Invalid
LogicalTimeDouble");
+ }
+}
+
+bool LogicalTimeDouble::isGreaterThan(rti1516::LogicalTime const & value) const
+throw (rti1516::InvalidLogicalTime)
+{
+ try {
+ const LogicalTimeDouble& p = dynamic_cast<const
LogicalTimeDouble&>(value);
+ return _value > p._value;
+ } catch (std::bad_cast)
+ {
+ throw std::wstring(L"Invalid LogicalTimeDouble");
+ //throw rti1516::InvalidLogicalTime(L"Invalid
LogicalTimeDouble");
+ }
+}
+
+bool LogicalTimeDouble::isLessThan(rti1516::LogicalTime const & value) const
+throw (rti1516::InvalidLogicalTime)
+{
+ try {
+ const LogicalTimeDouble& p = dynamic_cast<const
LogicalTimeDouble&>(value);
+ return _value < p._value;
+ } catch (std::bad_cast)
+ {
+ throw std::wstring(L"Invalid LogicalTimeDouble");
+ //throw rti1516::InvalidLogicalTime(L"Invalid
LogicalTimeDouble");
+ }
+}
+
+bool LogicalTimeDouble::isEqualTo(rti1516::LogicalTime const & value) const
+throw (rti1516::InvalidLogicalTime)
+{
+ try {
+ const LogicalTimeDouble& p = dynamic_cast<const
LogicalTimeDouble&>(value);
+ return _value == p._value;
+ } catch (std::bad_cast)
+ {
+ throw std::wstring(L"Invalid LogicalTimeDouble");
+ //throw rti1516::InvalidLogicalTime(L"Invalid
LogicalTimeDouble");
+ }
+}
+
+bool LogicalTimeDouble::isGreaterThanOrEqualTo(rti1516::LogicalTime const &
value) const
+throw (rti1516::InvalidLogicalTime)
+{
+ try {
+ const LogicalTimeDouble& p = dynamic_cast<const
LogicalTimeDouble&>(value);
+ return _value >= p._value;
+ } catch (std::bad_cast)
+ {
+ throw std::wstring(L"Invalid LogicalTimeDouble");
+ //throw rti1516::InvalidLogicalTime(L"Invalid
LogicalTimeDouble");
+ }
+}
+
+bool LogicalTimeDouble::isLessThanOrEqualTo(rti1516::LogicalTime const &
value) const
+throw (rti1516::InvalidLogicalTime)
+{
+ try {
+ const LogicalTimeDouble& p = dynamic_cast<const
LogicalTimeDouble&>(value);
+ return _value <= p._value;
+ } catch (std::bad_cast)
+ {
+ throw std::wstring(L"Invalid LogicalTimeDouble");
+ //throw rti1516::InvalidLogicalTime(L"Invalid
LogicalTimeDouble");
+ }
+}
+
+long LogicalTimeDouble::getSeconds() const
+{
+ return (long)(_value / MULTIPLIER);
+}
+
+int LogicalTimeDouble::getMicros() const
+{
+ return (int)(_value % MULTIPLIER);
+}
+
+std::wstring LogicalTimeDouble::toString() const
+{
+ wchar_t buf[128];
+ if (_value == MAX_VALUE) {
+ swprintf(buf, 128, L"LogicalTimeDouble<INF>");
+ } else {
+ swprintf(buf, 128, L"LogicalTimeDouble<%d.%06d>", getSeconds(),
getMicros());
+ }
+ return buf;
+}
+
+bool LogicalTimeDouble::operator==(LogicalTime const & lt_left) const
+ throw (rti1516::InvalidLogicalTime)
+{
+ try {
+ const LogicalTimeDouble& left = dynamic_cast<const
LogicalTimeDouble&>(lt_left);
+ return (((left._value - 1000) < _value) && ((left._value +
1000) > _value));
+ } catch (std::bad_cast)
+ {
+ throw std::wstring(L"Invalid LogicalTimeDouble");
+ //throw rti1516::InvalidLogicalTime(L"Invalid
LogicalTimeDouble");
+ }
+}
+
+int64_t LogicalTimeDouble::toMilliseconds() const
+{
+ return _value/1000;
+}
+
+rti1516::VariableLengthData LogicalTimeDouble::encode() const
+{
+ unsigned char buf[sizeof(_value)];
+ int pos = 0;
+ buf[pos++] = (unsigned char)((_value >> 56) & 0xFF);
+ buf[pos++] = (unsigned char)((_value >> 48) & 0xFF);
+ buf[pos++] = (unsigned char)((_value >> 40) & 0xFF);
+ buf[pos++] = (unsigned char)((_value >> 32) & 0xFF);
+ buf[pos++] = (unsigned char)((_value >> 24) & 0xFF);
+ buf[pos++] = (unsigned char)((_value >> 16) & 0xFF);
+ buf[pos++] = (unsigned char)((_value >> 8) & 0xFF);
+ buf[pos++] = (unsigned char)((_value >> 0) & 0xFF);
+
+ rti1516::VariableLengthData varData(buf, pos);
+
+ return varData;
+}
+
+unsigned long LogicalTimeDouble::encodedLength() const
+{
+ return 8L;
+}
+
+unsigned long LogicalTimeDouble::encode(void* buffer, unsigned long
bufferSize) const
+ throw (rti1516::CouldNotEncode)
+{
+ unsigned char *buf = (unsigned char*)buffer;
+ int pos = 0;
+ buf[pos++] = (unsigned char)((_value >> 56) & 0xFF);
+ buf[pos++] = (unsigned char)((_value >> 48) & 0xFF);
+ buf[pos++] = (unsigned char)((_value >> 40) & 0xFF);
+ buf[pos++] = (unsigned char)((_value >> 32) & 0xFF);
+ buf[pos++] = (unsigned char)((_value >> 24) & 0xFF);
+ buf[pos++] = (unsigned char)((_value >> 16) & 0xFF);
+ buf[pos++] = (unsigned char)((_value >> 8) & 0xFF);
+ buf[pos++] = (unsigned char)((_value >> 0) & 0xFF);
+
+ return 8L;
+}
+
+void LogicalTimeDouble::decode(rti1516::VariableLengthData const &
encodedLogicalTime)
+ throw (rti1516::InternalError, rti1516::CouldNotDecode)
+{
+ int64_t value = 0;
+ unsigned char* buf = (unsigned char*)encodedLogicalTime.data();
+ int pos = 0;
+ value = (value << 8) | buf[pos++];
+ value = (value << 8) | buf[pos++];
+ value = (value << 8) | buf[pos++];
+ value = (value << 8) | buf[pos++];
+ value = (value << 8) | buf[pos++];
+ value = (value << 8) | buf[pos++];
+ value = (value << 8) | buf[pos++];
+ value = (value << 8) | buf[pos++];
+
+ _value = value;
+}
+
+void LogicalTimeDouble::decode(void* buffer, unsigned long bufferSize)
+ throw (rti1516::InternalError,
+ rti1516::CouldNotDecode)
+{
+ int64_t value = 0;
+ unsigned char* buf = (unsigned char*)buffer;
+ int pos = 0;
+ value = (value << 8) | buf[pos++];
+ value = (value << 8) | buf[pos++];
+ value = (value << 8) | buf[pos++];
+ value = (value << 8) | buf[pos++];
+ value = (value << 8) | buf[pos++];
+ value = (value << 8) | buf[pos++];
+ value = (value << 8) | buf[pos++];
+ value = (value << 8) | buf[pos++];
+
+ _value = value;
+}
+
+///////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////
+
+
+
+
+
+
+
+LogicalTimeDoubleFactory::~LogicalTimeDoubleFactory()
+throw ()
+{
+}
+
+std::auto_ptr< rti1516::LogicalTime > LogicalTimeDoubleFactory::makeInitial()
+ throw (rti1516::InternalError)
+{
+ return std::auto_ptr< rti1516::LogicalTime >(new
LogicalTimeDouble((int64_t)0));
+}
+
+std::auto_ptr< rti1516::LogicalTimeInterval >
LogicalTimeDoubleFactory::makeZero()
+ throw (rti1516::InternalError)
+{
+ return std::auto_ptr< rti1516::LogicalTimeInterval >(new
LogicalTimeIntervalDouble((int64_t)0));
+}
+
+std::auto_ptr< rti1516::LogicalTimeInterval >
LogicalTimeDoubleFactory::epsilon()
+ throw (rti1516::InternalError)
+{
+ return std::auto_ptr< rti1516::LogicalTimeInterval >(new
LogicalTimeIntervalDouble((int64_t)1));
+}
+
+
+LogicalTimeFactoryDouble::~LogicalTimeFactoryDouble()
+throw ()
+{
+}
+
+
+
+///////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////
+
+
+
+
+
+
+LogicalTimeIntervalDouble::LogicalTimeIntervalDouble(double value)
+{
+ int64_t seconds = (long)floor(value);
+ int64_t micros = (long)fmod(value * MULTIPLIER, (double)MULTIPLIER);
+
+ _value = seconds * MULTIPLIER + micros;
+}
+
+LogicalTimeIntervalDouble::LogicalTimeIntervalDouble(int64_t value) :
+ _value(value)
+{
+}
+
+LogicalTimeIntervalDouble::~LogicalTimeIntervalDouble()
+ throw ()
+{
+}
+
+void LogicalTimeIntervalDouble::setZero()
+{
+ _value = 0;
+}
+
+bool LogicalTimeIntervalDouble::isZero() const
+{
+ return _value == 0;
+}
+
+void LogicalTimeIntervalDouble::setEpsilon()
+{
+ _value = 1;
+}
+
+bool LogicalTimeIntervalDouble::isEpsilon() const
+{
+ return _value == 1;
+}
+
+long LogicalTimeIntervalDouble::getSeconds() const
+{
+ return (long)(_value / MULTIPLIER);
+}
+
+int LogicalTimeIntervalDouble::getMicros() const
+{
+ return (int)(_value % MULTIPLIER);
+}
+
+void LogicalTimeIntervalDouble::setTo(rti1516::LogicalTimeInterval const &
value)
+ throw (rti1516::InvalidLogicalTimeInterval)
+{
+ try {
+ const LogicalTimeIntervalDouble& p = dynamic_cast<const
LogicalTimeIntervalDouble&>(value);
+ _value = p._value;
+ } catch (std::bad_cast)
+ {
+ throw rti1516::InvalidLogicalTime(L"Invalid LogicalTimeDouble");
+ }
+}
+
+std::auto_ptr< rti1516::LogicalTimeInterval >
+LogicalTimeIntervalDouble::subtract(rti1516::LogicalTimeInterval const &
subtrahend) const
+ throw (rti1516::InvalidLogicalTimeInterval)
+{
+ const LogicalTimeIntervalDouble& p = dynamic_cast<const
LogicalTimeIntervalDouble&>(subtrahend);
+
+ int64_t d = _value - p._value;
+ if (d < 0) {
+ d = -d;
+ }
+ return std::auto_ptr< rti1516::LogicalTimeInterval >(new
LogicalTimeIntervalDouble(d));
+}
+
+bool LogicalTimeIntervalDouble::isGreaterThan(rti1516::LogicalTimeInterval
const & value) const
+ throw (rti1516::InvalidLogicalTimeInterval)
+{
+ try {
+ const LogicalTimeIntervalDouble& p = dynamic_cast<const
LogicalTimeIntervalDouble&>(value);
+ return _value > p._value;
+ } catch (std::bad_cast)
+ {
+ throw rti1516::InvalidLogicalTime(L"Invalid LogicalTimeDouble");
+ }
+}
+
+bool LogicalTimeIntervalDouble::isLessThan(rti1516::LogicalTimeInterval const
& value) const
+throw (rti1516::InvalidLogicalTimeInterval)
+{
+ try {
+ const LogicalTimeIntervalDouble& p = dynamic_cast<const
LogicalTimeIntervalDouble&>(value);
+ return _value < p._value;
+ } catch (std::bad_cast)
+ {
+ throw rti1516::InvalidLogicalTime(L"Invalid LogicalTimeDouble");
+ }
+}
+
+bool LogicalTimeIntervalDouble::isEqualTo(rti1516::LogicalTimeInterval const &
value) const
+throw (rti1516::InvalidLogicalTimeInterval)
+{
+ try {
+ const LogicalTimeIntervalDouble& p = dynamic_cast<const
LogicalTimeIntervalDouble&>(value);
+ return _value == p._value;
+ } catch (std::bad_cast)
+ {
+ throw rti1516::InvalidLogicalTime(L"Invalid LogicalTimeDouble");
+ }
+}
+
+bool
LogicalTimeIntervalDouble::isGreaterThanOrEqualTo(rti1516::LogicalTimeInterval
const & value) const
+throw (rti1516::InvalidLogicalTimeInterval)
+{
+ try {
+ const LogicalTimeIntervalDouble& p = dynamic_cast<const
LogicalTimeIntervalDouble&>(value);
+ return _value >= p._value;
+ } catch (std::bad_cast)
+ {
+ throw rti1516::InvalidLogicalTime(L"Invalid LogicalTimeDouble");
+ }
+}
+
+bool
LogicalTimeIntervalDouble::isLessThanOrEqualTo(rti1516::LogicalTimeInterval
const & value) const
+throw (rti1516::InvalidLogicalTimeInterval)
+{
+ try {
+ const LogicalTimeIntervalDouble& p = dynamic_cast<const
LogicalTimeIntervalDouble&>(value);
+ return _value <= p._value;
+ } catch (std::bad_cast)
+ {
+ throw rti1516::InvalidLogicalTime(L"Invalid LogicalTimeDouble");
+ }
+}
+
+rti1516::VariableLengthData LogicalTimeIntervalDouble::encode() const
+{
+ unsigned char buf[sizeof(_value)];
+ int pos = 0;
+ buf[pos++] = (unsigned char)((_value >> 56) & 0xFF);
+ buf[pos++] = (unsigned char)((_value >> 48) & 0xFF);
+ buf[pos++] = (unsigned char)((_value >> 40) & 0xFF);
+ buf[pos++] = (unsigned char)((_value >> 32) & 0xFF);
+ buf[pos++] = (unsigned char)((_value >> 24) & 0xFF);
+ buf[pos++] = (unsigned char)((_value >> 16) & 0xFF);
+ buf[pos++] = (unsigned char)((_value >> 8) & 0xFF);
+ buf[pos++] = (unsigned char)((_value >> 0) & 0xFF);
+
+ rti1516::VariableLengthData varData(buf, pos);
+
+ return varData;
+}
+
+unsigned long
+LogicalTimeIntervalDouble::encodedLength() const
+{
+ return 8L;
+}
+unsigned long
+LogicalTimeIntervalDouble::encode(void* buffer, unsigned long bufferSize) const
+throw (rti1516::CouldNotEncode)
+{
+ if (bufferSize < 8L)
+ {
+ throw rti1516::CouldNotEncode(L"Not enough space to encode
LogicalTimeIntervalDouble");
+ }
+
+ unsigned char *buf = (unsigned char *) buffer;
+ int pos = 0;
+ buf[pos++] = (unsigned char)((_value >> 56) & 0xFF);
+ buf[pos++] = (unsigned char)((_value >> 48) & 0xFF);
+ buf[pos++] = (unsigned char)((_value >> 40) & 0xFF);
+ buf[pos++] = (unsigned char)((_value >> 32) & 0xFF);
+ buf[pos++] = (unsigned char)((_value >> 24) & 0xFF);
+ buf[pos++] = (unsigned char)((_value >> 16) & 0xFF);
+ buf[pos++] = (unsigned char)((_value >> 8) & 0xFF);
+ buf[pos++] = (unsigned char)((_value >> 0) & 0xFF);
+
+ return 8L;
+}
+
+void LogicalTimeIntervalDouble::decode(rti1516::VariableLengthData const &
encodedLogicalTimeInterval)
+throw (rti1516::InternalError, rti1516::CouldNotDecode)
+{
+ if (encodedLogicalTimeInterval.size() < 8L)
+ {
+ throw rti1516::CouldNotDecode(L"Not enough data in
VariableLengthData to decode LogicalTimeIntervalDouble. (Needs 8 bytes)");
+ }
+
+ int64_t value = 0;
+ unsigned char* buf = (unsigned char*)encodedLogicalTimeInterval.data();
+ int pos = 0;
+ value = (value << 8) | buf[pos++];
+ value = (value << 8) | buf[pos++];
+ value = (value << 8) | buf[pos++];
+ value = (value << 8) | buf[pos++];
+ value = (value << 8) | buf[pos++];
+ value = (value << 8) | buf[pos++];
+ value = (value << 8) | buf[pos++];
+ value = (value << 8) | buf[pos++];
+
+ _value = value;
+}
+
+
+void
+LogicalTimeIntervalDouble::decode(void* buffer, unsigned long bufferSize)
+throw (rti1516::InternalError,
+ rti1516::CouldNotDecode)
+{
+ if (bufferSize < 8L)
+ {
+ throw rti1516::CouldNotDecode(L"Not enough data in
VariableLengthData to decode LogicalTimeIntervalDouble. (Needs 8 bytes)");
+ }
+ int64_t value = 0;
+ unsigned char* buf = (unsigned char*)buffer;
+ int pos = 0;
+ value = (value << 8) | buf[pos++];
+ value = (value << 8) | buf[pos++];
+ value = (value << 8) | buf[pos++];
+ value = (value << 8) | buf[pos++];
+ value = (value << 8) | buf[pos++];
+ value = (value << 8) | buf[pos++];
+ value = (value << 8) | buf[pos++];
+ value = (value << 8) | buf[pos++];
+
+ _value = value;
+}
+
+
+std::wstring LogicalTimeIntervalDouble::toString() const
+{
+ wchar_t buf[128];
+ swprintf(buf, 128, L"LogicalTimeIntervalDouble<%d.%06d>", getSeconds(),
getMicros());
+ return buf;
+}
+
+
+void
+LogicalTimeIntervalDouble::setToDifference(rti1516::LogicalTime const &
minuend,
+
rti1516::LogicalTime const& subtrahend)
+
throw (rti1516::InvalidLogicalTime)
+{
+ try {
+ const LogicalTimeDouble& d_minuend = dynamic_cast<const
LogicalTimeDouble&>(minuend);
+ const LogicalTimeDouble& d_subtrahend = dynamic_cast<const
LogicalTimeDouble&>(subtrahend);
+
+ int64_t value = d_minuend.toMilliseconds() -
d_subtrahend.toMilliseconds();
+ if (value < 0) {
+ value = -value;
+ }
+ _value = value;
+ } catch (std::bad_cast)
+ {
+ throw rti1516::InvalidLogicalTime(L"Invalid LogicalTimeDouble");
+ }
+
+}
+
+rti1516::LogicalTimeInterval &
+LogicalTimeIntervalDouble::operator+=(rti1516::LogicalTimeInterval const &
addend)
+throw (rti1516::InvalidLogicalTimeInterval)
+{
+ return *this;
+}
+
+rti1516::LogicalTimeInterval &
+LogicalTimeIntervalDouble::operator-=(rti1516::LogicalTimeInterval const &
subtrahend)
+throw (rti1516::InvalidLogicalTimeInterval)
+{
+ return *this;
+}
+
+
+
+
+
+
+
+LogicalTimeIntervalDoubleFactory::~LogicalTimeIntervalDoubleFactory()
+ throw ()
+{
+}
+
+
+
+/*
+LogicalTimeIntervalFactoryDouble::~LogicalTimeIntervalFactoryDouble()
+ throw ()
+{
+}
+
+std::auto_ptr< rti1516::LogicalTimeInterval >
LogicalTimeIntervalFactoryDouble::makeZero()
+ throw (rti1516::InternalError)
+{
+ return std::auto_ptr< rti1516::LogicalTimeInterval >(new
LogicalTimeIntervalDouble((int64_t)0));
+}
+
+std::auto_ptr< rti1516::LogicalTimeInterval >
LogicalTimeIntervalFactoryDouble::epsilon()
+ throw (rti1516::InternalError)
+{
+ return std::auto_ptr< rti1516::LogicalTimeInterval >(new
LogicalTimeIntervalDouble((int64_t)1));
+}
+
+std::auto_ptr< rti1516::LogicalTimeInterval >
LogicalTimeIntervalFactoryDouble::decode(rti1516::EncodedLogicalTimeInterval
const & encodedLogicalTimeInterval)
+ // throw (InternalError, CouldNotDecode)
+ throw ()
+{
+ int64_t value = 0;
+ unsigned char* buf = (unsigned char*)encodedLogicalTimeInterval.data();
+ int pos = 0;
+ value = (value << 8) | buf[pos++];
+ value = (value << 8) | buf[pos++];
+ value = (value << 8) | buf[pos++];
+ value = (value << 8) | buf[pos++];
+ value = (value << 8) | buf[pos++];
+ value = (value << 8) | buf[pos++];
+ value = (value << 8) | buf[pos++];
+ value = (value << 8) | buf[pos++];
+ return std::auto_ptr< rti1516::LogicalTimeInterval >(new
LogicalTimeIntervalDouble(value));
+}
+*/
Index: hla-1_3/RTIambPrivateRefs.hh
===================================================================
RCS file: hla-1_3/RTIambPrivateRefs.hh
diff -N hla-1_3/RTIambPrivateRefs.hh
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ hla-1_3/RTIambPrivateRefs.hh 3 Mar 2014 15:18:23 -0000 1.1
@@ -0,0 +1,63 @@
+// ----------------------------------------------------------------------------
+// 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.hh,v 1.1 2014/03/03 15:18:23 erk Exp $
+// ----------------------------------------------------------------------------
+
+#include "RTI.hh"
+#include "fedtime.hh"
+#include "Message.hh"
+#include "RootObject.hh"
+#include "MessageBuffer.hh"
+
+using namespace certi ;
+
+class RTIambPrivateRefs
+{
+public:
+ RTIambPrivateRefs();
+ ~RTIambPrivateRefs();
+
+ void processException(Message *);
+ void executeService(Message *requete, Message *reponse);
+ void sendTickRequestStop();
+ void callFederateAmbassador(Message *msg) throw (RTI::RTIinternalError);
+ void leave(const char *msg) throw (RTI::RTIinternalError);
+
+#ifdef _WIN32
+ HANDLE handle_RTIA;
+#else
+ pid_t pid_RTIA ; //!< pid associated with rtia fork (private).
+#endif
+
+ //! Federate Ambassador reference for module calls.
+ RTI::FederateAmbassador *fed_amb ;
+
+ //! used to prevent reentrant calls (see tick() and executeService()).
+ bool is_reentrant ;
+
+ RootObject *_theRootObj ;
+
+ SocketUN *socketUn ;
+ MessageBuffer msgBufSend,msgBufReceive ;
+};
+
+// $Id: RTIambPrivateRefs.hh,v 1.1 2014/03/03 15:18:23 erk Exp $
Index: hla-1_3/RTIambassador.cc
===================================================================
RCS file: hla-1_3/RTIambassador.cc
diff -N hla-1_3/RTIambassador.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ hla-1_3/RTIambassador.cc 3 Mar 2014 15:18:23 -0000 1.1
@@ -0,0 +1,2861 @@
+// ----------------------------------------------------------------------------
+// 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: RTIambassador.cc,v 1.1 2014/03/03 15:18:23 erk Exp $
+// ----------------------------------------------------------------------------
+
+#include "RTI.hh"
+#include "fedtime.hh"
+
+#include "RTIambPrivateRefs.hh"
+#include "RTItypesImp.hh"
+
+#include "Message.hh"
+#include "M_Classes.hh"
+#include "PrettyDebug.hh"
+
+#include "config.h"
+
+#ifdef _WIN32
+#include <stdio.h>
+#include <string.h>
+#else
+#include <unistd.h>
+#endif
+#include <cstdlib>
+#include <iostream>
+#include <signal.h>
+#include <cassert>
+#include <cerrno>
+#include <typeinfo>
+#include <memory>
+
+#ifdef CERTI_REALTIME_EXTENSIONS
+#ifdef _WIN32
+#error "CERTI Realtime extensions are not currently supported on Windows"
+#else
+#include <sched.h>
+#include <sys/mman.h>
+#endif
+#endif
+
+using std::cout ;
+using std::cerr ;
+using std::endl ;
+
+namespace {
+
+static PrettyDebug D("LIBRTI", __FILE__);
+static PrettyDebug G("GENDOC",__FILE__) ;
+
+using namespace certi ;
+
+std::vector<certi::RegionHandle>
+build_region_handles(RTI::Region **regions, int nb)
+throw (RTI::RegionNotKnown)
+{
+ std::vector<certi::RegionHandle> vect(nb);
+ for (int i = 0 ; i < nb ; ++i) {
+ RTI::Region *region = regions[i] ;
+ try {
+ vect[i] = dynamic_cast<RegionImp
*>(region)->getHandle();
+ }
+ catch (std::bad_cast) {
+ throw RTI::RegionNotKnown("");
+ }
+ }
+ return vect ;
+} /* end of build_region_handles */
+
+RTI::Handle
+get_handle(const RTI::Region ®ion)
+throw (RTI::RegionNotKnown, RTI::RTIinternalError)
+{
+ try {
+ return dynamic_cast<const RegionImp &>(region).getHandle();
+ }
+ catch (std::bad_cast) {
+ throw RTI::RegionNotKnown("");
+ }
+ throw RTI::RTIinternalError("");
+} /* end of get_handle */
+
+char *
+hla_strdup(const std::string &s)
+throw (RTI::RTIinternalError)
+{
+ try {
+ size_t len = s.length();
+ // the HLA 1.3 standard defines, that char* must be free-ed by
delete[]
+ char *result = new char[len+1];
+ strncpy(result, s.c_str(), len);
+ result[len] = '\0';
+
+ return result;
+ }
+ catch (std::bad_alloc&) {
+ throw RTI::RTIinternalError("Cannot allocate memory.");
+ }
+ throw RTI::RTIinternalError("");
+} /* end of hla_strdup */
+
+template<typename T>
+void
+assignAHVToRequest(const std::vector<RTI::AttributeHandle>& AHV, T& request) {
+ request.setAttributesSize(AHV.size());
+ for (uint32_t i=0;i<AHV.size();++i) {
+ request.setAttributes(AHV[i],i);
+ }
+} /* end of assignAHVToRequest */
+
+template<typename T>
+void
+assignAHVPSToRequest(const std::vector<std::pair<RTI::AttributeHandle,
AttributeValue_t> >& AHVPSv, T& request) {
+
+ uint32_t size = AHVPSv.size();
+ request.setAttributesSize(size);
+ request.setValuesSize(size);
+
+ for (uint32_t i = 0 ; i < size ; ++i) {
+ // FIXME why iterate from the end?
+ request.setAttributes(AHVPSv[size-1-i].first,i);
+ request.setValues(AHVPSv[size-1-i].second,i);
+ }
+} /* end of assignAHVPSToRequest */
+
+template<typename T>
+void
+assignPHVPSToRequest(const std::vector<std::pair<RTI::ParameterHandle,
ParameterValue_t> > &PHVPSv, T& request) {
+
+ uint32_t size = PHVPSv.size();
+ request.setParametersSize(size);
+ request.setValuesSize(size);
+
+ for (uint32_t i = 0 ; i < size ; ++i) {
+ // FIXME why iterate from the end?
+ request.setParameters(PHVPSv[size-1-i].first,i);
+ request.setValues(PHVPSv[size-1-i].second,i);
+ }
+} /* end of assignPHVPSToRequest */
+} // anonymous namespace
+
+// ----------------------------------------------------------------------------
+//! Start RTIambassador processes for communication with RTIG.
+/*! When a new RTIambassador is created in the application, a new process rtia
+ is launched. This process is used for data exchange with rtig server.
+ This process connects to rtia after one second delay (UNIX socket).
+ */
+
+RTI::RTIambassador::RTIambassador()
+throw (RTI::MemoryExhausted, RTI::RTIinternalError)
+{
+ G.Out(pdGendoc,"enter RTIambassador::RTIambassador");
+ PrettyDebug::setFederateName( "LibRTI::UnjoinedFederate" );
+ std::stringstream msg;
+
+ privateRefs = new RTIambPrivateRefs();
+
+ privateRefs->socketUn = new SocketUN(stIgnoreSignal);
+
+ 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 = privateRefs->socketUn->listenUN();
+ if (port == -1) {
+ D.Out( pdError, "Cannot listen to RTIA connection. Abort." );
+ throw RTI::RTIinternalError( "Cannot listen to RTIA connection"
);
+ }
+#else
+ int pipeFd = privateRefs->socketUn->socketpair();
+ if (pipeFd == -1) {
+ D.Out( pdError, "Cannot get socketpair to RTIA connection.
Abort." );
+ throw RTI::RTIinternalError( "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)) {
+ D.Out( pdError, "Cannot duplicate socket for RTIA connection.
Abort." );
+ throw RTI::RTIinternalError( "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 RTI::RTIinternalError(msg.str().c_str());
+ }
+
+ 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((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 RTI::RTIinternalError("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)
+ << endl
+ << "Maybe RTIA is not in search PATH
environment.";
+ throw RTI::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 (privateRefs->socketUn->acceptUN(10*1000) == -1) {
+#ifdef _WIN32
+ TerminateProcess(privateRefs->handle_RTIA, 0);
+#else
+ kill( privateRefs->pid_RTIA, SIGINT );
+#endif
+ throw RTI::RTIinternalError( "Cannot connect to RTIA" );
+ }
+#endif
+
+ M_Open_Connexion req, rep ;
+ req.setVersionMajor(CERTI_Message::versionMajor);
+ req.setVersionMinor(CERTI_Message::versionMinor);
+
+ G.Out(pdGendoc," ====>executeService OPEN_CONNEXION");
+ privateRefs->executeService(&req, &rep);
+
+ G.Out(pdGendoc,"exit RTIambassador::RTIambassador");
+}
+
+// ----------------------------------------------------------------------------
+//! Closes processes.
+/*! When destructor is called, kill rtia process.
+ */
+RTI::RTIambassador::~RTIambassador()
+throw (RTI::RTIinternalError)
+{
+ 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
+
+ //TerminateProcess(privateRefs->handle_RTIA, 0);
+
+ delete privateRefs;
+}
+
+// ----------------------------------------------------------------------------
+RTI::Boolean
+RTI::RTIambassador::tick()
+throw (RTI::SpecifiedSaveLabelDoesNotExist,
+ RTI::ConcurrentAccessAttempted,
+ RTI::RTIinternalError)
+ {
+#if defined(LEGACY_LIBRTI)
+ __tick_kernel(RTI_FALSE, 0.0, 0.0);
+#elif defined (HLA13NG_LIBRTI)
+ // may suffer from starving
+ __tick_kernel(RTI_TRUE, 0.0, std::numeric_limits<double>::infinity());
+#else
+#error "At least one LIBRTI flag must be defined."
+#endif
+ return RTI_FALSE;
+ }
+
+// ----------------------------------------------------------------------------
+RTI::Boolean
+RTI::RTIambassador::tick2()
+throw (RTI::SpecifiedSaveLabelDoesNotExist,
+ RTI::ConcurrentAccessAttempted,
+ RTI::RTIinternalError)
+ {
+ __tick_kernel(RTI_FALSE, std::numeric_limits<double>::infinity(), 0.0);
+ return RTI_FALSE;
+ }
+
+// ----------------------------------------------------------------------------
+RTI::Boolean
+RTI::RTIambassador::__tick_kernel(RTI::Boolean multiple, TickTime minimum,
TickTime maximum)
+throw (RTI::SpecifiedSaveLabelDoesNotExist,
+ RTI::ConcurrentAccessAttempted,
+ RTI::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;
+
+ throw RTI::RTIinternalError(msg.str().c_str());
+ }
+
+ // 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;
+ throw RTI::RTIinternalError(msg.str().c_str());
+ }
+
+ // 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
RTI::Boolean(static_cast<M_Tick_Request*>(vers_Fed.get())->getMultiple());
+ }
+
+ try {
+ // Otherwise, the RTI calls a FederateAmbassador service.
+ privateRefs->callFederateAmbassador(vers_Fed.get());
+ }
+ catch (RTI::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;
+
+ throw RTI::RTIinternalError(msg.str().c_str());
+ }
+ } // while(1)
+ // This statement may never be reached but it please the compiler
+ // for 'non void function with no return'
+ return RTI::Boolean(false);
+ }
+
+// ----------------------------------------------------------------------------
+RTI::Boolean
+RTI::RTIambassador::tick(TickTime minimum, TickTime maximum)
+throw (RTI::SpecifiedSaveLabelDoesNotExist, RTI::ConcurrentAccessAttempted,
+ RTI::RTIinternalError)
+ {
+ return __tick_kernel(RTI_TRUE, minimum, maximum);
+ }
+
+#ifdef CERTI_REALTIME_EXTENSIONS
+// ----------------------------------------------------------------------------
+void
+RTI::RTIambassador::setPriorityforRTIAProcess(int priority, unsigned int
sched_type)
+ throw(RTIinternalError) {
+
+#ifdef _WIN32
+ throw RTIinternalError("Not Implemented on Windows");
+#else
+ struct sched_param sparm ;
+ int cr ;
+
+ sparm.sched_priority = priority ;
+ cr = sched_setscheduler(privateRefs->pid_RTIA,sched_type,&sparm);
+ if (cr !=0) {
+ throw RTIinternalError("RTIA process changing priority did not work");
+ if (errno==EPERM) {
+ throw RTIinternalError("The calling process has no SU permission for
that") ;
+ }
+ else if (errno==ESRCH){
+ throw RTIinternalError( "The process id does not exist") ;
+ }
+ throw RTIinternalError( "Unknown policy specified") ;
+ }
+#endif
+}
+
+// ----------------------------------------------------------------------------
+void
+RTI::RTIambassador::setAffinityforRTIAProcess(cpu_set_t mask)
+ throw(RTIinternalError) {
+#ifdef _WIN32
+ throw RTIinternalError("Not Implemented on Windows");
+#else
+if (sched_setaffinity(privateRefs->pid_RTIA, sizeof(cpu_set_t), &mask))
+ throw RTIinternalError( "RTIA process Error : sched_setaffinity") ;
+#endif
+}
+#endif
+
+// ----------------------------------------------------------------------------
+//! Get Region Token.
+RTI::RegionToken
+RTI::RTIambassador::getRegionToken(Region *region)
+throw (RTI::FederateNotExecutionMember, RTI::ConcurrentAccessAttempted,
+ RTI::RegionNotKnown, RTI::RTIinternalError)
+ {
+ return get_handle(*region);
+ }
+
+// ----------------------------------------------------------------------------
+//! Get Region.
+RTI::Region *
+RTI::RTIambassador::getRegion(RegionToken)
+throw (RTI::FederateNotExecutionMember, RTI::ConcurrentAccessAttempted,
+ RTI::RegionNotKnown, RTI::RTIinternalError)
+ {
+ throw RTI::RTIinternalError("unimplemented service getRegion");
+ }
+
+// ----------------------------------------------------------------------------
+// Create Federation Execution.
+/** Realization of the Create Federation Execution federation management
service
+ (HLA 1.3).
+ Send a CREATE_FEDERATION_EXECUTION request type to inform rtia process a
+ new federation is being created.
+ @param executionName execution name of the federation to be created
+ @param FED FED file name (path seen by rtig)
+ */
+void
+//RTI::
+RTI::RTIambassador::createFederationExecution(const char *executionName,
+ const char *FED)
+throw (RTI::RTIinternalError, RTI::ConcurrentAccessAttempted,
+ RTI::ErrorReadingFED, RTI::CouldNotOpenFED,
+ RTI::FederationExecutionAlreadyExists)
+ {
+ M_Create_Federation_Execution req, rep ;
+
+ G.Out(pdGendoc,"enter RTIambassador::createFederationExecution");
+
+ req.setFederationName(executionName);
+ req.setFEDid(FED);
+
+ /*#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 RTIambassador::createFederationExecution");
+
+ }
+
+// ----------------------------------------------------------------------------
+// Destroy Federation Execution.
+/** Realization of the Destroy Federation Execution federation management
service
+ (HLA 1.3).
+ Send a DESTROY_FEDERATION_EXECUTION request type to remove a federation
+ execution from the RTI set of federation executions.
+ \param executionName execution name of the federation to be destroyed
+ */
+void
+RTI::RTIambassador::destroyFederationExecution(const char *executionName)
+throw (RTI::RTIinternalError, RTI::ConcurrentAccessAttempted,
+ RTI::FederationExecutionDoesNotExist,
RTI::FederatesCurrentlyJoined)
+ {
+ M_Destroy_Federation_Execution req, rep ;
+
+ G.Out(pdGendoc,"enter RTIambassador::destroyFederationExecution");
+
+ req.setFederationName(executionName);
+
+ G.Out(pdGendoc," ====>executeService
DESTROY_FEDERATION_EXECUTION");
+
+ privateRefs->executeService(&req, &rep);
+
+ G.Out(pdGendoc,"exit RTIambassador::destroyFederationExecution");
+
+ }
+
+// ----------------------------------------------------------------------------
+//! Join Federation Execution.
+RTI::FederateHandle
+RTI::RTIambassador::joinFederationExecution(const char *yourName,
+ const char *executionName,
+ FederateAmbassadorPtr fedamb)
+throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
+ RTI::ConcurrentAccessAttempted, RTI::ErrorReadingFED,
RTI::CouldNotOpenFED,
+ RTI::FederationExecutionDoesNotExist,
RTI::FederateAlreadyExecutionMember)
+ {
+ M_Join_Federation_Execution req, rep ;
+
+ G.Out(pdGendoc,"enter RTIambassador::joinFederationExecution");
+
+ if ( yourName == NULL || strlen(yourName) == 0 )
+ throw RTI::RTIinternalError("Incorrect or empty federate name");
+ if ( executionName == NULL || strlen(executionName) == 0 )
+ throw RTI::RTIinternalError("Incorrect or empty federation
name");
+
+ privateRefs->fed_amb = (FederateAmbassador *) fedamb ;
+
+ req.setFederateName(yourName);
+ req.setFederationName(executionName);
+ G.Out(pdGendoc," ====>executeService JOIN_FEDERATION_EXECUTION");
+ privateRefs->executeService(&req, &rep);
+ G.Out(pdGendoc,"exit RTIambassador::joinFederationExecution");
+ PrettyDebug::setFederateName( "LibRTI::"+std::string(yourName));
+ return rep.getFederate();
+ }
+
+// ----------------------------------------------------------------------------
+//! Resign Federation Execution.
+void
+RTI::RTIambassador::resignFederationExecution(ResignAction theAction)
+throw (RTI::FederateOwnsAttributes,
+ RTI::FederateNotExecutionMember,
+ RTI::InvalidResignAction,
+ RTI::ConcurrentAccessAttempted,
+ RTI::RTIinternalError)
+ {
+ M_Resign_Federation_Execution req, rep ;
+
+ G.Out(pdGendoc,"enter RTIambassador::resignFederationExecution");
+
+ req.setResignAction(static_cast<certi::ResignAction>(theAction));
+
+ G.Out(pdGendoc," ====>executeService
RESIGN_FEDERATION_EXECUTION");
+ privateRefs->executeService(&req, &rep);
+
+ G.Out(pdGendoc,"exit RTIambassador::resignFederationExecution");
+
+ }
+
+void
+RTI::RTIambassador::registerFederationSynchronizationPoint(const char *label,
+ const char *the_tag)
+throw (RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::SaveInProgress,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError) {
+ M_Register_Federation_Synchronization_Point req, rep ;
+
+ G.Out(pdGendoc,"enter
RTIambassador::registerFederationSynchronizationPoint for all federates");
+
+ req.setLabel(label);
+ // no federate set
+ req.setFederateSetSize(0);
+ if ( the_tag == NULL )
+ {
+ throw RTI::RTIinternalError ("Calling
registerFederationSynchronizationPoint with Tag NULL");
+ }
+ req.setTag(the_tag);
+ G.Out(pdGendoc," ====>executeService
REGISTER_FEDERATION_SYNCHRONIZATION_POINT");
+ privateRefs->executeService(&req, &rep);
+
+ G.Out(pdGendoc,"exit
RTIambassador::registerFederationSynchronizationPoint for all federates");
+
+} /* end of RTI::RTIambassador::registerFederationSynchronizationPoint */
+
+void
+RTI::RTIambassador::registerFederationSynchronizationPoint(const char *label,
+ const char *theTag,
+ const FederateHandleSet &set_of_fed)
+throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
+ RTI::ConcurrentAccessAttempted,
RTI::FederateNotExecutionMember) {
+
+ M_Register_Federation_Synchronization_Point req, rep ;
+
+ G.Out(pdGendoc,"enter
RTIambassador::registerFederationSynchronizationPoint for some federates");
+
+ req.setLabel(label);
+ if ( theTag == NULL )
+ {
+ throw RTI::RTIinternalError ("Calling
registerFederationSynchronizationPoint with Tag NULL");
+ }
+ req.setTag(theTag);
+ // 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(set_of_fed.size());
+ for (uint32_t i=0 ; i<set_of_fed.size() ; i++) {
+ req.setFederateSet(set_of_fed.getHandle(i),i);
+ }
+
+ G.Out(pdGendoc," ====>executeService
REGISTER_FEDERATION_SYNCHRONIZATION_POINT");
+ privateRefs->executeService(&req, &rep);
+
+ G.Out(pdGendoc,"exit
RTIambassador::registerFederationSynchronizationPoint for some federates");
+
+} /* end of RTI::RTIambassador::registerFederationSynchronizationPoint */
+
+// ----------------------------------------------------------------------------
+//! Synchronization Point Achieved
+void
+RTI::RTIambassador::synchronizationPointAchieved(const char *label)
+throw (RTI::SynchronizationPointLabelWasNotAnnounced,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::SaveInProgress,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError)
+ {
+ M_Synchronization_Point_Achieved req, rep ;
+
+ G.Out(pdGendoc,"enter RTIambassador::synchronizationPointAchieved");
+
+ req.setLabel(label);
+ G.Out(pdGendoc," ====>executeService
SYNCHRONIZATION_POINT_ACHIEVED");
+ privateRefs->executeService(&req, &rep);
+
+ G.Out(pdGendoc,"exit RTIambassador::synchronizationPointAchieved");
+ }
+
+// ----------------------------------------------------------------------------
+//! Request Federation Save with time.
+void
+RTI::RTIambassador::requestFederationSave(const char *label,
+ const RTI::FedTime& theTime)
+throw (RTI::FederationTimeAlreadyPassed,
+ RTI::InvalidFederationTime,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::SaveInProgress,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError)
+ {
+ M_Request_Federation_Save req, rep ;
+
+ G.Out(pdGendoc,"enter RTIambassador::requestFederationSave with time");
+
+ req.setDate(certi_cast<RTIfedTime>()(theTime).getTime());
+ req.setLabel(label);
+
+ G.Out(pdGendoc," ====>executeService REQUEST_FEDERATION_SAVE");
+ privateRefs->executeService(&req, &rep);
+
+ G.Out(pdGendoc,"exit RTIambassador::requestFederationSave with time");
+ }
+
+// ----------------------------------------------------------------------------
+//! Request Federation Save without time.
+void
+RTI::RTIambassador::requestFederationSave(const char *label)
+throw (RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::SaveInProgress,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError)
+ {
+ M_Request_Federation_Save req, rep ;
+
+ G.Out(pdGendoc,"enter RTIambassador::requestFederationSave without
time");
+
+ req.setLabel(label);
+ G.Out(pdGendoc," ====>executeService REQUEST_FEDERATION_SAVE");
+
+ privateRefs->executeService(&req, &rep);
+ G.Out(pdGendoc,"exit RTIambassador::requestFederationSave without
time");
+ }
+
+// ----------------------------------------------------------------------------
+//! Federate Save Begun.
+void
+RTI::RTIambassador::federateSaveBegun()
+throw (RTI::SaveNotInitiated,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError)
+ {
+ M_Federate_Save_Begun req, rep ;
+
+ G.Out(pdGendoc,"enter RTIambassador::federateSaveBegun");
+
+ G.Out(pdGendoc," ====>executeService FEDERATE_SAVE_BEGUN");
+ privateRefs->executeService(&req, &rep);
+
+ G.Out(pdGendoc,"exit RTIambassador::federateSaveBegun");
+ }
+
+// ----------------------------------------------------------------------------
+//! Federate Save Complete.
+void
+RTI::RTIambassador::federateSaveComplete()
+throw (RTI::SaveNotInitiated,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError)
+ {
+ M_Federate_Save_Complete req, rep ;
+
+ G.Out(pdGendoc,"enter RTIambassador::federateSaveComplete");
+ G.Out(pdGendoc," ====>executeService FEDERATE_SAVE_COMPLETE");
+ privateRefs->executeService(&req, &rep);
+ G.Out(pdGendoc,"exit RTIambassador::federateSaveComplete");
+ }
+
+// ----------------------------------------------------------------------------
+// Federate Save Not Complete.
+void
+RTI::RTIambassador::federateSaveNotComplete()
+throw (RTI::SaveNotInitiated,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError)
+ {
+
+ M_Federate_Save_Not_Complete req, rep ;
+
+ G.Out(pdGendoc,"enter RTIambassador::federateSaveNotComplete");
+ G.Out(pdGendoc," ====>executeService FEDERATE_SAVE_NOT_COMPLETE");
+ privateRefs->executeService(&req, &rep);
+
+ G.Out(pdGendoc,"exit RTIambassador::federateSaveNotComplete");
+ }
+
+// ----------------------------------------------------------------------------
+//! Request Restore.
+void
+RTI::RTIambassador::requestFederationRestore(const char *label)
+throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
+ RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember)
+ {
+ M_Request_Federation_Restore req, rep ;
+
+ G.Out(pdGendoc,"enter RTIambassador::requestFederationRestore");
+ req.setLabel(label);
+ G.Out(pdGendoc," ====>executeService REQUEST_FEDERATION_RESTORE");
+ privateRefs->executeService(&req, &rep);
+ G.Out(pdGendoc,"exit RTIambassador::requestFederationRestore");
+ }
+
+// ----------------------------------------------------------------------------
+//! Restore Complete.
+void
+RTI::RTIambassador::federateRestoreComplete()
+throw (RTI::RTIinternalError, RTI::SaveInProgress,
+ RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
+ RTI::RestoreNotRequested)
+ {
+ M_Federate_Restore_Complete req, rep ;
+
+ G.Out(pdGendoc,"enter RTIambassador::federateRestoreComplete");
+
+ G.Out(pdGendoc," ====>executeService FEDERATE_RESTORE_COMPLETE");
+ privateRefs->executeService(&req, &rep);
+ G.Out(pdGendoc,"exit RTIambassador::federateRestoreComplete");
+ }
+
+// ----------------------------------------------------------------------------
+//! Federate Restore Not Complete.
+void
+RTI::RTIambassador::federateRestoreNotComplete()
+throw (RTI::RTIinternalError, RTI::SaveInProgress,
+ RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
+ RTI::RestoreNotRequested)
+ {
+ M_Federate_Restore_Not_Complete req, rep ;
+
+ G.Out(pdGendoc,"enter RTIambassador::federateRestoreNotComplete");
+ G.Out(pdGendoc," ====>executeService
FEDERATE_RESTORE_NOT_COMPLETE");
+
+ privateRefs->executeService(&req, &rep);
+ G.Out(pdGendoc,"exit RTIambassador::federateRestoreNotComplete");
+ }
+
+// ----------------------------------------------------------------------------
+// Publish Object Class
+void
+RTI::RTIambassador::publishObjectClass(ObjectClassHandle theClass,
+ const AttributeHandleSet& attributeList)
+throw (RTI::RTIinternalError,
+ RTI::RestoreInProgress, RTI::SaveInProgress,
RTI::ConcurrentAccessAttempted,
+ RTI::FederateNotExecutionMember,
RTI::OwnershipAcquisitionPending,
+ RTI::AttributeNotDefined, RTI::ObjectClassNotDefined)
+ {
+ M_Publish_Object_Class req, rep ;
+ const std::vector<unsigned long>& AHSI =
certi_cast<AttributeHandleSetImp>()(attributeList).getAttributeHandles();
+ G.Out(pdGendoc,"enter RTIambassador::publishObjectClass");
+
+ req.setObjectClass(theClass);
+ req.setAttributesSize(AHSI.size());
+ for (uint32_t i=0; i<AHSI.size(); ++i) {
+ req.setAttributes(AHSI[i],i);
+ }
+ G.Out(pdGendoc," ====>executeService PUBLISH_OBJECT_CLASS");
+ privateRefs->executeService(&req, &rep);
+ G.Out(pdGendoc,"exit RTIambassador::publishObjectClass");
+ }
+
+// ----------------------------------------------------------------------------
+// UnPublish Object Class
+void
+RTI::RTIambassador::unpublishObjectClass(ObjectClassHandle theClass)
+throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
+ RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
+ RTI::OwnershipAcquisitionPending, RTI::ObjectClassNotPublished,
+ RTI::ObjectClassNotDefined)
+ {
+ M_Unpublish_Object_Class req, rep ;
+
+ G.Out(pdGendoc,"enter RTIambassador::unpublishObjectClass");
+ req.setObjectClass(theClass);
+ G.Out(pdGendoc," ====>executeService UNPUBLISH_OBJECT_CLASS");
+ privateRefs->executeService(&req, &rep);
+ G.Out(pdGendoc,"exit RTIambassador::unpublishObjectClass");
+ }
+
+
+// ----------------------------------------------------------------------------
+// Publish Interaction Class
+void
+RTI::RTIambassador::publishInteractionClass(InteractionClassHandle
theInteraction)
+throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
+ RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
+ RTI::InteractionClassNotDefined)
+ {
+ M_Publish_Interaction_Class req, rep ;
+
+ req.setInteractionClass(theInteraction);
+ G.Out(pdGendoc," ====>executeService PUBLISH_INTERACTION_CLASS");
+ privateRefs->executeService(&req, &rep);
+ }
+
+// ----------------------------------------------------------------------------
+// Publish Interaction Class
+void
+RTI::RTIambassador::unpublishInteractionClass(InteractionClassHandle
theInteraction)
+throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
+ RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
+ RTI::InteractionClassNotPublished,
RTI::InteractionClassNotDefined)
+ {
+ M_Unpublish_Interaction_Class req, rep ;
+
+ req.setInteractionClass(theInteraction);
+ privateRefs->executeService(&req, &rep);
+ }
+
+// ----------------------------------------------------------------------------
+// Subscribe Object Class Attributes
+void
+RTI::RTIambassador::
+subscribeObjectClassAttributes(ObjectClassHandle theClass,
+ const AttributeHandleSet& attributeList,
+ RTI::Boolean active)
+throw (RTI::RTIinternalError,
+ RTI::RestoreInProgress, RTI::SaveInProgress,
RTI::ConcurrentAccessAttempted,
+ RTI::FederateNotExecutionMember, RTI::AttributeNotDefined,
+ RTI::ObjectClassNotDefined)
+ {
+ M_Subscribe_Object_Class_Attributes req, rep ;
+ G.Out(pdGendoc,"enter RTIambassador::subscribeObjectClassAttributes");
+ const std::vector<unsigned long>& AHSI =
certi_cast<AttributeHandleSetImp>()(attributeList).getAttributeHandles();
+
+ req.setObjectClass(theClass);
+ req.setAttributesSize(AHSI.size());
+ for (uint32_t i=0; i<AHSI.size();++i) {
+ req.setAttributes(AHSI[i],i);
+ }
+ req.setActive(active);
+
+ privateRefs->executeService(&req, &rep);
+ G.Out(pdGendoc,"exit RTIambassador::subscribeObjectClassAttributes");
+ }
+
+// ----------------------------------------------------------------------------
+// UnSubscribe Object Class Attribute
+void
+RTI::RTIambassador::unsubscribeObjectClass(ObjectClassHandle theClass)
+throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
+ RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
+ RTI::ObjectClassNotSubscribed, RTI::ObjectClassNotDefined)
+ {
+ M_Unsubscribe_Object_Class req, rep ;
+
+ req.setObjectClass(theClass);
+ privateRefs->executeService(&req, &rep);
+ }
+
+
+// ----------------------------------------------------------------------------
+// Subscribe Interaction Class
+void
+RTI::RTIambassador::subscribeInteractionClass(InteractionClassHandle theClass,
+ RTI::Boolean /*active*/)
+throw (RTI::RTIinternalError, RTI::RestoreInProgress,
+ RTI::SaveInProgress, RTI::FederateLoggingServiceCalls,
+ RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
+ RTI::InteractionClassNotDefined)
+ {
+ M_Subscribe_Interaction_Class req, rep ;
+ req.setInteractionClass(theClass);
+ privateRefs->executeService(&req, &rep);
+ }
+
+// ----------------------------------------------------------------------------
+// UnSubscribe Interaction Class
+void
+RTI::RTIambassador::unsubscribeInteractionClass(InteractionClassHandle
theClass)
+throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
+ RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
+ RTI::InteractionClassNotSubscribed,
RTI::InteractionClassNotDefined)
+ {
+ M_Unsubscribe_Interaction_Class req, rep ;
+
+ req.setInteractionClass(theClass);
+ privateRefs->executeService(&req, &rep);
+ }
+
+// ----------------------------------------------------------------------------
+// Register Object
+RTI::ObjectHandle
+RTI::RTIambassador::registerObjectInstance(ObjectClassHandle theClass,
+ const char *theObjectName)
+throw (RTI::RTIinternalError, RTI::RestoreInProgress,
+ RTI::SaveInProgress, RTI::ConcurrentAccessAttempted,
+ RTI::FederateNotExecutionMember, RTI::ObjectAlreadyRegistered,
+ RTI::ObjectClassNotPublished, RTI::ObjectClassNotDefined)
+ {
+ M_Register_Object_Instance req, rep ;
+
+ req.setObjectName(theObjectName);
+ req.setObjectClass(theClass);
+ privateRefs->executeService(&req, &rep);
+
+ return rep.getObject();
+ }
+
+// ----------------------------------------------------------------------------
+RTI::ObjectHandle
+RTI::RTIambassador::registerObjectInstance(ObjectClassHandle theClass)
+throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
+ RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
+ RTI::ObjectClassNotPublished, RTI::ObjectClassNotDefined)
+ {
+ M_Register_Object_Instance req, rep ;
+
+ req.setObjectClass(theClass);
+ privateRefs->executeService(&req, &rep);
+ return rep.getObject();
+ }
+
+// ----------------------------------------------------------------------------
+// Update Attribute Values with time
+RTI::EventRetractionHandle
+RTI::RTIambassador::
+updateAttributeValues(ObjectHandle theObject,
+ const AttributeHandleValuePairSet& theAttributes,
+ const RTI::FedTime& theTime,
+ const char *theTag)
+throw (RTI::ObjectNotKnown,
+ RTI::AttributeNotDefined,
+ RTI::AttributeNotOwned,
+ RTI::InvalidFederationTime,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::SaveInProgress,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError)
+ {
+ G.Out(pdGendoc,"enter RTIambassador::updateAttributeValues with time");
+ M_Update_Attribute_Values req, rep ;
+ RTI::EventRetractionHandle_s eventRetraction;
+ const std::vector<AttributeHandleValuePair_t>& AHVPS =
certi_cast<AttributeHandleValuePairSetImp>()(theAttributes).getAttributeHandleValuePairs();
+ req.setObject(theObject);
+ req.setDate(certi_cast<RTIfedTime>()(theTime).getTime());
+ /*
+ * Tolerate NULL tag (DMSO RTI-NG behavior)
+ * by not transmitting the tag in the CERTI message.
+ */
+ if ( theTag != NULL) {
+ req.setTag(theTag);
+ }
+ req.setAttributesSize(AHVPS.size());
+ req.setValuesSize(AHVPS.size());
+ for (uint32_t i=0;i<AHVPS.size();++i) {
+ req.setAttributes(AHVPS[i].first,i);
+ req.setValues(AHVPS[i].second,i);
+ }
+
+ privateRefs->executeService(&req, &rep);
+ G.Out(pdGendoc,"return RTIambassador::updateAttributeValues with
time");
+ eventRetraction.sendingFederate =
rep.getEventRetraction().getSendingFederate();
+ eventRetraction.theSerialNumber = rep.getEventRetraction().getSN();
+ return eventRetraction;
+ }
+
+// ----------------------------------------------------------------------------
+void
+RTI::RTIambassador::updateAttributeValues(ObjectHandle the_object,
+ const AttributeHandleValuePairSet& theAttributes,
+ const char *theTag)
+throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
+ RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
+ RTI::AttributeNotOwned, RTI::AttributeNotDefined,
RTI::ObjectNotKnown)
+ {
+ G.Out(pdGendoc,"enter RTIambassador::updateAttributeValues without
time");
+ M_Update_Attribute_Values req, rep ;
+ const std::vector<AttributeHandleValuePair_t>& AHVPS =
certi_cast<AttributeHandleValuePairSetImp>()(theAttributes).getAttributeHandleValuePairs();
+
+ req.setObject(the_object);
+ /*
+ * Tolerate NULL tag (DMSO RTI-NG behavior)
+ * by not transmitting the tag in the CERTI message.
+ */
+ if ( theTag != NULL) {
+ req.setTag(theTag);
+ }
+ req.setAttributesSize(AHVPS.size());
+ req.setValuesSize(AHVPS.size());
+ for (uint32_t i=0;i<AHVPS.size();++i) {
+ req.setAttributes(AHVPS[i].first,i);
+ req.setValues(AHVPS[i].second,i);
+ }
+ privateRefs->executeService(&req, &rep);
+ G.Out(pdGendoc,"exit RTIambassador::updateAttributeValues without
time");
+ }
+
+// ----------------------------------------------------------------------------
+RTI::EventRetractionHandle
+RTI::RTIambassador::sendInteraction(InteractionClassHandle theInteraction,
+ const ParameterHandleValuePairSet& theParameters,
+ const RTI::FedTime& theTime,
+ const char *theTag)
+throw (RTI::InteractionClassNotDefined,
+ RTI::InteractionClassNotPublished,
+ RTI::InteractionParameterNotDefined,
+ RTI::InvalidFederationTime,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::SaveInProgress,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError)
+ {
+ M_Send_Interaction req, rep ;
+ RTI::EventRetractionHandle eventRetraction;
+ req.setInteractionClass(theInteraction);
+ req.setDate(certi_cast<RTIfedTime>()(theTime).getTime());
+ /*
+ * Tolerate NULL tag (DMSO RTI-NG behavior)
+ * by not transmitting the tag in the CERTI message.
+ */
+ if ( theTag != NULL) {
+ req.setTag(theTag);
+ }
+
+
assignPHVPSToRequest(certi_cast<ParameterHandleValuePairSetImp>()(theParameters).getParameterHandleValuePairs(),req);
+ req.setRegion(0);
+
+ privateRefs->executeService(&req, &rep);
+
+ eventRetraction.sendingFederate =
rep.getEventRetraction().getSendingFederate();
+ eventRetraction.theSerialNumber = rep.getEventRetraction().getSN();
+ return eventRetraction;
+
+ }
+
+// ----------------------------------------------------------------------------
+/** Send Interaction without time
+ This service (HLA 1.3) send an interaction into the federation.
+ None is returned.
+ @param theInteraction Interaction class designator
+ @param theParameters Set of interaction parameters designator and value
pairs
+ @param theTag User-supplied tag
+ */
+void
+RTI::RTIambassador::sendInteraction(InteractionClassHandle theInteraction,
+ const ParameterHandleValuePairSet &theParameters,
+ const char *theTag)
+throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
+ RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
+ RTI::InteractionParameterNotDefined,
RTI::InteractionClassNotPublished,
+ RTI::InteractionClassNotDefined)
+ {
+
+ M_Send_Interaction req, rep ;
+
+ req.setInteractionClass(theInteraction);
+ /*
+ * Tolerate NULL tag (DMSO RTI-NG behavior)
+ * by not transmitting the tag in the CERTI message.
+ */
+ if ( theTag != NULL) {
+ req.setTag(theTag);
+ }
+
+
assignPHVPSToRequest(certi_cast<ParameterHandleValuePairSetImp>()(theParameters).getParameterHandleValuePairs(),req);
+ req.setRegion(0);
+ privateRefs->executeService(&req, &rep);
+}
+
+// ----------------------------------------------------------------------------
+RTI::EventRetractionHandle
+RTI::RTIambassador::deleteObjectInstance(ObjectHandle theObject,
+ const RTI::FedTime& theTime,
+ const char *theTag)
+throw (RTI::ObjectNotKnown,
+ RTI::DeletePrivilegeNotHeld,
+ RTI::InvalidFederationTime,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::SaveInProgress,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError)
+ {
+ M_Delete_Object_Instance req, rep ;
+ RTI::EventRetractionHandle eventRetraction;
+
+ req.setObject(theObject);
+ req.setDate(certi_cast<RTIfedTime>()(theTime).getTime());
+ if (theTag == NULL)
+ {
+ throw RTI::RTIinternalError ("Calling deleteObjectInstance with
Tag NULL") ;
+ }
+ req.setTag(theTag);
+
+ privateRefs->executeService(&req, &rep);
+ eventRetraction.sendingFederate =
rep.getEventRetraction().getSendingFederate();
+ eventRetraction.theSerialNumber =
rep.getEventRetraction().getSN();
+ return eventRetraction;
+
+ }
+
+// ----------------------------------------------------------------------------
+void
+RTI::RTIambassador::deleteObjectInstance(ObjectHandle theObject,
+ const char *theTag)
+throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
+ RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
+ RTI::DeletePrivilegeNotHeld, RTI::ObjectNotKnown)
+ {
+ M_Delete_Object_Instance req, rep ;
+
+ req.setObject(theObject);
+ if (theTag == NULL)
+ {
+ throw RTI::RTIinternalError ("Calling deleteObjectInstance with
Tag NULL") ;
+ }
+ req.setTag(theTag);
+ privateRefs->executeService(&req, &rep);
+ }
+
+// ----------------------------------------------------------------------------
+// Local Delete Object Instance
+void
+RTI::RTIambassador::localDeleteObjectInstance(ObjectHandle theObject)
+throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
+ RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
+ RTI::FederateOwnsAttributes, RTI::ObjectNotKnown)
+ {
+ throw RTI::RTIinternalError("unimplemented service
localDeleteObjectInstance");
+ M_Local_Delete_Object_Instance req, rep ;
+
+ req.setObject(theObject);
+ privateRefs->executeService(&req, &rep);
+ }
+
+
+// ----------------------------------------------------------------------------
+// Change Attribute Transportation Type
+void
+RTI::RTIambassador::
+changeAttributeTransportationType(ObjectHandle theObject,
+ const AttributeHandleSet& theAttributes,
+ TransportationHandle theType)
+throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
+ RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
+ RTI::InvalidTransportationHandle, RTI::AttributeNotOwned,
+ RTI::AttributeNotDefined, RTI::ObjectNotKnown)
+ {
+ M_Change_Attribute_Transportation_Type req, rep ;
+ const std::vector<AttributeHandle>& AHS =
certi_cast<AttributeHandleSetImp>()(theAttributes).getAttributeHandles();
+ req.setObject(theObject);
+ req.setTransportationType(theType);
+ req.setAttributesSize(AHS.size());
+ for (uint32_t i=0;i<AHS.size();++i) {
+ req.setAttributes(AHS[i],i);
+ }
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+// ----------------------------------------------------------------------------
+// Change Interaction Transportation Type
+void
+RTI::RTIambassador::
+changeInteractionTransportationType(InteractionClassHandle theClass,
+ TransportationHandle theType)
+throw (RTI::RTIinternalError, RTI::RestoreInProgress,
+ RTI::SaveInProgress, RTI::ConcurrentAccessAttempted,
+ RTI::FederateNotExecutionMember,
RTI::InvalidTransportationHandle,
+ RTI::InteractionClassNotPublished,
RTI::InteractionClassNotDefined)
+ {
+ M_Change_Interaction_Transportation_Type req, rep ;
+
+ req.setInteractionClass(theClass);
+ req.setTransportationType(theType);
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+// ----------------------------------------------------------------------------
+// Request Attribute Value Update
+void
+RTI::RTIambassador::requestObjectAttributeValueUpdate(ObjectHandle theObject,
+ const AttributeHandleSet &ahs)
+throw (RTI::RTIinternalError,
+ RTI::RestoreInProgress, RTI::SaveInProgress,
RTI::ConcurrentAccessAttempted,
+ RTI::FederateNotExecutionMember, RTI::AttributeNotDefined,
+ RTI::ObjectNotKnown)
+ {
+ M_Request_Object_Attribute_Value_Update req, rep ;
+
+ G.Out(pdGendoc,"enter
RTIambassador::requestObjectAttributeValueUpdate");
+ req.setObject(theObject);
+
assignAHVToRequest(certi_cast<AttributeHandleSetImp>()(ahs).getAttributeHandles(),req);
+
+ privateRefs->executeService(&req, &rep);
+ G.Out(pdGendoc,"exit
RTIambassador::requestObjectAttributeValueUpdate");
+ }
+
+// ----------------------------------------------------------------------------
+void
+RTI::RTIambassador::requestClassAttributeValueUpdate(ObjectClassHandle
theClass,
+ const AttributeHandleSet &attrs)
+throw (RTI::RTIinternalError,
+ RTI::RestoreInProgress, RTI::SaveInProgress,
RTI::ConcurrentAccessAttempted,
+ RTI::FederateNotExecutionMember, RTI::AttributeNotDefined,
+ RTI::ObjectClassNotDefined)
+ {
+
+ M_Request_Class_Attribute_Value_Update req, rep ;
+ const std::vector<AttributeHandle>& AHSv =
certi_cast<AttributeHandleSetImp>()(attrs).getAttributeHandles();
+ G.Out(pdGendoc,"enter RTIambassador::requestClassAttributeValueUpdate");
+ req.setObjectClass(theClass);
+ req.setAttributesSize(attrs.size());
+ for (uint32_t i=0;i<attrs.size();++i) {
+ req.setAttributes(AHSv[i],i);
+ }
+
+ privateRefs->executeService(&req, &rep);
+ G.Out(pdGendoc,"exit RTIambassador::requestClassAttributeValueUpdate");
+ }
+
+// ----------------------------------------------------------------------------
+// UnConditional Attribute Ownership Divestiture
+void
+RTI::RTIambassador::
+unconditionalAttributeOwnershipDivestiture(ObjectHandle theObject,
+ const AttributeHandleSet &attrs)
+throw (RTI::ObjectNotKnown,
+ RTI::AttributeNotDefined,
+ RTI::AttributeNotOwned,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::SaveInProgress,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError)
+ {
+ M_Unconditional_Attribute_Ownership_Divestiture req, rep ;
+ const std::vector<AttributeHandle>& AHSv =
certi_cast<AttributeHandleSetImp>()(attrs).getAttributeHandles();
+ req.setObject(theObject);
+
+ req.setAttributesSize(attrs.size());
+ for (uint32_t i=0;i<attrs.size();++i) {
+ req.setAttributes(AHSv[i],i);
+ }
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+// ----------------------------------------------------------------------------
+// Negotiated Attribute Ownership Divestiture
+void
+RTI::RTIambassador::
+negotiatedAttributeOwnershipDivestiture(ObjectHandle theObject,
+ const AttributeHandleSet& attrs,
+ const char *theTag)
+throw (RTI::ObjectNotKnown,
+ RTI::AttributeNotDefined,
+ RTI::AttributeNotOwned,
+ RTI::AttributeAlreadyBeingDivested,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::SaveInProgress,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError) {
+ M_Negotiated_Attribute_Ownership_Divestiture req, rep ;
+ const std::vector<AttributeHandle>& AHSv =
certi_cast<AttributeHandleSetImp>()(attrs).getAttributeHandles();
+
+ req.setObject(theObject);
+ if (theTag == NULL) {
+ throw RTI::RTIinternalError ("Calling
negotiatedAttributeOwnershipDivestiture with Tag NULL") ;
+ }
+ req.setTag(theTag);
+ req.setAttributesSize(attrs.size());
+ for (uint32_t i=0;i<attrs.size();++i) {
+ req.setAttributes(AHSv[i],i);
+ }
+
+ privateRefs->executeService(&req, &rep);
+}
+
+// ----------------------------------------------------------------------------
+// Attribute Ownership Acquisition
+void
+RTI::RTIambassador::
+attributeOwnershipAcquisition(ObjectHandle theObject,
+ const AttributeHandleSet& desiredAttributes,
+ const char *theTag)
+throw (RTI::ObjectNotKnown,
+ RTI::ObjectClassNotPublished,
+ RTI::AttributeNotDefined,
+ RTI::AttributeNotPublished,
+ RTI::FederateOwnsAttributes,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::SaveInProgress,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError)
+ {
+ M_Attribute_Ownership_Acquisition req, rep ;
+
+ req.setObject(theObject);
+ if (theTag == NULL)
+ {
+ throw RTI::RTIinternalError ("Calling
attributeOwnershipAcquisition with Tag NULL") ;
+ }
+ req.setTag(theTag);
+
assignAHVToRequest(certi_cast<AttributeHandleSetImp>()(desiredAttributes).getAttributeHandles(),req);
+ privateRefs->executeService(&req, &rep);
+ }
+
+// ----------------------------------------------------------------------------
+// Attribute Ownership Release Response
+RTI::AttributeHandleSet*
+RTI::RTIambassador::
+attributeOwnershipReleaseResponse(ObjectHandle theObject,
+ const AttributeHandleSet& attrs)
+throw (RTI::ObjectNotKnown,
+ RTI::AttributeNotDefined,
+ RTI::AttributeNotOwned,
+ RTI::FederateWasNotAskedToReleaseAttribute,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::SaveInProgress,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError)
+ {
+ M_Attribute_Ownership_Release_Response req, rep ;
+ AttributeHandleSetImp* retval;
+
+ req.setObject(theObject);
+
assignAHVToRequest(certi_cast<AttributeHandleSetImp>()(attrs).getAttributeHandles(),req);
+
+ privateRefs->executeService(&req, &rep);
+
+ if (rep.getExceptionType() == e_NO_EXCEPTION) {
+ retval = new AttributeHandleSetImp(rep.getAttributesSize());
+ for (uint32_t i=0;i<rep.getAttributesSize();++i) {
+ retval->add(rep.getAttributes()[i]);
+ }
+ return retval;
+ }
+
+ return NULL ;
+ }
+
+// ----------------------------------------------------------------------------
+// Cancel Negotiated Attribute Ownership Divestiture
+void
+RTI::RTIambassador::
+cancelNegotiatedAttributeOwnershipDivestiture(ObjectHandle theObject,
+ const AttributeHandleSet& attrs)
+throw (RTI::ObjectNotKnown,
+ RTI::AttributeNotDefined,
+ RTI::AttributeNotOwned,
+ RTI::AttributeDivestitureWasNotRequested,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::SaveInProgress,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError)
+ {
+ M_Cancel_Negotiated_Attribute_Ownership_Divestiture req, rep ;
+
+ req.setObject(theObject);
+
assignAHVToRequest(certi_cast<AttributeHandleSetImp>()(attrs).getAttributeHandles(),req);
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+// ----------------------------------------------------------------------------
+// Cancel Attribute Ownership Acquisition
+void
+RTI::RTIambassador::
+cancelAttributeOwnershipAcquisition(ObjectHandle theObject,
+ const AttributeHandleSet& attrs)
+throw (RTI::ObjectNotKnown,
+ RTI::AttributeNotDefined,
+ RTI::AttributeAlreadyOwned,
+ RTI::AttributeAcquisitionWasNotRequested,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::SaveInProgress,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError)
+ {
+ M_Cancel_Attribute_Ownership_Acquisition req, rep ;
+
+ req.setObject(theObject);
+
assignAHVToRequest(certi_cast<AttributeHandleSetImp>()(attrs).getAttributeHandles(),req);
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+// ----------------------------------------------------------------------------
+// Attribute Ownership Acquisition If Available
+void
+RTI::RTIambassador::
+attributeOwnershipAcquisitionIfAvailable(ObjectHandle theObject,
+ const AttributeHandleSet& desired)
+throw (RTI::ObjectNotKnown,
+ RTI::ObjectClassNotPublished,
+ RTI::AttributeNotDefined,
+ RTI::AttributeNotPublished,
+ RTI::FederateOwnsAttributes,
+ RTI::AttributeAlreadyBeingAcquired,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::SaveInProgress,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError)
+ {
+ M_Attribute_Ownership_Acquisition_If_Available req, rep ;
+
+ req.setObject(theObject);
+
assignAHVToRequest(certi_cast<AttributeHandleSetImp>()(desired).getAttributeHandles(),req);
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+// ----------------------------------------------------------------------------
+// Query Attribute Ownership
+void
+RTI::RTIambassador::
+queryAttributeOwnership(ObjectHandle theObject,
+ AttributeHandle theAttribute)
+throw (RTI::RTIinternalError, RTI::RestoreInProgress,
+ RTI::SaveInProgress, RTI::ConcurrentAccessAttempted,
+ RTI::FederateNotExecutionMember, RTI::AttributeNotDefined,
+ RTI::ObjectNotKnown)
+ {
+ M_Query_Attribute_Ownership req, rep ;
+
+ req.setObject(theObject);
+ req.setAttribute(theAttribute);
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+// ----------------------------------------------------------------------------
+// 5.16 Is Attribute Owned By Federate
+RTI::Boolean
+RTI::RTIambassador::isAttributeOwnedByFederate(ObjectHandle theObject,
+ AttributeHandle theAttribute)
+throw (RTI::ObjectNotKnown,
+ RTI::AttributeNotDefined,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::SaveInProgress,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError)
+ {
+ M_Is_Attribute_Owned_By_Federate req, rep ;
+
+ req.setObject(theObject);
+ req.setAttribute(theAttribute);
+
+ privateRefs->executeService(&req, &rep);
+
+ return (rep.getTag() == "RTI_TRUE") ? RTI_TRUE : RTI_FALSE;
+ }
+
+// ----------------------------------------------------------------------------
+// Enable Time Regulation
+void
+RTI::RTIambassador::enableTimeRegulation(const RTI::FedTime& theFederateTime,
+ const RTI::FedTime& theLookahead)
+throw (RTI::RTIinternalError, RTI::RestoreInProgress,
+ RTI::SaveInProgress, RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted, RTI::InvalidLookahead,
+ RTI::InvalidFederationTime, RTI::TimeAdvanceAlreadyInProgress,
+ RTI::EnableTimeRegulationPending,
RTI::TimeRegulationAlreadyEnabled)
+ {
+ M_Enable_Time_Regulation req, rep ;
+
+ req.setDate(certi_cast<RTIfedTime>()(theFederateTime).getTime());
+ req.setLookahead(certi_cast<RTIfedTime>()(theLookahead).getTime());
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+// ----------------------------------------------------------------------------
+// Disable Time Regulation
+void
+RTI::RTIambassador::disableTimeRegulation()
+throw (RTI::RTIinternalError,
+ RTI::RestoreInProgress, RTI::SaveInProgress,
+ RTI::FederateNotExecutionMember, RTI::ConcurrentAccessAttempted,
+ RTI::TimeRegulationWasNotEnabled)
+ {
+ M_Disable_Time_Regulation req, rep ;
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+// ----------------------------------------------------------------------------
+// Enable Time Constrained
+void
+RTI::RTIambassador::enableTimeConstrained()
+throw (RTI::TimeConstrainedAlreadyEnabled, //not implemented
+ RTI::EnableTimeConstrainedPending, //not implemented
+ RTI::TimeAdvanceAlreadyInProgress, //not implemented
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::SaveInProgress,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError)
+ {
+ M_Enable_Time_Constrained req, rep ;
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+// ----------------------------------------------------------------------------
+// Disable Time Constrained
+void
+RTI::RTIambassador::disableTimeConstrained()
+throw (RTI::TimeConstrainedWasNotEnabled, //not implemented
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::SaveInProgress,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError)
+ {
+ M_Disable_Time_Constrained req, rep ;
+ privateRefs->executeService(&req, &rep);
+ }
+
+// ----------------------------------------------------------------------------
+// Time Advance Request
+void
+RTI::RTIambassador::timeAdvanceRequest(const RTI::FedTime& theTime)
+throw (RTI::TimeAdvanceAlreadyInProgress,
+ RTI::FederationTimeAlreadyPassed,
+ RTI::InvalidFederationTime,
+ RTI::EnableTimeRegulationPending, //not implemented
+ RTI::EnableTimeConstrainedPending, //not implemented
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::SaveInProgress,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError)
+ {
+ M_Time_Advance_Request req, rep ;
+
+ req.setDate(certi_cast<RTIfedTime>()(theTime).getTime());
+ privateRefs->executeService(&req, &rep);
+ }
+
+// ----------------------------------------------------------------------------
+// Time Advance Request Available
+void
+RTI::RTIambassador::timeAdvanceRequestAvailable(const RTI::FedTime& theTime)
+throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
+ RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
+ RTI::EnableTimeConstrainedPending,
RTI::EnableTimeRegulationPending,
+ RTI::TimeAdvanceAlreadyInProgress,
RTI::FederationTimeAlreadyPassed,
+ RTI::InvalidFederationTime)
+ {
+ M_Time_Advance_Request_Available req, rep ;
+
+ req.setDate(certi_cast<RTIfedTime>()(theTime).getTime());
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+// ----------------------------------------------------------------------------
+// Next Event Request
+void
+RTI::RTIambassador::nextEventRequest(const RTI::FedTime& theTime)
+throw (RTI::TimeAdvanceAlreadyInProgress,
+ RTI::FederationTimeAlreadyPassed,
+ RTI::InvalidFederationTime,
+ RTI::EnableTimeRegulationPending, //not implemented
+ RTI::EnableTimeConstrainedPending, //not implemented
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::SaveInProgress,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError)
+ {
+ M_Next_Event_Request req, rep ;
+
+ req.setDate(certi_cast<RTIfedTime>()(theTime).getTime());
+ privateRefs->executeService(&req, &rep);
+ }
+
+// ----------------------------------------------------------------------------
+// Next Event Request Available
+void
+RTI::RTIambassador::nextEventRequestAvailable(const RTI::FedTime& theTime)
+throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
+ RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
+ RTI::EnableTimeConstrainedPending,
RTI::EnableTimeRegulationPending,
+ RTI::TimeAdvanceAlreadyInProgress,
RTI::FederationTimeAlreadyPassed,
+ RTI::InvalidFederationTime)
+ {
+ M_Next_Event_Request_Available req, rep ;
+
+ req.setDate(certi_cast<RTIfedTime>()(theTime).getTime());
+ privateRefs->executeService(&req, &rep);
+ }
+
+// ----------------------------------------------------------------------------
+// Flush Queue Request
+void
+RTI::RTIambassador::flushQueueRequest(const RTI::FedTime& theTime)
+throw (RTI::TimeAdvanceAlreadyInProgress,
+ RTI::FederationTimeAlreadyPassed,
+ RTI::InvalidFederationTime,
+ RTI::EnableTimeRegulationPending, //not implemented
+ RTI::EnableTimeConstrainedPending, //not implemented
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::SaveInProgress,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError)
+ {
+ throw RTI::RTIinternalError("Unimplemented Service flushQueueRequest");
+ M_Flush_Queue_Request req, rep ;
+
+ req.setDate(certi_cast<RTIfedTime>()(theTime).getTime());
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+// ----------------------------------------------------------------------------
+// Enable Asynchronous Delivery
+void
+RTI::RTIambassador::enableAsynchronousDelivery()
+throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
+ RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
+ RTI::AsynchronousDeliveryAlreadyEnabled)
+ {
+ // throw AsynchronousDeliveryAlreadyEnabled("Default value (non HLA)");
+
+ M_Enable_Asynchronous_Delivery req, rep ;
+
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+// ----------------------------------------------------------------------------
+// Disable Asynchronous Delivery
+void
+RTI::RTIambassador::disableAsynchronousDelivery()
+throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
+ RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
+ RTI::AsynchronousDeliveryAlreadyDisabled)
+ {
+ M_Disable_Asynchronous_Delivery req, rep ;
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+// ----------------------------------------------------------------------------
+// Query LBTS
+void
+RTI::RTIambassador::queryLBTS(RTI::FedTime& theTime)
+throw (RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::SaveInProgress,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError)
+ {
+ M_Query_Lbts req, rep ;
+
+ privateRefs->executeService(&req, &rep);
+
+ certi_cast<RTIfedTime>()(theTime) = rep.getDate().getTime();
+ }
+
+// ----------------------------------------------------------------------------
+// Query Federate Time
+void
+RTI::RTIambassador::queryFederateTime(RTI::FedTime& theTime)
+throw (RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::SaveInProgress,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError)
+ {
+ M_Query_Federate_Time req, rep ;
+
+ privateRefs->executeService(&req, &rep);
+
+ certi_cast<RTIfedTime>()(theTime) = rep.getDate().getTime();
+ }
+
+// ----------------------------------------------------------------------------
+// Query Minimum Next Event Time
+void
+RTI::RTIambassador::queryMinNextEventTime(RTI::FedTime& theTime)
+throw (RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::SaveInProgress,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError)
+ {
+ M_Query_Min_Next_Event_Time req, rep ;
+
+ privateRefs->executeService(&req, &rep);
+
+ certi_cast<RTIfedTime>()(theTime) = rep.getDate().getTime();
+ }
+
+// ----------------------------------------------------------------------------
+// Modify Lookahead
+void
+RTI::RTIambassador::modifyLookahead(const RTI::FedTime& theLookahead)
+throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
+ RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
+ RTI::InvalidLookahead)
+ {
+ M_Modify_Lookahead req, rep ;
+
+ req.setLookahead(certi_cast<RTIfedTime>()(theLookahead).getTime());
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+// ----------------------------------------------------------------------------
+// Query Lookahead
+void
+RTI::RTIambassador::queryLookahead(RTI::FedTime &theTime)
+throw (RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::SaveInProgress,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError)
+ {
+ M_Query_Lookahead req, rep ;
+
+ // Set Lookahead to a stupid value in the query
+ // in order to avoid uninitiliazed value
+ req.setLookahead(-1.0);
+ privateRefs->executeService(&req, &rep);
+
+ certi_cast<RTIfedTime>()(theTime) = rep.getLookahead();
+ }
+
+// ----------------------------------------------------------------------------
+// Retract
+void
+RTI::RTIambassador::retract(RTI::EventRetractionHandle handle)
+throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
+ RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
+ RTI::InvalidRetractionHandle)
+ {
+ throw RTI::RTIinternalError("Unimplemented Service retract");
+ M_Retract req, rep ;
+ EventRetraction event;
+
+ event.setSN(handle.theSerialNumber);
+ event.setSendingFederate(handle.sendingFederate);
+ req.setEventRetraction(event);
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+// ----------------------------------------------------------------------------
+// Change Attribute Order Type
+void
+RTI::RTIambassador::changeAttributeOrderType(ObjectHandle theObject,
+ const AttributeHandleSet& attrs,
+ OrderingHandle theType)
+throw (RTI::RTIinternalError,
+ RTI::RestoreInProgress, RTI::SaveInProgress,
RTI::ConcurrentAccessAttempted,
+ RTI::FederateNotExecutionMember, RTI::InvalidOrderingHandle,
+ RTI::AttributeNotOwned, RTI::AttributeNotDefined,
RTI::ObjectNotKnown)
+ {
+ M_Change_Attribute_Order_Type req, rep ;
+
+ req.setObject(theObject);
+ req.setOrder(theType);
+
assignAHVToRequest(certi_cast<AttributeHandleSetImp>()(attrs).getAttributeHandles(),req);
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+// ----------------------------------------------------------------------------
+// Change Interaction Order Type
+void
+RTI::RTIambassador::changeInteractionOrderType(InteractionClassHandle theClass,
+ OrderingHandle theType)
+throw (RTI::RTIinternalError, RTI::RestoreInProgress,
+ RTI::SaveInProgress, RTI::ConcurrentAccessAttempted,
+ RTI::FederateNotExecutionMember, RTI::InvalidOrderingHandle,
+ RTI::InteractionClassNotPublished,
RTI::InteractionClassNotDefined)
+ {
+ M_Change_Interaction_Order_Type req, rep ;
+
+ req.setInteractionClass(theClass);
+ req.setOrder(theType);
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+// ----------------------------------------------------------------------------
+/** Create a routing region for data distribution management.
+ \param space The space handle of the region
+ \param nb_extents The number of extents
+ \return A Region object, associated with the created region
+ */
+RTI::Region *
+RTI::RTIambassador::createRegion(SpaceHandle space, ULong nb_extents)
+throw (RTI::SpaceNotDefined,
+ RTI::InvalidExtents,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::SaveInProgress,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError)
+ {
+ M_Ddm_Create_Region req, rep ;
+ req.setSpace(space);
+ req.setExtentSetSize(nb_extents);
+ privateRefs->executeService(&req, &rep);
+ RTI::Region *region = new RegionImp(rep.getRegion(), space,
+ std::vector<Extent>(nb_extents,
+ Extent(rep.getExtentSetSize())));
+
+ assert(region->getNumberOfExtents() == nb_extents);
+ return region ;
+ }
+
+// ----------------------------------------------------------------------------
+/** Notify about region modification. Applies the changes done through
+ the region services to the RTI.
+ \param r The region to commit to the RTI
+ */
+void
+RTI::RTIambassador::notifyAboutRegionModification(Region &r)
+throw (RTI::RegionNotKnown,
+ RTI::InvalidExtents,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::SaveInProgress,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError)
+ {
+ try {
+ RegionImp ®ion = dynamic_cast<RegionImp &>(r);
+ Debug(D, pdDebug) << "Notify About Region " <<
region.getHandle()
+
<< " Modification" << endl ;
+ M_Ddm_Modify_Region req, rep ;
+
+ req.setRegion(region.getHandle());
+ req.setExtents(region.getExtents());
+
+ privateRefs->executeService(&req, &rep);
+ region.commit();
+ }
+ catch (std::bad_cast) {
+ throw RTI::RegionNotKnown("");
+ }
+ catch (RTI::Exception &e) {
+ throw ;
+ }
+ }
+
+// ----------------------------------------------------------------------------
+/** Delete region. Correctly destroys the region (through the RTI).
+ \attention Always use this function to destroy a region. Do NOT
+ use the C++ delete operator.
+ */
+void
+RTI::RTIambassador::deleteRegion(Region *region)
+throw (RTI::RegionNotKnown,
+ RTI::RegionInUse,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::SaveInProgress,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError)
+ {
+ if (region == 0) {
+ throw RegionNotKnown("");
+ }
+
+ M_Ddm_Delete_Region req, rep ;
+
+ try {
+ req.setRegion(dynamic_cast<RegionImp *>(region)->getHandle());
+ }
+ catch (std::bad_cast) {
+ throw RegionNotKnown("");
+ }
+ privateRefs->executeService(&req, &rep);
+
+ delete region ;
+ }
+
+// ----------------------------------------------------------------------------
+// Register Object Instance With Region
+RTI::ObjectHandle
+RTI::RTIambassador::registerObjectInstanceWithRegion(ObjectClassHandle
object_class,
+ const char *tag,
+ AttributeHandle attrs[],
+ Region *regions[],
+ ULong nb)
+throw (RTI::ObjectClassNotDefined,
+ RTI::ObjectClassNotPublished,
+ RTI::AttributeNotDefined,
+ RTI::AttributeNotPublished,
+ RTI::RegionNotKnown,
+ RTI::InvalidRegionContext,
+ RTI::ObjectAlreadyRegistered,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::SaveInProgress,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError)
+ {
+ M_Ddm_Register_Object req, rep ;
+
+ req.setObjectClass(object_class);
+ if ( tag != NULL )
+ {
+ req.setTag(tag);
+ }
+
+ req.setAttributesSize(nb);
+ for (uint32_t i=0;i<nb;++i) {
+ req.setAttributes(attrs[i],0);
+ }
+ req.setRegions(build_region_handles(regions, nb));
+
+ privateRefs->executeService(&req, &rep);
+
+ return rep.getObject();
+ }
+
+// ----------------------------------------------------------------------------
+RTI::ObjectHandle
+RTI::RTIambassador::registerObjectInstanceWithRegion(ObjectClassHandle
object_class,
+ RTI::AttributeHandle attrs[],
+ RTI::Region *regions[],
+ ULong nb)
+throw (RTI::ObjectClassNotDefined,
+ RTI::ObjectClassNotPublished,
+ RTI::AttributeNotDefined,
+ RTI::AttributeNotPublished,
+ RTI::RegionNotKnown,
+ RTI::InvalidRegionContext,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::SaveInProgress,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError)
+ {
+ M_Ddm_Register_Object req, rep ;
+
+ req.setObjectClass(object_class);
+ req.setAttributesSize(nb);
+ for (uint32_t i=0;i<nb;++i) {
+ req.setAttributes(attrs[i],0);
+ }
+
+ req.setRegions(build_region_handles(regions, nb));
+
+ privateRefs->executeService(&req, &rep);
+
+ return rep.getObject();
+ }
+
+// ----------------------------------------------------------------------------
+/** Associate region for updates. Make attributes of an object
+ be updated through a routing region.
+ @param region Region to use for updates
+ @param object Object to associate to the region
+ @param attributes Handles of the involved attributes
+ @sa unassociateRegionForUpdates
+ */
+void
+RTI::RTIambassador::associateRegionForUpdates(Region ®ion,
+ ObjectHandle object,
+ const AttributeHandleSet &attributes)
+throw (RTI::ObjectNotKnown,
+ RTI::AttributeNotDefined,
+ RTI::InvalidRegionContext,
+ RTI::RegionNotKnown,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::SaveInProgress,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError)
+ {
+ Debug(D, pdDebug) << "+ Associate Region for Updates" << endl ;
+
+ M_Ddm_Associate_Region req, rep ;
+
+ req.setObject(object);
+ req.setRegion(get_handle(region));
+
assignAHVToRequest(certi_cast<AttributeHandleSetImp>()(attributes).getAttributeHandles(),req);
+
+ privateRefs->executeService(&req, &rep);
+ Debug(D, pdDebug) << "- Associate Region for Updates" << endl ;
+ }
+
+// ----------------------------------------------------------------------------
+/** Unassociate region for updates. Make attributes of an object be updated
+ through the default region (ie. Declaration Management services)
+ @param region Region to unassociate
+ @param object Object to unassociate
+ @see associateRegionForUpdates
+ */
+void
+RTI::RTIambassador::unassociateRegionForUpdates(Region ®ion,
+ ObjectHandle object)
+throw (RTI::ObjectNotKnown,
+ RTI::InvalidRegionContext,
+ RTI::RegionNotKnown,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::SaveInProgress,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError)
+ {
+ Debug(D, pdDebug) << "+ Unassociate Region for Updates" << endl ;
+ M_Ddm_Unassociate_Region req, rep ;
+
+ req.setObject(object);
+ req.setRegion(get_handle(region));
+
+ privateRefs->executeService(&req, &rep);
+ Debug(D, pdDebug) << "- Unassociate Region for Updates" << endl ;
+ }
+
+// ----------------------------------------------------------------------------
+/** Subscribe object class attributes with region.
+ @param object_class ObjectClassHandle
+ @param region Region to subscribe with
+ @param attributes AttributeHandleSet involved in the subscription
+ @param passive Boolean
+ @sa unsubscribeObjectClassWithRegion
+ */
+void
+RTI::RTIambassador::subscribeObjectClassAttributesWithRegion(
+ ObjectClassHandle object_class,
+ Region ®ion,
+ const AttributeHandleSet &attributes,
+ Boolean passive)
+throw (RTI::ObjectClassNotDefined,
+ RTI::AttributeNotDefined,
+ RTI::RegionNotKnown,
+ RTI::InvalidRegionContext,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::SaveInProgress,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError)
+ {
+ Debug(D, pdDebug) << "+ Subscribe Object Class Attributes with Region"
<< endl ;
+ M_Ddm_Subscribe_Attributes req, rep ;
+
+ req.setObjectClass(object_class);
+ req.setRegion(get_handle(region));
+
assignAHVToRequest(certi_cast<AttributeHandleSetImp>()(attributes).getAttributeHandles(),req);
+ if (passive)
+ req.passiveOn();
+ else
+ req.passiveOff();
+
+ privateRefs->executeService(&req, &rep);
+ Debug(D, pdDebug) << "- Subscribe Object Class Attributes with Region"
<< endl ;
+ }
+
+// ----------------------------------------------------------------------------
+/** Unsubscribe object class attributes with region.
+ @param object_class ObjectClassHandle
+ @param region Region to unsubscribe with
+ @sa subscribeObjectClassAttributesWithRegion
+ */
+void
+RTI::RTIambassador::unsubscribeObjectClassWithRegion(ObjectClassHandle
object_class,
+ Region ®ion)
+throw (RTI::ObjectClassNotDefined,
+ RTI::RegionNotKnown,
+ RTI::ObjectClassNotSubscribed,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::SaveInProgress,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError)
+ {
+ Debug(D, pdDebug) << "+ Unsubscribe Object Class " << object_class
+ << " with Region" << endl ;
+ M_Ddm_Unsubscribe_Attributes req, rep ;
+
+ req.setObjectClass(object_class);
+ req.setRegion(get_handle(region));
+
+ privateRefs->executeService(&req, &rep);
+ Debug(D, pdDebug) << "- Unsubscribe Object Class with Region" << endl ;
+ }
+
+// ----------------------------------------------------------------------------
+// Subscribe Interaction Class With Region
+void
+RTI::RTIambassador::subscribeInteractionClassWithRegion(InteractionClassHandle
ic,
+ Region ®ion,
+ RTI::Boolean passive)
+throw (RTI::InteractionClassNotDefined,
+ RTI::RegionNotKnown,
+ RTI::InvalidRegionContext,
+ RTI::FederateLoggingServiceCalls,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::SaveInProgress,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError)
+ {
+ M_Ddm_Subscribe_Interaction req, rep ;
+
+ req.setInteractionClass(ic);
+ req.setRegion(get_handle(region));
+ if (passive)
+ req.passiveOn();
+ else
+ req.passiveOff();
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+// ----------------------------------------------------------------------------
+// UnSubscribe Interaction Class With Region
+void
+RTI::RTIambassador::unsubscribeInteractionClassWithRegion(InteractionClassHandle
ic,
+ Region ®ion)
+throw (RTI::InteractionClassNotDefined,
+ RTI::InteractionClassNotSubscribed,
+ RTI::RegionNotKnown,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::SaveInProgress,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError)
+ {
+ M_Ddm_Unsubscribe_Interaction req, rep ;
+
+ req.setInteractionClass(ic);
+ req.setRegion(get_handle(region));
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+// ----------------------------------------------------------------------------
+// Send Interaction With Region
+RTI::EventRetractionHandle
+RTI::RTIambassador::sendInteractionWithRegion(InteractionClassHandle
interaction,
+ const ParameterHandleValuePairSet &par,
+ const RTI::FedTime &time,
+ const char *tag,
+ const Region ®ion)
+throw (RTI::InteractionClassNotDefined,
+ RTI::InteractionClassNotPublished,
+ RTI::InteractionParameterNotDefined,
+ RTI::InvalidFederationTime,
+ RTI::RegionNotKnown,
+ RTI::InvalidRegionContext,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::SaveInProgress,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError)
+ {
+ M_Send_Interaction req, rep ;
+ EventRetractionHandle event;
+ req.setInteractionClass(interaction);
+
assignPHVPSToRequest(certi_cast<ParameterHandleValuePairSetImp>()(par).getParameterHandleValuePairs(),req);
+ req.setDate(certi_cast<RTIfedTime>()(time).getTime());
+ if ( tag == NULL )
+ {
+ throw RTI::RTIinternalError ("Calling sendInteractionWithRegion
with Tag NULL");
+ }
+ req.setTag(tag);
+ req.setRegion(get_handle(region));
+
+ privateRefs->executeService(&req, &rep);
+ event.theSerialNumber = rep.getEventRetraction().getSN();
+ event.sendingFederate = rep.getEventRetraction().getSendingFederate();
+ return event;
+ }
+
+// ----------------------------------------------------------------------------
+void
+RTI::RTIambassador::sendInteractionWithRegion(InteractionClassHandle
interaction,
+ const ParameterHandleValuePairSet &par,
+ const char *tag,
+ const Region ®ion)
+throw (RTI::InteractionClassNotDefined,
+ RTI::InteractionClassNotPublished,
+ RTI::InteractionParameterNotDefined,
+ RTI::RegionNotKnown,
+ RTI::InvalidRegionContext,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::SaveInProgress,
+ RTI::RestoreInProgress,
+ RTI::RTIinternalError)
+ {
+ M_Send_Interaction req, rep ;
+
+ req.setInteractionClass(interaction);
+
assignPHVPSToRequest(certi_cast<ParameterHandleValuePairSetImp>()(par).getParameterHandleValuePairs(),req);
+ if ( tag == NULL )
+ {
+ throw RTI::RTIinternalError ("Calling sendInteractionWithRegion
with Tag NULL");
+ }
+ req.setTag(tag);
+ req.setRegion(get_handle(region));
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+// ----------------------------------------------------------------------------
+// Request Class Attribute Value Update With Region
+void RTI::RTIambassador::
+requestClassAttributeValueUpdateWithRegion(ObjectClassHandle /*object*/,
+ const AttributeHandleSet &attrs,
+ const Region ®ion)
+throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
+ RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
+ RTI::RegionNotKnown, RTI::AttributeNotDefined,
RTI::ObjectClassNotDefined)
+ {
+ throw RTI::RTIinternalError("unimplemented service
requestClassAttributeValueUpdateWithRegion");
+
+ M_Ddm_Request_Update req, rep ;
+
assignAHVToRequest(certi_cast<AttributeHandleSetImp>()(attrs).getAttributeHandles(),req);
+ req.setRegion(get_handle(region));
+ privateRefs->executeService(&req, &rep);
+ }
+
+// ----------------------------------------------------------------------------
+/** Get object class handle
+ \param theName Name of the object class
+ */
+RTI::ObjectClassHandle
+RTI::RTIambassador::getObjectClassHandle(const char *theName)
+throw (RTI::NameNotFound,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::RTIinternalError)
+ {
+ M_Get_Object_Class_Handle req, rep ;
+
+ G.Out(pdGendoc,"enter RTIambassador::getObjectClassHandle");
+
+ req.setClassName(theName);
+ privateRefs->executeService(&req, &rep);
+
+ G.Out(pdGendoc,"exit RTIambassador::getObjectClassHandle");
+
+ return rep.getObjectClass();
+ }
+
+// ----------------------------------------------------------------------------
+/** Get object class name.
+ \param handle Handle of the object class
+ \return The class name associated with the handle, memory has to
+ be freed by the caller.
+ */
+char *
+RTI::RTIambassador::getObjectClassName(ObjectClassHandle handle)
+throw (RTI::ObjectClassNotDefined,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::RTIinternalError)
+ {
+ M_Get_Object_Class_Name req, rep ;
+
+ req.setObjectClass(handle);
+ privateRefs->executeService(&req, &rep);
+ return hla_strdup(rep.getClassName());
+ }
+
+// ----------------------------------------------------------------------------
+/** Get attribute handle.
+ \param theName Name of the attribute
+ \param whichClass Handle of the attribute's class
+ */
+RTI::AttributeHandle
+RTI::RTIambassador::getAttributeHandle(const char *theName,
+ ObjectClassHandle whichClass)
+throw (RTI::ObjectClassNotDefined,
+ RTI::NameNotFound,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::RTIinternalError)
+ {
+ G.Out(pdGendoc,"enter RTI::RTIambassador::getAttributeHandle");
+ M_Get_Attribute_Handle req, rep ;
+
+ req.setAttributeName(theName);
+ req.setObjectClass(whichClass);
+ privateRefs->executeService(&req, &rep);
+ G.Out(pdGendoc,"exit RTI::RTIambassador::getAttributeHandle");
+ return rep.getAttribute();
+ }
+
+// ----------------------------------------------------------------------------
+/** Get attribute name.
+ \param theHandle Handle of the attribute
+ \param whichClass Handle of the attribute's class
+ */
+
+char *
+RTI::RTIambassador::getAttributeName(AttributeHandle theHandle,
+ ObjectClassHandle whichClass)
+throw (RTI::ObjectClassNotDefined,
+ RTI::AttributeNotDefined,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::RTIinternalError)
+ {
+ M_Get_Attribute_Name req, rep ;
+
+ req.setAttribute(theHandle);
+ req.setObjectClass(whichClass);
+ privateRefs->executeService(&req, &rep);
+ return hla_strdup(rep.getAttributeName());
+ }
+
+// ----------------------------------------------------------------------------
+// Get Interaction Class Handle
+RTI::InteractionClassHandle
+RTI::RTIambassador::getInteractionClassHandle(const char *theName)
+throw (RTI::NameNotFound,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::RTIinternalError)
+ {
+ M_Get_Interaction_Class_Handle req, rep ;
+
+ req.setClassName(theName);
+
+ privateRefs->executeService(&req, &rep);
+
+ return rep.getInteractionClass();
+ }
+
+// ----------------------------------------------------------------------------
+// Get Interaction Class Name
+char *
+RTI::RTIambassador::getInteractionClassName(InteractionClassHandle theHandle)
+throw (RTI::InteractionClassNotDefined,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::RTIinternalError)
+ {
+ M_Get_Interaction_Class_Name req, rep ;
+
+ req.setInteractionClass(theHandle);
+
+ privateRefs->executeService(&req, &rep);
+
+ return hla_strdup(rep.getClassName());
+ }
+
+// ----------------------------------------------------------------------------
+// Get Parameter Handle
+RTI::ParameterHandle
+RTI::RTIambassador::getParameterHandle(const char *theName,
+ InteractionClassHandle whichClass)
+throw (RTI::InteractionClassNotDefined,
+ RTI::NameNotFound,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::RTIinternalError)
+ {
+ M_Get_Parameter_Handle req, rep ;
+
+
+ req.setParameterName(theName);
+ req.setInteractionClass(whichClass);
+
+ privateRefs->executeService(&req, &rep);
+
+ return rep.getParameter();
+ }
+
+// ----------------------------------------------------------------------------
+// Get Parameter Name
+char *
+RTI::RTIambassador::getParameterName(ParameterHandle theHandle,
+ InteractionClassHandle whichClass)
+throw (RTI::InteractionClassNotDefined,
+ RTI::InteractionParameterNotDefined,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::RTIinternalError)
+ {
+ M_Get_Parameter_Name req, rep ;
+
+ req.setParameter(theHandle);
+ req.setInteractionClass(whichClass);
+
+ privateRefs->executeService(&req, &rep);
+
+ return hla_strdup(rep.getParameterName());
+ }
+
+// ----------------------------------------------------------------------------
+// Get Object Instance Handle
+RTI::ObjectHandle
+RTI::RTIambassador::getObjectInstanceHandle(const char *theName)
+throw (RTI::RTIinternalError, RTI::ConcurrentAccessAttempted,
+ RTI::FederateNotExecutionMember, RTI::ObjectNotKnown)
+ {
+ M_Get_Object_Instance_Handle req, rep ;
+
+ req.setObjectInstanceName(theName);
+
+ privateRefs->executeService(&req, &rep);
+
+ return rep.getObject();
+ }
+
+// ----------------------------------------------------------------------------
+// Get Object Instance Name
+char *
+RTI::RTIambassador::getObjectInstanceName(ObjectHandle theHandle)
+throw (RTI::RTIinternalError, RTI::ConcurrentAccessAttempted,
+ RTI::FederateNotExecutionMember, RTI::ObjectNotKnown)
+ {
+ M_Get_Object_Instance_Name req, rep ;
+
+ req.setObject(theHandle);
+
+ privateRefs->executeService(&req, &rep);
+
+ return hla_strdup(rep.getObjectInstanceName());
+ }
+
+// ----------------------------------------------------------------------------
+/** Get routing space handle
+ \param rs_name Name of the routing space
+ */
+RTI::SpaceHandle
+RTI::RTIambassador::getRoutingSpaceHandle(const char *rs_name)
+throw (RTI::NameNotFound,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::RTIinternalError)
+ {
+ Debug(D, pdDebug) << "Get routing space handle: " << rs_name << endl ;
+ M_Get_Space_Handle req, rep ;
+
+ req.setSpaceName(rs_name);
+ privateRefs->executeService(&req, &rep);
+ return rep.getSpace();
+ }
+
+// ----------------------------------------------------------------------------
+/** Get routing space name
+ \param handle Handle of the routing space
+ */
+char *
+RTI::RTIambassador::getRoutingSpaceName(SpaceHandle handle)
+throw (RTI::SpaceNotDefined,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::RTIinternalError)
+ {
+ M_Get_Space_Name req, rep ;
+
+ req.setSpace(handle);
+ privateRefs->executeService(&req, &rep);
+ return hla_strdup(rep.getSpaceName());
+ }
+
+// ----------------------------------------------------------------------------
+/** Get dimension handle
+ \param dimension Name of the dimension
+ \param space The dimension's routing SpaceHandle
+ */
+RTI::DimensionHandle
+RTI::RTIambassador::getDimensionHandle(const char *dimension,
+ SpaceHandle space)
+throw (RTI::SpaceNotDefined,
+ RTI::NameNotFound,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::RTIinternalError)
+ {
+ M_Get_Dimension_Handle req, rep ;
+
+ req.setDimensionName(dimension);
+ req.setSpace(space);
+ privateRefs->executeService(&req, &rep);
+ return rep.getDimension();
+ }
+
+// ----------------------------------------------------------------------------
+/** Get dimension name
+ \param dimension Handle of the dimension
+ \param space The dimension's routing space handle
+ */
+char *
+RTI::RTIambassador::getDimensionName(DimensionHandle dimension,
+ SpaceHandle space)
+throw (RTI::SpaceNotDefined,
+ RTI::DimensionNotDefined,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::RTIinternalError)
+ {
+ M_Get_Dimension_Name req, rep ;
+
+ req.setDimension(dimension);
+ req.setSpace(space);
+ privateRefs->executeService(&req, &rep);
+ return hla_strdup(rep.getDimensionName());
+ }
+
+// ----------------------------------------------------------------------------
+/** Get attribute routing space handle
+ \param attribute The attribute handle
+ \param object_class The attribute's class handle
+ \return The associated routing space handle
+ */
+RTI::SpaceHandle
+RTI::RTIambassador::getAttributeRoutingSpaceHandle(AttributeHandle attribute,
+ ObjectClassHandle object_class)
+throw (RTI::ObjectClassNotDefined,
+ RTI::AttributeNotDefined,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::RTIinternalError)
+ {
+ M_Get_Attribute_Space_Handle req, rep ;
+
+ req.setAttribute(attribute);
+ req.setObjectClass(object_class);
+ privateRefs->executeService(&req, &rep);
+ return rep.getSpace();
+ }
+
+// ----------------------------------------------------------------------------
+// Get Object Class
+RTI::ObjectClassHandle
+RTI::RTIambassador::getObjectClass(ObjectHandle theObject)
+throw (RTI::RTIinternalError, RTI::ConcurrentAccessAttempted,
+ RTI::FederateNotExecutionMember, RTI::ObjectNotKnown)
+ {
+ M_Get_Object_Class req, rep ;
+
+ req.setObject(theObject);
+ privateRefs->executeService(&req, &rep);
+ return rep.getObjectClass();
+ }
+
+// ----------------------------------------------------------------------------
+/** Get interaction routing space handle
+ \param inter The interaction handle
+ \return The associated routing space
+ */
+RTI::SpaceHandle
+RTI::RTIambassador::getInteractionRoutingSpaceHandle(InteractionClassHandle
inter)
+throw (RTI::InteractionClassNotDefined,
+ RTI::FederateNotExecutionMember,
+ RTI::ConcurrentAccessAttempted,
+ RTI::RTIinternalError)
+ {
+ M_Get_Interaction_Space_Handle req, rep ;
+
+ req.setInteractionClass(inter);
+ this->privateRefs->executeService(&req, &rep);
+ return rep.getSpace();
+ }
+
+// ----------------------------------------------------------------------------
+// Get Transportation Handle
+RTI::TransportationHandle
+RTI::RTIambassador::getTransportationHandle(const char *theName)
+throw (RTI::RTIinternalError, RTI::ConcurrentAccessAttempted,
+ RTI::FederateNotExecutionMember, RTI::NameNotFound)
+ {
+ M_Get_Transportation_Handle req, rep ;
+
+ req.setTransportationName(theName);
+ privateRefs->executeService(&req, &rep);
+ return rep.getTransportation();
+ }
+
+// ----------------------------------------------------------------------------
+// Get Transportation Name
+char *
+RTI::RTIambassador::getTransportationName(TransportationHandle theHandle)
+throw (RTI::RTIinternalError, RTI::ConcurrentAccessAttempted,
+ RTI::FederateNotExecutionMember,
RTI::InvalidTransportationHandle)
+ {
+ M_Get_Transportation_Name req, rep ;
+
+ req.setTransportation(theHandle);
+ privateRefs->executeService(&req, &rep);
+ return hla_strdup(rep.getTransportationName());
+ }
+
+// ----------------------------------------------------------------------------
+// Get Ordering Handle
+RTI::OrderingHandle
+RTI::RTIambassador::getOrderingHandle(const char *theName)
+throw (RTI::RTIinternalError, RTI::ConcurrentAccessAttempted,
+ RTI::FederateNotExecutionMember, RTI::NameNotFound)
+ {
+ M_Get_Ordering_Handle req, rep ;
+
+ req.setOrderingName(theName);
+ privateRefs->executeService(&req, &rep);
+ return rep.getOrdering();
+ }
+
+
+// ----------------------------------------------------------------------------
+// Get Ordering Name
+char *
+RTI::RTIambassador::getOrderingName(OrderingHandle theHandle)
+throw (RTI::RTIinternalError, RTI::ConcurrentAccessAttempted,
+ RTI::FederateNotExecutionMember, RTI::InvalidOrderingHandle)
+ {
+ M_Get_Ordering_Name req, rep ;
+
+ req.setOrdering(theHandle);
+ privateRefs->executeService(&req, &rep);
+ return hla_strdup(rep.getOrderingName());
+ }
+
+void
+RTI::RTIambassador::enableClassRelevanceAdvisorySwitch()
+throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
+ RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember)
+ {
+ M_Enable_Class_Relevance_Advisory_Switch req, rep ;
+
+ privateRefs->executeService(&req, &rep);
+ }
+void
+RTI::RTIambassador::disableClassRelevanceAdvisorySwitch()
+throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
+ RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember)
+ {
+ M_Disable_Class_Relevance_Advisory_Switch req, rep ;
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+void
+RTI::RTIambassador::enableAttributeRelevanceAdvisorySwitch()
+throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
+ RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember)
+ {
+ M_Enable_Attribute_Relevance_Advisory_Switch req, rep ;
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+void
+RTI::RTIambassador::disableAttributeRelevanceAdvisorySwitch()
+throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
+ RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember)
+ {
+ M_Disable_Attribute_Relevance_Advisory_Switch req, rep ;
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+void RTI::RTIambassador::enableAttributeScopeAdvisorySwitch()
+throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
+ RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember)
+ {
+ M_Enable_Attribute_Scope_Advisory_Switch req, rep ;
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+void
+RTI::RTIambassador::disableAttributeScopeAdvisorySwitch()
+throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
+ RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember)
+ {
+ M_Disable_Attribute_Scope_Advisory_Switch req, rep ;
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+void
+RTI::RTIambassador::enableInteractionRelevanceAdvisorySwitch()
+throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
+ RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember)
+ {
+ M_Enable_Interaction_Relevance_Advisory_Switch req, rep ;
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+void
+RTI::RTIambassador::disableInteractionRelevanceAdvisorySwitch()
+throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
+ RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember)
+ {
+ M_Disable_Interaction_Relevance_Advisory_Switch req, rep ;
+
+ privateRefs->executeService(&req, &rep);
+ }
+
+// $Id: RTIambassador.cc,v 1.1 2014/03/03 15:18:23 erk Exp $
Index: hla-1_3/TestFedTime.cc
===================================================================
RCS file: hla-1_3/TestFedTime.cc
diff -N hla-1_3/TestFedTime.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ hla-1_3/TestFedTime.cc 3 Mar 2014 15:18:23 -0000 1.1
@@ -0,0 +1,89 @@
+// ----------------------------------------------------------------------------
+// TestFedTime.cc - Module test for the libFedTime
+// Copyright (C) 2008 Eric Noulard <address@hidden>
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License version 2.1, as published by the Free Software Foundation.
+//
+// This library 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.
+//
+// $Id: TestFedTime.cc,v 1.1 2014/03/03 15:18:23 erk Exp $
+// ----------------------------------------------------------------------------
+
+#include <iostream>
+#include <sstream>
+#include <cstdlib>
+
+#include "certi.hh"
+#include "fedtime.hh"
+
+#define BUFLEN 12
+#define PRINTBUFLEN 50
+std::string
+show(const void* data, uint32_t n) {
+ uint32_t i;
+ std::stringstream msg;
+
+ const uint8_t* u8data = reinterpret_cast<const uint8_t*>(data);
+ msg << "0x";
+ for (i=0;i<n;++i) {
+ if ((0==(i%2))&&(i>0)) {
+ msg << " ";
+ }
+ msg << std::uppercase << std::hex << (int)u8data[i];
+ }
+ return msg.str();
+}
+
+int
+main(int argc, char* argv[]) {
+ int result = EXIT_SUCCESS;
+ char buffer[BUFLEN];
+ char printBuffer[PRINTBUFLEN];
+
+ std::cout << "Host byte-order: "
+#ifdef HOST_IS_BIG_ENDIAN
+ << "big-endian" << std::endl;
+#else
+ << "little-endian" << std::endl;
+#endif
+ RTI::FedTime* time = RTI::FedTimeFactory::makeZero();
+ std::cout << "PrintableLength = " << time->getPrintableLength()
<<std::endl;
+ if (time->getPrintableLength() > (PRINTBUFLEN+1)) {
+ std::cerr << "Cannot print value " << PRINTBUFLEN+1 << " < "<<
time->getPrintableLength() << std::endl;
+ exit(EXIT_FAILURE);
+ }
+ time->getPrintableString(printBuffer);
+ std::cout << "Zero = " << printBuffer <<std::endl;
+ time->setEpsilon();time->getPrintableString(printBuffer);
+ std::cout << "Epsilon = " << printBuffer<<std::endl;
+ time->setPositiveInfinity();time->getPrintableString(printBuffer);
+ std::cout << "Positive Infinity = " << printBuffer<<std::endl;
+ time->setZero();
+ RTIfedTime pi(RTI::Double(3.14159));
+ *time = pi;
+ time->getPrintableString(printBuffer);
+ std::cout << "Pi = " << printBuffer<<std::endl;
+ double pid = pi.getTime();
+ std::cout << " raw value = " << show(&pid,sizeof(pid)) <<
std::endl;
+ std::cout << "Trying to encode time..." <<std::endl;
+ std::cout << " encoded length = " << time->encodedLength()
<<std::endl;
+ if (time->encodedLength()<(BUFLEN+1)) {
+ time->encode(buffer);
+ } else {
+ std::cerr << "Cannot encode :"<< (BUFLEN+1) << "<" <<
time->encodedLength() << std::endl;
+ return EXIT_FAILURE;
+ }
+ std::cout << " encoded value = " <<
show(buffer,time->encodedLength()) << std::endl;
+ std::cout << "Trying to decode time..." <<std::endl;
+ RTI::FedTime* time2 = RTI::FedTimeFactory::decode(buffer);
+ time2->getPrintableString(printBuffer);
+ std::cout << " decoded value = " << printBuffer << std::endl;
+ return result;
+}
+
+// $Id: TestFedTime.cc,v 1.1 2014/03/03 15:18:23 erk Exp $
Index: hla-1_3/RTItypes.cc
===================================================================
RCS file: hla-1_3/RTItypes.cc
diff -N hla-1_3/RTItypes.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ hla-1_3/RTItypes.cc 3 Mar 2014 15:18:23 -0000 1.1
@@ -0,0 +1,267 @@
+// ----------------------------------------------------------------------------
+// CERTI - HLA RunTime Infrastructure
+// Copyright (C) 2002-2006 ONERA
+//
+// This program 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.
+//
+// This program 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: RTItypes.cc,v 1.1 2014/03/03 15:18:23 erk Exp $
+// ----------------------------------------------------------------------------
+
+#include "Exception.hh"
+#include "PrettyDebug.hh"
+#include <assert.h>
+#include <sstream>
+#include <cstdlib>
+#include <cstring>
+#include "RTI.hh"
+
+// static members for HLA Exceptions
+const char *RTI::ArrayIndexOutOfBounds::_ex = "ArrayIndexOutOfBounds" ;
+const char *RTI::AsynchronousDeliveryAlreadyDisabled::_ex =
"AsynchronousDeliveryAlreadyDisabled" ;
+const char *RTI::AsynchronousDeliveryAlreadyEnabled::_ex =
"AsynchronousDeliveryAlreadyEnabled" ;
+const char *RTI::AttributeAcquisitionWasNotRequested::_ex =
"AttributeAcquisitionWasNotRequested" ;
+const char *RTI::AttributeAcquisitionWasNotCanceled::_ex =
"AttributeAcquisitionWasNotCanceled" ;
+const char *RTI::AttributeAlreadyBeingAcquired::_ex =
"AttributeAlreadyBeingAcquired" ;
+const char *RTI::AttributeAlreadyBeingDivested::_ex =
"AttributeAlreadyBeingDivested" ;
+const char *RTI::AttributeAlreadyOwned::_ex = "AttributeAlreadyOwned" ;
+const char *RTI::AttributeDivestitureWasNotRequested::_ex =
"AttributeDivestitureWasNotRequested" ;
+const char *RTI::AttributeNotDefined::_ex = "AttributeNotDefined" ;
+const char *RTI::AttributeNotKnown::_ex = "AttributeNotKnown" ;
+const char *RTI::AttributeNotOwned::_ex = "AttributeNotOwned" ;
+const char *RTI::AttributeNotPublished::_ex = "AttributeNotPublished" ;
+const char *RTI::ConcurrentAccessAttempted::_ex = "ConcurrentAccessAttempted" ;
+const char *RTI::CouldNotDiscover::_ex = "CouldNotDiscover" ;
+const char *RTI::CouldNotOpenFED::_ex = "CouldNotOpenFED" ;
+const char *RTI::CouldNotRestore::_ex = "CouldNotRestore" ;
+const char *RTI::DeletePrivilegeNotHeld::_ex = "DeletePrivilegeNotHeld" ;
+const char *RTI::DimensionNotDefined::_ex = "DimensionNotDefined" ;
+const char *RTI::EnableTimeConstrainedPending::_ex =
"EnableTimeConstrainedPending" ;
+const char *RTI::EnableTimeConstrainedWasNotPending::_ex =
"EnableTimeConstrainedWasNotPending" ;
+const char *RTI::EnableTimeRegulationPending::_ex =
"EnableTimeRegulationPending" ;
+const char *RTI::EnableTimeRegulationWasNotPending::_ex =
"EnableTimeRegulationWasNotPending" ;
+const char *RTI::ErrorReadingFED::_ex = "ErrorReadingFED" ;
+const char *RTI::EventNotKnown::_ex = "EventNotKnown" ;
+const char *RTI::FederateAlreadyExecutionMember::_ex =
"FederateAlreadyExecutionMember" ;
+const char *RTI::FederateInternalError::_ex = "FederateInternalError" ;
+const char *RTI::FederateLoggingServiceCalls::_ex =
"FederateLoggingServiceCalls" ;
+const char *RTI::FederateNotExecutionMember::_ex =
"FederateNotExecutionMember" ;
+const char *RTI::FederateOwnsAttributes::_ex = "FederateOwnsAttributes" ;
+const char *RTI::FederateWasNotAskedToReleaseAttribute::_ex =
"FederateWasNotAskedToReleaseAttribute" ;
+const char *RTI::FederatesCurrentlyJoined::_ex = "FederatesCurrentlyJoined" ;
+const char *RTI::FederationExecutionAlreadyExists::_ex =
"FederationExecutionAlreadyExists" ;
+const char *RTI::FederationExecutionDoesNotExist::_ex =
"FederationExecutionDoesNotExist" ;
+const char *RTI::FederationTimeAlreadyPassed::_ex =
"FederationTimeAlreadyPassed" ;
+const char *RTI::HandleValuePairMaximumExceeded::_ex =
"HandleValuePairMaximumExceeded" ;
+const char *RTI::InteractionClassNotDefined::_ex =
"InteractionClassNotDefined" ;
+const char *RTI::InteractionClassNotKnown::_ex = "InteractionClassNotKnown" ;
+const char *RTI::InteractionClassNotPublished::_ex =
"InteractionClassNotPublished" ;
+const char *RTI::InteractionClassNotSubscribed::_ex =
"InteractionClassNotSubscribed" ;
+const char *RTI::InteractionParameterNotDefined::_ex =
"InteractionParameterNotDefined" ;
+const char *RTI::InteractionParameterNotKnown::_ex =
"InteractionParameterNotKnown" ;
+const char *RTI::InvalidExtents::_ex = "InvalidExtents" ;
+const char *RTI::InvalidFederationTime::_ex = "InvalidFederationTime" ;
+const char *RTI::InvalidHandleValuePairSetContext::_ex =
"InvalidHandleValuePairSetContext" ;
+const char *RTI::InvalidLookahead::_ex = "InvalidLookahead" ;
+const char *RTI::InvalidOrderingHandle::_ex = "InvalidOrderingHandle" ;
+const char *RTI::InvalidRegionContext::_ex = "InvalidRegionContext" ;
+const char *RTI::InvalidResignAction::_ex = "InvalidResignAction" ;
+const char *RTI::InvalidRetractionHandle::_ex = "InvalidRetractionHandle" ;
+const char *RTI::InvalidTransportationHandle::_ex =
"InvalidTransportationHandle" ;
+const char *RTI::MemoryExhausted::_ex = "MemoryExhausted" ;
+const char *RTI::NameNotFound::_ex = "NameNotFound" ;
+const char *RTI::ObjectClassNotDefined::_ex = "ObjectClassNotDefined" ;
+const char *RTI::ObjectClassNotKnown::_ex = "ObjectClassNotKnown" ;
+const char *RTI::ObjectClassNotPublished::_ex = "ObjectClassNotPublished" ;
+const char *RTI::ObjectClassNotSubscribed::_ex = "ObjectClassNotSubscribed" ;
+const char *RTI::ObjectNotKnown::_ex = "ObjectNotKnown" ;
+const char *RTI::ObjectAlreadyRegistered::_ex = "ObjectAlreadyRegistered" ;
+const char *RTI::OwnershipAcquisitionPending::_ex =
"OwnershipAcquisitionPending" ;
+const char *RTI::RegionInUse::_ex = "RegionInUse" ;
+const char *RTI::RegionNotKnown::_ex = "RegionNotKnown" ;
+const char *RTI::RestoreInProgress::_ex = "RestoreInProgress" ;
+const char *RTI::RestoreNotRequested::_ex = "RestoreNotRequested" ;
+const char *RTI::RTIinternalError::_ex = "RTIinternalError" ;
+const char *RTI::SpaceNotDefined::_ex = "SpaceNotDefined" ;
+const char *RTI::SaveInProgress::_ex = "SaveInProgress" ;
+const char *RTI::SaveNotInitiated::_ex = "SaveNotInitiated" ;
+const char *RTI::SpecifiedSaveLabelDoesNotExist::_ex =
"SpecifiedSaveLabelDoesNotExist" ;
+const char *RTI::SynchronizationPointLabelWasNotAnnounced::_ex =
"SynchronizationPointLabelWasNotAnnounced" ;
+const char *RTI::TimeAdvanceAlreadyInProgress::_ex =
"TimeAdvanceAlreadyInProgress" ;
+const char *RTI::TimeAdvanceWasNotInProgress::_ex =
"TimeAdvanceWasNotInProgress" ;
+const char *RTI::TimeConstrainedAlreadyEnabled::_ex =
"TimeConstrainedAlreadyEnabled" ;
+const char *RTI::TimeConstrainedWasNotEnabled::_ex =
"TimeConstrainedWasNotEnabled" ;
+const char *RTI::TimeRegulationAlreadyEnabled::_ex =
"TimeRegulationAlreadyEnabled" ;
+const char *RTI::TimeRegulationWasNotEnabled::_ex =
"TimeRegulationWasNotEnabled" ;
+const char *RTI::UnableToPerformSave::_ex = "UnableToPerformSave" ;
+const char *RTI::ValueCountExceeded::_ex = "ValueCountExceeded" ;
+const char *RTI::ValueLengthExceeded::_ex = "ValueLengthExceeded" ;
+
+// TypeException managing (how to obtain TypeException from Exception name ?)
+long RTI::ArrayIndexOutOfBounds::type = certi::e_ArrayIndexOutOfBounds ;
+long RTI::AsynchronousDeliveryAlreadyDisabled::type =
certi::e_AsynchronousDeliveryAlreadyDisabled ;
+long RTI::AsynchronousDeliveryAlreadyEnabled::type =
certi::e_AsynchronousDeliveryAlreadyEnabled ;
+long RTI::AttributeAcquisitionWasNotRequested::type =
certi::e_AttributeAcquisitionWasNotRequested ;
+long RTI::AttributeAcquisitionWasNotCanceled::type =
certi::e_AttributeAcquisitionWasNotCanceled ;
+long RTI::AttributeAlreadyBeingAcquired::type =
certi::e_AttributeAlreadyBeingAcquired ;
+long RTI::AttributeAlreadyBeingDivested::type =
certi::e_AttributeAlreadyBeingDivested ;
+long RTI::AttributeAlreadyOwned::type = certi::e_AttributeAlreadyOwned ;
+long RTI::AttributeDivestitureWasNotRequested::type =
certi::e_AttributeDivestitureWasNotRequested ;
+long RTI::AttributeNotDefined::type = certi::e_AttributeNotDefined ;
+long RTI::AttributeNotKnown::type = certi::e_AttributeNotKnown ;
+long RTI::AttributeNotOwned::type = certi::e_AttributeNotOwned ;
+long RTI::AttributeNotPublished::type = certi::e_AttributeNotPublished ;
+long RTI::ConcurrentAccessAttempted::type = certi::e_ConcurrentAccessAttempted
;
+long RTI::CouldNotDiscover::type = certi::e_CouldNotDiscover ;
+long RTI::CouldNotOpenFED::type = certi::e_CouldNotOpenFED ;
+long RTI::CouldNotRestore::type = certi::e_CouldNotRestore ;
+long RTI::DeletePrivilegeNotHeld::type = certi::e_DeletePrivilegeNotHeld ;
+long RTI::DimensionNotDefined::type = certi::e_DimensionNotDefined ;
+long RTI::EnableTimeConstrainedPending::type =
certi::e_EnableTimeConstrainedPending ;
+long RTI::EnableTimeConstrainedWasNotPending::type =
certi::e_EnableTimeConstrainedWasNotPending ;
+long RTI::EnableTimeRegulationPending::type =
certi::e_EnableTimeRegulationPending ;
+long RTI::EnableTimeRegulationWasNotPending::type =
certi::e_EnableTimeRegulationWasNotPending ;
+long RTI::ErrorReadingFED::type = certi::e_ErrorReadingFED ;
+long RTI::EventNotKnown::type = certi::e_EventNotKnown ;
+long RTI::FederateAlreadyExecutionMember::type =
certi::e_FederateAlreadyExecutionMember ;
+long RTI::FederateInternalError::type = certi::e_FederateInternalError ;
+long RTI::FederateLoggingServiceCalls::type =
certi::e_FederateLoggingServiceCalls ;
+long RTI::FederateNotExecutionMember::type =
certi::e_FederateNotExecutionMember ;
+long RTI::FederateOwnsAttributes::type = certi::e_FederateOwnsAttributes ;
+long RTI::FederateWasNotAskedToReleaseAttribute::type =
certi::e_FederateWasNotAskedToReleaseAttribute ;
+long RTI::FederatesCurrentlyJoined::type = certi::e_FederatesCurrentlyJoined ;
+long RTI::FederationExecutionAlreadyExists::type =
certi::e_FederationExecutionAlreadyExists ;
+long RTI::FederationExecutionDoesNotExist::type =
certi::e_FederationExecutionDoesNotExist ;
+long RTI::FederationTimeAlreadyPassed::type =
certi::e_FederationTimeAlreadyPassed ;
+long RTI::HandleValuePairMaximumExceeded::type =
certi::e_HandleValuePairMaximumExceeded ;
+long RTI::InteractionClassNotDefined::type =
certi::e_InteractionClassNotDefined ;
+long RTI::InteractionClassNotKnown::type = certi::e_InteractionClassNotKnown ;
+long RTI::InteractionClassNotPublished::type =
certi::e_InteractionClassNotPublished ;
+long RTI::InteractionClassNotSubscribed::type =
certi::e_InteractionClassNotSubscribed ;
+long RTI::InteractionParameterNotDefined::type =
certi::e_InteractionParameterNotDefined ;
+long RTI::InteractionParameterNotKnown::type =
certi::e_InteractionParameterNotKnown ;
+long RTI::InvalidExtents::type = certi::e_InvalidExtents ;
+long RTI::InvalidFederationTime::type = certi::e_InvalidFederationTime ;
+long RTI::InvalidHandleValuePairSetContext::type =
certi::e_InvalidHandleValuePairSetContext ;
+long RTI::InvalidLookahead::type = certi::e_InvalidLookahead ;
+long RTI::InvalidOrderingHandle::type = certi::e_InvalidOrderingHandle ;
+long RTI::InvalidRegionContext::type = certi::e_InvalidRegionContext ;
+long RTI::InvalidResignAction::type = certi::e_InvalidResignAction ;
+long RTI::InvalidRetractionHandle::type = certi::e_InvalidRetractionHandle ;
+long RTI::InvalidTransportationHandle::type =
certi::e_InvalidTransportationHandle ;
+long RTI::MemoryExhausted::type = certi::e_MemoryExhausted ;
+long RTI::NameNotFound::type = certi::e_NameNotFound ;
+long RTI::ObjectClassNotDefined::type = certi::e_ObjectClassNotDefined ;
+long RTI::ObjectClassNotKnown::type = certi::e_ObjectClassNotKnown ;
+long RTI::ObjectClassNotPublished::type = certi::e_ObjectClassNotPublished ;
+long RTI::ObjectClassNotSubscribed::type = certi::e_ObjectClassNotSubscribed ;
+long RTI::ObjectNotKnown::type = certi::e_ObjectNotKnown ;
+long RTI::ObjectAlreadyRegistered::type = certi::e_ObjectAlreadyRegistered ;
+long RTI::OwnershipAcquisitionPending::type =
certi::e_OwnershipAcquisitionPending ;
+long RTI::RegionInUse::type = certi::e_RegionInUse ;
+long RTI::RegionNotKnown::type = certi::e_RegionNotKnown ;
+long RTI::RestoreInProgress::type = certi::e_RestoreInProgress ;
+long RTI::RestoreNotRequested::type = certi::e_RestoreNotRequested ;
+long RTI::RTIinternalError::type = certi::e_RTIinternalError ;
+long RTI::SpaceNotDefined::type = certi::e_SpaceNotDefined ;
+long RTI::SaveInProgress::type = certi::e_SaveInProgress ;
+long RTI::SaveNotInitiated::type = certi::e_SaveNotInitiated ;
+long RTI::SpecifiedSaveLabelDoesNotExist::type =
certi::e_SpecifiedSaveLabelDoesNotExist ;
+long RTI::SynchronizationPointLabelWasNotAnnounced::type =
certi::e_SynchronizationPointLabelWasNotAnnounced ;
+long RTI::TimeAdvanceAlreadyInProgress::type =
certi::e_TimeAdvanceAlreadyInProgress ;
+long RTI::TimeAdvanceWasNotInProgress::type =
certi::e_TimeAdvanceWasNotInProgress ;
+long RTI::TimeConstrainedAlreadyEnabled::type =
certi::e_TimeConstrainedAlreadyEnabled ;
+long RTI::TimeConstrainedWasNotEnabled::type =
certi::e_TimeConstrainedWasNotEnabled ;
+long RTI::TimeRegulationAlreadyEnabled::type =
certi::e_TimeRegulationAlreadyEnabled ;
+long RTI::TimeRegulationWasNotEnabled::type =
certi::e_TimeRegulationWasNotEnabled ;
+long RTI::UnableToPerformSave::type = certi::e_UnableToPerformSave ;
+long RTI::ValueCountExceeded::type = certi::e_ValueCountExceeded ;
+long RTI::ValueLengthExceeded::type = certi::e_ValueLengthExceeded ;
+
+static PrettyDebug PD_RTIException("RTI_EXCEPTION",__FILE__);
+
+RTI::Exception::~Exception()
+{
+ if (NULL!=_reason) {
+ free(_reason);
+ }
+}
+
+RTI::Exception::Exception(const char *reason)
+{
+ _reason = (reason == NULL)?NULL:strdup(reason);
+ _serial = 0 ;
+}
+
+RTI::Exception::Exception(ULong serial, const char *reason)
+{
+ _serial = serial ;
+ _reason = (reason == NULL)?NULL:strdup(reason);
+}
+
+
+RTI::Exception::Exception(const Exception &toCopy)
+{
+ _serial = toCopy._serial ;
+ _reason = ( toCopy._reason== NULL)?NULL:strdup(toCopy._reason) ;
+ _name = toCopy._name ;
+}
+
+RTI::Exception& RTI::Exception::operator=(const Exception &toCopy)
+{
+ _serial = toCopy._serial ;
+ _reason = (toCopy._reason == NULL)?NULL:strdup(toCopy._reason) ;
+ _name = toCopy._name ;
+ return *this ;
+}
+
+const std::string RTI::Exception::displayMe() const
+{
+ std::stringstream msg;
+
+ msg << "RTI::Exception [";
+ if (NULL!=_name) {
+ msg <<_name;
+ } else {
+ msg<<"<noname>";
+ }
+ msg <<",0x"<<std::hex<<_serial<<"]";
+ msg << " - reason=";
+ if (NULL !=_reason) {
+ msg << _reason;
+ } else {
+ msg << "<noreason>";
+ }
+ msg << std::endl;
+ msg << std::flush;
+
+ Debug(PD_RTIException, pdExcept) << msg.str();
+ return msg.str();
+}
+
+RTI_STD::ostream &
+operator<<(RTI_STD::ostream &os, RTI::Exception const &ex)
+{
+ // FIXME
+ return os << ex.displayMe();
+}
+
+RTI_STD::ostream &
+operator<<(RTI_STD::ostream &os, RTI::Exception *ex)
+{
+ assert(ex);
+ return os<<(*ex);
+}
+
+// $Id: RTItypes.cc,v 1.1 2014/03/03 15:18:23 erk Exp $
Index: hla-1_3/RTItypesImp.hh
===================================================================
RCS file: hla-1_3/RTItypesImp.hh
diff -N hla-1_3/RTItypesImp.hh
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ hla-1_3/RTItypesImp.hh 3 Mar 2014 15:18:23 -0000 1.1
@@ -0,0 +1,278 @@
+// ----------------------------------------------------------------------------
+// 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: RTItypesImp.hh,v 1.1 2014/03/03 15:18:23 erk Exp $
+// ----------------------------------------------------------------------------
+
+#ifndef _RTI_TYPESIMP_HH
+#define _RTI_TYPESIMP_HH
+
+#include "Extent.hh"
+#include "RTI.hh"
+#include "certi.hh"
+
+namespace certi {
+
+template<class I>
+struct certi_cast
+{
+ template<class R>
+ const I& operator()(const R& imp)
+ {
+ try {
+ return dynamic_cast<const I&>(imp);
+ }
+ catch (...)
+ {
+ throw RTI::RTIinternalError("Incompatible object on input.");
+ }
+ }
+
+ template<class R>
+ I& operator()(R& imp)
+ {
+ try {
+ return dynamic_cast<I&>(imp);
+ }
+ catch (...)
+ {
+ throw RTI::RTIinternalError("Incompatible object on input.");
+ }
+ }
+};
+
+typedef std::pair<AttributeHandle, AttributeValue_t>
AttributeHandleValuePair_t;
+
+class RTI_EXPORT AttributeHandleValuePairSetImp : public
RTI::AttributeHandleValuePairSet
+{
+public:
+ AttributeHandleValuePairSetImp(RTI::ULong);
+ AttributeHandleValuePairSetImp(const
std::vector<AttributeHandleValuePair_t> &);
+
+ virtual ~AttributeHandleValuePairSetImp();
+
+ virtual RTI::ULong size() const;
+
+ virtual RTI::Handle getHandle(RTI::ULong) const
+ throw (RTI::ArrayIndexOutOfBounds);
+
+ virtual RTI::ULong getValueLength(RTI::ULong) const
+ throw (RTI::ArrayIndexOutOfBounds);
+
+ virtual void getValue(RTI::ULong, char *, RTI::ULong &) const
+ throw (RTI::ArrayIndexOutOfBounds);
+
+ virtual char *getValuePointer(RTI::ULong, RTI::ULong &) const
+ throw (RTI::ArrayIndexOutOfBounds);
+
+ virtual RTI::TransportType getTransportType(RTI::ULong) const
+ throw (RTI::InvalidHandleValuePairSetContext);
+
+ virtual RTI::OrderType getOrderType(RTI::ULong) const
+ throw (RTI::ArrayIndexOutOfBounds,
RTI::InvalidHandleValuePairSetContext);
+
+ virtual RTI::Region *getRegion(RTI::ULong) const
+ throw (RTI::ArrayIndexOutOfBounds,
RTI::InvalidHandleValuePairSetContext);
+
+ virtual void add(RTI::Handle, const char *,RTI:: ULong)
+ throw (RTI::ValueLengthExceeded, RTI::ValueCountExceeded);
+
+ virtual void remove(RTI::Handle h)
+ throw (RTI::ArrayIndexOutOfBounds);
+
+ virtual void moveFrom(const AttributeHandleValuePairSet &, RTI::ULong &)
+ throw (RTI::ValueCountExceeded, RTI::ArrayIndexOutOfBounds);
+
+ virtual void empty();
+
+ virtual RTI::ULong start() const;
+ virtual RTI::ULong valid(RTI::ULong i) const;
+ virtual RTI::ULong next(RTI::ULong i) const;
+
+ const std::vector<AttributeHandleValuePair_t>&
getAttributeHandleValuePairs() const;
+
+protected:
+ std::vector<AttributeHandleValuePair_t> _set;
+ OrderType _order ;
+ TransportType _transport ;
+};
+
+class RTI_EXPORT AttributeHandleSetImp : public RTI::AttributeHandleSet
+{
+public:
+ AttributeHandleSetImp(RTI::ULong);
+ AttributeHandleSetImp(const std::vector<RTI::AttributeHandle> &val);
+ AttributeHandleSetImp(const std::vector<certi::AttributeHandle> &val);
+
+ virtual ~AttributeHandleSetImp();
+
+ virtual RTI::ULong size() const;
+
+ virtual RTI::AttributeHandle getHandle(RTI::ULong) const
+ throw (RTI::ArrayIndexOutOfBounds);
+
+ virtual void add(RTI::AttributeHandle)
+ throw (RTI::ArrayIndexOutOfBounds, RTI::AttributeNotDefined);
+
+ virtual void remove(RTI::AttributeHandle)
+ throw (RTI::AttributeNotDefined);
+
+ virtual void empty();
+
+ virtual RTI::Boolean isEmpty() const;
+ virtual RTI::Boolean isMember(RTI::AttributeHandle h) const;
+
+ const std::vector<RTI::AttributeHandle>& getAttributeHandles() const;
+
+protected:
+ std::vector<RTI::AttributeHandle> _set;
+};
+
+class RTI_EXPORT FederateHandleSetImp : public RTI::FederateHandleSet
+{
+public:
+ FederateHandleSetImp(RTI::ULong);
+ virtual ~FederateHandleSetImp();
+
+ virtual RTI::ULong size() const;
+
+ virtual RTI::FederateHandle getHandle(RTI::ULong) const
+ throw (RTI::ArrayIndexOutOfBounds);
+
+ virtual void add(RTI::FederateHandle)
+ throw (RTI::ValueCountExceeded);
+
+ virtual void remove(RTI::FederateHandle)
+ throw (RTI::ArrayIndexOutOfBounds);
+
+ virtual void empty();
+
+ virtual RTI::Boolean isMember(RTI::FederateHandle) const;
+
+protected:
+ std::vector<RTI::FederateHandle> _set;
+};
+
+typedef std::pair<RTI::ParameterHandle, ParameterValue_t>
ParameterHandleValuePair_t;
+
+class RTI_EXPORT ParameterHandleValuePairSetImp : public
RTI::ParameterHandleValuePairSet
+{
+public:
+ ParameterHandleValuePairSetImp(RTI::ULong);
+ ParameterHandleValuePairSetImp(const
std::vector<ParameterHandleValuePair_t> &);
+ virtual ~ParameterHandleValuePairSetImp();
+
+ virtual RTI::ULong size() const;
+
+ virtual RTI::Handle getHandle(RTI::ULong) const
+ throw (RTI::ArrayIndexOutOfBounds);
+
+ virtual RTI::ULong getValueLength(RTI::ULong) const
+ throw (RTI::ArrayIndexOutOfBounds);
+
+ virtual void getValue(RTI::ULong, char *, RTI::ULong &) const
+ throw (RTI::ArrayIndexOutOfBounds);
+
+ virtual char *getValuePointer(RTI::ULong, RTI::ULong &) const
+ throw (RTI::ArrayIndexOutOfBounds);
+
+ virtual RTI::TransportType getTransportType() const
+ throw (RTI::InvalidHandleValuePairSetContext);
+
+ virtual RTI::OrderType getOrderType() const
+ throw (RTI::InvalidHandleValuePairSetContext);
+
+ virtual RTI::Region *getRegion() const
+ throw (RTI::InvalidHandleValuePairSetContext);
+
+ virtual void add(RTI::Handle, const char *, RTI::ULong)
+ throw (RTI::ValueLengthExceeded, RTI::ValueCountExceeded);
+
+ virtual void remove(RTI::Handle)
+ throw (RTI::ArrayIndexOutOfBounds);
+
+ virtual void moveFrom(const ParameterHandleValuePairSet &, RTI::ULong &)
+ throw (RTI::ValueCountExceeded, RTI::ArrayIndexOutOfBounds);
+
+ virtual void empty();
+
+ virtual RTI::ULong start() const;
+ virtual RTI::ULong valid(RTI::ULong i) const;
+ virtual RTI::ULong next(RTI::ULong i) const;
+
+ const std::vector<ParameterHandleValuePair_t>&
getParameterHandleValuePairs() const;
+
+protected:
+ std::vector<ParameterHandleValuePair_t> _set;
+ RTI::OrderType _order ;
+ RTI::TransportType _transport ;
+};
+
+
+class RTI_EXPORT RegionImp : public RTI::Region
+{
+public:
+ RegionImp(RegionHandle, RTI::SpaceHandle, const std::vector<Extent>&);
+ virtual ~RegionImp();
+
+ virtual RTI::ULong getRangeLowerBound(RTI::ExtentIndex,
RTI::DimensionHandle) const
+ throw (RTI::ArrayIndexOutOfBounds);
+
+ virtual RTI::ULong getRangeUpperBound(RTI::ExtentIndex,
RTI::DimensionHandle) const
+ throw (RTI::ArrayIndexOutOfBounds);
+
+ virtual void setRangeLowerBound(RTI::ExtentIndex, RTI::DimensionHandle,
RTI::ULong)
+ throw (RTI::ArrayIndexOutOfBounds);
+
+ virtual void setRangeUpperBound(RTI::ExtentIndex, RTI::DimensionHandle,
RTI::ULong)
+ throw (RTI::ArrayIndexOutOfBounds);
+
+ virtual RTI::SpaceHandle getSpaceHandle() const
+ throw ();
+
+ virtual RTI::ULong getNumberOfExtents() const
+ throw ();
+
+ virtual RTI::ULong getRangeLowerBoundNotificationLimit(RTI::ExtentIndex,
RTI::DimensionHandle) const
+ throw (RTI::ArrayIndexOutOfBounds);
+
+ virtual RTI::ULong getRangeUpperBoundNotificationLimit(RTI::ExtentIndex,
RTI::DimensionHandle) const
+ throw (RTI::ArrayIndexOutOfBounds);
+
+ RegionHandle getHandle() const;
+
+ const std::vector<Extent>& getExtents() const;
+
+ void commit();
+
+private:
+ RegionHandle handle;
+ RTI::SpaceHandle space;
+ std::vector<Extent> extents;
+ // extents used in last notifyAboutRegionModification
+ std::vector<Extent> effectiveExtents;
+};
+
+}
+
+#endif // _RTI_TYPESIMP_HH
+
+// $Id: RTItypesImp.hh,v 1.1 2014/03/03 15:18:23 erk Exp $
Index: hla-1_3/RTIambPrivateRefs.cc
===================================================================
RCS file: hla-1_3/RTIambPrivateRefs.cc
diff -N hla-1_3/RTIambPrivateRefs.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ hla-1_3/RTIambPrivateRefs.cc 3 Mar 2014 15:18:24 -0000 1.1
@@ -0,0 +1,986 @@
+// ----------------------------------------------------------------------------
+// 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.cc,v 1.1 2014/03/03 15:18:24 erk Exp $
+// ----------------------------------------------------------------------------
+
+#include <config.h>
+#include "RTIambPrivateRefs.hh"
+#include "RTItypesImp.hh"
+#include "PrettyDebug.hh"
+#include "M_Classes.hh"
+#include <sstream>
+#include <iostream>
+#include <memory>
+
+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).begin(),
request->getValues(i).end());
+ }
+
+ return result;
+}
+
+template<typename T>
+std::vector<std::pair<RTI::ParameterHandle, ParameterValue_t> >
+getPHVPSFromRequest(T* request)
+{
+ uint32_t size = request->getParametersSize();
+
+ std::vector<std::pair<RTI::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).begin(),
request->getValues(i).end());
+ }
+
+ return result;
+}
+}
+
+RTIambPrivateRefs::RTIambPrivateRefs()
+{
+ fed_amb = NULL;
+#ifdef _WIN32
+ handle_RTIA = (HANDLE)-1;
+#else
+ pid_RTIA = (pid_t)-1;
+#endif
+ is_reentrant = false;
+ _theRootObj = NULL;
+ socketUn = NULL;
+}
+
+RTIambPrivateRefs::~RTIambPrivateRefs()
+{
+ delete socketUn ;
+}
+
+// ----------------------------------------------------------------------------
+void
+RTIambPrivateRefs::leave(const char *msg) throw (RTI::RTIinternalError)
+{
+ std::stringstream smsg;
+ smsg << "RTI called leave because <" <<msg<<">";
+ throw RTI::RTIinternalError(smsg.str().c_str());
+}
+
+// ----------------------------------------------------------------------------
+void
+RTIambPrivateRefs::executeService(Message *req, Message *rep)
+{
+ G.Out(pdGendoc,"enter
RTIambPrivateRefs::executeService(%s,%s)",req->getMessageName(),rep->getMessageName());
+
+ D.Out(pdDebug, "sending request to RTIA.");
+
+ try {
+ req->send(socketUn,msgBufSend);
+ }
+ catch (NetworkError) {
+ std::cerr << "libRTI: exception: NetworkError (write)" <<
std::endl ;
+ throw RTI::RTIinternalError("libRTI: Network Write Error");
+ }
+
+ D.Out(pdDebug, "waiting RTIA reply.");
+
+ // waiting RTI reply.
+ try {
+ rep->receive(socketUn,msgBufReceive);
+ }
+ catch (NetworkError) {
+ std::cerr << "libRTI: exception: NetworkError (read)" <<
std::endl ;
+ throw RTI::RTIinternalError("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 RTI::RTIinternalError("RTIambPrivateRefs::executeService:
"
+ "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 RTIambPrivateRefs::executeService");
+}
+
+void
+RTIambPrivateRefs::sendTickRequestStop()
+{
+ G.Out(pdGendoc,"enter RTIambPrivateRefs::sendTickRequestStop");
+
+ M_Tick_Request_Stop req, rep ;
+
+ try {
+ req.send(socketUn, msgBufSend);
+ }
+ catch (NetworkError) {
+ std::cerr << "libRTI: exception: NetworkError (write)" <<
std::endl ;
+ throw RTI::RTIinternalError("libRTI: Network Write Error");
+ }
+
+ try {
+ rep.receive(socketUn, msgBufReceive);
+ }
+ catch (NetworkError) {
+ std::cerr << "libRTI: exception: NetworkError (read)" <<
std::endl ;
+ throw RTI::RTIinternalError("libRTI: Network Read Error waiting
RTI reply");
+ }
+
+ // ignore the response, ignore exceptions
+ // rep->type == Message::TICK_REQUEST;
+
+ G.Out(pdGendoc,"exit RTIambPrivateRefs::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
+RTIambPrivateRefs::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.");
+ throw RTI::ArrayIndexOutOfBounds(msg->getExceptionReason());
+ } break ;
+
+ case e_AsynchronousDeliveryAlreadyEnabled: {
+ D.Out(pdExcept, "Throwing e_AsynchronousDeliveryAlreadyEnabled
exception.");
+ throw
RTI::AsynchronousDeliveryAlreadyEnabled(msg->getExceptionReason());
+ } break ;
+
+ case e_AsynchronousDeliveryAlreadyDisabled: {
+ D.Out(pdExcept, "Throwing e_AsynchronousDeliveryAlreadyDisabled
exception.");
+ throw
RTI::AsynchronousDeliveryAlreadyDisabled(msg->getExceptionReason());
+ } break ;
+
+ case e_AttributeAlreadyOwned: {
+ D.Out(pdExcept, "Throwing e_AttributeAlreadyOwned exception.");
+ throw RTI::AttributeAlreadyOwned(msg->getExceptionReason());
+ } break ;
+
+ case e_AttributeAlreadyBeingAcquired: {
+ D.Out(pdExcept,
+ "Throwing e_AttributeAlreadyBeingAcquired
exception.");
+ throw
RTI::AttributeAlreadyBeingAcquired(msg->getExceptionReason());
+ } break ;
+
+ case e_AttributeAlreadyBeingDivested: {
+ D.Out(pdExcept,
+ "Throwing e_AttributeAlreadyBeingDivested
exception.");
+ throw
RTI::AttributeAlreadyBeingDivested(msg->getExceptionReason());
+ } break ;
+
+ case e_AttributeDivestitureWasNotRequested: {
+ D.Out(pdExcept,
+ "Throwing e_AttributeDivestitureWasNotRequested
exception.");
+ throw
RTI::AttributeDivestitureWasNotRequested(msg->getExceptionReason());
+ } break ;
+
+ case e_AttributeAcquisitionWasNotRequested: {
+ D.Out(pdExcept,
+ "Throwing e_AttributeAcquisitionWasNotRequested
exception.");
+ throw
RTI::AttributeAcquisitionWasNotRequested(msg->getExceptionReason());
+ } break ;
+
+ case e_AttributeNotDefined: {
+ D.Out(pdExcept, "Throwing e_AttributeNotDefined exception.");
+ throw RTI::AttributeNotDefined(msg->getExceptionReason());
+ } break ;
+
+ case e_AttributeNotKnown: {
+ D.Out(pdExcept, "Throwing e_AttributeNotKnown exception.");
+ throw RTI::AttributeNotKnown(msg->getExceptionReason());
+ } break ;
+
+ case e_AttributeNotOwned: {
+ D.Out(pdExcept, "Throwing e_AttributeNotOwned exception.");
+ throw RTI::AttributeNotOwned(msg->getExceptionReason());
+ } break ;
+
+ case e_AttributeNotPublished: {
+ D.Out(pdExcept, "Throwing e_AttributeNotPublished exception.");
+ throw RTI::AttributeNotPublished(msg->getExceptionReason());
+ } break ;
+
+ case e_AttributeNotSubscribed: {
+ D.Out(pdExcept, "Throwing e_AttributeNotSubscribed exception.");
+ throw RTI::RTIinternalError(msg->getExceptionReason());
+ } break ;
+
+ case e_ConcurrentAccessAttempted: {
+ D.Out(pdExcept, "Throwing e_ConcurrentAccessAttempted
exception.");
+ throw RTI::ConcurrentAccessAttempted(msg->getExceptionReason());
+ } break ;
+
+ case e_CouldNotDiscover: {
+ D.Out(pdExcept, "Throwing e_CouldNotDiscover exception.");
+ throw RTI::CouldNotDiscover(msg->getExceptionReason());
+ } break ;
+
+ case e_CouldNotOpenFED: {
+ D.Out(pdExcept, "Throwing e_CouldNotOpenFED exception.");
+ throw RTI::CouldNotOpenFED(msg->getExceptionReason());
+ } break ;
+
+ case e_CouldNotOpenRID: {
+ D.Out(pdExcept, "Throwing e_CouldNotOpenRID exception.");
+ throw RTI::RTIinternalError(msg->getExceptionReason());
+ } break ;
+
+ case e_CouldNotRestore: {
+ D.Out(pdExcept, "Throwing e_CouldNotRestore exception.");
+ throw RTI::CouldNotRestore(msg->getExceptionReason());
+ } break ;
+
+ case e_DeletePrivilegeNotHeld: {
+ D.Out(pdExcept, "Throwing e_DeletePrivilegeNotHeld exception.");
+ throw RTI::DeletePrivilegeNotHeld(msg->getExceptionReason());
+ } break ;
+
+ case e_ErrorReadingRID: {
+ D.Out(pdExcept, "Throwing e_ErrorReadingRID exception.");
+ throw RTI::RTIinternalError(msg->getExceptionReason());
+ } break ;
+
+ case e_ErrorReadingFED: {
+ D.Out(pdExcept, "Throwing e_ErrorReadingFED exception.");
+ throw RTI::ErrorReadingFED(msg->getExceptionReason());
+ } break ;
+
+ case e_EventNotKnown: {
+ D.Out(pdExcept, "Throwing e_EventNotKnown exception.");
+ throw RTI::EventNotKnown(msg->getExceptionReason());
+ } break ;
+
+ case e_FederateAlreadyPaused: {
+ D.Out(pdExcept, "Throwing e_FederateAlreadyPaused exception.");
+ throw RTI::RTIinternalError(msg->getExceptionReason());
+ } break ;
+
+ case e_FederateAlreadyExecutionMember: {
+ D.Out(pdExcept,
+ "Throwing e_FederateAlreadyExecutionMember
exception.");
+ throw
RTI::FederateAlreadyExecutionMember(msg->getExceptionReason());
+ } break ;
+
+ case e_FederateDoesNotExist: {
+ D.Out(pdExcept, "Throwing e_FederateDoesNotExist exception.");
+ throw RTI::RTIinternalError(msg->getExceptionReason());
+ } break ;
+
+ case e_FederateInternalError: {
+ D.Out(pdExcept, "Throwing e_FederateInternalError exception.");
+ throw RTI::FederateInternalError(msg->getExceptionReason());
+ } break ;
+
+ case e_FederateNameAlreadyInUse: {
+ D.Out(pdExcept, "Throwing e_FederateNameAlreadyInUse
exception.");
+ throw RTI::RTIinternalError(msg->getExceptionReason());
+ } break ;
+
+ case e_FederateNotExecutionMember: {
+ D.Out(pdExcept, "Throwing e_FederateNotExecutionMember
exception.");
+ throw
RTI::FederateNotExecutionMember(msg->getExceptionReason());
+ } break ;
+
+ case e_FederateNotPaused: {
+ D.Out(pdExcept, "Throwing e_FederateNotPaused exception.");
+ throw RTI::RTIinternalError(msg->getExceptionReason());
+ } break ;
+
+ case e_FederateOwnsAttributes: {
+ D.Out(pdExcept, "Throwing e_FederateOwnsAttributes exception.");
+ throw RTI::FederateOwnsAttributes(msg->getExceptionReason());
+ } break ;
+
+ case e_FederatesCurrentlyJoined: {
+ D.Out(pdExcept, "Throwing e_FederatesCurrentlyJoined
exception.");
+ throw RTI::FederatesCurrentlyJoined(msg->getExceptionReason());
+ } break ;
+
+ case e_FederateWasNotAskedToReleaseAttribute: {
+ D.Out(pdExcept,
+ "Throwing
e_FederateWasNotAskedToReleaseAttribute exception.");
+ D.Out(pdDebug,
+ "Throwing
e_FederateWasNotAskedToReleaseAttribute exception.");
+ throw
RTI::FederateWasNotAskedToReleaseAttribute(msg->getExceptionReason());
+ } break ;
+
+ case e_FederationAlreadyPaused: {
+ D.Out(pdExcept, "Throwing e_FederationAlreadyPaused
exception.");
+ throw RTI::RTIinternalError(msg->getExceptionReason());
+ } break ;
+
+ case e_FederationExecutionAlreadyExists: {
+ D.Out(pdExcept, "Throwing e_FederationExecutionAlreadyExists
excep.");
+ throw
RTI::FederationExecutionAlreadyExists(msg->getExceptionReason());
+ } break ;
+
+ case e_FederationExecutionDoesNotExist: {
+ D.Out(pdExcept, "Throwing e_FederationExecutionDoesNotExist
except.");
+ throw
RTI::FederationExecutionDoesNotExist(msg->getExceptionReason());
+ } break ;
+
+ case e_FederationNotPaused: {
+ D.Out(pdExcept, "Throwing e_FederationNotPaused exception.");
+ throw RTI::RTIinternalError(msg->getExceptionReason());
+ } break ;
+
+ case e_FederationTimeAlreadyPassed: {
+ D.Out(pdExcept, "Throwing e_FederationTimeAlreadyPassed
exception.");
+ throw
RTI::FederationTimeAlreadyPassed(msg->getExceptionReason());
+ } break ;
+
+ case e_FederateNotPublishing: {
+ D.Out(pdExcept, "Throwing e_FederateNotPublishing exception.");
+ throw RTI::RTIinternalError(msg->getExceptionReason());
+ } break ;
+
+ case e_FederateNotSubscribing: {
+ D.Out(pdExcept, "Throwing e_FederateNotSubscribing exception.");
+ throw RTI::RTIinternalError(msg->getExceptionReason());
+ } break ;
+
+ case e_RegionNotKnown: {
+ D.Out(pdExcept, "Throwing e_RegionNotKnown exception.");
+ throw RTI::RegionNotKnown(msg->getExceptionReason());
+ } break ;
+
+ case e_IDsupplyExhausted: {
+ D.Out(pdExcept, "Throwing e_IDsupplyExhausted exception.");
+ throw RTI::RTIinternalError(msg->getExceptionReason());
+ } break ;
+
+ case e_InteractionClassNotDefined: {
+ D.Out(pdExcept, "Throwing e_InteractionClassNotDefined
exception.");
+ throw
RTI::InteractionClassNotDefined(msg->getExceptionReason());
+ } break ;
+
+ case e_InteractionClassNotKnown: {
+ D.Out(pdExcept, "Throwing e_InteractionClassNotKnown
exception.");
+ throw RTI::InteractionClassNotKnown(msg->getExceptionReason());
+ } break ;
+
+ case e_InteractionClassNotPublished: {
+ D.Out(pdExcept, "Throwing e_InteractionClassNotPublished
exception.");
+ throw
RTI::InteractionClassNotPublished(msg->getExceptionReason());
+ } break ;
+
+ case e_InteractionParameterNotDefined: {
+ D.Out(pdExcept,
+ "Throwing e_InteractionParameterNotDefined
exception.");
+ throw
RTI::InteractionParameterNotDefined(msg->getExceptionReason());
+ } break ;
+
+ case e_InteractionParameterNotKnown: {
+ D.Out(pdExcept, "Throwing e_InteractionParameterNotKnown
exception.");
+ throw
RTI::InteractionParameterNotKnown(msg->getExceptionReason());
+ } break ;
+
+ case e_InvalidDivestitureCondition: {
+ D.Out(pdExcept, "Throwing e_InvalidDivestitureCondition
exception.");
+ throw RTI::RTIinternalError(msg->getExceptionReason());
+ } break ;
+
+ case e_InvalidExtents: {
+ D.Out(pdExcept, "Throwing e_InvalidExtents exception.");
+ throw RTI::InvalidExtents(msg->getExceptionReason());
+ } break ;
+
+ case e_InvalidFederationTime: {
+ D.Out(pdExcept, "Throwing e_InvalidFederationTime exception.");
+ throw RTI::InvalidFederationTime(msg->getExceptionReason());
+ } break ;
+
+ case e_InvalidFederationTimeDelta: {
+ D.Out(pdExcept, "Throwing e_InvalidFederationTimeDelta
exception.");
+ throw RTI::RTIinternalError(msg->getExceptionReason());
+ } break ;
+
+ case e_InvalidLookahead: {
+ D.Out(pdExcept, "Throwing e_InvalidLookahead.");
+ throw RTI::InvalidLookahead(msg->getExceptionReason());
+ } break ;
+
+ case e_InvalidObjectHandle: {
+ D.Out(pdExcept, "Throwing e_InvalidObjectHandle exception.");
+ throw RTI::RTIinternalError(msg->getExceptionReason());
+ } break ;
+
+ case e_InvalidOrderingHandle: {
+ D.Out(pdExcept, "Throwing e_InvalidOrderingHandle exception.");
+ throw RTI::InvalidOrderingHandle(msg->getExceptionReason());
+ } break ;
+
+ case e_InvalidResignAction: {
+ D.Out(pdExcept, "Throwing e_InvalidResignAction exception.");
+ throw RTI::InvalidResignAction(msg->getExceptionReason());
+ } break ;
+
+ case e_InvalidRetractionHandle: {
+ D.Out(pdExcept, "Throwing e_InvalidRetractionHandle
exception.");
+ throw RTI::InvalidRetractionHandle(msg->getExceptionReason());
+ } break ;
+
+ case e_InvalidRoutingSpace: {
+ D.Out(pdExcept, "Throwing e_InvalidRoutingSpace exception.");
+ throw RTI::RTIinternalError(msg->getExceptionReason());
+ } break ;
+
+ case e_InvalidTransportationHandle: {
+ D.Out(pdExcept, "Throwing e_InvalidTransportationHandle
exception.");
+ throw
RTI::InvalidTransportationHandle(msg->getExceptionReason());
+ } break ;
+
+ case e_MemoryExhausted: {
+ D.Out(pdExcept, "Throwing e_MemoryExhausted exception.");
+ throw RTI::MemoryExhausted(msg->getExceptionReason());
+ } break ;
+
+ case e_NameNotFound: {
+ D.Out(pdExcept, "Throwing e_NameNotFound exception.");
+ throw RTI::NameNotFound(msg->getExceptionReason());
+ } break ;
+
+ case e_NoPauseRequested: {
+ D.Out(pdExcept, "Throwing e_NoPauseRequested exception.");
+ throw RTI::RTIinternalError(msg->getExceptionReason());
+ } break ;
+
+ case e_NoResumeRequested: {
+ D.Out(pdExcept, "Throwing e_NoResumeRequested exception.");
+ throw RTI::RTIinternalError(msg->getExceptionReason());
+ } break ;
+
+ case e_ObjectClassNotDefined: {
+ D.Out(pdExcept, "Throwing e_ObjectClassNotDefined exception.");
+ throw RTI::ObjectClassNotDefined(msg->getExceptionReason());
+ } break ;
+
+ case e_ObjectClassNotKnown: {
+ D.Out(pdExcept, "Throwing e_ObjectClassNotKnown exception.");
+ throw RTI::ObjectClassNotKnown(msg->getExceptionReason());
+ } break ;
+
+ case e_ObjectClassNotPublished: {
+ D.Out(pdExcept, "Throwing e_ObjectClassNotPublished
exception.");
+ throw RTI::ObjectClassNotPublished(msg->getExceptionReason());
+ } break ;
+
+ case e_ObjectClassNotSubscribed: {
+ D.Out(pdExcept, "Throwing e_ObjectClassNotSubscribed
exception.");
+ throw RTI::ObjectClassNotSubscribed(msg->getExceptionReason());
+ } break ;
+
+ case e_ObjectNotKnown: {
+ D.Out(pdExcept, "Throwing e_ObjectNotKnown exception.");
+ throw RTI::ObjectNotKnown(msg->getExceptionReason());
+ } break ;
+
+ case e_ObjectAlreadyRegistered: {
+ D.Out(pdExcept, "Throwing e_ObjectAlreadyRegistered
exception.");
+ throw RTI::ObjectAlreadyRegistered(msg->getExceptionReason());
+ } break ;
+
+ case e_RestoreInProgress: {
+ D.Out(pdExcept, "Throwing e_RestoreInProgress exception.");
+ throw RTI::RestoreInProgress(msg->getExceptionReason());
+ } break ;
+
+ case e_RestoreNotRequested: {
+ D.Out(pdExcept, "Throwing e_RestoreNotRequested exception.");
+ throw RTI::RestoreNotRequested(msg->getExceptionReason());
+ } break ;
+
+ case e_RTIinternalError: {
+ D.Out(pdExcept, "Throwing e_RTIinternalError exception.");
+ throw RTI::RTIinternalError(msg->getExceptionReason());
+ } break ;
+
+ case e_SpaceNotDefined: {
+ D.Out(pdExcept, "Throwing e_SpaceNotDefined exception.");
+ throw RTI::SpaceNotDefined(msg->getExceptionReason());
+ } break ;
+
+ case e_SaveInProgress: {
+ D.Out(pdExcept, "Throwing e_SaveInProgress exception.");
+ throw RTI::SaveInProgress(msg->getExceptionReason());
+ } break ;
+
+ case e_SaveNotInitiated: {
+ D.Out(pdExcept, "Throwing e_SaveNotInitiated exception.");
+ throw RTI::SaveNotInitiated(msg->getExceptionReason());
+ } break ;
+
+ case e_SecurityError: {
+ D.Out(pdExcept, "Throwing e_SecurityError exception.");
+ throw RTI::RTIinternalError(msg->getExceptionReason());
+ } break ;
+
+ case e_SpecifiedSaveLabelDoesNotExist: {
+ D.Out(pdExcept,
+ "Throwing e_SpecifiedSaveLabelDoesNotExist
exception.");
+ throw
RTI::SpecifiedSaveLabelDoesNotExist(msg->getExceptionReason());
+ } break ;
+
+ case e_TimeAdvanceAlreadyInProgress: {
+ D.Out(pdExcept, "Throwing e_TimeAdvanceAlreadyInProgress
exception.");
+ throw
RTI::TimeAdvanceAlreadyInProgress(msg->getExceptionReason());
+ } break ;
+
+ case e_TimeAdvanceWasNotInProgress: {
+ D.Out(pdExcept, "Throwing e_TimeAdvanceWasNotInProgress
exception.");
+ throw
RTI::TimeAdvanceWasNotInProgress(msg->getExceptionReason());
+ } break ;
+
+ case e_TooManyIDsRequested: {
+ D.Out(pdExcept, "Throwing e_TooManyIDsRequested exception.");
+ throw RTI::RTIinternalError(msg->getExceptionReason());
+ } break ;
+
+ case e_UnableToPerformSave: {
+ D.Out(pdExcept, "Throwing e_UnableToPerformSave exception.");
+ throw RTI::UnableToPerformSave(msg->getExceptionReason());
+ } break ;
+
+ case e_UnimplementedService: {
+ D.Out(pdExcept, "Throwing e_UnimplementedService exception.");
+ throw RTI::RTIinternalError(msg->getExceptionReason());
+ } break ;
+
+ case e_UnknownLabel: {
+ D.Out(pdExcept, "Throwing e_UnknownLabel exception.");
+ throw RTI::RTIinternalError(msg->getExceptionReason());
+ } break ;
+
+ case e_ValueCountExceeded: {
+ D.Out(pdExcept, "Throwing e_ValueCountExceeded exception.");
+ throw RTI::ValueCountExceeded(msg->getExceptionReason());
+ } break ;
+
+ case e_ValueLengthExceeded: {
+ D.Out(pdExcept, "Throwing e_ValueLengthExceeded exception.");
+ throw RTI::ValueLengthExceeded(msg->getExceptionReason());
+ } break ;
+
+ default: {
+ D.Out(pdExcept, "Throwing unknown exception !");
+ std::cout << "LibRTI: Receiving unknown RTI exception." <<
std::endl;
+ throw RTI::RTIinternalError(msg->getExceptionReason());
+ } break ;
+ }
+}
+
+#define CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(service) \
+ catch (RTI::Exception &e) { \
+ std::stringstream msg; \
+ msg << "Error in " << service << ": " << e._name << "["
<< e._reason << "]"; \
+ throw RTI::RTIinternalError(msg.str().c_str()); \
+ }
+
+void
+RTIambPrivateRefs::callFederateAmbassador(Message *msg)
+throw (RTI::RTIinternalError)
+{
+ switch (msg->getMessageType()) {
+
+ case Message::SYNCHRONIZATION_POINT_REGISTRATION_SUCCEEDED:
+ try {
+
fed_amb->synchronizationPointRegistrationSucceeded((msg->getLabel()).c_str());
+ }
+
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("synchronizationPointRegistrationSucceeded")
+ break ;
+
+ case Message::SYNCHRONIZATION_POINT_REGISTRATION_FAILED:
+ try {
+
fed_amb->synchronizationPointRegistrationFailed((msg->getLabel()).c_str());
+ }
+
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("synchronizationPointRegistrationFailed")
+ break ;
+
+ case Message::ANNOUNCE_SYNCHRONIZATION_POINT:
+ try {
+
fed_amb->announceSynchronizationPoint((msg->getLabel()).c_str(),(msg->getTag()).c_str());
+ }
+
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("announceSynchronizationPoint")
+ break ;
+
+ case Message::FEDERATION_SYNCHRONIZED:
+ try {
+
fed_amb->federationSynchronized((msg->getLabel()).c_str());
+ }
+ CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("federationSynchronized")
+ break ;
+
+ case Message::INITIATE_FEDERATE_SAVE:
+ try {
+
fed_amb->initiateFederateSave((msg->getLabel()).c_str());
+ }
+ CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("initiateFederateSave")
+ break ;
+
+ case Message::FEDERATION_SAVED:
+ try {
+ fed_amb->federationSaved();
+ }
+ CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("federationSaved")
+ break ;
+
+ case Message::REQUEST_FEDERATION_RESTORE_SUCCEEDED:
+ try {
+ fed_amb->requestFederationRestoreSucceeded(
+ (msg->getLabel()).c_str());
+ }
+
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("requestFederationRestoreSucceeded")
+ break ;
+
+ case Message::REQUEST_FEDERATION_RESTORE_FAILED:
+ try {
+
fed_amb->requestFederationRestoreFailed((msg->getLabel()).c_str(),
+ (msg->getTag()).c_str());
+ }
+
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("requestFederationRestoreFailed")
+ break ;
+
+ case Message::FEDERATION_RESTORE_BEGUN:
+ try {
+ fed_amb->federationRestoreBegun();
+ }
+ CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("federationRestoreBegun")
+ break ;
+
+ case Message::INITIATE_FEDERATE_RESTORE:
+ try {
+ M_Initiate_Federate_Restore *IFR =
static_cast<M_Initiate_Federate_Restore *>(msg);
+
fed_amb->initiateFederateRestore((IFR->getLabel()).c_str(),
+ IFR->getFederate());
+ }
+ CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("initiateFederateRestore")
+ break ;
+
+ case Message::FEDERATION_RESTORED:
+ try {
+ fed_amb->federationRestored();
+ }
+ CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("federationRestored")
+ break ;
+
+ case Message::FEDERATION_NOT_RESTORED:
+ try {
+ fed_amb->federationNotRestored();
+ }
+ CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("federationNotRestored")
+ break ;
+
+ case Message::START_REGISTRATION_FOR_OBJECT_CLASS:
+ try {
+
fed_amb->startRegistrationForObjectClass(static_cast<M_Start_Registration_For_Object_Class
*>(msg)->getObjectClass());
+ }
+
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("startRegistrationForObjectClass")
+ break ;
+
+ case Message::STOP_REGISTRATION_FOR_OBJECT_CLASS:
+ try {
+
fed_amb->stopRegistrationForObjectClass(static_cast<M_Stop_Registration_For_Object_Class
*>(msg)->getObjectClass());
+ }
+
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("stopRegistrationForObjectClass")
+ break ;
+
+ case Message::TURN_INTERACTIONS_ON:
+ try {
+
fed_amb->turnInteractionsOn(static_cast<M_Turn_Interactions_On
*>(msg)->getInteractionClass());
+ }
+ CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("turnInteractionsOn")
+ break ;
+
+ case Message::TURN_INTERACTIONS_OFF:
+ try {
+
fed_amb->turnInteractionsOff(static_cast<M_Turn_Interactions_Off
*>(msg)->getInteractionClass());
+ }
+ CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("turnInteractionsOff")
+ break ;
+
+ case Message::DISCOVER_OBJECT_INSTANCE:
+ try {
+ M_Discover_Object_Instance* DOI =
static_cast<M_Discover_Object_Instance *>(msg);
+ fed_amb->discoverObjectInstance(DOI->getObject(),
+ DOI->getObjectClass(),
+ DOI->getObjectName().c_str());
+ }
+ CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("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");
+ RTI::AttributeHandleValuePairSet *attributes =
+ new
AttributeHandleValuePairSetImp(getAHVPSFromRequest(RAV));
+
+ if (msg->isDated()) {
+ RTI::EventRetractionHandle event;
+ event.theSerialNumber =
RAV->getEventRetraction().getSN();
+ event.sendingFederate =
RAV->getEventRetraction().getSendingFederate();
+
fed_amb->reflectAttributeValues(RAV->getObject(),
+ *attributes,
+
RTIfedTime(msg->getDate().getTime()),
+ (msg->getTag()).c_str(),
+ event);
+ }
+ else {
+
fed_amb->reflectAttributeValues(RAV->getObject(),
+ *attributes,
+ (msg->getTag()).c_str());
+ }
+ delete attributes ;
+ }
+ CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("reflectAttributeValues")
+ break ;
+
+ case Message::RECEIVE_INTERACTION:
+ try {
+ M_Receive_Interaction* RI =
static_cast<M_Receive_Interaction *>(msg);
+ RTI::ParameterHandleValuePairSet *parameters =
+ new
ParameterHandleValuePairSetImp(getPHVPSFromRequest(RI));
+
+ if (msg->isDated()) {
+ RTI::EventRetractionHandle event;
+ event.theSerialNumber =
RI->getEventRetraction().getSN();
+ event.sendingFederate =
RI->getEventRetraction().getSendingFederate();
+ fed_amb->receiveInteraction(
+ RI->getInteractionClass(),
+ *parameters,
+
RTIfedTime(msg->getDate().getTime()),
+ (msg->getTag()).c_str(),
+ event);
+ }
+ else {
+ fed_amb->receiveInteraction(
+ RI->getInteractionClass(),
+ *parameters,
+ (msg->getTag()).c_str());
+ }
+ delete parameters ;
+ }
+ CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("receiveInteraction")
+ break ;
+
+ case Message::REMOVE_OBJECT_INSTANCE:
+ try {
+ M_Remove_Object_Instance* ROI =
static_cast<M_Remove_Object_Instance *>(msg);
+ RTI::EventRetractionHandle event;
+ event.theSerialNumber =
ROI->getEventRetraction().getSN();
+ event.sendingFederate =
ROI->getEventRetraction().getSendingFederate();
+ if (msg->isDated()) {
+ fed_amb->removeObjectInstance(
+ ROI->getObject(),
+
RTIfedTime(msg->getDate().getTime()),
+ (msg->getTag()).c_str(),
+ event);
+ }
+ else {
+ fed_amb->removeObjectInstance(
+ ROI->getObject(),
+ (msg->getTag()).c_str());
+ }
+ }
+ CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("removeObjectInstance")
+ break ;
+
+ case Message::PROVIDE_ATTRIBUTE_VALUE_UPDATE:
+ try {
+ M_Provide_Attribute_Value_Update* PAVU =
static_cast<M_Provide_Attribute_Value_Update *>(msg);
+ std::auto_ptr<RTI::AttributeHandleSet> attributeSet(
+ new
AttributeHandleSetImp(PAVU->getAttributes()));
+
+
fed_amb->provideAttributeValueUpdate(PAVU->getObject(),*attributeSet);
+ }
+
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("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);
+ RTI::AttributeHandleSet *attributeSet =
+ new
AttributeHandleSetImp(RAOA->getAttributes());
+
+ fed_amb->
+ requestAttributeOwnershipAssumption(RAOA->getObject(),
+ *attributeSet,
+ (msg->getTag()).c_str());
+ delete attributeSet ;
+ }
+
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("requestAttributeOwnershipAssumption")
+ break ;
+
+ case Message::REQUEST_ATTRIBUTE_OWNERSHIP_RELEASE:
+ try {
+ M_Request_Attribute_Ownership_Release* RAOR =
static_cast<M_Request_Attribute_Ownership_Release *>(msg);
+ RTI::AttributeHandleSet *attributeSet =
+ new
AttributeHandleSetImp(RAOR->getAttributes());
+
+ fed_amb->requestAttributeOwnershipRelease(
+ RAOR->getObject(),
+ *attributeSet,
+ (msg->getTag()).c_str());
+
+ delete attributeSet ;
+ }
+
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("requestAttributeOwnershipRelease")
+ break ;
+
+ case Message::ATTRIBUTE_OWNERSHIP_UNAVAILABLE:
+ try {
+ M_Attribute_Ownership_Unavailable* AOU =
static_cast<M_Attribute_Ownership_Unavailable *>(msg);
+ RTI::AttributeHandleSet *attributeSet =
+ new
AttributeHandleSetImp(AOU->getAttributes());
+
+ fed_amb->attributeOwnershipUnavailable(AOU->getObject(),
+ *attributeSet);
+
+ delete attributeSet ;
+ }
+
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("attributeOwnershipUnavailable")
+ break ;
+
+ case Message::ATTRIBUTE_OWNERSHIP_ACQUISITION_NOTIFICATION:
+ try {
+ M_Attribute_Ownership_Acquisition_Notification* AOAN =
static_cast<M_Attribute_Ownership_Acquisition_Notification *>(msg);
+ RTI::AttributeHandleSet *attributeSet =
+ new
AttributeHandleSetImp(AOAN->getAttributes());
+
+ fed_amb->attributeOwnershipAcquisitionNotification(
+ AOAN->getObject(),
+ *attributeSet);
+
+ delete attributeSet ;
+ }
+
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("attributeOwnershipAcquisitionNotification")
+ break ;
+
+ case Message::ATTRIBUTE_OWNERSHIP_DIVESTITURE_NOTIFICATION:
+ try {
+ M_Attribute_Ownership_Divestiture_Notification* AODN =
static_cast<M_Attribute_Ownership_Divestiture_Notification *>(msg);
+ RTI::AttributeHandleSet *attributeSet =
+ new
AttributeHandleSetImp(AODN->getAttributes());
+
+ fed_amb->attributeOwnershipDivestitureNotification(
+ AODN->getObject(),
+ *attributeSet);
+
+ delete attributeSet ;
+ }
+
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("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);
+ RTI::AttributeHandleSet *attributeSet =
+ new
AttributeHandleSetImp(CAOAC->getAttributes());
+
+
fed_amb->confirmAttributeOwnershipAcquisitionCancellation(
+ CAOAC->getObject(),
+ *attributeSet);
+
+ delete attributeSet ;
+ }
+
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("confirmAttributeOwnershipAcquisitionCancellation")
+ break ;
+
+ case Message::INFORM_ATTRIBUTE_OWNERSHIP:
+ try {
+ M_Inform_Attribute_Ownership* IAO =
static_cast<M_Inform_Attribute_Ownership *>(msg);
+ fed_amb->
+ informAttributeOwnership(IAO->getObject(),
+ IAO->getAttribute(),
+ IAO->getFederate());
+ }
+ CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("informAttributeOwnership")
+ break ;
+
+ case Message::ATTRIBUTE_IS_NOT_OWNED:
+ try {
+ M_Attribute_Is_Not_Owned* AINO =
static_cast<M_Attribute_Is_Not_Owned *>(msg);
+ fed_amb->attributeIsNotOwned(AINO->getObject(),
+ AINO->getAttribute());
+ }
+ CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("attributeIsNotOwned")
+ break ;
+
+ case Message::TIME_ADVANCE_GRANT:
+ try {
+
fed_amb->timeAdvanceGrant(RTIfedTime(msg->getDate().getTime()));
+ }
+ CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("timeAdvanceGrant")
+ break ;
+
+ case Message::TIME_REGULATION_ENABLED:
+ try {
+
fed_amb->timeRegulationEnabled(RTIfedTime(msg->getDate().getTime()));
+ }
+ CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("timeRegulationEnabled")
+ break ;
+
+ case Message::TIME_CONSTRAINED_ENABLED:
+ try {
+
fed_amb->timeConstrainedEnabled(RTIfedTime(msg->getDate().getTime()));
+ }
+ CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("timeConstrainedEnabled")
+ break ;
+
+ default:
+ leave("RTI service requested by RTI is unknown.");
+ }
+}
+
+// $Id: RTIambPrivateRefs.cc,v 1.1 2014/03/03 15:18:24 erk Exp $
Index: hla-1_3/RTIfedTime.cc
===================================================================
RCS file: hla-1_3/RTIfedTime.cc
diff -N hla-1_3/RTIfedTime.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ hla-1_3/RTIfedTime.cc 3 Mar 2014 15:18:24 -0000 1.1
@@ -0,0 +1,515 @@
+// ----------------------------------------------------------------------------
+// CERTI - HLA RunTime Infrastructure
+// Copyright (C) 2002-2006 ONERA
+//
+// This file is part of CERTI-libCERTI
+//
+// CERTI-libCERTI 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-libCERTI 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 <math.h>
+
+#include "certi.hh"
+#include "fedtime.hh"
+#include "FedTimeD.hh"
+
+#include <algorithm>
+#include <limits>
+#include <sstream>
+#include <typeinfo>
+
+using std::stringstream ;
+
+namespace
+{
+
+// ----------------------------------------------------------------------------
+/** FedTime to RTIfedTime reference cast
+ */
+inline const RTIfedTime &
+rft(const RTI::FedTime &time)
+ throw (RTI::InvalidFederationTime)
+{
+ try {
+ return dynamic_cast<const RTIfedTime &>(time);
+ }
+ catch (std::bad_cast) {
+ //throw RTI::InvalidFederationTime("Could not cast to RTIfedTime");
+ }
+}
+
+inline bool
+is_infinity(const RTI::FedTime &time)
+{
+ return const_cast<RTI::FedTime &>(time).isPositiveInfinity() ==
RTI::RTI_TRUE ;
+}
+
+const char *infinity_str = "+inf" ;
+
+} // anonymous namespace
+
+// ----------------------------------------------------------------------------
+// FedTimeFactory
+RTI::FedTime *
+RTI::FedTimeFactory::makeZero()
+ throw (RTI::MemoryExhausted)
+{
+ try {
+ return new RTIfedTime();
+ }
+ catch (std::bad_alloc) {
+ //throw RTI::MemoryExhausted("Cannot allocate RTI::FedTime.");
+ }
+}
+
+RTI::FedTime *
+RTI::FedTimeFactory::decode(const char *buf)
+ throw (RTI::MemoryExhausted)
+{
+ union ud {
+ double dv;
+ uint64_t uv;
+ } value;
+ try {
+ value.uv = CERTI_DECODE_DOUBLE_FROM_UINT64BE(buf);
+ return new RTIfedTime(value.dv);
+ }
+ catch (std::bad_alloc) {
+ //throw RTI::MemoryExhausted("Cannot allocate RTI::FedTime.");
+ }
+}
+
+// ----------------------------------------------------------------------------
+// RTIfedTime
+RTIfedTime::RTIfedTime()
+ : _fedTime(0),
+ _zero(0),
+ _epsilon(std::numeric_limits<double>::epsilon()),
+ _positiveInfinity(std::numeric_limits<double>::infinity()) { }
+
+RTIfedTime::RTIfedTime(const RTI::Double &time)
+ : _fedTime(time),
+ _zero(0),
+ _epsilon(std::numeric_limits<double>::epsilon()),
+ _positiveInfinity(std::numeric_limits<double>::infinity()) { }
+
+RTIfedTime::RTIfedTime(const RTI::FedTime &time)
+ : _fedTime(rft(time).getTime()),
+ _zero(0),
+ _epsilon(std::numeric_limits<double>::epsilon()),
+ _positiveInfinity(std::numeric_limits<double>::infinity()) { }
+
+// ----------------------------------------------------------------------------
+RTIfedTime::RTIfedTime(const RTIfedTime &time)
+ : FedTime(),
+ _fedTime(time._fedTime),
+ _zero(time._zero),
+ _epsilon(time._epsilon),
+ _positiveInfinity(time._positiveInfinity) { }
+
+// ----------------------------------------------------------------------------
+RTIfedTime::~RTIfedTime()
+{
+}
+
+// ----------------------------------------------------------------------------
+void
+RTIfedTime::setZero()
+{
+ _fedTime = _zero;
+}
+
+// ----------------------------------------------------------------------------
+RTI::Boolean
+RTIfedTime::isZero()
+{
+ return RTI::Boolean(_fedTime == _zero);
+}
+
+// ----------------------------------------------------------------------------
+void
+RTIfedTime::setEpsilon()
+{
+ _fedTime = _epsilon;
+}
+
+// ----------------------------------------------------------------------------
+void
+RTIfedTime::setPositiveInfinity()
+{
+ _fedTime = _positiveInfinity;
+}
+
+// ----------------------------------------------------------------------------
+RTI::Boolean
+RTIfedTime::isPositiveInfinity()
+{
+ return RTI::Boolean(_fedTime == _positiveInfinity);
+}
+
+// ----------------------------------------------------------------------------
+int
+RTIfedTime::encodedLength() const
+{
+ // current implementation of RTIfedtime takes
+ // four IEEE-754 double values:
+ // _fedTime
+ // _zero
+ // _epsilon
+ // _positiveInfinity
+ // but we only transmit _fedTime because other value will
+ // be reconstructed autonomously
+ return (sizeof(double));
+}
+
+// ----------------------------------------------------------------------------
+void
+RTIfedTime::encode(char *buffer) const
+{
+#ifdef HOST_IS_BIG_ENDIAN
+ memcpy(buffer, &_fedTime, sizeof(double));
+#else
+ uint64_t value;
+ value = CERTI_ENCODE_DOUBLE_TO_UINT64BE(&_fedTime);
+ memcpy(buffer,&value,sizeof(double));
+#endif
+}
+
+// ----------------------------------------------------------------------------
+int
+RTIfedTime::getPrintableLength() const
+{
+ stringstream s ;
+
+ if (is_infinity(*this))
+ s << infinity_str ;
+ else
+ s << _fedTime ;
+
+ return s.str().length() + 1 ;
+}
+
+// ----------------------------------------------------------------------------
+void
+RTIfedTime::getPrintableString(char *str)
+{
+ stringstream s ;
+
+ if (is_infinity(*this))
+ s << infinity_str ;
+ else
+ s << _fedTime ;
+
+ s >> str ;
+ str[s.str().length()] = 0 ;
+}
+
+// ----------------------------------------------------------------------------
+RTI::FedTime &
+RTIfedTime::operator+=(const RTI::FedTime &time)
+ throw (RTI::InvalidFederationTime)
+{
+ _fedTime += rft(time)._fedTime ;
+ return *this;
+}
+
+// ----------------------------------------------------------------------------
+RTI::FedTime &
+RTIfedTime::operator-=(const RTI::FedTime &time)
+ throw (RTI::InvalidFederationTime)
+{
+ _fedTime -= rft(time)._fedTime ;
+ return *this;
+}
+
+// ----------------------------------------------------------------------------
+RTI::Boolean
+RTIfedTime::operator<=(const RTI::FedTime &time) const
+ throw (RTI::InvalidFederationTime)
+{
+ if (const_cast<RTI::FedTime &>(time).isPositiveInfinity())
+ return RTI::RTI_TRUE ;
+ else if (is_infinity(*this))
+ return RTI::RTI_FALSE ;
+ else
+ return RTI::Boolean(certi::fcmp(_fedTime, rft(time)._fedTime, _epsilon)
<= 0);
+}
+
+// ----------------------------------------------------------------------------
+RTI::Boolean
+RTIfedTime::operator<(const RTI::FedTime &time) const
+ throw (RTI::InvalidFederationTime)
+{
+ if (is_infinity(*this))
+ return RTI::RTI_FALSE ;
+ else
+ return RTI::Boolean(is_infinity(time) || certi::fcmp(_fedTime,
rft(time)._fedTime, _epsilon) < 0);
+}
+
+// ----------------------------------------------------------------------------
+RTI::Boolean
+RTIfedTime::operator>=(const RTI::FedTime &time) const
+ throw (RTI::InvalidFederationTime)
+{
+ if (is_infinity(*this))
+ return RTI::RTI_TRUE ;
+ else if (is_infinity(time))
+ return RTI::RTI_FALSE ;
+ else
+ return RTI::Boolean(certi::fcmp(_fedTime, rft(time)._fedTime, _epsilon)
>= 0);
+}
+
+// ----------------------------------------------------------------------------
+RTI::Boolean
+RTIfedTime::operator>(const RTI::FedTime &time) const
+ throw (RTI::InvalidFederationTime)
+{
+ if (is_infinity(time))
+ return RTI::RTI_FALSE ;
+ else
+ return RTI::Boolean(is_infinity(*this) || certi::fcmp(_fedTime,
rft(time)._fedTime, _epsilon) > 0);
+}
+
+// ----------------------------------------------------------------------------
+inline RTI::Boolean
+RTIfedTime::operator==(const RTI::FedTime &time) const
+ throw (RTI::InvalidFederationTime)
+{
+ if (is_infinity(*this) && is_infinity(time))
+ return RTI::RTI_TRUE ;
+ else if (is_infinity(*this) || is_infinity(time))
+ return RTI::RTI_FALSE ;
+ else
+ return RTI::Boolean(certi::fcmp(_fedTime, rft(time)._fedTime, _epsilon)
== 0);
+}
+
+// ----------------------------------------------------------------------------
+RTI::FedTime &
+RTIfedTime::operator=(const RTI::FedTime &time)
+ throw (RTI::InvalidFederationTime)
+{
+ _fedTime = rft(time)._fedTime ;
+ return *this ;
+}
+
+// ----------------------------------------------------------------------------
+RTI::Double
+RTIfedTime::getTime() const
+{
+ return _fedTime ;
+}
+
+// ----------------------------------------------------------------------------
+RTI::Boolean
+RTIfedTime::operator==(const RTI::Double &time) const
+ throw (RTI::InvalidFederationTime)
+{
+ return RTI::Boolean(!is_infinity(*this) && certi::fcmp(_fedTime, time,
_epsilon) == 0);
+}
+
+// ----------------------------------------------------------------------------
+RTI::Boolean
+RTIfedTime::operator!=(const RTI::FedTime &time) const
+ throw (RTI::InvalidFederationTime)
+{
+ return RTI::Boolean(certi::fcmp(_fedTime, rft(time)._fedTime, _epsilon) !=
0);
+}
+
+// ----------------------------------------------------------------------------
+RTI::Boolean
+RTIfedTime::operator!=(const RTI::Double &time) const
+ throw (RTI::InvalidFederationTime)
+{
+ return RTI::Boolean(is_infinity(*this) || certi::fcmp(_fedTime, time,
_epsilon) != 0);
+}
+
+// ----------------------------------------------------------------------------
+RTI::FedTime &
+RTIfedTime::operator=(const RTIfedTime &time)
+ throw (RTI::InvalidFederationTime)
+{
+ _fedTime = time._fedTime ;
+ return *this ;
+}
+
+// ----------------------------------------------------------------------------
+RTI::FedTime &
+RTIfedTime::operator=(const RTI::Double &time)
+ throw (RTI::InvalidFederationTime)
+{
+ _fedTime = time ;
+ return *this ;
+}
+
+RTI::FedTime &
+RTIfedTime::operator*=(const RTI::FedTime &time)
+ throw (RTI::InvalidFederationTime)
+{
+ _fedTime *= rft(time)._fedTime ;
+ return *this ;
+}
+
+RTI::FedTime &
+RTIfedTime::operator/=(const RTI::FedTime &time)
+ throw (RTI::InvalidFederationTime)
+{
+ _fedTime /= rft(time)._fedTime ;
+ return *this ;
+}
+
+RTI::FedTime &
+RTIfedTime::operator+=(const RTI::Double &time)
+ throw (RTI::InvalidFederationTime)
+{
+ _fedTime += time ;
+ return *this ;
+}
+
+RTI::FedTime &
+RTIfedTime::operator-=(const RTI::Double &time)
+ throw (RTI::InvalidFederationTime)
+{
+ _fedTime -= time ;
+ return *this ;
+}
+
+RTI::FedTime &
+RTIfedTime::operator*=(const RTI::Double &time)
+ throw (RTI::InvalidFederationTime)
+{
+ _fedTime *= time ;
+ return *this ;
+}
+
+RTI::FedTime &
+RTIfedTime::operator/=(const RTI::Double &time)
+ throw (RTI::InvalidFederationTime)
+{
+ _fedTime /= time ;
+ return *this ;
+}
+
+// ----------------------------------------------------------------------------
+RTIfedTime
+RTIfedTime::operator+(const RTI::FedTime &time)
+ throw (RTI::InvalidFederationTime)
+{
+ RTIfedTime fedtime = _fedTime + rft(time)._fedTime ;
+ return fedtime ;
+}
+
+RTIfedTime
+RTIfedTime::operator+(const RTI::Double &time)
+ throw (RTI::InvalidFederationTime)
+{
+ RTIfedTime fedtime = _fedTime + time ;
+ return fedtime ;
+}
+
+// ----------------------------------------------------------------------------
+RTIfedTime
+RTIfedTime::operator-(const RTI::FedTime &time)
+ throw (RTI::InvalidFederationTime)
+{
+ RTIfedTime fedtime = _fedTime - rft(time)._fedTime ;
+ return fedtime ;
+}
+
+RTIfedTime
+RTIfedTime::operator-(const RTI::Double &time)
+ throw (RTI::InvalidFederationTime)
+{
+ RTIfedTime fedtime = _fedTime - time ;
+ return fedtime ;
+}
+
+// ----------------------------------------------------------------------------
+RTIfedTime
+RTIfedTime::operator*(const RTI::FedTime &time)
+ throw (RTI::InvalidFederationTime)
+{
+ RTIfedTime fedtime = _fedTime * rft(time)._fedTime ;
+ return fedtime ;
+}
+
+RTIfedTime
+RTIfedTime::operator*(const RTI::Double &time)
+ throw (RTI::InvalidFederationTime)
+{
+ RTIfedTime fedtime = _fedTime * time ;
+ return fedtime ;
+}
+
+// ----------------------------------------------------------------------------
+RTIfedTime
+RTIfedTime::operator/(const RTI::FedTime &time)
+ throw (RTI::InvalidFederationTime)
+{
+ RTIfedTime fedtime = _fedTime / rft(time)._fedTime ;
+ return fedtime ;
+}
+
+RTIfedTime
+RTIfedTime::operator/(const RTI::Double &time)
+ throw (RTI::InvalidFederationTime)
+{
+ RTIfedTime fedtime = _fedTime / time ;
+ return fedtime ;
+}
+
+// ----------------------------------------------------------------------------
+std::ostream &
+operator<<(std::ostream &s, const RTI::FedTime &time)
+{
+ if (is_infinity(time))
+ s << infinity_str ;
+ else
+ s << rft(time).getTime();
+ return s ;
+}
+
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+RTIfedTime
+operator+(const RTI::Double &d, const RTI::FedTime &time)
+{
+ RTIfedTime fedtime = d + rft(time).getTime();
+ return fedtime ;
+}
+
+// ----------------------------------------------------------------------------
+RTIfedTime
+operator-(const RTI::Double &d, const RTI::FedTime &time)
+{
+ RTIfedTime fedtime = d - rft(time).getTime();
+ return fedtime ;
+}
+
+// ----------------------------------------------------------------------------
+RTIfedTime
+operator*(const RTI::Double &d, const RTI::FedTime &time)
+{
+ RTIfedTime fedtime = d * rft(time).getTime();
+ return fedtime ;
+}
+
+// ----------------------------------------------------------------------------
+RTIfedTime
+operator/(const RTI::Double &d, const RTI::FedTime &time)
+{
+ RTIfedTime fedtime = d / rft(time).getTime();
+ return fedtime ;
+}
Index: hla-1_3/RTItypesImp.cc
===================================================================
RCS file: hla-1_3/RTItypesImp.cc
diff -N hla-1_3/RTItypesImp.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ hla-1_3/RTItypesImp.cc 3 Mar 2014 15:18:24 -0000 1.1
@@ -0,0 +1,572 @@
+// ----------------------------------------------------------------------------
+// CERTI - HLA RunTime Infrastructure
+// Copyright (C) 2002-2006 ONERA
+//
+// This program 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.
+//
+// This program 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: RTItypesImp.cc,v 1.1 2014/03/03 15:18:24 erk Exp $
+// ----------------------------------------------------------------------------
+
+#include "RTItypesImp.hh"
+#include "PrettyDebug.hh"
+
+#include <algorithm>
+#include <string.h>
+
+using namespace certi ;
+
+static PrettyDebug D("LIBRTI", __FILE__);
+static PrettyDebug G("GENDOC",__FILE__);
+
+
+// ----------------------------------------------------------------------------
+AttributeHandleValuePairSetImp::AttributeHandleValuePairSetImp(RTI::ULong size)
+{
+ _order = RECEIVE;
+ _transport = RELIABLE;
+
+ _set.reserve(size);
+}
+
+AttributeHandleValuePairSetImp::AttributeHandleValuePairSetImp(const
std::vector<AttributeHandleValuePair_t> &val)
+ : _set(val)
+{
+ _order = RECEIVE;
+ _transport = RELIABLE;
+}
+
+AttributeHandleValuePairSetImp::~AttributeHandleValuePairSetImp()
+{
+}
+
+RTI::ULong AttributeHandleValuePairSetImp::size() const
+{
+ return _set.size();
+}
+
+RTI::Handle AttributeHandleValuePairSetImp::getHandle(RTI::ULong i) const
+ throw (RTI::ArrayIndexOutOfBounds)
+{
+ if (i < size())
+ return _set[i].first;
+ else
+ throw RTI::ArrayIndexOutOfBounds("");
+}
+
+RTI::ULong AttributeHandleValuePairSetImp::getValueLength(RTI::ULong i) const
+ throw (RTI::ArrayIndexOutOfBounds)
+{
+ if (i < size())
+ return _set[i].second.size();
+ else
+ throw RTI::ArrayIndexOutOfBounds("");
+}
+
+void AttributeHandleValuePairSetImp::getValue(RTI::ULong i, char *buff,
RTI::ULong &len) const
+ throw (RTI::ArrayIndexOutOfBounds)
+{
+ if (i < size()) {
+ const AttributeHandleValuePair_t& item = _set[i];
+ len = item.second.size();
+ memcpy(buff, &(item.second[0]), len);
+ }
+ else
+ throw RTI::ArrayIndexOutOfBounds("");
+}
+
+char *AttributeHandleValuePairSetImp::getValuePointer(RTI::ULong i, RTI::ULong
&len) const
+ throw (RTI::ArrayIndexOutOfBounds)
+{
+ if (i < size()) {
+ const AttributeHandleValuePair_t& item = _set[i];
+ len = item.second.size();
+ return (char *)&(item.second[0]);
+ }
+ else
+ throw RTI::ArrayIndexOutOfBounds("");
+}
+
+RTI::TransportType
AttributeHandleValuePairSetImp::getTransportType(RTI::ULong) const
+ throw (RTI::InvalidHandleValuePairSetContext)
+{
+ return _transport;
+}
+
+RTI::OrderType AttributeHandleValuePairSetImp::getOrderType(RTI::ULong) const
+ throw (RTI::ArrayIndexOutOfBounds, RTI::InvalidHandleValuePairSetContext)
+{
+ return _order;
+}
+
+RTI::Region *AttributeHandleValuePairSetImp::getRegion(RTI::ULong) const
+ throw (RTI::ArrayIndexOutOfBounds, RTI::InvalidHandleValuePairSetContext)
+{
+ throw RTI::RTIinternalError("unimplemented function getRegion()");
+}
+
+void AttributeHandleValuePairSetImp::add(RTI::Handle h, const char *str,
RTI::ULong len)
+ throw (RTI::ValueLengthExceeded, RTI::ValueCountExceeded)
+{
+ std::vector<char> v;
+ v.assign(str,str+len);
+ _set.push_back(AttributeHandleValuePair_t(h, v));
+}
+
+void AttributeHandleValuePairSetImp::remove(RTI::Handle h)
+ throw (RTI::ArrayIndexOutOfBounds)
+{
+ for (std::vector<AttributeHandleValuePair_t>::iterator pos = _set.begin();
+ pos != _set.end(); pos++) {
+ if (pos->first == h) {
+ _set.erase(pos);
+ return;
+ }
+ }
+
+ throw RTI::ArrayIndexOutOfBounds("");
+}
+
+void AttributeHandleValuePairSetImp::moveFrom(const
AttributeHandleValuePairSet &, RTI::ULong &)
+ throw (RTI::ValueCountExceeded, RTI::ArrayIndexOutOfBounds)
+{
+ throw RTI::RTIinternalError("unimplemented function moveFrom()");
+}
+
+void AttributeHandleValuePairSetImp::empty()
+{
+ _set.clear();
+}
+
+RTI::ULong AttributeHandleValuePairSetImp::start() const
+{
+ // not implemented
+ return 0 ;
+}
+
+RTI::ULong AttributeHandleValuePairSetImp::valid(RTI::ULong i) const
+{
+ // not implemented
+ return 0 ;
+}
+
+RTI::ULong AttributeHandleValuePairSetImp::next(RTI::ULong i) const
+{
+ // not implemented
+ return 0 ;
+}
+
+const std::vector<AttributeHandleValuePair_t>&
+AttributeHandleValuePairSetImp::getAttributeHandleValuePairs() const
+{
+ return _set;
+}
+
+// ----------------------------------------------------------------------------
+AttributeHandleSetImp::AttributeHandleSetImp(RTI::ULong size)
+{
+ _set.reserve(size);
+}
+
+AttributeHandleSetImp::AttributeHandleSetImp(const
std::vector<RTI::AttributeHandle> &val)
+ : _set(val)
+{
+}
+
+AttributeHandleSetImp::AttributeHandleSetImp(const
std::vector<certi::AttributeHandle> &val)
+{
+ _set.resize(val.size());
+ std::copy(val.begin(), val.end(), _set.begin());
+}
+
+AttributeHandleSetImp::~AttributeHandleSetImp()
+{
+}
+
+RTI::ULong AttributeHandleSetImp::size() const
+{
+ return _set.size();
+}
+
+RTI::AttributeHandle AttributeHandleSetImp::getHandle(RTI::ULong i) const
+ throw (RTI::ArrayIndexOutOfBounds)
+{
+ if (i < size())
+ return _set[i];
+ else
+ throw RTI::ArrayIndexOutOfBounds("");
+}
+
+void AttributeHandleSetImp::add(RTI::AttributeHandle h)
+ throw (RTI::ArrayIndexOutOfBounds, RTI::AttributeNotDefined)
+{
+ _set.push_back(h);
+}
+
+void AttributeHandleSetImp::remove(RTI::AttributeHandle h)
+ throw (RTI::AttributeNotDefined)
+{
+ std::vector<RTI::AttributeHandle>::iterator pos = std::find(_set.begin(),
_set.end(), h);
+ if (pos != _set.end())
+ _set.erase(pos);
+ else
+ throw RTI::ArrayIndexOutOfBounds("");
+}
+
+void AttributeHandleSetImp::empty()
+{
+ _set.clear();
+}
+
+RTI::Boolean AttributeHandleSetImp::isEmpty() const
+{
+ return RTI::Boolean(_set.empty());
+}
+
+RTI::Boolean AttributeHandleSetImp::isMember(RTI::AttributeHandle h) const
+{
+ return RTI::Boolean(std::find(_set.begin(), _set.end(), h) != _set.end());
+}
+
+const std::vector<RTI::AttributeHandle>&
+AttributeHandleSetImp::getAttributeHandles() const
+{
+ return _set;
+}
+
+// ----------------------------------------------------------------------------
+FederateHandleSetImp::FederateHandleSetImp(RTI::ULong size)
+{
+ _set.reserve(size);
+}
+
+FederateHandleSetImp::~FederateHandleSetImp()
+{
+}
+
+RTI::ULong FederateHandleSetImp::size() const
+{
+ return _set.size();
+}
+
+RTI::FederateHandle FederateHandleSetImp::getHandle(RTI::ULong i) const
+ throw (RTI::ArrayIndexOutOfBounds)
+{
+ if (i < size())
+ return _set[i];
+ else
+ throw RTI::ArrayIndexOutOfBounds("");
+}
+
+void FederateHandleSetImp::add(RTI::FederateHandle h)
+ throw (RTI::ValueCountExceeded)
+{
+ _set.push_back(h);
+}
+
+void FederateHandleSetImp::remove(RTI::FederateHandle h)
+ throw (RTI::ArrayIndexOutOfBounds)
+{
+ std::vector<RTI::FederateHandle>::iterator pos = std::find(_set.begin(),
_set.end(), h);
+ if (pos != _set.end())
+ _set.erase(pos);
+ else
+ throw RTI::ArrayIndexOutOfBounds("");
+}
+
+void FederateHandleSetImp::empty()
+{
+ _set.clear();
+}
+
+RTI::Boolean FederateHandleSetImp::isMember(RTI::FederateHandle h) const
+{
+ return RTI::Boolean(std::find(_set.begin(), _set.end(), h) != _set.end());
+}
+
+// ----------------------------------------------------------------------------
+ParameterHandleValuePairSetImp::ParameterHandleValuePairSetImp(RTI::ULong size)
+{
+ _order = RECEIVE;
+ _transport = RELIABLE;
+
+ _set.reserve(size);
+}
+
+ParameterHandleValuePairSetImp::ParameterHandleValuePairSetImp(const
std::vector<ParameterHandleValuePair_t> &val)
+ : _set(val)
+{
+ _order = RECEIVE;
+ _transport = RELIABLE;
+}
+
+ParameterHandleValuePairSetImp::~ParameterHandleValuePairSetImp()
+{
+}
+
+RTI::ULong ParameterHandleValuePairSetImp::size() const
+{
+ return _set.size();
+}
+
+RTI::Handle ParameterHandleValuePairSetImp::getHandle(RTI::ULong i) const
+ throw (RTI::ArrayIndexOutOfBounds)
+{
+ if (i < size())
+ return _set[i].first;
+ else
+ throw RTI::ArrayIndexOutOfBounds("");
+}
+
+RTI::ULong ParameterHandleValuePairSetImp::getValueLength(RTI::ULong i) const
+ throw (RTI::ArrayIndexOutOfBounds)
+{
+ if (i < size())
+ return _set[i].second.size();
+ else
+ throw RTI::ArrayIndexOutOfBounds("");
+}
+
+void ParameterHandleValuePairSetImp::getValue(RTI::ULong i, char *buff,
RTI::ULong &len) const
+ throw (RTI::ArrayIndexOutOfBounds)
+{
+ if (i < size()) {
+ const ParameterHandleValuePair_t& item = _set[i];
+ len = item.second.size();
+ memcpy(buff, &(item.second[0]), len);
+ }
+ else
+ throw RTI::ArrayIndexOutOfBounds("");
+}
+
+char *ParameterHandleValuePairSetImp::getValuePointer(RTI::ULong i, RTI::ULong
&len) const
+ throw (RTI::ArrayIndexOutOfBounds)
+{
+ if (i < size()) {
+ const ParameterHandleValuePair_t& item = _set[i];
+ len = item.second.size();
+ return (char *)&(item.second[0]);
+ }
+ else
+ throw RTI::ArrayIndexOutOfBounds("");
+}
+
+RTI::TransportType ParameterHandleValuePairSetImp::getTransportType() const
+ throw (RTI::InvalidHandleValuePairSetContext)
+{
+ return _transport;
+}
+
+RTI::OrderType ParameterHandleValuePairSetImp::getOrderType() const
+ throw (RTI::InvalidHandleValuePairSetContext)
+{
+ return _order;
+}
+
+RTI::Region *ParameterHandleValuePairSetImp::getRegion() const
+ throw (RTI::InvalidHandleValuePairSetContext)
+{
+ throw RTI::RTIinternalError("unimplemented function getRegion()");
+}
+
+void ParameterHandleValuePairSetImp::add(RTI::Handle h, const char *str,
RTI::ULong len)
+ throw (RTI::ValueLengthExceeded, RTI::ValueCountExceeded)
+{
+ std::vector<char> v;
+ v.assign(str,str+len);
+ _set.push_back(ParameterHandleValuePair_t(h, v));
+}
+
+void ParameterHandleValuePairSetImp::remove(RTI::Handle h)
+ throw (RTI::ArrayIndexOutOfBounds)
+{
+ for (std::vector<ParameterHandleValuePair_t>::iterator pos = _set.begin();
+ pos != _set.end(); pos++) {
+ if (pos->first == h) {
+ _set.erase(pos);
+ return;
+ }
+ }
+
+ throw RTI::ArrayIndexOutOfBounds("");
+}
+
+void ParameterHandleValuePairSetImp::moveFrom(const
ParameterHandleValuePairSet &, RTI::ULong &)
+ throw (RTI::ValueCountExceeded, RTI::ArrayIndexOutOfBounds)
+{
+ throw RTI::RTIinternalError("unimplemented function moveFrom()");
+}
+
+void ParameterHandleValuePairSetImp::empty()
+{
+ _set.clear();
+}
+
+RTI::ULong ParameterHandleValuePairSetImp::start() const
+{
+ // not implemented
+ return 0;
+}
+
+RTI::ULong ParameterHandleValuePairSetImp::valid(RTI::ULong i) const
+{
+ // not implemented
+ return 0;
+}
+
+RTI::ULong ParameterHandleValuePairSetImp::next(RTI::ULong i) const
+{
+ // not implemented
+ return 0;
+}
+
+const std::vector<ParameterHandleValuePair_t> &
+ParameterHandleValuePairSetImp::getParameterHandleValuePairs() const
+{
+ return _set;
+}
+
+// ----------------------------------------------------------------------------
+RTI::AttributeHandleValuePairSet *
+RTI::AttributeSetFactory::create(RTI::ULong size)
+ throw (MemoryExhausted, ValueCountExceeded, HandleValuePairMaximumExceeded)
+{
+ return new AttributeHandleValuePairSetImp(size);
+}
+
+// ----------------------------------------------------------------------------
+RTI::AttributeHandleSet *
+RTI::AttributeHandleSetFactory::create(RTI::ULong size)
+ throw (MemoryExhausted, ValueCountExceeded)
+{
+ return new AttributeHandleSetImp(size);
+}
+
+// ----------------------------------------------------------------------------
+RTI::FederateHandleSet *
+RTI::FederateHandleSetFactory::create(RTI::ULong size)
+ throw (MemoryExhausted, ValueCountExceeded)
+{
+ return new FederateHandleSetImp(size);
+}
+
+// ----------------------------------------------------------------------------
+RTI::ParameterHandleValuePairSet *
+RTI::ParameterSetFactory::create(RTI::ULong size)
+ throw (MemoryExhausted, ValueCountExceeded, HandleValuePairMaximumExceeded)
+{
+ return new ParameterHandleValuePairSetImp(size);
+}
+
+// ----------------------------------------------------------------------------
+RegionImp::RegionImp(RegionHandle h, RTI::SpaceHandle s, const
std::vector<Extent> &ext)
+ : handle(h), space(s), extents(ext), effectiveExtents(ext)
+{
+}
+
+RegionImp::~RegionImp()
+{
+}
+
+RTI::ULong RegionImp::getRangeLowerBound(RTI::ExtentIndex index,
RTI::DimensionHandle dimension) const
+ throw (RTI::ArrayIndexOutOfBounds)
+{
+ if (index < extents.size())
+ return extents[index].getRangeLowerBound(dimension);
+ else
+ throw RTI::ArrayIndexOutOfBounds("Extent index above limit");
+}
+
+RTI::ULong RegionImp::getRangeUpperBound(RTI::ExtentIndex index,
RTI::DimensionHandle dimension) const
+ throw (RTI::ArrayIndexOutOfBounds)
+{
+ if (index < extents.size())
+ return extents[index].getRangeUpperBound(dimension);
+ else
+ throw RTI::ArrayIndexOutOfBounds("Extent index above limit");
+}
+
+void RegionImp::setRangeLowerBound(RTI::ExtentIndex index,
RTI::DimensionHandle dimension, RTI::ULong val)
+ throw (RTI::ArrayIndexOutOfBounds)
+{
+ if (index < extents.size())
+ extents[index].setRangeLowerBound(dimension, val);
+ else
+ throw RTI::ArrayIndexOutOfBounds("Extent index above limit");
+}
+
+void RegionImp::setRangeUpperBound(RTI::ExtentIndex index,
RTI::DimensionHandle dimension, RTI::ULong val)
+ throw (RTI::ArrayIndexOutOfBounds)
+{
+ if (index < extents.size())
+ extents[index].setRangeUpperBound(dimension, val);
+ else
+ throw RTI::ArrayIndexOutOfBounds("Extent index above limit");
+}
+
+RTI::SpaceHandle RegionImp::getSpaceHandle() const
+ throw ()
+{
+ return space;
+}
+
+RTI::ULong RegionImp::getNumberOfExtents() const
+ throw ()
+{
+ return extents.size();
+}
+
+RTI::ULong RegionImp::getRangeLowerBoundNotificationLimit(RTI::ExtentIndex
index, RTI::DimensionHandle dimension) const
+ throw (RTI::ArrayIndexOutOfBounds)
+{
+ if (index < effectiveExtents.size())
+ return effectiveExtents[index].getRangeLowerBound(dimension);
+ else
+ throw RTI::ArrayIndexOutOfBounds("Extent index above limit");
+}
+
+RTI::ULong RegionImp::getRangeUpperBoundNotificationLimit(RTI::ExtentIndex
index, RTI::DimensionHandle dimension) const
+ throw (RTI::ArrayIndexOutOfBounds)
+{
+ if (index < effectiveExtents.size())
+ return effectiveExtents[index].getRangeUpperBound(dimension);
+ else
+ throw RTI::ArrayIndexOutOfBounds("Extent index above limit");
+}
+
+RegionHandle RegionImp::getHandle() const
+{
+ return handle;
+}
+
+/** Get the region's extents
+ \return The extents, as a vector
+ */
+const std::vector<Extent> &
+RegionImp::getExtents() const
+{
+ return extents;
+}
+
+/** Register a successful notifyAboutRegionModification()
+ */
+void RegionImp::commit()
+{
+ if (extents.size() != effectiveExtents.size())
+ throw RTI::InvalidExtents("Different number of extents");
+
+ effectiveExtents = extents;
+}
+
+// $Id: RTItypesImp.cc,v 1.1 2014/03/03 15:18:24 erk Exp $
Index: hla-1_3/CMakeLists.txt
===================================================================
RCS file: hla-1_3/CMakeLists.txt
diff -N hla-1_3/CMakeLists.txt
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ hla-1_3/CMakeLists.txt 3 Mar 2014 15:18:24 -0000 1.1
@@ -0,0 +1,102 @@
+# Add standard specific include directory
+include_directories(${CMAKE_SOURCE_DIR}/include/hla-1_3)
+include_directories(${CMAKE_BINARY_DIR}/include/hla-1_3)
+
+set(RTI_LIB_SRCS
+ RTIambassador.cc
+ RTIambPrivateRefs.cc
+ RTIambPrivateRefs.hh
+ RTItypes.cc
+ RTItypesImp.cc
+ RTItypesImp.hh
+ )
+
+set(RTI_LIB_INCLUDEENDIF
+ ${CMAKE_SOURCE_DIR}/include/hla-1_3/baseTypes.hh
+ ${CMAKE_SOURCE_DIR}/include/certi.hh
+ ${CMAKE_SOURCE_DIR}/include/hla-1_3/federateAmbServices.hh
+ ${CMAKE_SOURCE_DIR}/include/hla-1_3/NullFederateAmbassador.hh
+ ${CMAKE_SOURCE_DIR}/include/hla-1_3/RTI.hh
+ ${CMAKE_SOURCE_DIR}/include/hla-1_3/RTIambServices.hh
+ ${CMAKE_BINARY_DIR}/include/hla-1_3/RTItypes.hh
+ )
+
+add_library(RTI ${RTI_LIB_SRCS} ${RTI_LIB_INCLUDE})
+target_link_libraries(RTI CERTI FedTime)
+
+if (BUILD_LEGACY_LIBRTI)
+ message(STATUS "libRTI variant: CERTI legacy")
+ set_target_properties(RTI PROPERTIES OUTPUT_NAME "RTI")
+ set_target_properties(RTI PROPERTIES COMPILE_FLAGS "-DLEGACY_LIBRTI")
+else (BUILD_LEGACY_LIBRTI)
+ message(STATUS "libRTI variant: HLA 1.3 NG")
+ if (WIN32 AND CERTI_RTING_DLL_USE_LIB_PREFIX)
+ set_target_properties(RTI PROPERTIES OUTPUT_NAME "libRTI-NG")
+ else()
+ set_target_properties(RTI PROPERTIES OUTPUT_NAME "RTI-NG")
+ endif()
+ set_target_properties(RTI PROPERTIES COMPILE_FLAGS "-DHLA13NG_LIBRTI")
+endif (BUILD_LEGACY_LIBRTI)
+set_target_properties(RTI PROPERTIES VERSION 1.0.0 SOVERSION 1)
+if (MINGW)
+ set_target_properties(RTI PROPERTIES LINK_FLAGS
"-Wl,--output-def,${LIBRARY_OUTPUT_PATH}/libRTI.def")
+ install(FILES ${LIBRARY_OUTPUT_PATH}/libRTI.def
+ DESTINATION lib)
+endif (MINGW)
+
+
+##################################################################
+# Lib FedTime
+# A replacement lib FedTime may be provided by the user
+# CERTI is provided one. The lib FedTime depends on libRTI
+# since it inherits from the RTI::FedTime abstract class.
+##################################################################
+IF(CMAKE_COMPILER_IS_GNUCC)
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long")
+ENDIF(CMAKE_COMPILER_IS_GNUCC)
+IF(CMAKE_COMPILER_IS_GNUCXX)
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-long-long")
+ENDIF(CMAKE_COMPILER_IS_GNUCXX)
+
+include_directories(${CMAKE_SOURCE_DIR}/libHLA)
+set(FEDTIME_SRCS
+ RTIfedTime.cc
+ ${CMAKE_SOURCE_DIR}/include/hla-1_3/fedtime.hh
+)
+
+source_group("Source Files\\FedTime" FILES ${FEDTIME_SRCS})
+
+add_library(FedTime ${FEDTIME_SRCS})
+# Correct line
+target_link_libraries(FedTime)
+# Incorrect line
+# (at least the dependency exists but we cannot specify that
+# because we would generate a circular deps RTI-->FedTime-->RTI)
+#TARGET_LINK_LIBRARIES(FedTime RTI)
+
+IF (WIN32 AND CERTI_RTING_DLL_USE_LIB_PREFIX)
+ set_target_properties(FedTime PROPERTIES OUTPUT_NAME "libFedTime")
+ENDIF()
+
+set_target_properties(FedTime PROPERTIES PROJECT_LABEL LibFedTime)
+IF (MINGW)
+ set_target_properties(FedTime PROPERTIES LINK_FLAGS
"-Wl,--output-def,${LIBRARY_OUTPUT_PATH}/libFedTime.def")
+ INSTALL(FILES ${LIBRARY_OUTPUT_PATH}/libFedTime.def
+ DESTINATION lib)
+ENDIF (MINGW)
+
+set_target_properties(FedTime PROPERTIES VERSION 1.0.0 SOVERSION 1)
+
+set(TestFedTime_SRCS
+ TestFedTime.cc
+)
+add_executable(TestFedTime ${TestFedTime_SRCS})
+target_link_libraries(TestFedTime FedTime RTI)
+add_test(NAME TestLibFedTime COMMAND $<TARGET_FILE:TestFedTime>)
+
+# Install rules for both libRTI-NG and libFedTime
+install(TARGETS RTI FedTime
+ EXPORT CERTIDepends
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib)
Index: ieee1516-2010/CMakeLists.txt
===================================================================
RCS file: ieee1516-2010/CMakeLists.txt
diff -N ieee1516-2010/CMakeLists.txt
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ieee1516-2010/CMakeLists.txt 3 Mar 2014 15:18:24 -0000 1.1
@@ -0,0 +1,10 @@
+# Add standard specific include directory
+include_directories(${CMAKE_SOURCE_DIR}/include/ieee1516-2010)
+include_directories(${CMAKE_BINARY_DIR}/include/ieee1516-2010)
+
+# TO BE CONTINUED
+
+# mimic install directory structure in the binary tree in order to ease the
linking
+# of builtin test (i.e. testFederate)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/RTI1516fedTime.h
${CMAKE_BINARY_DIR}/include/ieee1516-2010/RTI/RTI1516fedTime.h COPYONLY)
+install(FILES RTI1516fedTime.h DESTINATION include/ieee1516-2010/RTI)
\ No newline at end of file
Index: ieee1516-2010/RTI1516fedTime.h
===================================================================
RCS file: ieee1516-2010/RTI1516fedTime.h
diff -N ieee1516-2010/RTI1516fedTime.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ieee1516-2010/RTI1516fedTime.h 3 Mar 2014 15:18:24 -0000 1.1
@@ -0,0 +1,335 @@
+#ifndef RTI1516E_FEDTIME_H
+#define RTI1516E_FEDTIME_H
+
+#include <RTI/certiLogicalTime.h>
+#include <RTI/certiLogicalTimeInterval.h>
+#include <RTI/certiLogicalTimeFactory.h>
+
+namespace rti1516e {
+ class VariableLengthData;
+}
+
+class FEDTIME_EXPORT RTI1516fedTime : public rti1516e::LogicalTime
+{
+public:
+ RTI1516fedTime(double timeVal);
+ RTI1516fedTime(const RTI1516fedTime &other);
+
+ virtual ~RTI1516fedTime()
+ throw ();
+
+ virtual
+ void
+ setInitial();
+
+ virtual
+ bool
+ isInitial() const;
+
+ virtual
+ void
+ setFinal();
+
+ virtual
+ bool
+ isFinal() const;
+
+ virtual
+ rti1516::LogicalTime &
+ operator=(rti1516::LogicalTime const & value)
+ throw (rti1516::InvalidLogicalTime);
+
+ virtual
+ RTI1516fedTime &
+ operator=(RTI1516fedTime const & value)
+ throw ();
+
+ virtual
+ rti1516::LogicalTime &
+ operator+=(rti1516::LogicalTimeInterval const & addend)
+ throw (rti1516::IllegalTimeArithmetic,
rti1516::InvalidLogicalTimeInterval);
+
+ virtual
+ rti1516::LogicalTime &
+ operator-=(rti1516::LogicalTimeInterval const & subtrahend)
+ throw (rti1516::IllegalTimeArithmetic,
rti1516::InvalidLogicalTimeInterval);
+
+ virtual
+ bool
+ operator>(rti1516::LogicalTime const & value) const
+ throw (rti1516::InvalidLogicalTime);
+
+ virtual
+ bool
+ operator<(rti1516::LogicalTime const & value) const
+ throw (rti1516::InvalidLogicalTime);
+
+ virtual
+ bool
+ operator==(rti1516::LogicalTime const & value) const
+ throw (rti1516::InvalidLogicalTime);
+
+ virtual
+ bool
+ operator>=(rti1516::LogicalTime const & value) const
+ throw (rti1516::InvalidLogicalTime);
+
+ virtual
+ bool
+ operator<=(rti1516::LogicalTime const & value) const
+ throw (rti1516::InvalidLogicalTime);
+
+ // Generates an encoded value that can be used to send
+ // LogicalTimes to other federates in updates or interactions
+ // Not implemented.
+ virtual
+ rti1516::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 (rti1516::CouldNotEncode);
+
+ // Decode encodedLogicalTime into self
+ // Not implemented.
+ virtual
+ void
+ decode(rti1516::VariableLengthData const & encodedLogicalTime)
+ throw (rti1516::InternalError,
+ rti1516::CouldNotDecode);
+
+ // Alternate decode that reads directly from a buffer
+ virtual
+ void
+ decode(void* buffer, unsigned long bufferSize)
+ throw (rti1516::InternalError,
+ rti1516::CouldNotDecode);
+
+ virtual
+ std::wstring
+ toString() const;
+
+ // Returns the name of the implementation, as needed by
+ // createFederationExecution.
+ virtual
+ std::wstring
+ implementationName() const;
+
+ double getFedTime() const
+ { return _fedTime; }
+
+ bool isInfinity() const
+ { return _fedTime == _positiveInfinity; }
+
+
+private:
+ double _fedTime;
+ double _zero;
+ double _epsilon;
+ double _positiveInfinity;
+
+}; // class RTI_EXPORT_FEDTIME RTI1516fedTime
+
+class FEDTIME_EXPORT RTI1516fedTimeInterval : public
rti1516::LogicalTimeInterval
+{
+public:
+ RTI1516fedTimeInterval(double timeVal);
+ RTI1516fedTimeInterval(const RTI1516fedTimeInterval &other);
+
+ virtual
+ ~RTI1516fedTimeInterval()
+ throw ();
+
+ virtual
+ void
+ setZero();
+
+ virtual
+ bool
+ isZero() const;
+
+ virtual
+ void
+ setEpsilon();
+
+ virtual
+ bool
+ isEpsilon() const;
+
+ virtual
+ rti1516::LogicalTimeInterval &
+ operator=(rti1516::LogicalTimeInterval const & value)
+ throw (rti1516::InvalidLogicalTimeInterval);
+
+ virtual
+ RTI1516fedTimeInterval &
+ operator=(RTI1516fedTimeInterval const & other)
+ throw ();
+
+ // Set self to the difference between two LogicalTimes
+ virtual
+ void
+ setToDifference(rti1516::LogicalTime const & minuend,
+ rti1516::LogicalTime const& subtrahend)
+ throw (rti1516::InvalidLogicalTime);
+
+ virtual
+ rti1516::LogicalTimeInterval &
+ operator+=(rti1516::LogicalTimeInterval const & addend)
+ throw (rti1516::InvalidLogicalTimeInterval);
+
+ virtual
+ rti1516::LogicalTimeInterval &
+ operator-=(rti1516::LogicalTimeInterval const & subtrahend)
+ throw (rti1516::InvalidLogicalTimeInterval);
+
+ virtual
+ bool
+ operator>(rti1516::LogicalTimeInterval const & value) const
+ throw (rti1516::InvalidLogicalTimeInterval);
+
+ virtual
+ bool
+ operator<(rti1516::LogicalTimeInterval const & value) const
+ throw (rti1516::InvalidLogicalTimeInterval);
+
+ virtual
+ bool
+ operator==(rti1516::LogicalTimeInterval const & value) const
+ throw (rti1516::InvalidLogicalTimeInterval);
+
+ virtual
+ bool
+ operator>=(rti1516::LogicalTimeInterval const & value) const
+ throw (rti1516::InvalidLogicalTimeInterval);
+
+ virtual
+ bool
+ operator<=(rti1516::LogicalTimeInterval const & value) const
+ throw (rti1516::InvalidLogicalTimeInterval);
+
+ // Generates an encoded value that can be used to send
+ // LogicalTimeIntervals to other federates in updates or interactions
+ // Not implemented.
+ virtual
+ rti1516::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 (rti1516::CouldNotEncode);
+
+ // Decode encodedValue into self
+ // Not implemented.
+ virtual
+ void
+ decode(rti1516::VariableLengthData const & encodedValue)
+ throw (rti1516::InternalError, rti1516::CouldNotDecode);
+
+ // Alternate decode that reads directly from a buffer
+ virtual
+ void
+ decode(void* buffer, unsigned long bufferSize)
+ throw (rti1516::InternalError, rti1516::CouldNotDecode);
+
+ virtual
+ std::wstring
+ toString() const;
+
+ // Returns the name of the implementation, as needed by
+ // createFederationExecution.
+ virtual
+ std::wstring
+ implementationName() const;
+
+ double getInterval() const
+ { return _fedInterval; }
+
+ double getEpsilon() const
+ { return _epsilon; }
+
+private:
+ double _fedInterval;
+ double _zero;
+ double _epsilon;
+ double _positiveInfinity;
+
+}; // class FEDTIME_EXPORT RTI1516fedTimeInterval
+
+class FEDTIME_EXPORT RTI1516fedTimeFactory : public rti1516::LogicalTimeFactory
+{
+public:
+ virtual
+ ~RTI1516fedTimeFactory()
+ throw ();
+
+ // Returns a LogicalTime with a value of "initial"
+ virtual
+ std::auto_ptr< rti1516::LogicalTime >
+ makeLogicalTime()
+ throw (rti1516::InternalError);
+
+ virtual
+ std::auto_ptr< rti1516::LogicalTime >
+ makeLogicalTime(double timeVal)
+ throw (rti1516::InternalError);
+
+ // Returns a LogicalTimeInterval with a value of "zero"
+ virtual
+ std::auto_ptr< rti1516::LogicalTimeInterval >
+ makeLogicalTimeInterval()
+ throw (rti1516::InternalError);
+
+ virtual
+ std::auto_ptr< rti1516::LogicalTimeInterval >
+ makeLogicalTimeInterval(double timeInterval)
+ throw (rti1516::InternalError);
+
+private:
+ friend class rti1516::LogicalTimeFactoryFactory;
+
+ // Private constructor - Only for LogicalTimeFactoryFactory to access.
+ RTI1516fedTimeFactory()
+ throw();
+
+}; // class FEDTIME_EXPORT RTI1516fedTimeFactory
+
+
+
+// The LogicalTimeFactoryFactory must also be implemented by the
+// federate. The definition is copied here (though commented out)
+// for reference.
+
+//namespace rti1516
+//{
+// class FEDTIME_EXPORT LogicalTimeFactoryFactory
+// {
+// public:
+//
+// // The name is used to choose among several LogicalTimeFactories that
might
+// // be present in the fedtime library. Each federation chooses its
+// // implementation by passing the appropriate name to
createFederationExecution.
+// // If the supplied name is the empty string, a default
LogicalTimeFactory is
+// // returned. If the supplied implementation name does not match any
name
+// // supported by the library, then a NULL pointer is returned.
+// static std::auto_ptr< LogicalTimeFactory >
+// makeLogicalTimeFactory(std::wstring const & implementationName);
+// };
+//}
+
+
+
+
+# endif // RTI1516_FED_TIME_H
Index: LogicalTimeDouble.cpp
===================================================================
RCS file: LogicalTimeDouble.cpp
diff -N LogicalTimeDouble.cpp
--- LogicalTimeDouble.cpp 31 May 2010 13:14:18 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,733 +0,0 @@
-#ifdef _WIN32
-#pragma warning(disable : 4786)
-#pragma warning(disable:4290)
-#endif
-
-#include "RTI/certiRTI1516.h"
-//#include "RTI/EncodedLogicalTime.h"
-//#include "RTI/EncodedLogicalTimeInterval.h"
-
-#include "LogicalTimeDouble.h"
-
-#include <cmath>
-#include <climits>
-#include <typeinfo>
-
-/*
-namespace
-{
- class MyEncodedLogicalTime : public rti1516::EncodedLogicalTime
- {
- private:
- rti1516::VariableLengthValueClass _value;
- void* _data;
- size_t _size;
- public:
- MyEncodedLogicalTime(const void* data, size_t size) :
- _value(data, size)
- {
- }
- virtual ~MyEncodedLogicalTime() throw () {}
-
- virtual void const * data() const
- {
- return _value.data();
- }
- virtual size_t size() const
- {
- return _value.size();
- }
- };
-
- class MyEncodedLogicalTimeInterval : public
rti1516::EncodedLogicalTimeInterval
- {
- private:
- rti1516::VariableLengthValueClass _value;
- void* _data;
- size_t _size;
- public:
- MyEncodedLogicalTimeInterval(const void* data, size_t size) :
- _value(data, size)
- {
- }
- virtual ~MyEncodedLogicalTimeInterval() throw () {}
-
- virtual void const * data() const
- {
- return _value.data();
- }
- virtual size_t size() const
- {
- return _value.size();
- }
- };
-}
-*/
-
-#ifdef __GNUC__
-const int64_t MAX_VALUE = LONG_LONG_MAX;
-#else
-const int64_t MAX_VALUE = 9223372036854775807;
-#endif
-const int64_t MULTIPLIER = 1000000;
-
-LogicalTimeDouble::LogicalTimeDouble(double value)
-{
- int64_t seconds = (long)floor(value);
- int64_t micros = (long)fmod(value * MULTIPLIER, (double)MULTIPLIER);
-
- _value = seconds * MULTIPLIER + micros;
-}
-
-LogicalTimeDouble::LogicalTimeDouble(int64_t value) :
- _value(value)
-{
-}
-
-LogicalTimeDouble::~LogicalTimeDouble()
- throw ()
-{
-}
-
-void LogicalTimeDouble::setInitial()
-{
- _value = 0;
-}
-
-bool LogicalTimeDouble::isInitial() const
-{
- return _value == 0;
-}
-
-void LogicalTimeDouble::setFinal()
-{
- _value = MAX_VALUE;
-}
-
-bool LogicalTimeDouble::isFinal() const
-{
- return _value == MAX_VALUE;
-}
-
-void LogicalTimeDouble::setTo(rti1516::LogicalTime const & value)
-throw (rti1516::InvalidLogicalTime)
-{
- try {
- const LogicalTimeDouble& p = dynamic_cast<const
LogicalTimeDouble&>(value);
- _value = p._value;
- } catch (std::bad_cast)
- {
- throw std::wstring(L"Invalid LogicalTimeDouble");
- //throw rti1516::InvalidLogicalTime(L"Invalid
LogicalTimeDouble");
- }
-}
-
-rti1516::LogicalTime &
-LogicalTimeDouble::operator=(rti1516::LogicalTime const & value)
-throw (rti1516::InvalidLogicalTime)
-{
- setTo(value);
- return *this;
-}
-
-LogicalTimeDouble &
-LogicalTimeDouble::operator=(LogicalTimeDouble const & value)
-throw (rti1516::InvalidLogicalTime)
-{
- setTo(value);
- return *this;
-}
-
-
-
-
-
-void LogicalTimeDouble::increaseBy(rti1516::LogicalTimeInterval const & addend)
-throw (rti1516::IllegalTimeArithmetic, rti1516::InvalidLogicalTimeInterval)
-{
- try {
- const LogicalTimeIntervalDouble& p = dynamic_cast<const
LogicalTimeIntervalDouble&>(addend);
- _value += p._value;
- } catch (std::bad_cast)
- {
- throw std::wstring(L"Invalid LogicalTimeDouble");
- //throw rti1516::InvalidLogicalTimeInterval(L"Invalid
LogicalTimeDouble");
- }
-}
-
-void LogicalTimeDouble::decreaseBy(rti1516::LogicalTimeInterval const &
subtrahend)
-throw (rti1516::IllegalTimeArithmetic, rti1516::InvalidLogicalTimeInterval)
-{
- try {
- const LogicalTimeIntervalDouble& p = dynamic_cast<const
LogicalTimeIntervalDouble&>(subtrahend);
- _value -= p._value;
- } catch (std::bad_cast)
- {
- throw std::wstring(L"Invalid LogicalTimeDouble");
- //throw rti1516::InvalidLogicalTimeInterval(L"Invalid
LogicalTimeDouble");
- }
-
-}
-
-std::auto_ptr< rti1516::LogicalTimeInterval >
LogicalTimeDouble::subtract(rti1516::LogicalTime const & subtrahend) const
-throw (rti1516::InvalidLogicalTime)
-{
- try {
- const LogicalTimeDouble& p = dynamic_cast<const
LogicalTimeDouble&>(subtrahend);
- return std::auto_ptr< rti1516::LogicalTimeInterval >(new
LogicalTimeIntervalDouble(_value - p._value));
- } catch (std::bad_cast)
- {
- throw std::wstring(L"Invalid LogicalTimeDouble");
- //throw rti1516::InvalidLogicalTime(L"Invalid
LogicalTimeDouble");
- }
-}
-
-bool LogicalTimeDouble::isGreaterThan(rti1516::LogicalTime const & value) const
-throw (rti1516::InvalidLogicalTime)
-{
- try {
- const LogicalTimeDouble& p = dynamic_cast<const
LogicalTimeDouble&>(value);
- return _value > p._value;
- } catch (std::bad_cast)
- {
- throw std::wstring(L"Invalid LogicalTimeDouble");
- //throw rti1516::InvalidLogicalTime(L"Invalid
LogicalTimeDouble");
- }
-}
-
-bool LogicalTimeDouble::isLessThan(rti1516::LogicalTime const & value) const
-throw (rti1516::InvalidLogicalTime)
-{
- try {
- const LogicalTimeDouble& p = dynamic_cast<const
LogicalTimeDouble&>(value);
- return _value < p._value;
- } catch (std::bad_cast)
- {
- throw std::wstring(L"Invalid LogicalTimeDouble");
- //throw rti1516::InvalidLogicalTime(L"Invalid
LogicalTimeDouble");
- }
-}
-
-bool LogicalTimeDouble::isEqualTo(rti1516::LogicalTime const & value) const
-throw (rti1516::InvalidLogicalTime)
-{
- try {
- const LogicalTimeDouble& p = dynamic_cast<const
LogicalTimeDouble&>(value);
- return _value == p._value;
- } catch (std::bad_cast)
- {
- throw std::wstring(L"Invalid LogicalTimeDouble");
- //throw rti1516::InvalidLogicalTime(L"Invalid
LogicalTimeDouble");
- }
-}
-
-bool LogicalTimeDouble::isGreaterThanOrEqualTo(rti1516::LogicalTime const &
value) const
-throw (rti1516::InvalidLogicalTime)
-{
- try {
- const LogicalTimeDouble& p = dynamic_cast<const
LogicalTimeDouble&>(value);
- return _value >= p._value;
- } catch (std::bad_cast)
- {
- throw std::wstring(L"Invalid LogicalTimeDouble");
- //throw rti1516::InvalidLogicalTime(L"Invalid
LogicalTimeDouble");
- }
-}
-
-bool LogicalTimeDouble::isLessThanOrEqualTo(rti1516::LogicalTime const &
value) const
-throw (rti1516::InvalidLogicalTime)
-{
- try {
- const LogicalTimeDouble& p = dynamic_cast<const
LogicalTimeDouble&>(value);
- return _value <= p._value;
- } catch (std::bad_cast)
- {
- throw std::wstring(L"Invalid LogicalTimeDouble");
- //throw rti1516::InvalidLogicalTime(L"Invalid
LogicalTimeDouble");
- }
-}
-
-long LogicalTimeDouble::getSeconds() const
-{
- return (long)(_value / MULTIPLIER);
-}
-
-int LogicalTimeDouble::getMicros() const
-{
- return (int)(_value % MULTIPLIER);
-}
-
-std::wstring LogicalTimeDouble::toString() const
-{
- wchar_t buf[128];
- if (_value == MAX_VALUE) {
- swprintf(buf, 128, L"LogicalTimeDouble<INF>");
- } else {
- swprintf(buf, 128, L"LogicalTimeDouble<%d.%06d>", getSeconds(),
getMicros());
- }
- return buf;
-}
-
-bool LogicalTimeDouble::operator==(LogicalTime const & lt_left) const
- throw (rti1516::InvalidLogicalTime)
-{
- try {
- const LogicalTimeDouble& left = dynamic_cast<const
LogicalTimeDouble&>(lt_left);
- return (((left._value - 1000) < _value) && ((left._value +
1000) > _value));
- } catch (std::bad_cast)
- {
- throw std::wstring(L"Invalid LogicalTimeDouble");
- //throw rti1516::InvalidLogicalTime(L"Invalid
LogicalTimeDouble");
- }
-}
-
-int64_t LogicalTimeDouble::toMilliseconds() const
-{
- return _value/1000;
-}
-
-rti1516::VariableLengthData LogicalTimeDouble::encode() const
-{
- unsigned char buf[sizeof(_value)];
- int pos = 0;
- buf[pos++] = (unsigned char)((_value >> 56) & 0xFF);
- buf[pos++] = (unsigned char)((_value >> 48) & 0xFF);
- buf[pos++] = (unsigned char)((_value >> 40) & 0xFF);
- buf[pos++] = (unsigned char)((_value >> 32) & 0xFF);
- buf[pos++] = (unsigned char)((_value >> 24) & 0xFF);
- buf[pos++] = (unsigned char)((_value >> 16) & 0xFF);
- buf[pos++] = (unsigned char)((_value >> 8) & 0xFF);
- buf[pos++] = (unsigned char)((_value >> 0) & 0xFF);
-
- rti1516::VariableLengthData varData(buf, pos);
-
- return varData;
-}
-
-unsigned long LogicalTimeDouble::encodedLength() const
-{
- return 8L;
-}
-
-unsigned long LogicalTimeDouble::encode(void* buffer, unsigned long
bufferSize) const
- throw (rti1516::CouldNotEncode)
-{
- unsigned char *buf = (unsigned char*)buffer;
- int pos = 0;
- buf[pos++] = (unsigned char)((_value >> 56) & 0xFF);
- buf[pos++] = (unsigned char)((_value >> 48) & 0xFF);
- buf[pos++] = (unsigned char)((_value >> 40) & 0xFF);
- buf[pos++] = (unsigned char)((_value >> 32) & 0xFF);
- buf[pos++] = (unsigned char)((_value >> 24) & 0xFF);
- buf[pos++] = (unsigned char)((_value >> 16) & 0xFF);
- buf[pos++] = (unsigned char)((_value >> 8) & 0xFF);
- buf[pos++] = (unsigned char)((_value >> 0) & 0xFF);
-
- return 8L;
-}
-
-void LogicalTimeDouble::decode(rti1516::VariableLengthData const &
encodedLogicalTime)
- throw (rti1516::InternalError, rti1516::CouldNotDecode)
-{
- int64_t value = 0;
- unsigned char* buf = (unsigned char*)encodedLogicalTime.data();
- int pos = 0;
- value = (value << 8) | buf[pos++];
- value = (value << 8) | buf[pos++];
- value = (value << 8) | buf[pos++];
- value = (value << 8) | buf[pos++];
- value = (value << 8) | buf[pos++];
- value = (value << 8) | buf[pos++];
- value = (value << 8) | buf[pos++];
- value = (value << 8) | buf[pos++];
-
- _value = value;
-}
-
-void LogicalTimeDouble::decode(void* buffer, unsigned long bufferSize)
- throw (rti1516::InternalError,
- rti1516::CouldNotDecode)
-{
- int64_t value = 0;
- unsigned char* buf = (unsigned char*)buffer;
- int pos = 0;
- value = (value << 8) | buf[pos++];
- value = (value << 8) | buf[pos++];
- value = (value << 8) | buf[pos++];
- value = (value << 8) | buf[pos++];
- value = (value << 8) | buf[pos++];
- value = (value << 8) | buf[pos++];
- value = (value << 8) | buf[pos++];
- value = (value << 8) | buf[pos++];
-
- _value = value;
-}
-
-///////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-
-
-
-
-
-
-
-LogicalTimeDoubleFactory::~LogicalTimeDoubleFactory()
-throw ()
-{
-}
-
-std::auto_ptr< rti1516::LogicalTime > LogicalTimeDoubleFactory::makeInitial()
- throw (rti1516::InternalError)
-{
- return std::auto_ptr< rti1516::LogicalTime >(new
LogicalTimeDouble((int64_t)0));
-}
-
-std::auto_ptr< rti1516::LogicalTimeInterval >
LogicalTimeDoubleFactory::makeZero()
- throw (rti1516::InternalError)
-{
- return std::auto_ptr< rti1516::LogicalTimeInterval >(new
LogicalTimeIntervalDouble((int64_t)0));
-}
-
-std::auto_ptr< rti1516::LogicalTimeInterval >
LogicalTimeDoubleFactory::epsilon()
- throw (rti1516::InternalError)
-{
- return std::auto_ptr< rti1516::LogicalTimeInterval >(new
LogicalTimeIntervalDouble((int64_t)1));
-}
-
-
-LogicalTimeFactoryDouble::~LogicalTimeFactoryDouble()
-throw ()
-{
-}
-
-
-
-///////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-
-
-
-
-
-
-LogicalTimeIntervalDouble::LogicalTimeIntervalDouble(double value)
-{
- int64_t seconds = (long)floor(value);
- int64_t micros = (long)fmod(value * MULTIPLIER, (double)MULTIPLIER);
-
- _value = seconds * MULTIPLIER + micros;
-}
-
-LogicalTimeIntervalDouble::LogicalTimeIntervalDouble(int64_t value) :
- _value(value)
-{
-}
-
-LogicalTimeIntervalDouble::~LogicalTimeIntervalDouble()
- throw ()
-{
-}
-
-void LogicalTimeIntervalDouble::setZero()
-{
- _value = 0;
-}
-
-bool LogicalTimeIntervalDouble::isZero() const
-{
- return _value == 0;
-}
-
-void LogicalTimeIntervalDouble::setEpsilon()
-{
- _value = 1;
-}
-
-bool LogicalTimeIntervalDouble::isEpsilon() const
-{
- return _value == 1;
-}
-
-long LogicalTimeIntervalDouble::getSeconds() const
-{
- return (long)(_value / MULTIPLIER);
-}
-
-int LogicalTimeIntervalDouble::getMicros() const
-{
- return (int)(_value % MULTIPLIER);
-}
-
-void LogicalTimeIntervalDouble::setTo(rti1516::LogicalTimeInterval const &
value)
- throw (rti1516::InvalidLogicalTimeInterval)
-{
- try {
- const LogicalTimeIntervalDouble& p = dynamic_cast<const
LogicalTimeIntervalDouble&>(value);
- _value = p._value;
- } catch (std::bad_cast)
- {
- throw rti1516::InvalidLogicalTime(L"Invalid LogicalTimeDouble");
- }
-}
-
-std::auto_ptr< rti1516::LogicalTimeInterval >
-LogicalTimeIntervalDouble::subtract(rti1516::LogicalTimeInterval const &
subtrahend) const
- throw (rti1516::InvalidLogicalTimeInterval)
-{
- const LogicalTimeIntervalDouble& p = dynamic_cast<const
LogicalTimeIntervalDouble&>(subtrahend);
-
- int64_t d = _value - p._value;
- if (d < 0) {
- d = -d;
- }
- return std::auto_ptr< rti1516::LogicalTimeInterval >(new
LogicalTimeIntervalDouble(d));
-}
-
-bool LogicalTimeIntervalDouble::isGreaterThan(rti1516::LogicalTimeInterval
const & value) const
- throw (rti1516::InvalidLogicalTimeInterval)
-{
- try {
- const LogicalTimeIntervalDouble& p = dynamic_cast<const
LogicalTimeIntervalDouble&>(value);
- return _value > p._value;
- } catch (std::bad_cast)
- {
- throw rti1516::InvalidLogicalTime(L"Invalid LogicalTimeDouble");
- }
-}
-
-bool LogicalTimeIntervalDouble::isLessThan(rti1516::LogicalTimeInterval const
& value) const
-throw (rti1516::InvalidLogicalTimeInterval)
-{
- try {
- const LogicalTimeIntervalDouble& p = dynamic_cast<const
LogicalTimeIntervalDouble&>(value);
- return _value < p._value;
- } catch (std::bad_cast)
- {
- throw rti1516::InvalidLogicalTime(L"Invalid LogicalTimeDouble");
- }
-}
-
-bool LogicalTimeIntervalDouble::isEqualTo(rti1516::LogicalTimeInterval const &
value) const
-throw (rti1516::InvalidLogicalTimeInterval)
-{
- try {
- const LogicalTimeIntervalDouble& p = dynamic_cast<const
LogicalTimeIntervalDouble&>(value);
- return _value == p._value;
- } catch (std::bad_cast)
- {
- throw rti1516::InvalidLogicalTime(L"Invalid LogicalTimeDouble");
- }
-}
-
-bool
LogicalTimeIntervalDouble::isGreaterThanOrEqualTo(rti1516::LogicalTimeInterval
const & value) const
-throw (rti1516::InvalidLogicalTimeInterval)
-{
- try {
- const LogicalTimeIntervalDouble& p = dynamic_cast<const
LogicalTimeIntervalDouble&>(value);
- return _value >= p._value;
- } catch (std::bad_cast)
- {
- throw rti1516::InvalidLogicalTime(L"Invalid LogicalTimeDouble");
- }
-}
-
-bool
LogicalTimeIntervalDouble::isLessThanOrEqualTo(rti1516::LogicalTimeInterval
const & value) const
-throw (rti1516::InvalidLogicalTimeInterval)
-{
- try {
- const LogicalTimeIntervalDouble& p = dynamic_cast<const
LogicalTimeIntervalDouble&>(value);
- return _value <= p._value;
- } catch (std::bad_cast)
- {
- throw rti1516::InvalidLogicalTime(L"Invalid LogicalTimeDouble");
- }
-}
-
-rti1516::VariableLengthData LogicalTimeIntervalDouble::encode() const
-{
- unsigned char buf[sizeof(_value)];
- int pos = 0;
- buf[pos++] = (unsigned char)((_value >> 56) & 0xFF);
- buf[pos++] = (unsigned char)((_value >> 48) & 0xFF);
- buf[pos++] = (unsigned char)((_value >> 40) & 0xFF);
- buf[pos++] = (unsigned char)((_value >> 32) & 0xFF);
- buf[pos++] = (unsigned char)((_value >> 24) & 0xFF);
- buf[pos++] = (unsigned char)((_value >> 16) & 0xFF);
- buf[pos++] = (unsigned char)((_value >> 8) & 0xFF);
- buf[pos++] = (unsigned char)((_value >> 0) & 0xFF);
-
- rti1516::VariableLengthData varData(buf, pos);
-
- return varData;
-}
-
-unsigned long
-LogicalTimeIntervalDouble::encodedLength() const
-{
- return 8L;
-}
-unsigned long
-LogicalTimeIntervalDouble::encode(void* buffer, unsigned long bufferSize) const
-throw (rti1516::CouldNotEncode)
-{
- if (bufferSize < 8L)
- {
- throw rti1516::CouldNotEncode(L"Not enough space to encode
LogicalTimeIntervalDouble");
- }
-
- unsigned char *buf = (unsigned char *) buffer;
- int pos = 0;
- buf[pos++] = (unsigned char)((_value >> 56) & 0xFF);
- buf[pos++] = (unsigned char)((_value >> 48) & 0xFF);
- buf[pos++] = (unsigned char)((_value >> 40) & 0xFF);
- buf[pos++] = (unsigned char)((_value >> 32) & 0xFF);
- buf[pos++] = (unsigned char)((_value >> 24) & 0xFF);
- buf[pos++] = (unsigned char)((_value >> 16) & 0xFF);
- buf[pos++] = (unsigned char)((_value >> 8) & 0xFF);
- buf[pos++] = (unsigned char)((_value >> 0) & 0xFF);
-
- return 8L;
-}
-
-void LogicalTimeIntervalDouble::decode(rti1516::VariableLengthData const &
encodedLogicalTimeInterval)
-throw (rti1516::InternalError, rti1516::CouldNotDecode)
-{
- if (encodedLogicalTimeInterval.size() < 8L)
- {
- throw rti1516::CouldNotDecode(L"Not enough data in
VariableLengthData to decode LogicalTimeIntervalDouble. (Needs 8 bytes)");
- }
-
- int64_t value = 0;
- unsigned char* buf = (unsigned char*)encodedLogicalTimeInterval.data();
- int pos = 0;
- value = (value << 8) | buf[pos++];
- value = (value << 8) | buf[pos++];
- value = (value << 8) | buf[pos++];
- value = (value << 8) | buf[pos++];
- value = (value << 8) | buf[pos++];
- value = (value << 8) | buf[pos++];
- value = (value << 8) | buf[pos++];
- value = (value << 8) | buf[pos++];
-
- _value = value;
-}
-
-
-void
-LogicalTimeIntervalDouble::decode(void* buffer, unsigned long bufferSize)
-throw (rti1516::InternalError,
- rti1516::CouldNotDecode)
-{
- if (bufferSize < 8L)
- {
- throw rti1516::CouldNotDecode(L"Not enough data in
VariableLengthData to decode LogicalTimeIntervalDouble. (Needs 8 bytes)");
- }
- int64_t value = 0;
- unsigned char* buf = (unsigned char*)buffer;
- int pos = 0;
- value = (value << 8) | buf[pos++];
- value = (value << 8) | buf[pos++];
- value = (value << 8) | buf[pos++];
- value = (value << 8) | buf[pos++];
- value = (value << 8) | buf[pos++];
- value = (value << 8) | buf[pos++];
- value = (value << 8) | buf[pos++];
- value = (value << 8) | buf[pos++];
-
- _value = value;
-}
-
-
-std::wstring LogicalTimeIntervalDouble::toString() const
-{
- wchar_t buf[128];
- swprintf(buf, 128, L"LogicalTimeIntervalDouble<%d.%06d>", getSeconds(),
getMicros());
- return buf;
-}
-
-
-void
-LogicalTimeIntervalDouble::setToDifference(rti1516::LogicalTime const &
minuend,
-
rti1516::LogicalTime const& subtrahend)
-
throw (rti1516::InvalidLogicalTime)
-{
- try {
- const LogicalTimeDouble& d_minuend = dynamic_cast<const
LogicalTimeDouble&>(minuend);
- const LogicalTimeDouble& d_subtrahend = dynamic_cast<const
LogicalTimeDouble&>(subtrahend);
-
- int64_t value = d_minuend.toMilliseconds() -
d_subtrahend.toMilliseconds();
- if (value < 0) {
- value = -value;
- }
- _value = value;
- } catch (std::bad_cast)
- {
- throw rti1516::InvalidLogicalTime(L"Invalid LogicalTimeDouble");
- }
-
-}
-
-rti1516::LogicalTimeInterval &
-LogicalTimeIntervalDouble::operator+=(rti1516::LogicalTimeInterval const &
addend)
-throw (rti1516::InvalidLogicalTimeInterval)
-{
- return *this;
-}
-
-rti1516::LogicalTimeInterval &
-LogicalTimeIntervalDouble::operator-=(rti1516::LogicalTimeInterval const &
subtrahend)
-throw (rti1516::InvalidLogicalTimeInterval)
-{
- return *this;
-}
-
-
-
-
-
-
-
-LogicalTimeIntervalDoubleFactory::~LogicalTimeIntervalDoubleFactory()
- throw ()
-{
-}
-
-
-
-/*
-LogicalTimeIntervalFactoryDouble::~LogicalTimeIntervalFactoryDouble()
- throw ()
-{
-}
-
-std::auto_ptr< rti1516::LogicalTimeInterval >
LogicalTimeIntervalFactoryDouble::makeZero()
- throw (rti1516::InternalError)
-{
- return std::auto_ptr< rti1516::LogicalTimeInterval >(new
LogicalTimeIntervalDouble((int64_t)0));
-}
-
-std::auto_ptr< rti1516::LogicalTimeInterval >
LogicalTimeIntervalFactoryDouble::epsilon()
- throw (rti1516::InternalError)
-{
- return std::auto_ptr< rti1516::LogicalTimeInterval >(new
LogicalTimeIntervalDouble((int64_t)1));
-}
-
-std::auto_ptr< rti1516::LogicalTimeInterval >
LogicalTimeIntervalFactoryDouble::decode(rti1516::EncodedLogicalTimeInterval
const & encodedLogicalTimeInterval)
- // throw (InternalError, CouldNotDecode)
- throw ()
-{
- int64_t value = 0;
- unsigned char* buf = (unsigned char*)encodedLogicalTimeInterval.data();
- int pos = 0;
- value = (value << 8) | buf[pos++];
- value = (value << 8) | buf[pos++];
- value = (value << 8) | buf[pos++];
- value = (value << 8) | buf[pos++];
- value = (value << 8) | buf[pos++];
- value = (value << 8) | buf[pos++];
- value = (value << 8) | buf[pos++];
- value = (value << 8) | buf[pos++];
- return std::auto_ptr< rti1516::LogicalTimeInterval >(new
LogicalTimeIntervalDouble(value));
-}
-*/
Index: RTI1516ambassador.h
===================================================================
RCS file: RTI1516ambassador.h
diff -N RTI1516ambassador.h
--- RTI1516ambassador.h 16 Sep 2013 14:14:37 -0000 1.3
+++ /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 28 Apr 2010 18:48:30 -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: RTI1516ambPrivateRefs.h
===================================================================
RCS file: RTI1516ambPrivateRefs.h
diff -N RTI1516ambPrivateRefs.h
--- RTI1516ambPrivateRefs.h 28 Apr 2010 18:48:30 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,63 +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 2010/04/28 18:48:30 erk Exp $
-// ----------------------------------------------------------------------------
-
-#include <RTI/certiRTI1516.h>
-//#include "fedtime.hh"
-#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 2010/04/28 18:48:30 erk Exp $
Index: RTI1516exception.cpp
===================================================================
RCS file: RTI1516exception.cpp
diff -N RTI1516exception.cpp
--- RTI1516exception.cpp 1 Feb 2012 16:25:35 -0000 1.2
+++ /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: RTI1516ambassadorFactory.cpp
===================================================================
RCS file: RTI1516ambassadorFactory.cpp
diff -N RTI1516ambassadorFactory.cpp
--- RTI1516ambassadorFactory.cpp 27 Oct 2011 07:59:51 -0000 1.7
+++ /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: RTI1516HandleFactory.cpp
===================================================================
RCS file: RTI1516HandleFactory.cpp
diff -N RTI1516HandleFactory.cpp
--- RTI1516HandleFactory.cpp 28 Apr 2010 18:48:30 -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: RTIambassador.cc
===================================================================
RCS file: RTIambassador.cc
diff -N RTIambassador.cc
--- RTIambassador.cc 27 Oct 2011 07:59:51 -0000 3.128
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,2861 +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: RTIambassador.cc,v 3.128 2011/10/27 07:59:51 erk Exp $
-// ----------------------------------------------------------------------------
-
-#include "RTI.hh"
-#include "fedtime.hh"
-
-#include "RTIambPrivateRefs.hh"
-#include "RTItypesImp.hh"
-
-#include "Message.hh"
-#include "M_Classes.hh"
-#include "PrettyDebug.hh"
-
-#include "config.h"
-
-#ifdef _WIN32
-#include <stdio.h>
-#include <string.h>
-#else
-#include <unistd.h>
-#endif
-#include <cstdlib>
-#include <iostream>
-#include <signal.h>
-#include <cassert>
-#include <cerrno>
-#include <typeinfo>
-#include <memory>
-
-#ifdef CERTI_REALTIME_EXTENSIONS
-#ifdef _WIN32
-#error "CERTI Realtime extensions are not currently supported on Windows"
-#else
-#include <sched.h>
-#include <sys/mman.h>
-#endif
-#endif
-
-using std::cout ;
-using std::cerr ;
-using std::endl ;
-
-namespace {
-
-static PrettyDebug D("LIBRTI", __FILE__);
-static PrettyDebug G("GENDOC",__FILE__) ;
-
-using namespace certi ;
-
-std::vector<certi::RegionHandle>
-build_region_handles(RTI::Region **regions, int nb)
-throw (RTI::RegionNotKnown)
-{
- std::vector<certi::RegionHandle> vect(nb);
- for (int i = 0 ; i < nb ; ++i) {
- RTI::Region *region = regions[i] ;
- try {
- vect[i] = dynamic_cast<RegionImp
*>(region)->getHandle();
- }
- catch (std::bad_cast) {
- throw RTI::RegionNotKnown("");
- }
- }
- return vect ;
-} /* end of build_region_handles */
-
-RTI::Handle
-get_handle(const RTI::Region ®ion)
-throw (RTI::RegionNotKnown, RTI::RTIinternalError)
-{
- try {
- return dynamic_cast<const RegionImp &>(region).getHandle();
- }
- catch (std::bad_cast) {
- throw RTI::RegionNotKnown("");
- }
- throw RTI::RTIinternalError("");
-} /* end of get_handle */
-
-char *
-hla_strdup(const std::string &s)
-throw (RTI::RTIinternalError)
-{
- try {
- size_t len = s.length();
- // the HLA 1.3 standard defines, that char* must be free-ed by
delete[]
- char *result = new char[len+1];
- strncpy(result, s.c_str(), len);
- result[len] = '\0';
-
- return result;
- }
- catch (std::bad_alloc&) {
- throw RTI::RTIinternalError("Cannot allocate memory.");
- }
- throw RTI::RTIinternalError("");
-} /* end of hla_strdup */
-
-template<typename T>
-void
-assignAHVToRequest(const std::vector<RTI::AttributeHandle>& AHV, T& request) {
- request.setAttributesSize(AHV.size());
- for (uint32_t i=0;i<AHV.size();++i) {
- request.setAttributes(AHV[i],i);
- }
-} /* end of assignAHVToRequest */
-
-template<typename T>
-void
-assignAHVPSToRequest(const std::vector<std::pair<RTI::AttributeHandle,
AttributeValue_t> >& AHVPSv, T& request) {
-
- uint32_t size = AHVPSv.size();
- request.setAttributesSize(size);
- request.setValuesSize(size);
-
- for (uint32_t i = 0 ; i < size ; ++i) {
- // FIXME why iterate from the end?
- request.setAttributes(AHVPSv[size-1-i].first,i);
- request.setValues(AHVPSv[size-1-i].second,i);
- }
-} /* end of assignAHVPSToRequest */
-
-template<typename T>
-void
-assignPHVPSToRequest(const std::vector<std::pair<RTI::ParameterHandle,
ParameterValue_t> > &PHVPSv, T& request) {
-
- uint32_t size = PHVPSv.size();
- request.setParametersSize(size);
- request.setValuesSize(size);
-
- for (uint32_t i = 0 ; i < size ; ++i) {
- // FIXME why iterate from the end?
- request.setParameters(PHVPSv[size-1-i].first,i);
- request.setValues(PHVPSv[size-1-i].second,i);
- }
-} /* end of assignPHVPSToRequest */
-} // anonymous namespace
-
-// ----------------------------------------------------------------------------
-//! Start RTIambassador processes for communication with RTIG.
-/*! When a new RTIambassador is created in the application, a new process rtia
- is launched. This process is used for data exchange with rtig server.
- This process connects to rtia after one second delay (UNIX socket).
- */
-
-RTI::RTIambassador::RTIambassador()
-throw (RTI::MemoryExhausted, RTI::RTIinternalError)
-{
- G.Out(pdGendoc,"enter RTIambassador::RTIambassador");
- PrettyDebug::setFederateName( "LibRTI::UnjoinedFederate" );
- std::stringstream msg;
-
- privateRefs = new RTIambPrivateRefs();
-
- privateRefs->socketUn = new SocketUN(stIgnoreSignal);
-
- 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 = privateRefs->socketUn->listenUN();
- if (port == -1) {
- D.Out( pdError, "Cannot listen to RTIA connection. Abort." );
- throw RTI::RTIinternalError( "Cannot listen to RTIA connection"
);
- }
-#else
- int pipeFd = privateRefs->socketUn->socketpair();
- if (pipeFd == -1) {
- D.Out( pdError, "Cannot get socketpair to RTIA connection.
Abort." );
- throw RTI::RTIinternalError( "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)) {
- D.Out( pdError, "Cannot duplicate socket for RTIA connection.
Abort." );
- throw RTI::RTIinternalError( "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 RTI::RTIinternalError(msg.str().c_str());
- }
-
- 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((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 RTI::RTIinternalError("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)
- << endl
- << "Maybe RTIA is not in search PATH
environment.";
- throw RTI::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 (privateRefs->socketUn->acceptUN(10*1000) == -1) {
-#ifdef _WIN32
- TerminateProcess(privateRefs->handle_RTIA, 0);
-#else
- kill( privateRefs->pid_RTIA, SIGINT );
-#endif
- throw RTI::RTIinternalError( "Cannot connect to RTIA" );
- }
-#endif
-
- M_Open_Connexion req, rep ;
- req.setVersionMajor(CERTI_Message::versionMajor);
- req.setVersionMinor(CERTI_Message::versionMinor);
-
- G.Out(pdGendoc," ====>executeService OPEN_CONNEXION");
- privateRefs->executeService(&req, &rep);
-
- G.Out(pdGendoc,"exit RTIambassador::RTIambassador");
-}
-
-// ----------------------------------------------------------------------------
-//! Closes processes.
-/*! When destructor is called, kill rtia process.
- */
-RTI::RTIambassador::~RTIambassador()
-throw (RTI::RTIinternalError)
-{
- 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
-
- //TerminateProcess(privateRefs->handle_RTIA, 0);
-
- delete privateRefs;
-}
-
-// ----------------------------------------------------------------------------
-RTI::Boolean
-RTI::RTIambassador::tick()
-throw (RTI::SpecifiedSaveLabelDoesNotExist,
- RTI::ConcurrentAccessAttempted,
- RTI::RTIinternalError)
- {
-#if defined(LEGACY_LIBRTI)
- __tick_kernel(RTI_FALSE, 0.0, 0.0);
-#elif defined (HLA13NG_LIBRTI)
- // may suffer from starving
- __tick_kernel(RTI_TRUE, 0.0, std::numeric_limits<double>::infinity());
-#else
-#error "At least one LIBRTI flag must be defined."
-#endif
- return RTI_FALSE;
- }
-
-// ----------------------------------------------------------------------------
-RTI::Boolean
-RTI::RTIambassador::tick2()
-throw (RTI::SpecifiedSaveLabelDoesNotExist,
- RTI::ConcurrentAccessAttempted,
- RTI::RTIinternalError)
- {
- __tick_kernel(RTI_FALSE, std::numeric_limits<double>::infinity(), 0.0);
- return RTI_FALSE;
- }
-
-// ----------------------------------------------------------------------------
-RTI::Boolean
-RTI::RTIambassador::__tick_kernel(RTI::Boolean multiple, TickTime minimum,
TickTime maximum)
-throw (RTI::SpecifiedSaveLabelDoesNotExist,
- RTI::ConcurrentAccessAttempted,
- RTI::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;
-
- throw RTI::RTIinternalError(msg.str().c_str());
- }
-
- // 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;
- throw RTI::RTIinternalError(msg.str().c_str());
- }
-
- // 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
RTI::Boolean(static_cast<M_Tick_Request*>(vers_Fed.get())->getMultiple());
- }
-
- try {
- // Otherwise, the RTI calls a FederateAmbassador service.
- privateRefs->callFederateAmbassador(vers_Fed.get());
- }
- catch (RTI::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;
-
- throw RTI::RTIinternalError(msg.str().c_str());
- }
- } // while(1)
- // This statement may never be reached but it please the compiler
- // for 'non void function with no return'
- return RTI::Boolean(false);
- }
-
-// ----------------------------------------------------------------------------
-RTI::Boolean
-RTI::RTIambassador::tick(TickTime minimum, TickTime maximum)
-throw (RTI::SpecifiedSaveLabelDoesNotExist, RTI::ConcurrentAccessAttempted,
- RTI::RTIinternalError)
- {
- return __tick_kernel(RTI_TRUE, minimum, maximum);
- }
-
-#ifdef CERTI_REALTIME_EXTENSIONS
-// ----------------------------------------------------------------------------
-void
-RTI::RTIambassador::setPriorityforRTIAProcess(int priority, unsigned int
sched_type)
- throw(RTIinternalError) {
-
-#ifdef _WIN32
- throw RTIinternalError("Not Implemented on Windows");
-#else
- struct sched_param sparm ;
- int cr ;
-
- sparm.sched_priority = priority ;
- cr = sched_setscheduler(privateRefs->pid_RTIA,sched_type,&sparm);
- if (cr !=0) {
- throw RTIinternalError("RTIA process changing priority did not work");
- if (errno==EPERM) {
- throw RTIinternalError("The calling process has no SU permission for
that") ;
- }
- else if (errno==ESRCH){
- throw RTIinternalError( "The process id does not exist") ;
- }
- throw RTIinternalError( "Unknown policy specified") ;
- }
-#endif
-}
-
-// ----------------------------------------------------------------------------
-void
-RTI::RTIambassador::setAffinityforRTIAProcess(cpu_set_t mask)
- throw(RTIinternalError) {
-#ifdef _WIN32
- throw RTIinternalError("Not Implemented on Windows");
-#else
-if (sched_setaffinity(privateRefs->pid_RTIA, sizeof(cpu_set_t), &mask))
- throw RTIinternalError( "RTIA process Error : sched_setaffinity") ;
-#endif
-}
-#endif
-
-// ----------------------------------------------------------------------------
-//! Get Region Token.
-RTI::RegionToken
-RTI::RTIambassador::getRegionToken(Region *region)
-throw (RTI::FederateNotExecutionMember, RTI::ConcurrentAccessAttempted,
- RTI::RegionNotKnown, RTI::RTIinternalError)
- {
- return get_handle(*region);
- }
-
-// ----------------------------------------------------------------------------
-//! Get Region.
-RTI::Region *
-RTI::RTIambassador::getRegion(RegionToken)
-throw (RTI::FederateNotExecutionMember, RTI::ConcurrentAccessAttempted,
- RTI::RegionNotKnown, RTI::RTIinternalError)
- {
- throw RTI::RTIinternalError("unimplemented service getRegion");
- }
-
-// ----------------------------------------------------------------------------
-// Create Federation Execution.
-/** Realization of the Create Federation Execution federation management
service
- (HLA 1.3).
- Send a CREATE_FEDERATION_EXECUTION request type to inform rtia process a
- new federation is being created.
- @param executionName execution name of the federation to be created
- @param FED FED file name (path seen by rtig)
- */
-void
-//RTI::
-RTI::RTIambassador::createFederationExecution(const char *executionName,
- const char *FED)
-throw (RTI::RTIinternalError, RTI::ConcurrentAccessAttempted,
- RTI::ErrorReadingFED, RTI::CouldNotOpenFED,
- RTI::FederationExecutionAlreadyExists)
- {
- M_Create_Federation_Execution req, rep ;
-
- G.Out(pdGendoc,"enter RTIambassador::createFederationExecution");
-
- req.setFederationName(executionName);
- req.setFEDid(FED);
-
- /*#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 RTIambassador::createFederationExecution");
-
- }
-
-// ----------------------------------------------------------------------------
-// Destroy Federation Execution.
-/** Realization of the Destroy Federation Execution federation management
service
- (HLA 1.3).
- Send a DESTROY_FEDERATION_EXECUTION request type to remove a federation
- execution from the RTI set of federation executions.
- \param executionName execution name of the federation to be destroyed
- */
-void
-RTI::RTIambassador::destroyFederationExecution(const char *executionName)
-throw (RTI::RTIinternalError, RTI::ConcurrentAccessAttempted,
- RTI::FederationExecutionDoesNotExist,
RTI::FederatesCurrentlyJoined)
- {
- M_Destroy_Federation_Execution req, rep ;
-
- G.Out(pdGendoc,"enter RTIambassador::destroyFederationExecution");
-
- req.setFederationName(executionName);
-
- G.Out(pdGendoc," ====>executeService
DESTROY_FEDERATION_EXECUTION");
-
- privateRefs->executeService(&req, &rep);
-
- G.Out(pdGendoc,"exit RTIambassador::destroyFederationExecution");
-
- }
-
-// ----------------------------------------------------------------------------
-//! Join Federation Execution.
-RTI::FederateHandle
-RTI::RTIambassador::joinFederationExecution(const char *yourName,
- const char *executionName,
- FederateAmbassadorPtr fedamb)
-throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
- RTI::ConcurrentAccessAttempted, RTI::ErrorReadingFED,
RTI::CouldNotOpenFED,
- RTI::FederationExecutionDoesNotExist,
RTI::FederateAlreadyExecutionMember)
- {
- M_Join_Federation_Execution req, rep ;
-
- G.Out(pdGendoc,"enter RTIambassador::joinFederationExecution");
-
- if ( yourName == NULL || strlen(yourName) == 0 )
- throw RTI::RTIinternalError("Incorrect or empty federate name");
- if ( executionName == NULL || strlen(executionName) == 0 )
- throw RTI::RTIinternalError("Incorrect or empty federation
name");
-
- privateRefs->fed_amb = (FederateAmbassador *) fedamb ;
-
- req.setFederateName(yourName);
- req.setFederationName(executionName);
- G.Out(pdGendoc," ====>executeService JOIN_FEDERATION_EXECUTION");
- privateRefs->executeService(&req, &rep);
- G.Out(pdGendoc,"exit RTIambassador::joinFederationExecution");
- PrettyDebug::setFederateName( "LibRTI::"+std::string(yourName));
- return rep.getFederate();
- }
-
-// ----------------------------------------------------------------------------
-//! Resign Federation Execution.
-void
-RTI::RTIambassador::resignFederationExecution(ResignAction theAction)
-throw (RTI::FederateOwnsAttributes,
- RTI::FederateNotExecutionMember,
- RTI::InvalidResignAction,
- RTI::ConcurrentAccessAttempted,
- RTI::RTIinternalError)
- {
- M_Resign_Federation_Execution req, rep ;
-
- G.Out(pdGendoc,"enter RTIambassador::resignFederationExecution");
-
- req.setResignAction(static_cast<certi::ResignAction>(theAction));
-
- G.Out(pdGendoc," ====>executeService
RESIGN_FEDERATION_EXECUTION");
- privateRefs->executeService(&req, &rep);
-
- G.Out(pdGendoc,"exit RTIambassador::resignFederationExecution");
-
- }
-
-void
-RTI::RTIambassador::registerFederationSynchronizationPoint(const char *label,
- const char *the_tag)
-throw (RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::SaveInProgress,
- RTI::RestoreInProgress,
- RTI::RTIinternalError) {
- M_Register_Federation_Synchronization_Point req, rep ;
-
- G.Out(pdGendoc,"enter
RTIambassador::registerFederationSynchronizationPoint for all federates");
-
- req.setLabel(label);
- // no federate set
- req.setFederateSetSize(0);
- if ( the_tag == NULL )
- {
- throw RTI::RTIinternalError ("Calling
registerFederationSynchronizationPoint with Tag NULL");
- }
- req.setTag(the_tag);
- G.Out(pdGendoc," ====>executeService
REGISTER_FEDERATION_SYNCHRONIZATION_POINT");
- privateRefs->executeService(&req, &rep);
-
- G.Out(pdGendoc,"exit
RTIambassador::registerFederationSynchronizationPoint for all federates");
-
-} /* end of RTI::RTIambassador::registerFederationSynchronizationPoint */
-
-void
-RTI::RTIambassador::registerFederationSynchronizationPoint(const char *label,
- const char *theTag,
- const FederateHandleSet &set_of_fed)
-throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
- RTI::ConcurrentAccessAttempted,
RTI::FederateNotExecutionMember) {
-
- M_Register_Federation_Synchronization_Point req, rep ;
-
- G.Out(pdGendoc,"enter
RTIambassador::registerFederationSynchronizationPoint for some federates");
-
- req.setLabel(label);
- if ( theTag == NULL )
- {
- throw RTI::RTIinternalError ("Calling
registerFederationSynchronizationPoint with Tag NULL");
- }
- req.setTag(theTag);
- // 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(set_of_fed.size());
- for (uint32_t i=0 ; i<set_of_fed.size() ; i++) {
- req.setFederateSet(set_of_fed.getHandle(i),i);
- }
-
- G.Out(pdGendoc," ====>executeService
REGISTER_FEDERATION_SYNCHRONIZATION_POINT");
- privateRefs->executeService(&req, &rep);
-
- G.Out(pdGendoc,"exit
RTIambassador::registerFederationSynchronizationPoint for some federates");
-
-} /* end of RTI::RTIambassador::registerFederationSynchronizationPoint */
-
-// ----------------------------------------------------------------------------
-//! Synchronization Point Achieved
-void
-RTI::RTIambassador::synchronizationPointAchieved(const char *label)
-throw (RTI::SynchronizationPointLabelWasNotAnnounced,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::SaveInProgress,
- RTI::RestoreInProgress,
- RTI::RTIinternalError)
- {
- M_Synchronization_Point_Achieved req, rep ;
-
- G.Out(pdGendoc,"enter RTIambassador::synchronizationPointAchieved");
-
- req.setLabel(label);
- G.Out(pdGendoc," ====>executeService
SYNCHRONIZATION_POINT_ACHIEVED");
- privateRefs->executeService(&req, &rep);
-
- G.Out(pdGendoc,"exit RTIambassador::synchronizationPointAchieved");
- }
-
-// ----------------------------------------------------------------------------
-//! Request Federation Save with time.
-void
-RTI::RTIambassador::requestFederationSave(const char *label,
- const RTI::FedTime& theTime)
-throw (RTI::FederationTimeAlreadyPassed,
- RTI::InvalidFederationTime,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::SaveInProgress,
- RTI::RestoreInProgress,
- RTI::RTIinternalError)
- {
- M_Request_Federation_Save req, rep ;
-
- G.Out(pdGendoc,"enter RTIambassador::requestFederationSave with time");
-
- req.setDate(certi_cast<RTIfedTime>()(theTime).getTime());
- req.setLabel(label);
-
- G.Out(pdGendoc," ====>executeService REQUEST_FEDERATION_SAVE");
- privateRefs->executeService(&req, &rep);
-
- G.Out(pdGendoc,"exit RTIambassador::requestFederationSave with time");
- }
-
-// ----------------------------------------------------------------------------
-//! Request Federation Save without time.
-void
-RTI::RTIambassador::requestFederationSave(const char *label)
-throw (RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::SaveInProgress,
- RTI::RestoreInProgress,
- RTI::RTIinternalError)
- {
- M_Request_Federation_Save req, rep ;
-
- G.Out(pdGendoc,"enter RTIambassador::requestFederationSave without
time");
-
- req.setLabel(label);
- G.Out(pdGendoc," ====>executeService REQUEST_FEDERATION_SAVE");
-
- privateRefs->executeService(&req, &rep);
- G.Out(pdGendoc,"exit RTIambassador::requestFederationSave without
time");
- }
-
-// ----------------------------------------------------------------------------
-//! Federate Save Begun.
-void
-RTI::RTIambassador::federateSaveBegun()
-throw (RTI::SaveNotInitiated,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::RestoreInProgress,
- RTI::RTIinternalError)
- {
- M_Federate_Save_Begun req, rep ;
-
- G.Out(pdGendoc,"enter RTIambassador::federateSaveBegun");
-
- G.Out(pdGendoc," ====>executeService FEDERATE_SAVE_BEGUN");
- privateRefs->executeService(&req, &rep);
-
- G.Out(pdGendoc,"exit RTIambassador::federateSaveBegun");
- }
-
-// ----------------------------------------------------------------------------
-//! Federate Save Complete.
-void
-RTI::RTIambassador::federateSaveComplete()
-throw (RTI::SaveNotInitiated,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::RestoreInProgress,
- RTI::RTIinternalError)
- {
- M_Federate_Save_Complete req, rep ;
-
- G.Out(pdGendoc,"enter RTIambassador::federateSaveComplete");
- G.Out(pdGendoc," ====>executeService FEDERATE_SAVE_COMPLETE");
- privateRefs->executeService(&req, &rep);
- G.Out(pdGendoc,"exit RTIambassador::federateSaveComplete");
- }
-
-// ----------------------------------------------------------------------------
-// Federate Save Not Complete.
-void
-RTI::RTIambassador::federateSaveNotComplete()
-throw (RTI::SaveNotInitiated,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::RestoreInProgress,
- RTI::RTIinternalError)
- {
-
- M_Federate_Save_Not_Complete req, rep ;
-
- G.Out(pdGendoc,"enter RTIambassador::federateSaveNotComplete");
- G.Out(pdGendoc," ====>executeService FEDERATE_SAVE_NOT_COMPLETE");
- privateRefs->executeService(&req, &rep);
-
- G.Out(pdGendoc,"exit RTIambassador::federateSaveNotComplete");
- }
-
-// ----------------------------------------------------------------------------
-//! Request Restore.
-void
-RTI::RTIambassador::requestFederationRestore(const char *label)
-throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
- RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember)
- {
- M_Request_Federation_Restore req, rep ;
-
- G.Out(pdGendoc,"enter RTIambassador::requestFederationRestore");
- req.setLabel(label);
- G.Out(pdGendoc," ====>executeService REQUEST_FEDERATION_RESTORE");
- privateRefs->executeService(&req, &rep);
- G.Out(pdGendoc,"exit RTIambassador::requestFederationRestore");
- }
-
-// ----------------------------------------------------------------------------
-//! Restore Complete.
-void
-RTI::RTIambassador::federateRestoreComplete()
-throw (RTI::RTIinternalError, RTI::SaveInProgress,
- RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
- RTI::RestoreNotRequested)
- {
- M_Federate_Restore_Complete req, rep ;
-
- G.Out(pdGendoc,"enter RTIambassador::federateRestoreComplete");
-
- G.Out(pdGendoc," ====>executeService FEDERATE_RESTORE_COMPLETE");
- privateRefs->executeService(&req, &rep);
- G.Out(pdGendoc,"exit RTIambassador::federateRestoreComplete");
- }
-
-// ----------------------------------------------------------------------------
-//! Federate Restore Not Complete.
-void
-RTI::RTIambassador::federateRestoreNotComplete()
-throw (RTI::RTIinternalError, RTI::SaveInProgress,
- RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
- RTI::RestoreNotRequested)
- {
- M_Federate_Restore_Not_Complete req, rep ;
-
- G.Out(pdGendoc,"enter RTIambassador::federateRestoreNotComplete");
- G.Out(pdGendoc," ====>executeService
FEDERATE_RESTORE_NOT_COMPLETE");
-
- privateRefs->executeService(&req, &rep);
- G.Out(pdGendoc,"exit RTIambassador::federateRestoreNotComplete");
- }
-
-// ----------------------------------------------------------------------------
-// Publish Object Class
-void
-RTI::RTIambassador::publishObjectClass(ObjectClassHandle theClass,
- const AttributeHandleSet& attributeList)
-throw (RTI::RTIinternalError,
- RTI::RestoreInProgress, RTI::SaveInProgress,
RTI::ConcurrentAccessAttempted,
- RTI::FederateNotExecutionMember,
RTI::OwnershipAcquisitionPending,
- RTI::AttributeNotDefined, RTI::ObjectClassNotDefined)
- {
- M_Publish_Object_Class req, rep ;
- const std::vector<unsigned long>& AHSI =
certi_cast<AttributeHandleSetImp>()(attributeList).getAttributeHandles();
- G.Out(pdGendoc,"enter RTIambassador::publishObjectClass");
-
- req.setObjectClass(theClass);
- req.setAttributesSize(AHSI.size());
- for (uint32_t i=0; i<AHSI.size(); ++i) {
- req.setAttributes(AHSI[i],i);
- }
- G.Out(pdGendoc," ====>executeService PUBLISH_OBJECT_CLASS");
- privateRefs->executeService(&req, &rep);
- G.Out(pdGendoc,"exit RTIambassador::publishObjectClass");
- }
-
-// ----------------------------------------------------------------------------
-// UnPublish Object Class
-void
-RTI::RTIambassador::unpublishObjectClass(ObjectClassHandle theClass)
-throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
- RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
- RTI::OwnershipAcquisitionPending, RTI::ObjectClassNotPublished,
- RTI::ObjectClassNotDefined)
- {
- M_Unpublish_Object_Class req, rep ;
-
- G.Out(pdGendoc,"enter RTIambassador::unpublishObjectClass");
- req.setObjectClass(theClass);
- G.Out(pdGendoc," ====>executeService UNPUBLISH_OBJECT_CLASS");
- privateRefs->executeService(&req, &rep);
- G.Out(pdGendoc,"exit RTIambassador::unpublishObjectClass");
- }
-
-
-// ----------------------------------------------------------------------------
-// Publish Interaction Class
-void
-RTI::RTIambassador::publishInteractionClass(InteractionClassHandle
theInteraction)
-throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
- RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
- RTI::InteractionClassNotDefined)
- {
- M_Publish_Interaction_Class req, rep ;
-
- req.setInteractionClass(theInteraction);
- G.Out(pdGendoc," ====>executeService PUBLISH_INTERACTION_CLASS");
- privateRefs->executeService(&req, &rep);
- }
-
-// ----------------------------------------------------------------------------
-// Publish Interaction Class
-void
-RTI::RTIambassador::unpublishInteractionClass(InteractionClassHandle
theInteraction)
-throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
- RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
- RTI::InteractionClassNotPublished,
RTI::InteractionClassNotDefined)
- {
- M_Unpublish_Interaction_Class req, rep ;
-
- req.setInteractionClass(theInteraction);
- privateRefs->executeService(&req, &rep);
- }
-
-// ----------------------------------------------------------------------------
-// Subscribe Object Class Attributes
-void
-RTI::RTIambassador::
-subscribeObjectClassAttributes(ObjectClassHandle theClass,
- const AttributeHandleSet& attributeList,
- RTI::Boolean active)
-throw (RTI::RTIinternalError,
- RTI::RestoreInProgress, RTI::SaveInProgress,
RTI::ConcurrentAccessAttempted,
- RTI::FederateNotExecutionMember, RTI::AttributeNotDefined,
- RTI::ObjectClassNotDefined)
- {
- M_Subscribe_Object_Class_Attributes req, rep ;
- G.Out(pdGendoc,"enter RTIambassador::subscribeObjectClassAttributes");
- const std::vector<unsigned long>& AHSI =
certi_cast<AttributeHandleSetImp>()(attributeList).getAttributeHandles();
-
- req.setObjectClass(theClass);
- req.setAttributesSize(AHSI.size());
- for (uint32_t i=0; i<AHSI.size();++i) {
- req.setAttributes(AHSI[i],i);
- }
- req.setActive(active);
-
- privateRefs->executeService(&req, &rep);
- G.Out(pdGendoc,"exit RTIambassador::subscribeObjectClassAttributes");
- }
-
-// ----------------------------------------------------------------------------
-// UnSubscribe Object Class Attribute
-void
-RTI::RTIambassador::unsubscribeObjectClass(ObjectClassHandle theClass)
-throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
- RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
- RTI::ObjectClassNotSubscribed, RTI::ObjectClassNotDefined)
- {
- M_Unsubscribe_Object_Class req, rep ;
-
- req.setObjectClass(theClass);
- privateRefs->executeService(&req, &rep);
- }
-
-
-// ----------------------------------------------------------------------------
-// Subscribe Interaction Class
-void
-RTI::RTIambassador::subscribeInteractionClass(InteractionClassHandle theClass,
- RTI::Boolean /*active*/)
-throw (RTI::RTIinternalError, RTI::RestoreInProgress,
- RTI::SaveInProgress, RTI::FederateLoggingServiceCalls,
- RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
- RTI::InteractionClassNotDefined)
- {
- M_Subscribe_Interaction_Class req, rep ;
- req.setInteractionClass(theClass);
- privateRefs->executeService(&req, &rep);
- }
-
-// ----------------------------------------------------------------------------
-// UnSubscribe Interaction Class
-void
-RTI::RTIambassador::unsubscribeInteractionClass(InteractionClassHandle
theClass)
-throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
- RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
- RTI::InteractionClassNotSubscribed,
RTI::InteractionClassNotDefined)
- {
- M_Unsubscribe_Interaction_Class req, rep ;
-
- req.setInteractionClass(theClass);
- privateRefs->executeService(&req, &rep);
- }
-
-// ----------------------------------------------------------------------------
-// Register Object
-RTI::ObjectHandle
-RTI::RTIambassador::registerObjectInstance(ObjectClassHandle theClass,
- const char *theObjectName)
-throw (RTI::RTIinternalError, RTI::RestoreInProgress,
- RTI::SaveInProgress, RTI::ConcurrentAccessAttempted,
- RTI::FederateNotExecutionMember, RTI::ObjectAlreadyRegistered,
- RTI::ObjectClassNotPublished, RTI::ObjectClassNotDefined)
- {
- M_Register_Object_Instance req, rep ;
-
- req.setObjectName(theObjectName);
- req.setObjectClass(theClass);
- privateRefs->executeService(&req, &rep);
-
- return rep.getObject();
- }
-
-// ----------------------------------------------------------------------------
-RTI::ObjectHandle
-RTI::RTIambassador::registerObjectInstance(ObjectClassHandle theClass)
-throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
- RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
- RTI::ObjectClassNotPublished, RTI::ObjectClassNotDefined)
- {
- M_Register_Object_Instance req, rep ;
-
- req.setObjectClass(theClass);
- privateRefs->executeService(&req, &rep);
- return rep.getObject();
- }
-
-// ----------------------------------------------------------------------------
-// Update Attribute Values with time
-RTI::EventRetractionHandle
-RTI::RTIambassador::
-updateAttributeValues(ObjectHandle theObject,
- const AttributeHandleValuePairSet& theAttributes,
- const RTI::FedTime& theTime,
- const char *theTag)
-throw (RTI::ObjectNotKnown,
- RTI::AttributeNotDefined,
- RTI::AttributeNotOwned,
- RTI::InvalidFederationTime,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::SaveInProgress,
- RTI::RestoreInProgress,
- RTI::RTIinternalError)
- {
- G.Out(pdGendoc,"enter RTIambassador::updateAttributeValues with time");
- M_Update_Attribute_Values req, rep ;
- RTI::EventRetractionHandle_s eventRetraction;
- const std::vector<AttributeHandleValuePair_t>& AHVPS =
certi_cast<AttributeHandleValuePairSetImp>()(theAttributes).getAttributeHandleValuePairs();
- req.setObject(theObject);
- req.setDate(certi_cast<RTIfedTime>()(theTime).getTime());
- /*
- * Tolerate NULL tag (DMSO RTI-NG behavior)
- * by not transmitting the tag in the CERTI message.
- */
- if ( theTag != NULL) {
- req.setTag(theTag);
- }
- req.setAttributesSize(AHVPS.size());
- req.setValuesSize(AHVPS.size());
- for (uint32_t i=0;i<AHVPS.size();++i) {
- req.setAttributes(AHVPS[i].first,i);
- req.setValues(AHVPS[i].second,i);
- }
-
- privateRefs->executeService(&req, &rep);
- G.Out(pdGendoc,"return RTIambassador::updateAttributeValues with
time");
- eventRetraction.sendingFederate =
rep.getEventRetraction().getSendingFederate();
- eventRetraction.theSerialNumber = rep.getEventRetraction().getSN();
- return eventRetraction;
- }
-
-// ----------------------------------------------------------------------------
-void
-RTI::RTIambassador::updateAttributeValues(ObjectHandle the_object,
- const AttributeHandleValuePairSet& theAttributes,
- const char *theTag)
-throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
- RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
- RTI::AttributeNotOwned, RTI::AttributeNotDefined,
RTI::ObjectNotKnown)
- {
- G.Out(pdGendoc,"enter RTIambassador::updateAttributeValues without
time");
- M_Update_Attribute_Values req, rep ;
- const std::vector<AttributeHandleValuePair_t>& AHVPS =
certi_cast<AttributeHandleValuePairSetImp>()(theAttributes).getAttributeHandleValuePairs();
-
- req.setObject(the_object);
- /*
- * Tolerate NULL tag (DMSO RTI-NG behavior)
- * by not transmitting the tag in the CERTI message.
- */
- if ( theTag != NULL) {
- req.setTag(theTag);
- }
- req.setAttributesSize(AHVPS.size());
- req.setValuesSize(AHVPS.size());
- for (uint32_t i=0;i<AHVPS.size();++i) {
- req.setAttributes(AHVPS[i].first,i);
- req.setValues(AHVPS[i].second,i);
- }
- privateRefs->executeService(&req, &rep);
- G.Out(pdGendoc,"exit RTIambassador::updateAttributeValues without
time");
- }
-
-// ----------------------------------------------------------------------------
-RTI::EventRetractionHandle
-RTI::RTIambassador::sendInteraction(InteractionClassHandle theInteraction,
- const ParameterHandleValuePairSet& theParameters,
- const RTI::FedTime& theTime,
- const char *theTag)
-throw (RTI::InteractionClassNotDefined,
- RTI::InteractionClassNotPublished,
- RTI::InteractionParameterNotDefined,
- RTI::InvalidFederationTime,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::SaveInProgress,
- RTI::RestoreInProgress,
- RTI::RTIinternalError)
- {
- M_Send_Interaction req, rep ;
- RTI::EventRetractionHandle eventRetraction;
- req.setInteractionClass(theInteraction);
- req.setDate(certi_cast<RTIfedTime>()(theTime).getTime());
- /*
- * Tolerate NULL tag (DMSO RTI-NG behavior)
- * by not transmitting the tag in the CERTI message.
- */
- if ( theTag != NULL) {
- req.setTag(theTag);
- }
-
-
assignPHVPSToRequest(certi_cast<ParameterHandleValuePairSetImp>()(theParameters).getParameterHandleValuePairs(),req);
- req.setRegion(0);
-
- privateRefs->executeService(&req, &rep);
-
- eventRetraction.sendingFederate =
rep.getEventRetraction().getSendingFederate();
- eventRetraction.theSerialNumber = rep.getEventRetraction().getSN();
- return eventRetraction;
-
- }
-
-// ----------------------------------------------------------------------------
-/** Send Interaction without time
- This service (HLA 1.3) send an interaction into the federation.
- None is returned.
- @param theInteraction Interaction class designator
- @param theParameters Set of interaction parameters designator and value
pairs
- @param theTag User-supplied tag
- */
-void
-RTI::RTIambassador::sendInteraction(InteractionClassHandle theInteraction,
- const ParameterHandleValuePairSet &theParameters,
- const char *theTag)
-throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
- RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
- RTI::InteractionParameterNotDefined,
RTI::InteractionClassNotPublished,
- RTI::InteractionClassNotDefined)
- {
-
- M_Send_Interaction req, rep ;
-
- req.setInteractionClass(theInteraction);
- /*
- * Tolerate NULL tag (DMSO RTI-NG behavior)
- * by not transmitting the tag in the CERTI message.
- */
- if ( theTag != NULL) {
- req.setTag(theTag);
- }
-
-
assignPHVPSToRequest(certi_cast<ParameterHandleValuePairSetImp>()(theParameters).getParameterHandleValuePairs(),req);
- req.setRegion(0);
- privateRefs->executeService(&req, &rep);
-}
-
-// ----------------------------------------------------------------------------
-RTI::EventRetractionHandle
-RTI::RTIambassador::deleteObjectInstance(ObjectHandle theObject,
- const RTI::FedTime& theTime,
- const char *theTag)
-throw (RTI::ObjectNotKnown,
- RTI::DeletePrivilegeNotHeld,
- RTI::InvalidFederationTime,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::SaveInProgress,
- RTI::RestoreInProgress,
- RTI::RTIinternalError)
- {
- M_Delete_Object_Instance req, rep ;
- RTI::EventRetractionHandle eventRetraction;
-
- req.setObject(theObject);
- req.setDate(certi_cast<RTIfedTime>()(theTime).getTime());
- if (theTag == NULL)
- {
- throw RTI::RTIinternalError ("Calling deleteObjectInstance with
Tag NULL") ;
- }
- req.setTag(theTag);
-
- privateRefs->executeService(&req, &rep);
- eventRetraction.sendingFederate =
rep.getEventRetraction().getSendingFederate();
- eventRetraction.theSerialNumber =
rep.getEventRetraction().getSN();
- return eventRetraction;
-
- }
-
-// ----------------------------------------------------------------------------
-void
-RTI::RTIambassador::deleteObjectInstance(ObjectHandle theObject,
- const char *theTag)
-throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
- RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
- RTI::DeletePrivilegeNotHeld, RTI::ObjectNotKnown)
- {
- M_Delete_Object_Instance req, rep ;
-
- req.setObject(theObject);
- if (theTag == NULL)
- {
- throw RTI::RTIinternalError ("Calling deleteObjectInstance with
Tag NULL") ;
- }
- req.setTag(theTag);
- privateRefs->executeService(&req, &rep);
- }
-
-// ----------------------------------------------------------------------------
-// Local Delete Object Instance
-void
-RTI::RTIambassador::localDeleteObjectInstance(ObjectHandle theObject)
-throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
- RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
- RTI::FederateOwnsAttributes, RTI::ObjectNotKnown)
- {
- throw RTI::RTIinternalError("unimplemented service
localDeleteObjectInstance");
- M_Local_Delete_Object_Instance req, rep ;
-
- req.setObject(theObject);
- privateRefs->executeService(&req, &rep);
- }
-
-
-// ----------------------------------------------------------------------------
-// Change Attribute Transportation Type
-void
-RTI::RTIambassador::
-changeAttributeTransportationType(ObjectHandle theObject,
- const AttributeHandleSet& theAttributes,
- TransportationHandle theType)
-throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
- RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
- RTI::InvalidTransportationHandle, RTI::AttributeNotOwned,
- RTI::AttributeNotDefined, RTI::ObjectNotKnown)
- {
- M_Change_Attribute_Transportation_Type req, rep ;
- const std::vector<AttributeHandle>& AHS =
certi_cast<AttributeHandleSetImp>()(theAttributes).getAttributeHandles();
- req.setObject(theObject);
- req.setTransportationType(theType);
- req.setAttributesSize(AHS.size());
- for (uint32_t i=0;i<AHS.size();++i) {
- req.setAttributes(AHS[i],i);
- }
-
- privateRefs->executeService(&req, &rep);
- }
-
-// ----------------------------------------------------------------------------
-// Change Interaction Transportation Type
-void
-RTI::RTIambassador::
-changeInteractionTransportationType(InteractionClassHandle theClass,
- TransportationHandle theType)
-throw (RTI::RTIinternalError, RTI::RestoreInProgress,
- RTI::SaveInProgress, RTI::ConcurrentAccessAttempted,
- RTI::FederateNotExecutionMember,
RTI::InvalidTransportationHandle,
- RTI::InteractionClassNotPublished,
RTI::InteractionClassNotDefined)
- {
- M_Change_Interaction_Transportation_Type req, rep ;
-
- req.setInteractionClass(theClass);
- req.setTransportationType(theType);
-
- privateRefs->executeService(&req, &rep);
- }
-
-// ----------------------------------------------------------------------------
-// Request Attribute Value Update
-void
-RTI::RTIambassador::requestObjectAttributeValueUpdate(ObjectHandle theObject,
- const AttributeHandleSet &ahs)
-throw (RTI::RTIinternalError,
- RTI::RestoreInProgress, RTI::SaveInProgress,
RTI::ConcurrentAccessAttempted,
- RTI::FederateNotExecutionMember, RTI::AttributeNotDefined,
- RTI::ObjectNotKnown)
- {
- M_Request_Object_Attribute_Value_Update req, rep ;
-
- G.Out(pdGendoc,"enter
RTIambassador::requestObjectAttributeValueUpdate");
- req.setObject(theObject);
-
assignAHVToRequest(certi_cast<AttributeHandleSetImp>()(ahs).getAttributeHandles(),req);
-
- privateRefs->executeService(&req, &rep);
- G.Out(pdGendoc,"exit
RTIambassador::requestObjectAttributeValueUpdate");
- }
-
-// ----------------------------------------------------------------------------
-void
-RTI::RTIambassador::requestClassAttributeValueUpdate(ObjectClassHandle
theClass,
- const AttributeHandleSet &attrs)
-throw (RTI::RTIinternalError,
- RTI::RestoreInProgress, RTI::SaveInProgress,
RTI::ConcurrentAccessAttempted,
- RTI::FederateNotExecutionMember, RTI::AttributeNotDefined,
- RTI::ObjectClassNotDefined)
- {
-
- M_Request_Class_Attribute_Value_Update req, rep ;
- const std::vector<AttributeHandle>& AHSv =
certi_cast<AttributeHandleSetImp>()(attrs).getAttributeHandles();
- G.Out(pdGendoc,"enter RTIambassador::requestClassAttributeValueUpdate");
- req.setObjectClass(theClass);
- req.setAttributesSize(attrs.size());
- for (uint32_t i=0;i<attrs.size();++i) {
- req.setAttributes(AHSv[i],i);
- }
-
- privateRefs->executeService(&req, &rep);
- G.Out(pdGendoc,"exit RTIambassador::requestClassAttributeValueUpdate");
- }
-
-// ----------------------------------------------------------------------------
-// UnConditional Attribute Ownership Divestiture
-void
-RTI::RTIambassador::
-unconditionalAttributeOwnershipDivestiture(ObjectHandle theObject,
- const AttributeHandleSet &attrs)
-throw (RTI::ObjectNotKnown,
- RTI::AttributeNotDefined,
- RTI::AttributeNotOwned,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::SaveInProgress,
- RTI::RestoreInProgress,
- RTI::RTIinternalError)
- {
- M_Unconditional_Attribute_Ownership_Divestiture req, rep ;
- const std::vector<AttributeHandle>& AHSv =
certi_cast<AttributeHandleSetImp>()(attrs).getAttributeHandles();
- req.setObject(theObject);
-
- req.setAttributesSize(attrs.size());
- for (uint32_t i=0;i<attrs.size();++i) {
- req.setAttributes(AHSv[i],i);
- }
-
- privateRefs->executeService(&req, &rep);
- }
-
-// ----------------------------------------------------------------------------
-// Negotiated Attribute Ownership Divestiture
-void
-RTI::RTIambassador::
-negotiatedAttributeOwnershipDivestiture(ObjectHandle theObject,
- const AttributeHandleSet& attrs,
- const char *theTag)
-throw (RTI::ObjectNotKnown,
- RTI::AttributeNotDefined,
- RTI::AttributeNotOwned,
- RTI::AttributeAlreadyBeingDivested,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::SaveInProgress,
- RTI::RestoreInProgress,
- RTI::RTIinternalError) {
- M_Negotiated_Attribute_Ownership_Divestiture req, rep ;
- const std::vector<AttributeHandle>& AHSv =
certi_cast<AttributeHandleSetImp>()(attrs).getAttributeHandles();
-
- req.setObject(theObject);
- if (theTag == NULL) {
- throw RTI::RTIinternalError ("Calling
negotiatedAttributeOwnershipDivestiture with Tag NULL") ;
- }
- req.setTag(theTag);
- req.setAttributesSize(attrs.size());
- for (uint32_t i=0;i<attrs.size();++i) {
- req.setAttributes(AHSv[i],i);
- }
-
- privateRefs->executeService(&req, &rep);
-}
-
-// ----------------------------------------------------------------------------
-// Attribute Ownership Acquisition
-void
-RTI::RTIambassador::
-attributeOwnershipAcquisition(ObjectHandle theObject,
- const AttributeHandleSet& desiredAttributes,
- const char *theTag)
-throw (RTI::ObjectNotKnown,
- RTI::ObjectClassNotPublished,
- RTI::AttributeNotDefined,
- RTI::AttributeNotPublished,
- RTI::FederateOwnsAttributes,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::SaveInProgress,
- RTI::RestoreInProgress,
- RTI::RTIinternalError)
- {
- M_Attribute_Ownership_Acquisition req, rep ;
-
- req.setObject(theObject);
- if (theTag == NULL)
- {
- throw RTI::RTIinternalError ("Calling
attributeOwnershipAcquisition with Tag NULL") ;
- }
- req.setTag(theTag);
-
assignAHVToRequest(certi_cast<AttributeHandleSetImp>()(desiredAttributes).getAttributeHandles(),req);
- privateRefs->executeService(&req, &rep);
- }
-
-// ----------------------------------------------------------------------------
-// Attribute Ownership Release Response
-RTI::AttributeHandleSet*
-RTI::RTIambassador::
-attributeOwnershipReleaseResponse(ObjectHandle theObject,
- const AttributeHandleSet& attrs)
-throw (RTI::ObjectNotKnown,
- RTI::AttributeNotDefined,
- RTI::AttributeNotOwned,
- RTI::FederateWasNotAskedToReleaseAttribute,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::SaveInProgress,
- RTI::RestoreInProgress,
- RTI::RTIinternalError)
- {
- M_Attribute_Ownership_Release_Response req, rep ;
- AttributeHandleSetImp* retval;
-
- req.setObject(theObject);
-
assignAHVToRequest(certi_cast<AttributeHandleSetImp>()(attrs).getAttributeHandles(),req);
-
- privateRefs->executeService(&req, &rep);
-
- if (rep.getExceptionType() == e_NO_EXCEPTION) {
- retval = new AttributeHandleSetImp(rep.getAttributesSize());
- for (uint32_t i=0;i<rep.getAttributesSize();++i) {
- retval->add(rep.getAttributes()[i]);
- }
- return retval;
- }
-
- return NULL ;
- }
-
-// ----------------------------------------------------------------------------
-// Cancel Negotiated Attribute Ownership Divestiture
-void
-RTI::RTIambassador::
-cancelNegotiatedAttributeOwnershipDivestiture(ObjectHandle theObject,
- const AttributeHandleSet& attrs)
-throw (RTI::ObjectNotKnown,
- RTI::AttributeNotDefined,
- RTI::AttributeNotOwned,
- RTI::AttributeDivestitureWasNotRequested,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::SaveInProgress,
- RTI::RestoreInProgress,
- RTI::RTIinternalError)
- {
- M_Cancel_Negotiated_Attribute_Ownership_Divestiture req, rep ;
-
- req.setObject(theObject);
-
assignAHVToRequest(certi_cast<AttributeHandleSetImp>()(attrs).getAttributeHandles(),req);
-
- privateRefs->executeService(&req, &rep);
- }
-
-// ----------------------------------------------------------------------------
-// Cancel Attribute Ownership Acquisition
-void
-RTI::RTIambassador::
-cancelAttributeOwnershipAcquisition(ObjectHandle theObject,
- const AttributeHandleSet& attrs)
-throw (RTI::ObjectNotKnown,
- RTI::AttributeNotDefined,
- RTI::AttributeAlreadyOwned,
- RTI::AttributeAcquisitionWasNotRequested,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::SaveInProgress,
- RTI::RestoreInProgress,
- RTI::RTIinternalError)
- {
- M_Cancel_Attribute_Ownership_Acquisition req, rep ;
-
- req.setObject(theObject);
-
assignAHVToRequest(certi_cast<AttributeHandleSetImp>()(attrs).getAttributeHandles(),req);
-
- privateRefs->executeService(&req, &rep);
- }
-
-// ----------------------------------------------------------------------------
-// Attribute Ownership Acquisition If Available
-void
-RTI::RTIambassador::
-attributeOwnershipAcquisitionIfAvailable(ObjectHandle theObject,
- const AttributeHandleSet& desired)
-throw (RTI::ObjectNotKnown,
- RTI::ObjectClassNotPublished,
- RTI::AttributeNotDefined,
- RTI::AttributeNotPublished,
- RTI::FederateOwnsAttributes,
- RTI::AttributeAlreadyBeingAcquired,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::SaveInProgress,
- RTI::RestoreInProgress,
- RTI::RTIinternalError)
- {
- M_Attribute_Ownership_Acquisition_If_Available req, rep ;
-
- req.setObject(theObject);
-
assignAHVToRequest(certi_cast<AttributeHandleSetImp>()(desired).getAttributeHandles(),req);
-
- privateRefs->executeService(&req, &rep);
- }
-
-// ----------------------------------------------------------------------------
-// Query Attribute Ownership
-void
-RTI::RTIambassador::
-queryAttributeOwnership(ObjectHandle theObject,
- AttributeHandle theAttribute)
-throw (RTI::RTIinternalError, RTI::RestoreInProgress,
- RTI::SaveInProgress, RTI::ConcurrentAccessAttempted,
- RTI::FederateNotExecutionMember, RTI::AttributeNotDefined,
- RTI::ObjectNotKnown)
- {
- M_Query_Attribute_Ownership req, rep ;
-
- req.setObject(theObject);
- req.setAttribute(theAttribute);
-
- privateRefs->executeService(&req, &rep);
- }
-
-// ----------------------------------------------------------------------------
-// 5.16 Is Attribute Owned By Federate
-RTI::Boolean
-RTI::RTIambassador::isAttributeOwnedByFederate(ObjectHandle theObject,
- AttributeHandle theAttribute)
-throw (RTI::ObjectNotKnown,
- RTI::AttributeNotDefined,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::SaveInProgress,
- RTI::RestoreInProgress,
- RTI::RTIinternalError)
- {
- M_Is_Attribute_Owned_By_Federate req, rep ;
-
- req.setObject(theObject);
- req.setAttribute(theAttribute);
-
- privateRefs->executeService(&req, &rep);
-
- return (rep.getTag() == "RTI_TRUE") ? RTI_TRUE : RTI_FALSE;
- }
-
-// ----------------------------------------------------------------------------
-// Enable Time Regulation
-void
-RTI::RTIambassador::enableTimeRegulation(const RTI::FedTime& theFederateTime,
- const RTI::FedTime& theLookahead)
-throw (RTI::RTIinternalError, RTI::RestoreInProgress,
- RTI::SaveInProgress, RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted, RTI::InvalidLookahead,
- RTI::InvalidFederationTime, RTI::TimeAdvanceAlreadyInProgress,
- RTI::EnableTimeRegulationPending,
RTI::TimeRegulationAlreadyEnabled)
- {
- M_Enable_Time_Regulation req, rep ;
-
- req.setDate(certi_cast<RTIfedTime>()(theFederateTime).getTime());
- req.setLookahead(certi_cast<RTIfedTime>()(theLookahead).getTime());
-
- privateRefs->executeService(&req, &rep);
- }
-
-// ----------------------------------------------------------------------------
-// Disable Time Regulation
-void
-RTI::RTIambassador::disableTimeRegulation()
-throw (RTI::RTIinternalError,
- RTI::RestoreInProgress, RTI::SaveInProgress,
- RTI::FederateNotExecutionMember, RTI::ConcurrentAccessAttempted,
- RTI::TimeRegulationWasNotEnabled)
- {
- M_Disable_Time_Regulation req, rep ;
-
- privateRefs->executeService(&req, &rep);
- }
-
-// ----------------------------------------------------------------------------
-// Enable Time Constrained
-void
-RTI::RTIambassador::enableTimeConstrained()
-throw (RTI::TimeConstrainedAlreadyEnabled, //not implemented
- RTI::EnableTimeConstrainedPending, //not implemented
- RTI::TimeAdvanceAlreadyInProgress, //not implemented
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::SaveInProgress,
- RTI::RestoreInProgress,
- RTI::RTIinternalError)
- {
- M_Enable_Time_Constrained req, rep ;
-
- privateRefs->executeService(&req, &rep);
- }
-
-// ----------------------------------------------------------------------------
-// Disable Time Constrained
-void
-RTI::RTIambassador::disableTimeConstrained()
-throw (RTI::TimeConstrainedWasNotEnabled, //not implemented
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::SaveInProgress,
- RTI::RestoreInProgress,
- RTI::RTIinternalError)
- {
- M_Disable_Time_Constrained req, rep ;
- privateRefs->executeService(&req, &rep);
- }
-
-// ----------------------------------------------------------------------------
-// Time Advance Request
-void
-RTI::RTIambassador::timeAdvanceRequest(const RTI::FedTime& theTime)
-throw (RTI::TimeAdvanceAlreadyInProgress,
- RTI::FederationTimeAlreadyPassed,
- RTI::InvalidFederationTime,
- RTI::EnableTimeRegulationPending, //not implemented
- RTI::EnableTimeConstrainedPending, //not implemented
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::SaveInProgress,
- RTI::RestoreInProgress,
- RTI::RTIinternalError)
- {
- M_Time_Advance_Request req, rep ;
-
- req.setDate(certi_cast<RTIfedTime>()(theTime).getTime());
- privateRefs->executeService(&req, &rep);
- }
-
-// ----------------------------------------------------------------------------
-// Time Advance Request Available
-void
-RTI::RTIambassador::timeAdvanceRequestAvailable(const RTI::FedTime& theTime)
-throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
- RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
- RTI::EnableTimeConstrainedPending,
RTI::EnableTimeRegulationPending,
- RTI::TimeAdvanceAlreadyInProgress,
RTI::FederationTimeAlreadyPassed,
- RTI::InvalidFederationTime)
- {
- M_Time_Advance_Request_Available req, rep ;
-
- req.setDate(certi_cast<RTIfedTime>()(theTime).getTime());
-
- privateRefs->executeService(&req, &rep);
- }
-
-// ----------------------------------------------------------------------------
-// Next Event Request
-void
-RTI::RTIambassador::nextEventRequest(const RTI::FedTime& theTime)
-throw (RTI::TimeAdvanceAlreadyInProgress,
- RTI::FederationTimeAlreadyPassed,
- RTI::InvalidFederationTime,
- RTI::EnableTimeRegulationPending, //not implemented
- RTI::EnableTimeConstrainedPending, //not implemented
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::SaveInProgress,
- RTI::RestoreInProgress,
- RTI::RTIinternalError)
- {
- M_Next_Event_Request req, rep ;
-
- req.setDate(certi_cast<RTIfedTime>()(theTime).getTime());
- privateRefs->executeService(&req, &rep);
- }
-
-// ----------------------------------------------------------------------------
-// Next Event Request Available
-void
-RTI::RTIambassador::nextEventRequestAvailable(const RTI::FedTime& theTime)
-throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
- RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
- RTI::EnableTimeConstrainedPending,
RTI::EnableTimeRegulationPending,
- RTI::TimeAdvanceAlreadyInProgress,
RTI::FederationTimeAlreadyPassed,
- RTI::InvalidFederationTime)
- {
- M_Next_Event_Request_Available req, rep ;
-
- req.setDate(certi_cast<RTIfedTime>()(theTime).getTime());
- privateRefs->executeService(&req, &rep);
- }
-
-// ----------------------------------------------------------------------------
-// Flush Queue Request
-void
-RTI::RTIambassador::flushQueueRequest(const RTI::FedTime& theTime)
-throw (RTI::TimeAdvanceAlreadyInProgress,
- RTI::FederationTimeAlreadyPassed,
- RTI::InvalidFederationTime,
- RTI::EnableTimeRegulationPending, //not implemented
- RTI::EnableTimeConstrainedPending, //not implemented
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::SaveInProgress,
- RTI::RestoreInProgress,
- RTI::RTIinternalError)
- {
- throw RTI::RTIinternalError("Unimplemented Service flushQueueRequest");
- M_Flush_Queue_Request req, rep ;
-
- req.setDate(certi_cast<RTIfedTime>()(theTime).getTime());
-
- privateRefs->executeService(&req, &rep);
- }
-
-// ----------------------------------------------------------------------------
-// Enable Asynchronous Delivery
-void
-RTI::RTIambassador::enableAsynchronousDelivery()
-throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
- RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
- RTI::AsynchronousDeliveryAlreadyEnabled)
- {
- // throw AsynchronousDeliveryAlreadyEnabled("Default value (non HLA)");
-
- M_Enable_Asynchronous_Delivery req, rep ;
-
-
- privateRefs->executeService(&req, &rep);
- }
-
-// ----------------------------------------------------------------------------
-// Disable Asynchronous Delivery
-void
-RTI::RTIambassador::disableAsynchronousDelivery()
-throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
- RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
- RTI::AsynchronousDeliveryAlreadyDisabled)
- {
- M_Disable_Asynchronous_Delivery req, rep ;
-
- privateRefs->executeService(&req, &rep);
- }
-
-// ----------------------------------------------------------------------------
-// Query LBTS
-void
-RTI::RTIambassador::queryLBTS(RTI::FedTime& theTime)
-throw (RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::SaveInProgress,
- RTI::RestoreInProgress,
- RTI::RTIinternalError)
- {
- M_Query_Lbts req, rep ;
-
- privateRefs->executeService(&req, &rep);
-
- certi_cast<RTIfedTime>()(theTime) = rep.getDate().getTime();
- }
-
-// ----------------------------------------------------------------------------
-// Query Federate Time
-void
-RTI::RTIambassador::queryFederateTime(RTI::FedTime& theTime)
-throw (RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::SaveInProgress,
- RTI::RestoreInProgress,
- RTI::RTIinternalError)
- {
- M_Query_Federate_Time req, rep ;
-
- privateRefs->executeService(&req, &rep);
-
- certi_cast<RTIfedTime>()(theTime) = rep.getDate().getTime();
- }
-
-// ----------------------------------------------------------------------------
-// Query Minimum Next Event Time
-void
-RTI::RTIambassador::queryMinNextEventTime(RTI::FedTime& theTime)
-throw (RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::SaveInProgress,
- RTI::RestoreInProgress,
- RTI::RTIinternalError)
- {
- M_Query_Min_Next_Event_Time req, rep ;
-
- privateRefs->executeService(&req, &rep);
-
- certi_cast<RTIfedTime>()(theTime) = rep.getDate().getTime();
- }
-
-// ----------------------------------------------------------------------------
-// Modify Lookahead
-void
-RTI::RTIambassador::modifyLookahead(const RTI::FedTime& theLookahead)
-throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
- RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
- RTI::InvalidLookahead)
- {
- M_Modify_Lookahead req, rep ;
-
- req.setLookahead(certi_cast<RTIfedTime>()(theLookahead).getTime());
-
- privateRefs->executeService(&req, &rep);
- }
-
-// ----------------------------------------------------------------------------
-// Query Lookahead
-void
-RTI::RTIambassador::queryLookahead(RTI::FedTime &theTime)
-throw (RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::SaveInProgress,
- RTI::RestoreInProgress,
- RTI::RTIinternalError)
- {
- M_Query_Lookahead req, rep ;
-
- // Set Lookahead to a stupid value in the query
- // in order to avoid uninitiliazed value
- req.setLookahead(-1.0);
- privateRefs->executeService(&req, &rep);
-
- certi_cast<RTIfedTime>()(theTime) = rep.getLookahead();
- }
-
-// ----------------------------------------------------------------------------
-// Retract
-void
-RTI::RTIambassador::retract(RTI::EventRetractionHandle handle)
-throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
- RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
- RTI::InvalidRetractionHandle)
- {
- throw RTI::RTIinternalError("Unimplemented Service retract");
- M_Retract req, rep ;
- EventRetraction event;
-
- event.setSN(handle.theSerialNumber);
- event.setSendingFederate(handle.sendingFederate);
- req.setEventRetraction(event);
-
- privateRefs->executeService(&req, &rep);
- }
-
-// ----------------------------------------------------------------------------
-// Change Attribute Order Type
-void
-RTI::RTIambassador::changeAttributeOrderType(ObjectHandle theObject,
- const AttributeHandleSet& attrs,
- OrderingHandle theType)
-throw (RTI::RTIinternalError,
- RTI::RestoreInProgress, RTI::SaveInProgress,
RTI::ConcurrentAccessAttempted,
- RTI::FederateNotExecutionMember, RTI::InvalidOrderingHandle,
- RTI::AttributeNotOwned, RTI::AttributeNotDefined,
RTI::ObjectNotKnown)
- {
- M_Change_Attribute_Order_Type req, rep ;
-
- req.setObject(theObject);
- req.setOrder(theType);
-
assignAHVToRequest(certi_cast<AttributeHandleSetImp>()(attrs).getAttributeHandles(),req);
-
- privateRefs->executeService(&req, &rep);
- }
-
-// ----------------------------------------------------------------------------
-// Change Interaction Order Type
-void
-RTI::RTIambassador::changeInteractionOrderType(InteractionClassHandle theClass,
- OrderingHandle theType)
-throw (RTI::RTIinternalError, RTI::RestoreInProgress,
- RTI::SaveInProgress, RTI::ConcurrentAccessAttempted,
- RTI::FederateNotExecutionMember, RTI::InvalidOrderingHandle,
- RTI::InteractionClassNotPublished,
RTI::InteractionClassNotDefined)
- {
- M_Change_Interaction_Order_Type req, rep ;
-
- req.setInteractionClass(theClass);
- req.setOrder(theType);
-
- privateRefs->executeService(&req, &rep);
- }
-
-// ----------------------------------------------------------------------------
-/** Create a routing region for data distribution management.
- \param space The space handle of the region
- \param nb_extents The number of extents
- \return A Region object, associated with the created region
- */
-RTI::Region *
-RTI::RTIambassador::createRegion(SpaceHandle space, ULong nb_extents)
-throw (RTI::SpaceNotDefined,
- RTI::InvalidExtents,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::SaveInProgress,
- RTI::RestoreInProgress,
- RTI::RTIinternalError)
- {
- M_Ddm_Create_Region req, rep ;
- req.setSpace(space);
- req.setExtentSetSize(nb_extents);
- privateRefs->executeService(&req, &rep);
- RTI::Region *region = new RegionImp(rep.getRegion(), space,
- std::vector<Extent>(nb_extents,
- Extent(rep.getExtentSetSize())));
-
- assert(region->getNumberOfExtents() == nb_extents);
- return region ;
- }
-
-// ----------------------------------------------------------------------------
-/** Notify about region modification. Applies the changes done through
- the region services to the RTI.
- \param r The region to commit to the RTI
- */
-void
-RTI::RTIambassador::notifyAboutRegionModification(Region &r)
-throw (RTI::RegionNotKnown,
- RTI::InvalidExtents,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::SaveInProgress,
- RTI::RestoreInProgress,
- RTI::RTIinternalError)
- {
- try {
- RegionImp ®ion = dynamic_cast<RegionImp &>(r);
- Debug(D, pdDebug) << "Notify About Region " <<
region.getHandle()
-
<< " Modification" << endl ;
- M_Ddm_Modify_Region req, rep ;
-
- req.setRegion(region.getHandle());
- req.setExtents(region.getExtents());
-
- privateRefs->executeService(&req, &rep);
- region.commit();
- }
- catch (std::bad_cast) {
- throw RTI::RegionNotKnown("");
- }
- catch (RTI::Exception &e) {
- throw ;
- }
- }
-
-// ----------------------------------------------------------------------------
-/** Delete region. Correctly destroys the region (through the RTI).
- \attention Always use this function to destroy a region. Do NOT
- use the C++ delete operator.
- */
-void
-RTI::RTIambassador::deleteRegion(Region *region)
-throw (RTI::RegionNotKnown,
- RTI::RegionInUse,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::SaveInProgress,
- RTI::RestoreInProgress,
- RTI::RTIinternalError)
- {
- if (region == 0) {
- throw RegionNotKnown("");
- }
-
- M_Ddm_Delete_Region req, rep ;
-
- try {
- req.setRegion(dynamic_cast<RegionImp *>(region)->getHandle());
- }
- catch (std::bad_cast) {
- throw RegionNotKnown("");
- }
- privateRefs->executeService(&req, &rep);
-
- delete region ;
- }
-
-// ----------------------------------------------------------------------------
-// Register Object Instance With Region
-RTI::ObjectHandle
-RTI::RTIambassador::registerObjectInstanceWithRegion(ObjectClassHandle
object_class,
- const char *tag,
- AttributeHandle attrs[],
- Region *regions[],
- ULong nb)
-throw (RTI::ObjectClassNotDefined,
- RTI::ObjectClassNotPublished,
- RTI::AttributeNotDefined,
- RTI::AttributeNotPublished,
- RTI::RegionNotKnown,
- RTI::InvalidRegionContext,
- RTI::ObjectAlreadyRegistered,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::SaveInProgress,
- RTI::RestoreInProgress,
- RTI::RTIinternalError)
- {
- M_Ddm_Register_Object req, rep ;
-
- req.setObjectClass(object_class);
- if ( tag != NULL )
- {
- req.setTag(tag);
- }
-
- req.setAttributesSize(nb);
- for (uint32_t i=0;i<nb;++i) {
- req.setAttributes(attrs[i],0);
- }
- req.setRegions(build_region_handles(regions, nb));
-
- privateRefs->executeService(&req, &rep);
-
- return rep.getObject();
- }
-
-// ----------------------------------------------------------------------------
-RTI::ObjectHandle
-RTI::RTIambassador::registerObjectInstanceWithRegion(ObjectClassHandle
object_class,
- RTI::AttributeHandle attrs[],
- RTI::Region *regions[],
- ULong nb)
-throw (RTI::ObjectClassNotDefined,
- RTI::ObjectClassNotPublished,
- RTI::AttributeNotDefined,
- RTI::AttributeNotPublished,
- RTI::RegionNotKnown,
- RTI::InvalidRegionContext,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::SaveInProgress,
- RTI::RestoreInProgress,
- RTI::RTIinternalError)
- {
- M_Ddm_Register_Object req, rep ;
-
- req.setObjectClass(object_class);
- req.setAttributesSize(nb);
- for (uint32_t i=0;i<nb;++i) {
- req.setAttributes(attrs[i],0);
- }
-
- req.setRegions(build_region_handles(regions, nb));
-
- privateRefs->executeService(&req, &rep);
-
- return rep.getObject();
- }
-
-// ----------------------------------------------------------------------------
-/** Associate region for updates. Make attributes of an object
- be updated through a routing region.
- @param region Region to use for updates
- @param object Object to associate to the region
- @param attributes Handles of the involved attributes
- @sa unassociateRegionForUpdates
- */
-void
-RTI::RTIambassador::associateRegionForUpdates(Region ®ion,
- ObjectHandle object,
- const AttributeHandleSet &attributes)
-throw (RTI::ObjectNotKnown,
- RTI::AttributeNotDefined,
- RTI::InvalidRegionContext,
- RTI::RegionNotKnown,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::SaveInProgress,
- RTI::RestoreInProgress,
- RTI::RTIinternalError)
- {
- Debug(D, pdDebug) << "+ Associate Region for Updates" << endl ;
-
- M_Ddm_Associate_Region req, rep ;
-
- req.setObject(object);
- req.setRegion(get_handle(region));
-
assignAHVToRequest(certi_cast<AttributeHandleSetImp>()(attributes).getAttributeHandles(),req);
-
- privateRefs->executeService(&req, &rep);
- Debug(D, pdDebug) << "- Associate Region for Updates" << endl ;
- }
-
-// ----------------------------------------------------------------------------
-/** Unassociate region for updates. Make attributes of an object be updated
- through the default region (ie. Declaration Management services)
- @param region Region to unassociate
- @param object Object to unassociate
- @see associateRegionForUpdates
- */
-void
-RTI::RTIambassador::unassociateRegionForUpdates(Region ®ion,
- ObjectHandle object)
-throw (RTI::ObjectNotKnown,
- RTI::InvalidRegionContext,
- RTI::RegionNotKnown,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::SaveInProgress,
- RTI::RestoreInProgress,
- RTI::RTIinternalError)
- {
- Debug(D, pdDebug) << "+ Unassociate Region for Updates" << endl ;
- M_Ddm_Unassociate_Region req, rep ;
-
- req.setObject(object);
- req.setRegion(get_handle(region));
-
- privateRefs->executeService(&req, &rep);
- Debug(D, pdDebug) << "- Unassociate Region for Updates" << endl ;
- }
-
-// ----------------------------------------------------------------------------
-/** Subscribe object class attributes with region.
- @param object_class ObjectClassHandle
- @param region Region to subscribe with
- @param attributes AttributeHandleSet involved in the subscription
- @param passive Boolean
- @sa unsubscribeObjectClassWithRegion
- */
-void
-RTI::RTIambassador::subscribeObjectClassAttributesWithRegion(
- ObjectClassHandle object_class,
- Region ®ion,
- const AttributeHandleSet &attributes,
- Boolean passive)
-throw (RTI::ObjectClassNotDefined,
- RTI::AttributeNotDefined,
- RTI::RegionNotKnown,
- RTI::InvalidRegionContext,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::SaveInProgress,
- RTI::RestoreInProgress,
- RTI::RTIinternalError)
- {
- Debug(D, pdDebug) << "+ Subscribe Object Class Attributes with Region"
<< endl ;
- M_Ddm_Subscribe_Attributes req, rep ;
-
- req.setObjectClass(object_class);
- req.setRegion(get_handle(region));
-
assignAHVToRequest(certi_cast<AttributeHandleSetImp>()(attributes).getAttributeHandles(),req);
- if (passive)
- req.passiveOn();
- else
- req.passiveOff();
-
- privateRefs->executeService(&req, &rep);
- Debug(D, pdDebug) << "- Subscribe Object Class Attributes with Region"
<< endl ;
- }
-
-// ----------------------------------------------------------------------------
-/** Unsubscribe object class attributes with region.
- @param object_class ObjectClassHandle
- @param region Region to unsubscribe with
- @sa subscribeObjectClassAttributesWithRegion
- */
-void
-RTI::RTIambassador::unsubscribeObjectClassWithRegion(ObjectClassHandle
object_class,
- Region ®ion)
-throw (RTI::ObjectClassNotDefined,
- RTI::RegionNotKnown,
- RTI::ObjectClassNotSubscribed,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::SaveInProgress,
- RTI::RestoreInProgress,
- RTI::RTIinternalError)
- {
- Debug(D, pdDebug) << "+ Unsubscribe Object Class " << object_class
- << " with Region" << endl ;
- M_Ddm_Unsubscribe_Attributes req, rep ;
-
- req.setObjectClass(object_class);
- req.setRegion(get_handle(region));
-
- privateRefs->executeService(&req, &rep);
- Debug(D, pdDebug) << "- Unsubscribe Object Class with Region" << endl ;
- }
-
-// ----------------------------------------------------------------------------
-// Subscribe Interaction Class With Region
-void
-RTI::RTIambassador::subscribeInteractionClassWithRegion(InteractionClassHandle
ic,
- Region ®ion,
- RTI::Boolean passive)
-throw (RTI::InteractionClassNotDefined,
- RTI::RegionNotKnown,
- RTI::InvalidRegionContext,
- RTI::FederateLoggingServiceCalls,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::SaveInProgress,
- RTI::RestoreInProgress,
- RTI::RTIinternalError)
- {
- M_Ddm_Subscribe_Interaction req, rep ;
-
- req.setInteractionClass(ic);
- req.setRegion(get_handle(region));
- if (passive)
- req.passiveOn();
- else
- req.passiveOff();
-
- privateRefs->executeService(&req, &rep);
- }
-
-// ----------------------------------------------------------------------------
-// UnSubscribe Interaction Class With Region
-void
-RTI::RTIambassador::unsubscribeInteractionClassWithRegion(InteractionClassHandle
ic,
- Region ®ion)
-throw (RTI::InteractionClassNotDefined,
- RTI::InteractionClassNotSubscribed,
- RTI::RegionNotKnown,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::SaveInProgress,
- RTI::RestoreInProgress,
- RTI::RTIinternalError)
- {
- M_Ddm_Unsubscribe_Interaction req, rep ;
-
- req.setInteractionClass(ic);
- req.setRegion(get_handle(region));
-
- privateRefs->executeService(&req, &rep);
- }
-
-// ----------------------------------------------------------------------------
-// Send Interaction With Region
-RTI::EventRetractionHandle
-RTI::RTIambassador::sendInteractionWithRegion(InteractionClassHandle
interaction,
- const ParameterHandleValuePairSet &par,
- const RTI::FedTime &time,
- const char *tag,
- const Region ®ion)
-throw (RTI::InteractionClassNotDefined,
- RTI::InteractionClassNotPublished,
- RTI::InteractionParameterNotDefined,
- RTI::InvalidFederationTime,
- RTI::RegionNotKnown,
- RTI::InvalidRegionContext,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::SaveInProgress,
- RTI::RestoreInProgress,
- RTI::RTIinternalError)
- {
- M_Send_Interaction req, rep ;
- EventRetractionHandle event;
- req.setInteractionClass(interaction);
-
assignPHVPSToRequest(certi_cast<ParameterHandleValuePairSetImp>()(par).getParameterHandleValuePairs(),req);
- req.setDate(certi_cast<RTIfedTime>()(time).getTime());
- if ( tag == NULL )
- {
- throw RTI::RTIinternalError ("Calling sendInteractionWithRegion
with Tag NULL");
- }
- req.setTag(tag);
- req.setRegion(get_handle(region));
-
- privateRefs->executeService(&req, &rep);
- event.theSerialNumber = rep.getEventRetraction().getSN();
- event.sendingFederate = rep.getEventRetraction().getSendingFederate();
- return event;
- }
-
-// ----------------------------------------------------------------------------
-void
-RTI::RTIambassador::sendInteractionWithRegion(InteractionClassHandle
interaction,
- const ParameterHandleValuePairSet &par,
- const char *tag,
- const Region ®ion)
-throw (RTI::InteractionClassNotDefined,
- RTI::InteractionClassNotPublished,
- RTI::InteractionParameterNotDefined,
- RTI::RegionNotKnown,
- RTI::InvalidRegionContext,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::SaveInProgress,
- RTI::RestoreInProgress,
- RTI::RTIinternalError)
- {
- M_Send_Interaction req, rep ;
-
- req.setInteractionClass(interaction);
-
assignPHVPSToRequest(certi_cast<ParameterHandleValuePairSetImp>()(par).getParameterHandleValuePairs(),req);
- if ( tag == NULL )
- {
- throw RTI::RTIinternalError ("Calling sendInteractionWithRegion
with Tag NULL");
- }
- req.setTag(tag);
- req.setRegion(get_handle(region));
-
- privateRefs->executeService(&req, &rep);
- }
-
-// ----------------------------------------------------------------------------
-// Request Class Attribute Value Update With Region
-void RTI::RTIambassador::
-requestClassAttributeValueUpdateWithRegion(ObjectClassHandle /*object*/,
- const AttributeHandleSet &attrs,
- const Region ®ion)
-throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
- RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
- RTI::RegionNotKnown, RTI::AttributeNotDefined,
RTI::ObjectClassNotDefined)
- {
- throw RTI::RTIinternalError("unimplemented service
requestClassAttributeValueUpdateWithRegion");
-
- M_Ddm_Request_Update req, rep ;
-
assignAHVToRequest(certi_cast<AttributeHandleSetImp>()(attrs).getAttributeHandles(),req);
- req.setRegion(get_handle(region));
- privateRefs->executeService(&req, &rep);
- }
-
-// ----------------------------------------------------------------------------
-/** Get object class handle
- \param theName Name of the object class
- */
-RTI::ObjectClassHandle
-RTI::RTIambassador::getObjectClassHandle(const char *theName)
-throw (RTI::NameNotFound,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::RTIinternalError)
- {
- M_Get_Object_Class_Handle req, rep ;
-
- G.Out(pdGendoc,"enter RTIambassador::getObjectClassHandle");
-
- req.setClassName(theName);
- privateRefs->executeService(&req, &rep);
-
- G.Out(pdGendoc,"exit RTIambassador::getObjectClassHandle");
-
- return rep.getObjectClass();
- }
-
-// ----------------------------------------------------------------------------
-/** Get object class name.
- \param handle Handle of the object class
- \return The class name associated with the handle, memory has to
- be freed by the caller.
- */
-char *
-RTI::RTIambassador::getObjectClassName(ObjectClassHandle handle)
-throw (RTI::ObjectClassNotDefined,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::RTIinternalError)
- {
- M_Get_Object_Class_Name req, rep ;
-
- req.setObjectClass(handle);
- privateRefs->executeService(&req, &rep);
- return hla_strdup(rep.getClassName());
- }
-
-// ----------------------------------------------------------------------------
-/** Get attribute handle.
- \param theName Name of the attribute
- \param whichClass Handle of the attribute's class
- */
-RTI::AttributeHandle
-RTI::RTIambassador::getAttributeHandle(const char *theName,
- ObjectClassHandle whichClass)
-throw (RTI::ObjectClassNotDefined,
- RTI::NameNotFound,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::RTIinternalError)
- {
- G.Out(pdGendoc,"enter RTI::RTIambassador::getAttributeHandle");
- M_Get_Attribute_Handle req, rep ;
-
- req.setAttributeName(theName);
- req.setObjectClass(whichClass);
- privateRefs->executeService(&req, &rep);
- G.Out(pdGendoc,"exit RTI::RTIambassador::getAttributeHandle");
- return rep.getAttribute();
- }
-
-// ----------------------------------------------------------------------------
-/** Get attribute name.
- \param theHandle Handle of the attribute
- \param whichClass Handle of the attribute's class
- */
-
-char *
-RTI::RTIambassador::getAttributeName(AttributeHandle theHandle,
- ObjectClassHandle whichClass)
-throw (RTI::ObjectClassNotDefined,
- RTI::AttributeNotDefined,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::RTIinternalError)
- {
- M_Get_Attribute_Name req, rep ;
-
- req.setAttribute(theHandle);
- req.setObjectClass(whichClass);
- privateRefs->executeService(&req, &rep);
- return hla_strdup(rep.getAttributeName());
- }
-
-// ----------------------------------------------------------------------------
-// Get Interaction Class Handle
-RTI::InteractionClassHandle
-RTI::RTIambassador::getInteractionClassHandle(const char *theName)
-throw (RTI::NameNotFound,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::RTIinternalError)
- {
- M_Get_Interaction_Class_Handle req, rep ;
-
- req.setClassName(theName);
-
- privateRefs->executeService(&req, &rep);
-
- return rep.getInteractionClass();
- }
-
-// ----------------------------------------------------------------------------
-// Get Interaction Class Name
-char *
-RTI::RTIambassador::getInteractionClassName(InteractionClassHandle theHandle)
-throw (RTI::InteractionClassNotDefined,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::RTIinternalError)
- {
- M_Get_Interaction_Class_Name req, rep ;
-
- req.setInteractionClass(theHandle);
-
- privateRefs->executeService(&req, &rep);
-
- return hla_strdup(rep.getClassName());
- }
-
-// ----------------------------------------------------------------------------
-// Get Parameter Handle
-RTI::ParameterHandle
-RTI::RTIambassador::getParameterHandle(const char *theName,
- InteractionClassHandle whichClass)
-throw (RTI::InteractionClassNotDefined,
- RTI::NameNotFound,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::RTIinternalError)
- {
- M_Get_Parameter_Handle req, rep ;
-
-
- req.setParameterName(theName);
- req.setInteractionClass(whichClass);
-
- privateRefs->executeService(&req, &rep);
-
- return rep.getParameter();
- }
-
-// ----------------------------------------------------------------------------
-// Get Parameter Name
-char *
-RTI::RTIambassador::getParameterName(ParameterHandle theHandle,
- InteractionClassHandle whichClass)
-throw (RTI::InteractionClassNotDefined,
- RTI::InteractionParameterNotDefined,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::RTIinternalError)
- {
- M_Get_Parameter_Name req, rep ;
-
- req.setParameter(theHandle);
- req.setInteractionClass(whichClass);
-
- privateRefs->executeService(&req, &rep);
-
- return hla_strdup(rep.getParameterName());
- }
-
-// ----------------------------------------------------------------------------
-// Get Object Instance Handle
-RTI::ObjectHandle
-RTI::RTIambassador::getObjectInstanceHandle(const char *theName)
-throw (RTI::RTIinternalError, RTI::ConcurrentAccessAttempted,
- RTI::FederateNotExecutionMember, RTI::ObjectNotKnown)
- {
- M_Get_Object_Instance_Handle req, rep ;
-
- req.setObjectInstanceName(theName);
-
- privateRefs->executeService(&req, &rep);
-
- return rep.getObject();
- }
-
-// ----------------------------------------------------------------------------
-// Get Object Instance Name
-char *
-RTI::RTIambassador::getObjectInstanceName(ObjectHandle theHandle)
-throw (RTI::RTIinternalError, RTI::ConcurrentAccessAttempted,
- RTI::FederateNotExecutionMember, RTI::ObjectNotKnown)
- {
- M_Get_Object_Instance_Name req, rep ;
-
- req.setObject(theHandle);
-
- privateRefs->executeService(&req, &rep);
-
- return hla_strdup(rep.getObjectInstanceName());
- }
-
-// ----------------------------------------------------------------------------
-/** Get routing space handle
- \param rs_name Name of the routing space
- */
-RTI::SpaceHandle
-RTI::RTIambassador::getRoutingSpaceHandle(const char *rs_name)
-throw (RTI::NameNotFound,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::RTIinternalError)
- {
- Debug(D, pdDebug) << "Get routing space handle: " << rs_name << endl ;
- M_Get_Space_Handle req, rep ;
-
- req.setSpaceName(rs_name);
- privateRefs->executeService(&req, &rep);
- return rep.getSpace();
- }
-
-// ----------------------------------------------------------------------------
-/** Get routing space name
- \param handle Handle of the routing space
- */
-char *
-RTI::RTIambassador::getRoutingSpaceName(SpaceHandle handle)
-throw (RTI::SpaceNotDefined,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::RTIinternalError)
- {
- M_Get_Space_Name req, rep ;
-
- req.setSpace(handle);
- privateRefs->executeService(&req, &rep);
- return hla_strdup(rep.getSpaceName());
- }
-
-// ----------------------------------------------------------------------------
-/** Get dimension handle
- \param dimension Name of the dimension
- \param space The dimension's routing SpaceHandle
- */
-RTI::DimensionHandle
-RTI::RTIambassador::getDimensionHandle(const char *dimension,
- SpaceHandle space)
-throw (RTI::SpaceNotDefined,
- RTI::NameNotFound,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::RTIinternalError)
- {
- M_Get_Dimension_Handle req, rep ;
-
- req.setDimensionName(dimension);
- req.setSpace(space);
- privateRefs->executeService(&req, &rep);
- return rep.getDimension();
- }
-
-// ----------------------------------------------------------------------------
-/** Get dimension name
- \param dimension Handle of the dimension
- \param space The dimension's routing space handle
- */
-char *
-RTI::RTIambassador::getDimensionName(DimensionHandle dimension,
- SpaceHandle space)
-throw (RTI::SpaceNotDefined,
- RTI::DimensionNotDefined,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::RTIinternalError)
- {
- M_Get_Dimension_Name req, rep ;
-
- req.setDimension(dimension);
- req.setSpace(space);
- privateRefs->executeService(&req, &rep);
- return hla_strdup(rep.getDimensionName());
- }
-
-// ----------------------------------------------------------------------------
-/** Get attribute routing space handle
- \param attribute The attribute handle
- \param object_class The attribute's class handle
- \return The associated routing space handle
- */
-RTI::SpaceHandle
-RTI::RTIambassador::getAttributeRoutingSpaceHandle(AttributeHandle attribute,
- ObjectClassHandle object_class)
-throw (RTI::ObjectClassNotDefined,
- RTI::AttributeNotDefined,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::RTIinternalError)
- {
- M_Get_Attribute_Space_Handle req, rep ;
-
- req.setAttribute(attribute);
- req.setObjectClass(object_class);
- privateRefs->executeService(&req, &rep);
- return rep.getSpace();
- }
-
-// ----------------------------------------------------------------------------
-// Get Object Class
-RTI::ObjectClassHandle
-RTI::RTIambassador::getObjectClass(ObjectHandle theObject)
-throw (RTI::RTIinternalError, RTI::ConcurrentAccessAttempted,
- RTI::FederateNotExecutionMember, RTI::ObjectNotKnown)
- {
- M_Get_Object_Class req, rep ;
-
- req.setObject(theObject);
- privateRefs->executeService(&req, &rep);
- return rep.getObjectClass();
- }
-
-// ----------------------------------------------------------------------------
-/** Get interaction routing space handle
- \param inter The interaction handle
- \return The associated routing space
- */
-RTI::SpaceHandle
-RTI::RTIambassador::getInteractionRoutingSpaceHandle(InteractionClassHandle
inter)
-throw (RTI::InteractionClassNotDefined,
- RTI::FederateNotExecutionMember,
- RTI::ConcurrentAccessAttempted,
- RTI::RTIinternalError)
- {
- M_Get_Interaction_Space_Handle req, rep ;
-
- req.setInteractionClass(inter);
- this->privateRefs->executeService(&req, &rep);
- return rep.getSpace();
- }
-
-// ----------------------------------------------------------------------------
-// Get Transportation Handle
-RTI::TransportationHandle
-RTI::RTIambassador::getTransportationHandle(const char *theName)
-throw (RTI::RTIinternalError, RTI::ConcurrentAccessAttempted,
- RTI::FederateNotExecutionMember, RTI::NameNotFound)
- {
- M_Get_Transportation_Handle req, rep ;
-
- req.setTransportationName(theName);
- privateRefs->executeService(&req, &rep);
- return rep.getTransportation();
- }
-
-// ----------------------------------------------------------------------------
-// Get Transportation Name
-char *
-RTI::RTIambassador::getTransportationName(TransportationHandle theHandle)
-throw (RTI::RTIinternalError, RTI::ConcurrentAccessAttempted,
- RTI::FederateNotExecutionMember,
RTI::InvalidTransportationHandle)
- {
- M_Get_Transportation_Name req, rep ;
-
- req.setTransportation(theHandle);
- privateRefs->executeService(&req, &rep);
- return hla_strdup(rep.getTransportationName());
- }
-
-// ----------------------------------------------------------------------------
-// Get Ordering Handle
-RTI::OrderingHandle
-RTI::RTIambassador::getOrderingHandle(const char *theName)
-throw (RTI::RTIinternalError, RTI::ConcurrentAccessAttempted,
- RTI::FederateNotExecutionMember, RTI::NameNotFound)
- {
- M_Get_Ordering_Handle req, rep ;
-
- req.setOrderingName(theName);
- privateRefs->executeService(&req, &rep);
- return rep.getOrdering();
- }
-
-
-// ----------------------------------------------------------------------------
-// Get Ordering Name
-char *
-RTI::RTIambassador::getOrderingName(OrderingHandle theHandle)
-throw (RTI::RTIinternalError, RTI::ConcurrentAccessAttempted,
- RTI::FederateNotExecutionMember, RTI::InvalidOrderingHandle)
- {
- M_Get_Ordering_Name req, rep ;
-
- req.setOrdering(theHandle);
- privateRefs->executeService(&req, &rep);
- return hla_strdup(rep.getOrderingName());
- }
-
-void
-RTI::RTIambassador::enableClassRelevanceAdvisorySwitch()
-throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
- RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember)
- {
- M_Enable_Class_Relevance_Advisory_Switch req, rep ;
-
- privateRefs->executeService(&req, &rep);
- }
-void
-RTI::RTIambassador::disableClassRelevanceAdvisorySwitch()
-throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
- RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember)
- {
- M_Disable_Class_Relevance_Advisory_Switch req, rep ;
-
- privateRefs->executeService(&req, &rep);
- }
-
-void
-RTI::RTIambassador::enableAttributeRelevanceAdvisorySwitch()
-throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
- RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember)
- {
- M_Enable_Attribute_Relevance_Advisory_Switch req, rep ;
-
- privateRefs->executeService(&req, &rep);
- }
-
-void
-RTI::RTIambassador::disableAttributeRelevanceAdvisorySwitch()
-throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
- RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember)
- {
- M_Disable_Attribute_Relevance_Advisory_Switch req, rep ;
-
- privateRefs->executeService(&req, &rep);
- }
-
-void RTI::RTIambassador::enableAttributeScopeAdvisorySwitch()
-throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
- RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember)
- {
- M_Enable_Attribute_Scope_Advisory_Switch req, rep ;
-
- privateRefs->executeService(&req, &rep);
- }
-
-void
-RTI::RTIambassador::disableAttributeScopeAdvisorySwitch()
-throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
- RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember)
- {
- M_Disable_Attribute_Scope_Advisory_Switch req, rep ;
-
- privateRefs->executeService(&req, &rep);
- }
-
-void
-RTI::RTIambassador::enableInteractionRelevanceAdvisorySwitch()
-throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
- RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember)
- {
- M_Enable_Interaction_Relevance_Advisory_Switch req, rep ;
-
- privateRefs->executeService(&req, &rep);
- }
-
-void
-RTI::RTIambassador::disableInteractionRelevanceAdvisorySwitch()
-throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
- RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember)
- {
- M_Disable_Interaction_Relevance_Advisory_Switch req, rep ;
-
- privateRefs->executeService(&req, &rep);
- }
-
-// $Id: RTIambassador.cc,v 3.128 2011/10/27 07:59:51 erk Exp $
Index: RTI1516fedAmbassador.cpp
===================================================================
RCS file: RTI1516fedAmbassador.cpp
diff -N RTI1516fedAmbassador.cpp
--- RTI1516fedAmbassador.cpp 28 Apr 2010 18:48:30 -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: TestFedTime.cc
===================================================================
RCS file: TestFedTime.cc
diff -N TestFedTime.cc
--- TestFedTime.cc 28 Feb 2010 18:54:44 -0000 3.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,89 +0,0 @@
-// ----------------------------------------------------------------------------
-// TestFedTime.cc - Module test for the libFedTime
-// Copyright (C) 2008 Eric Noulard <address@hidden>
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License version 2.1, as published by the Free Software Foundation.
-//
-// This library 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.
-//
-// $Id: TestFedTime.cc,v 3.1 2010/02/28 18:54:44 erk Exp $
-// ----------------------------------------------------------------------------
-
-#include <iostream>
-#include <sstream>
-#include <cstdlib>
-
-#include "certi.hh"
-#include "fedtime.hh"
-
-#define BUFLEN 12
-#define PRINTBUFLEN 50
-std::string
-show(const void* data, uint32_t n) {
- uint32_t i;
- std::stringstream msg;
-
- const uint8_t* u8data = reinterpret_cast<const uint8_t*>(data);
- msg << "0x";
- for (i=0;i<n;++i) {
- if ((0==(i%2))&&(i>0)) {
- msg << " ";
- }
- msg << std::uppercase << std::hex << (int)u8data[i];
- }
- return msg.str();
-}
-
-int
-main(int argc, char* argv[]) {
- int result = EXIT_SUCCESS;
- char buffer[BUFLEN];
- char printBuffer[PRINTBUFLEN];
-
- std::cout << "Host byte-order: "
-#ifdef HOST_IS_BIG_ENDIAN
- << "big-endian" << std::endl;
-#else
- << "little-endian" << std::endl;
-#endif
- RTI::FedTime* time = RTI::FedTimeFactory::makeZero();
- std::cout << "PrintableLength = " << time->getPrintableLength()
<<std::endl;
- if (time->getPrintableLength() > (PRINTBUFLEN+1)) {
- std::cerr << "Cannot print value " << PRINTBUFLEN+1 << " < "<<
time->getPrintableLength() << std::endl;
- exit(EXIT_FAILURE);
- }
- time->getPrintableString(printBuffer);
- std::cout << "Zero = " << printBuffer <<std::endl;
- time->setEpsilon();time->getPrintableString(printBuffer);
- std::cout << "Epsilon = " << printBuffer<<std::endl;
- time->setPositiveInfinity();time->getPrintableString(printBuffer);
- std::cout << "Positive Infinity = " << printBuffer<<std::endl;
- time->setZero();
- RTIfedTime pi(RTI::Double(3.14159));
- *time = pi;
- time->getPrintableString(printBuffer);
- std::cout << "Pi = " << printBuffer<<std::endl;
- double pid = pi.getTime();
- std::cout << " raw value = " << show(&pid,sizeof(pid)) <<
std::endl;
- std::cout << "Trying to encode time..." <<std::endl;
- std::cout << " encoded length = " << time->encodedLength()
<<std::endl;
- if (time->encodedLength()<(BUFLEN+1)) {
- time->encode(buffer);
- } else {
- std::cerr << "Cannot encode :"<< (BUFLEN+1) << "<" <<
time->encodedLength() << std::endl;
- return EXIT_FAILURE;
- }
- std::cout << " encoded value = " <<
show(buffer,time->encodedLength()) << std::endl;
- std::cout << "Trying to decode time..." <<std::endl;
- RTI::FedTime* time2 = RTI::FedTimeFactory::decode(buffer);
- time2->getPrintableString(printBuffer);
- std::cout << " decoded value = " << printBuffer << std::endl;
- return result;
-}
-
-// $Id: TestFedTime.cc,v 3.1 2010/02/28 18:54:44 erk Exp $
Index: RTItypesImp.cc
===================================================================
RCS file: RTItypesImp.cc
diff -N RTItypesImp.cc
--- RTItypesImp.cc 13 Jul 2011 15:43:16 -0000 3.10
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,572 +0,0 @@
-// ----------------------------------------------------------------------------
-// CERTI - HLA RunTime Infrastructure
-// Copyright (C) 2002-2006 ONERA
-//
-// This program 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.
-//
-// This program 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: RTItypesImp.cc,v 3.10 2011/07/13 15:43:16 erk Exp $
-// ----------------------------------------------------------------------------
-
-#include "RTItypesImp.hh"
-#include "PrettyDebug.hh"
-
-#include <algorithm>
-#include <string.h>
-
-using namespace certi ;
-
-static PrettyDebug D("LIBRTI", __FILE__);
-static PrettyDebug G("GENDOC",__FILE__);
-
-
-// ----------------------------------------------------------------------------
-AttributeHandleValuePairSetImp::AttributeHandleValuePairSetImp(RTI::ULong size)
-{
- _order = RECEIVE;
- _transport = RELIABLE;
-
- _set.reserve(size);
-}
-
-AttributeHandleValuePairSetImp::AttributeHandleValuePairSetImp(const
std::vector<AttributeHandleValuePair_t> &val)
- : _set(val)
-{
- _order = RECEIVE;
- _transport = RELIABLE;
-}
-
-AttributeHandleValuePairSetImp::~AttributeHandleValuePairSetImp()
-{
-}
-
-RTI::ULong AttributeHandleValuePairSetImp::size() const
-{
- return _set.size();
-}
-
-RTI::Handle AttributeHandleValuePairSetImp::getHandle(RTI::ULong i) const
- throw (RTI::ArrayIndexOutOfBounds)
-{
- if (i < size())
- return _set[i].first;
- else
- throw RTI::ArrayIndexOutOfBounds("");
-}
-
-RTI::ULong AttributeHandleValuePairSetImp::getValueLength(RTI::ULong i) const
- throw (RTI::ArrayIndexOutOfBounds)
-{
- if (i < size())
- return _set[i].second.size();
- else
- throw RTI::ArrayIndexOutOfBounds("");
-}
-
-void AttributeHandleValuePairSetImp::getValue(RTI::ULong i, char *buff,
RTI::ULong &len) const
- throw (RTI::ArrayIndexOutOfBounds)
-{
- if (i < size()) {
- const AttributeHandleValuePair_t& item = _set[i];
- len = item.second.size();
- memcpy(buff, &(item.second[0]), len);
- }
- else
- throw RTI::ArrayIndexOutOfBounds("");
-}
-
-char *AttributeHandleValuePairSetImp::getValuePointer(RTI::ULong i, RTI::ULong
&len) const
- throw (RTI::ArrayIndexOutOfBounds)
-{
- if (i < size()) {
- const AttributeHandleValuePair_t& item = _set[i];
- len = item.second.size();
- return (char *)&(item.second[0]);
- }
- else
- throw RTI::ArrayIndexOutOfBounds("");
-}
-
-RTI::TransportType
AttributeHandleValuePairSetImp::getTransportType(RTI::ULong) const
- throw (RTI::InvalidHandleValuePairSetContext)
-{
- return _transport;
-}
-
-RTI::OrderType AttributeHandleValuePairSetImp::getOrderType(RTI::ULong) const
- throw (RTI::ArrayIndexOutOfBounds, RTI::InvalidHandleValuePairSetContext)
-{
- return _order;
-}
-
-RTI::Region *AttributeHandleValuePairSetImp::getRegion(RTI::ULong) const
- throw (RTI::ArrayIndexOutOfBounds, RTI::InvalidHandleValuePairSetContext)
-{
- throw RTI::RTIinternalError("unimplemented function getRegion()");
-}
-
-void AttributeHandleValuePairSetImp::add(RTI::Handle h, const char *str,
RTI::ULong len)
- throw (RTI::ValueLengthExceeded, RTI::ValueCountExceeded)
-{
- std::vector<char> v;
- v.assign(str,str+len);
- _set.push_back(AttributeHandleValuePair_t(h, v));
-}
-
-void AttributeHandleValuePairSetImp::remove(RTI::Handle h)
- throw (RTI::ArrayIndexOutOfBounds)
-{
- for (std::vector<AttributeHandleValuePair_t>::iterator pos = _set.begin();
- pos != _set.end(); pos++) {
- if (pos->first == h) {
- _set.erase(pos);
- return;
- }
- }
-
- throw RTI::ArrayIndexOutOfBounds("");
-}
-
-void AttributeHandleValuePairSetImp::moveFrom(const
AttributeHandleValuePairSet &, RTI::ULong &)
- throw (RTI::ValueCountExceeded, RTI::ArrayIndexOutOfBounds)
-{
- throw RTI::RTIinternalError("unimplemented function moveFrom()");
-}
-
-void AttributeHandleValuePairSetImp::empty()
-{
- _set.clear();
-}
-
-RTI::ULong AttributeHandleValuePairSetImp::start() const
-{
- // not implemented
- return 0 ;
-}
-
-RTI::ULong AttributeHandleValuePairSetImp::valid(RTI::ULong i) const
-{
- // not implemented
- return 0 ;
-}
-
-RTI::ULong AttributeHandleValuePairSetImp::next(RTI::ULong i) const
-{
- // not implemented
- return 0 ;
-}
-
-const std::vector<AttributeHandleValuePair_t>&
-AttributeHandleValuePairSetImp::getAttributeHandleValuePairs() const
-{
- return _set;
-}
-
-// ----------------------------------------------------------------------------
-AttributeHandleSetImp::AttributeHandleSetImp(RTI::ULong size)
-{
- _set.reserve(size);
-}
-
-AttributeHandleSetImp::AttributeHandleSetImp(const
std::vector<RTI::AttributeHandle> &val)
- : _set(val)
-{
-}
-
-AttributeHandleSetImp::AttributeHandleSetImp(const
std::vector<certi::AttributeHandle> &val)
-{
- _set.resize(val.size());
- std::copy(val.begin(), val.end(), _set.begin());
-}
-
-AttributeHandleSetImp::~AttributeHandleSetImp()
-{
-}
-
-RTI::ULong AttributeHandleSetImp::size() const
-{
- return _set.size();
-}
-
-RTI::AttributeHandle AttributeHandleSetImp::getHandle(RTI::ULong i) const
- throw (RTI::ArrayIndexOutOfBounds)
-{
- if (i < size())
- return _set[i];
- else
- throw RTI::ArrayIndexOutOfBounds("");
-}
-
-void AttributeHandleSetImp::add(RTI::AttributeHandle h)
- throw (RTI::ArrayIndexOutOfBounds, RTI::AttributeNotDefined)
-{
- _set.push_back(h);
-}
-
-void AttributeHandleSetImp::remove(RTI::AttributeHandle h)
- throw (RTI::AttributeNotDefined)
-{
- std::vector<RTI::AttributeHandle>::iterator pos = std::find(_set.begin(),
_set.end(), h);
- if (pos != _set.end())
- _set.erase(pos);
- else
- throw RTI::ArrayIndexOutOfBounds("");
-}
-
-void AttributeHandleSetImp::empty()
-{
- _set.clear();
-}
-
-RTI::Boolean AttributeHandleSetImp::isEmpty() const
-{
- return RTI::Boolean(_set.empty());
-}
-
-RTI::Boolean AttributeHandleSetImp::isMember(RTI::AttributeHandle h) const
-{
- return RTI::Boolean(std::find(_set.begin(), _set.end(), h) != _set.end());
-}
-
-const std::vector<RTI::AttributeHandle>&
-AttributeHandleSetImp::getAttributeHandles() const
-{
- return _set;
-}
-
-// ----------------------------------------------------------------------------
-FederateHandleSetImp::FederateHandleSetImp(RTI::ULong size)
-{
- _set.reserve(size);
-}
-
-FederateHandleSetImp::~FederateHandleSetImp()
-{
-}
-
-RTI::ULong FederateHandleSetImp::size() const
-{
- return _set.size();
-}
-
-RTI::FederateHandle FederateHandleSetImp::getHandle(RTI::ULong i) const
- throw (RTI::ArrayIndexOutOfBounds)
-{
- if (i < size())
- return _set[i];
- else
- throw RTI::ArrayIndexOutOfBounds("");
-}
-
-void FederateHandleSetImp::add(RTI::FederateHandle h)
- throw (RTI::ValueCountExceeded)
-{
- _set.push_back(h);
-}
-
-void FederateHandleSetImp::remove(RTI::FederateHandle h)
- throw (RTI::ArrayIndexOutOfBounds)
-{
- std::vector<RTI::FederateHandle>::iterator pos = std::find(_set.begin(),
_set.end(), h);
- if (pos != _set.end())
- _set.erase(pos);
- else
- throw RTI::ArrayIndexOutOfBounds("");
-}
-
-void FederateHandleSetImp::empty()
-{
- _set.clear();
-}
-
-RTI::Boolean FederateHandleSetImp::isMember(RTI::FederateHandle h) const
-{
- return RTI::Boolean(std::find(_set.begin(), _set.end(), h) != _set.end());
-}
-
-// ----------------------------------------------------------------------------
-ParameterHandleValuePairSetImp::ParameterHandleValuePairSetImp(RTI::ULong size)
-{
- _order = RECEIVE;
- _transport = RELIABLE;
-
- _set.reserve(size);
-}
-
-ParameterHandleValuePairSetImp::ParameterHandleValuePairSetImp(const
std::vector<ParameterHandleValuePair_t> &val)
- : _set(val)
-{
- _order = RECEIVE;
- _transport = RELIABLE;
-}
-
-ParameterHandleValuePairSetImp::~ParameterHandleValuePairSetImp()
-{
-}
-
-RTI::ULong ParameterHandleValuePairSetImp::size() const
-{
- return _set.size();
-}
-
-RTI::Handle ParameterHandleValuePairSetImp::getHandle(RTI::ULong i) const
- throw (RTI::ArrayIndexOutOfBounds)
-{
- if (i < size())
- return _set[i].first;
- else
- throw RTI::ArrayIndexOutOfBounds("");
-}
-
-RTI::ULong ParameterHandleValuePairSetImp::getValueLength(RTI::ULong i) const
- throw (RTI::ArrayIndexOutOfBounds)
-{
- if (i < size())
- return _set[i].second.size();
- else
- throw RTI::ArrayIndexOutOfBounds("");
-}
-
-void ParameterHandleValuePairSetImp::getValue(RTI::ULong i, char *buff,
RTI::ULong &len) const
- throw (RTI::ArrayIndexOutOfBounds)
-{
- if (i < size()) {
- const ParameterHandleValuePair_t& item = _set[i];
- len = item.second.size();
- memcpy(buff, &(item.second[0]), len);
- }
- else
- throw RTI::ArrayIndexOutOfBounds("");
-}
-
-char *ParameterHandleValuePairSetImp::getValuePointer(RTI::ULong i, RTI::ULong
&len) const
- throw (RTI::ArrayIndexOutOfBounds)
-{
- if (i < size()) {
- const ParameterHandleValuePair_t& item = _set[i];
- len = item.second.size();
- return (char *)&(item.second[0]);
- }
- else
- throw RTI::ArrayIndexOutOfBounds("");
-}
-
-RTI::TransportType ParameterHandleValuePairSetImp::getTransportType() const
- throw (RTI::InvalidHandleValuePairSetContext)
-{
- return _transport;
-}
-
-RTI::OrderType ParameterHandleValuePairSetImp::getOrderType() const
- throw (RTI::InvalidHandleValuePairSetContext)
-{
- return _order;
-}
-
-RTI::Region *ParameterHandleValuePairSetImp::getRegion() const
- throw (RTI::InvalidHandleValuePairSetContext)
-{
- throw RTI::RTIinternalError("unimplemented function getRegion()");
-}
-
-void ParameterHandleValuePairSetImp::add(RTI::Handle h, const char *str,
RTI::ULong len)
- throw (RTI::ValueLengthExceeded, RTI::ValueCountExceeded)
-{
- std::vector<char> v;
- v.assign(str,str+len);
- _set.push_back(ParameterHandleValuePair_t(h, v));
-}
-
-void ParameterHandleValuePairSetImp::remove(RTI::Handle h)
- throw (RTI::ArrayIndexOutOfBounds)
-{
- for (std::vector<ParameterHandleValuePair_t>::iterator pos = _set.begin();
- pos != _set.end(); pos++) {
- if (pos->first == h) {
- _set.erase(pos);
- return;
- }
- }
-
- throw RTI::ArrayIndexOutOfBounds("");
-}
-
-void ParameterHandleValuePairSetImp::moveFrom(const
ParameterHandleValuePairSet &, RTI::ULong &)
- throw (RTI::ValueCountExceeded, RTI::ArrayIndexOutOfBounds)
-{
- throw RTI::RTIinternalError("unimplemented function moveFrom()");
-}
-
-void ParameterHandleValuePairSetImp::empty()
-{
- _set.clear();
-}
-
-RTI::ULong ParameterHandleValuePairSetImp::start() const
-{
- // not implemented
- return 0;
-}
-
-RTI::ULong ParameterHandleValuePairSetImp::valid(RTI::ULong i) const
-{
- // not implemented
- return 0;
-}
-
-RTI::ULong ParameterHandleValuePairSetImp::next(RTI::ULong i) const
-{
- // not implemented
- return 0;
-}
-
-const std::vector<ParameterHandleValuePair_t> &
-ParameterHandleValuePairSetImp::getParameterHandleValuePairs() const
-{
- return _set;
-}
-
-// ----------------------------------------------------------------------------
-RTI::AttributeHandleValuePairSet *
-RTI::AttributeSetFactory::create(RTI::ULong size)
- throw (MemoryExhausted, ValueCountExceeded, HandleValuePairMaximumExceeded)
-{
- return new AttributeHandleValuePairSetImp(size);
-}
-
-// ----------------------------------------------------------------------------
-RTI::AttributeHandleSet *
-RTI::AttributeHandleSetFactory::create(RTI::ULong size)
- throw (MemoryExhausted, ValueCountExceeded)
-{
- return new AttributeHandleSetImp(size);
-}
-
-// ----------------------------------------------------------------------------
-RTI::FederateHandleSet *
-RTI::FederateHandleSetFactory::create(RTI::ULong size)
- throw (MemoryExhausted, ValueCountExceeded)
-{
- return new FederateHandleSetImp(size);
-}
-
-// ----------------------------------------------------------------------------
-RTI::ParameterHandleValuePairSet *
-RTI::ParameterSetFactory::create(RTI::ULong size)
- throw (MemoryExhausted, ValueCountExceeded, HandleValuePairMaximumExceeded)
-{
- return new ParameterHandleValuePairSetImp(size);
-}
-
-// ----------------------------------------------------------------------------
-RegionImp::RegionImp(RegionHandle h, RTI::SpaceHandle s, const
std::vector<Extent> &ext)
- : handle(h), space(s), extents(ext), effectiveExtents(ext)
-{
-}
-
-RegionImp::~RegionImp()
-{
-}
-
-RTI::ULong RegionImp::getRangeLowerBound(RTI::ExtentIndex index,
RTI::DimensionHandle dimension) const
- throw (RTI::ArrayIndexOutOfBounds)
-{
- if (index < extents.size())
- return extents[index].getRangeLowerBound(dimension);
- else
- throw RTI::ArrayIndexOutOfBounds("Extent index above limit");
-}
-
-RTI::ULong RegionImp::getRangeUpperBound(RTI::ExtentIndex index,
RTI::DimensionHandle dimension) const
- throw (RTI::ArrayIndexOutOfBounds)
-{
- if (index < extents.size())
- return extents[index].getRangeUpperBound(dimension);
- else
- throw RTI::ArrayIndexOutOfBounds("Extent index above limit");
-}
-
-void RegionImp::setRangeLowerBound(RTI::ExtentIndex index,
RTI::DimensionHandle dimension, RTI::ULong val)
- throw (RTI::ArrayIndexOutOfBounds)
-{
- if (index < extents.size())
- extents[index].setRangeLowerBound(dimension, val);
- else
- throw RTI::ArrayIndexOutOfBounds("Extent index above limit");
-}
-
-void RegionImp::setRangeUpperBound(RTI::ExtentIndex index,
RTI::DimensionHandle dimension, RTI::ULong val)
- throw (RTI::ArrayIndexOutOfBounds)
-{
- if (index < extents.size())
- extents[index].setRangeUpperBound(dimension, val);
- else
- throw RTI::ArrayIndexOutOfBounds("Extent index above limit");
-}
-
-RTI::SpaceHandle RegionImp::getSpaceHandle() const
- throw ()
-{
- return space;
-}
-
-RTI::ULong RegionImp::getNumberOfExtents() const
- throw ()
-{
- return extents.size();
-}
-
-RTI::ULong RegionImp::getRangeLowerBoundNotificationLimit(RTI::ExtentIndex
index, RTI::DimensionHandle dimension) const
- throw (RTI::ArrayIndexOutOfBounds)
-{
- if (index < effectiveExtents.size())
- return effectiveExtents[index].getRangeLowerBound(dimension);
- else
- throw RTI::ArrayIndexOutOfBounds("Extent index above limit");
-}
-
-RTI::ULong RegionImp::getRangeUpperBoundNotificationLimit(RTI::ExtentIndex
index, RTI::DimensionHandle dimension) const
- throw (RTI::ArrayIndexOutOfBounds)
-{
- if (index < effectiveExtents.size())
- return effectiveExtents[index].getRangeUpperBound(dimension);
- else
- throw RTI::ArrayIndexOutOfBounds("Extent index above limit");
-}
-
-RegionHandle RegionImp::getHandle() const
-{
- return handle;
-}
-
-/** Get the region's extents
- \return The extents, as a vector
- */
-const std::vector<Extent> &
-RegionImp::getExtents() const
-{
- return extents;
-}
-
-/** Register a successful notifyAboutRegionModification()
- */
-void RegionImp::commit()
-{
- if (extents.size() != effectiveExtents.size())
- throw RTI::InvalidExtents("Different number of extents");
-
- effectiveExtents = extents;
-}
-
-// $Id: RTItypesImp.cc,v 3.10 2011/07/13 15:43:16 erk Exp $
Index: RTItypes.cc
===================================================================
RCS file: RTItypes.cc
diff -N RTItypes.cc
--- RTItypes.cc 7 Mar 2010 18:23:39 -0000 1.6
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,267 +0,0 @@
-// ----------------------------------------------------------------------------
-// CERTI - HLA RunTime Infrastructure
-// Copyright (C) 2002-2006 ONERA
-//
-// This program 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.
-//
-// This program 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: RTItypes.cc,v 1.6 2010/03/07 18:23:39 erk Exp $
-// ----------------------------------------------------------------------------
-
-#include "Exception.hh"
-#include "PrettyDebug.hh"
-#include <assert.h>
-#include <sstream>
-#include <cstdlib>
-#include <cstring>
-#include "RTI.hh"
-
-// static members for HLA Exceptions
-const char *RTI::ArrayIndexOutOfBounds::_ex = "ArrayIndexOutOfBounds" ;
-const char *RTI::AsynchronousDeliveryAlreadyDisabled::_ex =
"AsynchronousDeliveryAlreadyDisabled" ;
-const char *RTI::AsynchronousDeliveryAlreadyEnabled::_ex =
"AsynchronousDeliveryAlreadyEnabled" ;
-const char *RTI::AttributeAcquisitionWasNotRequested::_ex =
"AttributeAcquisitionWasNotRequested" ;
-const char *RTI::AttributeAcquisitionWasNotCanceled::_ex =
"AttributeAcquisitionWasNotCanceled" ;
-const char *RTI::AttributeAlreadyBeingAcquired::_ex =
"AttributeAlreadyBeingAcquired" ;
-const char *RTI::AttributeAlreadyBeingDivested::_ex =
"AttributeAlreadyBeingDivested" ;
-const char *RTI::AttributeAlreadyOwned::_ex = "AttributeAlreadyOwned" ;
-const char *RTI::AttributeDivestitureWasNotRequested::_ex =
"AttributeDivestitureWasNotRequested" ;
-const char *RTI::AttributeNotDefined::_ex = "AttributeNotDefined" ;
-const char *RTI::AttributeNotKnown::_ex = "AttributeNotKnown" ;
-const char *RTI::AttributeNotOwned::_ex = "AttributeNotOwned" ;
-const char *RTI::AttributeNotPublished::_ex = "AttributeNotPublished" ;
-const char *RTI::ConcurrentAccessAttempted::_ex = "ConcurrentAccessAttempted" ;
-const char *RTI::CouldNotDiscover::_ex = "CouldNotDiscover" ;
-const char *RTI::CouldNotOpenFED::_ex = "CouldNotOpenFED" ;
-const char *RTI::CouldNotRestore::_ex = "CouldNotRestore" ;
-const char *RTI::DeletePrivilegeNotHeld::_ex = "DeletePrivilegeNotHeld" ;
-const char *RTI::DimensionNotDefined::_ex = "DimensionNotDefined" ;
-const char *RTI::EnableTimeConstrainedPending::_ex =
"EnableTimeConstrainedPending" ;
-const char *RTI::EnableTimeConstrainedWasNotPending::_ex =
"EnableTimeConstrainedWasNotPending" ;
-const char *RTI::EnableTimeRegulationPending::_ex =
"EnableTimeRegulationPending" ;
-const char *RTI::EnableTimeRegulationWasNotPending::_ex =
"EnableTimeRegulationWasNotPending" ;
-const char *RTI::ErrorReadingFED::_ex = "ErrorReadingFED" ;
-const char *RTI::EventNotKnown::_ex = "EventNotKnown" ;
-const char *RTI::FederateAlreadyExecutionMember::_ex =
"FederateAlreadyExecutionMember" ;
-const char *RTI::FederateInternalError::_ex = "FederateInternalError" ;
-const char *RTI::FederateLoggingServiceCalls::_ex =
"FederateLoggingServiceCalls" ;
-const char *RTI::FederateNotExecutionMember::_ex =
"FederateNotExecutionMember" ;
-const char *RTI::FederateOwnsAttributes::_ex = "FederateOwnsAttributes" ;
-const char *RTI::FederateWasNotAskedToReleaseAttribute::_ex =
"FederateWasNotAskedToReleaseAttribute" ;
-const char *RTI::FederatesCurrentlyJoined::_ex = "FederatesCurrentlyJoined" ;
-const char *RTI::FederationExecutionAlreadyExists::_ex =
"FederationExecutionAlreadyExists" ;
-const char *RTI::FederationExecutionDoesNotExist::_ex =
"FederationExecutionDoesNotExist" ;
-const char *RTI::FederationTimeAlreadyPassed::_ex =
"FederationTimeAlreadyPassed" ;
-const char *RTI::HandleValuePairMaximumExceeded::_ex =
"HandleValuePairMaximumExceeded" ;
-const char *RTI::InteractionClassNotDefined::_ex =
"InteractionClassNotDefined" ;
-const char *RTI::InteractionClassNotKnown::_ex = "InteractionClassNotKnown" ;
-const char *RTI::InteractionClassNotPublished::_ex =
"InteractionClassNotPublished" ;
-const char *RTI::InteractionClassNotSubscribed::_ex =
"InteractionClassNotSubscribed" ;
-const char *RTI::InteractionParameterNotDefined::_ex =
"InteractionParameterNotDefined" ;
-const char *RTI::InteractionParameterNotKnown::_ex =
"InteractionParameterNotKnown" ;
-const char *RTI::InvalidExtents::_ex = "InvalidExtents" ;
-const char *RTI::InvalidFederationTime::_ex = "InvalidFederationTime" ;
-const char *RTI::InvalidHandleValuePairSetContext::_ex =
"InvalidHandleValuePairSetContext" ;
-const char *RTI::InvalidLookahead::_ex = "InvalidLookahead" ;
-const char *RTI::InvalidOrderingHandle::_ex = "InvalidOrderingHandle" ;
-const char *RTI::InvalidRegionContext::_ex = "InvalidRegionContext" ;
-const char *RTI::InvalidResignAction::_ex = "InvalidResignAction" ;
-const char *RTI::InvalidRetractionHandle::_ex = "InvalidRetractionHandle" ;
-const char *RTI::InvalidTransportationHandle::_ex =
"InvalidTransportationHandle" ;
-const char *RTI::MemoryExhausted::_ex = "MemoryExhausted" ;
-const char *RTI::NameNotFound::_ex = "NameNotFound" ;
-const char *RTI::ObjectClassNotDefined::_ex = "ObjectClassNotDefined" ;
-const char *RTI::ObjectClassNotKnown::_ex = "ObjectClassNotKnown" ;
-const char *RTI::ObjectClassNotPublished::_ex = "ObjectClassNotPublished" ;
-const char *RTI::ObjectClassNotSubscribed::_ex = "ObjectClassNotSubscribed" ;
-const char *RTI::ObjectNotKnown::_ex = "ObjectNotKnown" ;
-const char *RTI::ObjectAlreadyRegistered::_ex = "ObjectAlreadyRegistered" ;
-const char *RTI::OwnershipAcquisitionPending::_ex =
"OwnershipAcquisitionPending" ;
-const char *RTI::RegionInUse::_ex = "RegionInUse" ;
-const char *RTI::RegionNotKnown::_ex = "RegionNotKnown" ;
-const char *RTI::RestoreInProgress::_ex = "RestoreInProgress" ;
-const char *RTI::RestoreNotRequested::_ex = "RestoreNotRequested" ;
-const char *RTI::RTIinternalError::_ex = "RTIinternalError" ;
-const char *RTI::SpaceNotDefined::_ex = "SpaceNotDefined" ;
-const char *RTI::SaveInProgress::_ex = "SaveInProgress" ;
-const char *RTI::SaveNotInitiated::_ex = "SaveNotInitiated" ;
-const char *RTI::SpecifiedSaveLabelDoesNotExist::_ex =
"SpecifiedSaveLabelDoesNotExist" ;
-const char *RTI::SynchronizationPointLabelWasNotAnnounced::_ex =
"SynchronizationPointLabelWasNotAnnounced" ;
-const char *RTI::TimeAdvanceAlreadyInProgress::_ex =
"TimeAdvanceAlreadyInProgress" ;
-const char *RTI::TimeAdvanceWasNotInProgress::_ex =
"TimeAdvanceWasNotInProgress" ;
-const char *RTI::TimeConstrainedAlreadyEnabled::_ex =
"TimeConstrainedAlreadyEnabled" ;
-const char *RTI::TimeConstrainedWasNotEnabled::_ex =
"TimeConstrainedWasNotEnabled" ;
-const char *RTI::TimeRegulationAlreadyEnabled::_ex =
"TimeRegulationAlreadyEnabled" ;
-const char *RTI::TimeRegulationWasNotEnabled::_ex =
"TimeRegulationWasNotEnabled" ;
-const char *RTI::UnableToPerformSave::_ex = "UnableToPerformSave" ;
-const char *RTI::ValueCountExceeded::_ex = "ValueCountExceeded" ;
-const char *RTI::ValueLengthExceeded::_ex = "ValueLengthExceeded" ;
-
-// TypeException managing (how to obtain TypeException from Exception name ?)
-long RTI::ArrayIndexOutOfBounds::type = certi::e_ArrayIndexOutOfBounds ;
-long RTI::AsynchronousDeliveryAlreadyDisabled::type =
certi::e_AsynchronousDeliveryAlreadyDisabled ;
-long RTI::AsynchronousDeliveryAlreadyEnabled::type =
certi::e_AsynchronousDeliveryAlreadyEnabled ;
-long RTI::AttributeAcquisitionWasNotRequested::type =
certi::e_AttributeAcquisitionWasNotRequested ;
-long RTI::AttributeAcquisitionWasNotCanceled::type =
certi::e_AttributeAcquisitionWasNotCanceled ;
-long RTI::AttributeAlreadyBeingAcquired::type =
certi::e_AttributeAlreadyBeingAcquired ;
-long RTI::AttributeAlreadyBeingDivested::type =
certi::e_AttributeAlreadyBeingDivested ;
-long RTI::AttributeAlreadyOwned::type = certi::e_AttributeAlreadyOwned ;
-long RTI::AttributeDivestitureWasNotRequested::type =
certi::e_AttributeDivestitureWasNotRequested ;
-long RTI::AttributeNotDefined::type = certi::e_AttributeNotDefined ;
-long RTI::AttributeNotKnown::type = certi::e_AttributeNotKnown ;
-long RTI::AttributeNotOwned::type = certi::e_AttributeNotOwned ;
-long RTI::AttributeNotPublished::type = certi::e_AttributeNotPublished ;
-long RTI::ConcurrentAccessAttempted::type = certi::e_ConcurrentAccessAttempted
;
-long RTI::CouldNotDiscover::type = certi::e_CouldNotDiscover ;
-long RTI::CouldNotOpenFED::type = certi::e_CouldNotOpenFED ;
-long RTI::CouldNotRestore::type = certi::e_CouldNotRestore ;
-long RTI::DeletePrivilegeNotHeld::type = certi::e_DeletePrivilegeNotHeld ;
-long RTI::DimensionNotDefined::type = certi::e_DimensionNotDefined ;
-long RTI::EnableTimeConstrainedPending::type =
certi::e_EnableTimeConstrainedPending ;
-long RTI::EnableTimeConstrainedWasNotPending::type =
certi::e_EnableTimeConstrainedWasNotPending ;
-long RTI::EnableTimeRegulationPending::type =
certi::e_EnableTimeRegulationPending ;
-long RTI::EnableTimeRegulationWasNotPending::type =
certi::e_EnableTimeRegulationWasNotPending ;
-long RTI::ErrorReadingFED::type = certi::e_ErrorReadingFED ;
-long RTI::EventNotKnown::type = certi::e_EventNotKnown ;
-long RTI::FederateAlreadyExecutionMember::type =
certi::e_FederateAlreadyExecutionMember ;
-long RTI::FederateInternalError::type = certi::e_FederateInternalError ;
-long RTI::FederateLoggingServiceCalls::type =
certi::e_FederateLoggingServiceCalls ;
-long RTI::FederateNotExecutionMember::type =
certi::e_FederateNotExecutionMember ;
-long RTI::FederateOwnsAttributes::type = certi::e_FederateOwnsAttributes ;
-long RTI::FederateWasNotAskedToReleaseAttribute::type =
certi::e_FederateWasNotAskedToReleaseAttribute ;
-long RTI::FederatesCurrentlyJoined::type = certi::e_FederatesCurrentlyJoined ;
-long RTI::FederationExecutionAlreadyExists::type =
certi::e_FederationExecutionAlreadyExists ;
-long RTI::FederationExecutionDoesNotExist::type =
certi::e_FederationExecutionDoesNotExist ;
-long RTI::FederationTimeAlreadyPassed::type =
certi::e_FederationTimeAlreadyPassed ;
-long RTI::HandleValuePairMaximumExceeded::type =
certi::e_HandleValuePairMaximumExceeded ;
-long RTI::InteractionClassNotDefined::type =
certi::e_InteractionClassNotDefined ;
-long RTI::InteractionClassNotKnown::type = certi::e_InteractionClassNotKnown ;
-long RTI::InteractionClassNotPublished::type =
certi::e_InteractionClassNotPublished ;
-long RTI::InteractionClassNotSubscribed::type =
certi::e_InteractionClassNotSubscribed ;
-long RTI::InteractionParameterNotDefined::type =
certi::e_InteractionParameterNotDefined ;
-long RTI::InteractionParameterNotKnown::type =
certi::e_InteractionParameterNotKnown ;
-long RTI::InvalidExtents::type = certi::e_InvalidExtents ;
-long RTI::InvalidFederationTime::type = certi::e_InvalidFederationTime ;
-long RTI::InvalidHandleValuePairSetContext::type =
certi::e_InvalidHandleValuePairSetContext ;
-long RTI::InvalidLookahead::type = certi::e_InvalidLookahead ;
-long RTI::InvalidOrderingHandle::type = certi::e_InvalidOrderingHandle ;
-long RTI::InvalidRegionContext::type = certi::e_InvalidRegionContext ;
-long RTI::InvalidResignAction::type = certi::e_InvalidResignAction ;
-long RTI::InvalidRetractionHandle::type = certi::e_InvalidRetractionHandle ;
-long RTI::InvalidTransportationHandle::type =
certi::e_InvalidTransportationHandle ;
-long RTI::MemoryExhausted::type = certi::e_MemoryExhausted ;
-long RTI::NameNotFound::type = certi::e_NameNotFound ;
-long RTI::ObjectClassNotDefined::type = certi::e_ObjectClassNotDefined ;
-long RTI::ObjectClassNotKnown::type = certi::e_ObjectClassNotKnown ;
-long RTI::ObjectClassNotPublished::type = certi::e_ObjectClassNotPublished ;
-long RTI::ObjectClassNotSubscribed::type = certi::e_ObjectClassNotSubscribed ;
-long RTI::ObjectNotKnown::type = certi::e_ObjectNotKnown ;
-long RTI::ObjectAlreadyRegistered::type = certi::e_ObjectAlreadyRegistered ;
-long RTI::OwnershipAcquisitionPending::type =
certi::e_OwnershipAcquisitionPending ;
-long RTI::RegionInUse::type = certi::e_RegionInUse ;
-long RTI::RegionNotKnown::type = certi::e_RegionNotKnown ;
-long RTI::RestoreInProgress::type = certi::e_RestoreInProgress ;
-long RTI::RestoreNotRequested::type = certi::e_RestoreNotRequested ;
-long RTI::RTIinternalError::type = certi::e_RTIinternalError ;
-long RTI::SpaceNotDefined::type = certi::e_SpaceNotDefined ;
-long RTI::SaveInProgress::type = certi::e_SaveInProgress ;
-long RTI::SaveNotInitiated::type = certi::e_SaveNotInitiated ;
-long RTI::SpecifiedSaveLabelDoesNotExist::type =
certi::e_SpecifiedSaveLabelDoesNotExist ;
-long RTI::SynchronizationPointLabelWasNotAnnounced::type =
certi::e_SynchronizationPointLabelWasNotAnnounced ;
-long RTI::TimeAdvanceAlreadyInProgress::type =
certi::e_TimeAdvanceAlreadyInProgress ;
-long RTI::TimeAdvanceWasNotInProgress::type =
certi::e_TimeAdvanceWasNotInProgress ;
-long RTI::TimeConstrainedAlreadyEnabled::type =
certi::e_TimeConstrainedAlreadyEnabled ;
-long RTI::TimeConstrainedWasNotEnabled::type =
certi::e_TimeConstrainedWasNotEnabled ;
-long RTI::TimeRegulationAlreadyEnabled::type =
certi::e_TimeRegulationAlreadyEnabled ;
-long RTI::TimeRegulationWasNotEnabled::type =
certi::e_TimeRegulationWasNotEnabled ;
-long RTI::UnableToPerformSave::type = certi::e_UnableToPerformSave ;
-long RTI::ValueCountExceeded::type = certi::e_ValueCountExceeded ;
-long RTI::ValueLengthExceeded::type = certi::e_ValueLengthExceeded ;
-
-static PrettyDebug PD_RTIException("RTI_EXCEPTION",__FILE__);
-
-RTI::Exception::~Exception()
-{
- if (NULL!=_reason) {
- free(_reason);
- }
-}
-
-RTI::Exception::Exception(const char *reason)
-{
- _reason = (reason == NULL)?NULL:strdup(reason);
- _serial = 0 ;
-}
-
-RTI::Exception::Exception(ULong serial, const char *reason)
-{
- _serial = serial ;
- _reason = (reason == NULL)?NULL:strdup(reason);
-}
-
-
-RTI::Exception::Exception(const Exception &toCopy)
-{
- _serial = toCopy._serial ;
- _reason = ( toCopy._reason== NULL)?NULL:strdup(toCopy._reason) ;
- _name = toCopy._name ;
-}
-
-RTI::Exception& RTI::Exception::operator=(const Exception &toCopy)
-{
- _serial = toCopy._serial ;
- _reason = (toCopy._reason == NULL)?NULL:strdup(toCopy._reason) ;
- _name = toCopy._name ;
- return *this ;
-}
-
-const std::string RTI::Exception::displayMe() const
-{
- std::stringstream msg;
-
- msg << "RTI::Exception [";
- if (NULL!=_name) {
- msg <<_name;
- } else {
- msg<<"<noname>";
- }
- msg <<",0x"<<std::hex<<_serial<<"]";
- msg << " - reason=";
- if (NULL !=_reason) {
- msg << _reason;
- } else {
- msg << "<noreason>";
- }
- msg << std::endl;
- msg << std::flush;
-
- Debug(PD_RTIException, pdExcept) << msg.str();
- return msg.str();
-}
-
-RTI_STD::ostream &
-operator<<(RTI_STD::ostream &os, RTI::Exception const &ex)
-{
- // FIXME
- return os << ex.displayMe();
-}
-
-RTI_STD::ostream &
-operator<<(RTI_STD::ostream &os, RTI::Exception *ex)
-{
- assert(ex);
- return os<<(*ex);
-}
-
-// $Id: RTItypes.cc,v 1.6 2010/03/07 18:23:39 erk Exp $
Index: RTI1516Handle.cpp
===================================================================
RCS file: RTI1516Handle.cpp
diff -N RTI1516Handle.cpp
--- RTI1516Handle.cpp 17 Feb 2011 14:53:26 -0000 1.3
+++ /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: RTI1516ambPrivateRefs.cpp
===================================================================
RCS file: RTI1516ambPrivateRefs.cpp
diff -N RTI1516ambPrivateRefs.cpp
--- RTI1516ambPrivateRefs.cpp 13 Jul 2011 15:43:16 -0000 1.5
+++ /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.5 2011/07/13 15:43:16 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.5 2011/07/13 15:43:16 erk Exp $
Index: RTI1516HandleImplementation.cpp
===================================================================
RCS file: RTI1516HandleImplementation.cpp
diff -N RTI1516HandleImplementation.cpp
--- RTI1516HandleImplementation.cpp 31 May 2010 09:33:25 -0000 1.2
+++ /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: RTI1516fedTime.h
===================================================================
RCS file: RTI1516fedTime.h
diff -N RTI1516fedTime.h
--- RTI1516fedTime.h 8 Jun 2011 14:42:08 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,335 +0,0 @@
-#ifndef RTI1516_FEDTIME_H
-#define RTI1516_FEDTIME_H
-
-#include <RTI/certiLogicalTime.h>
-#include <RTI/certiLogicalTimeInterval.h>
-#include <RTI/certiLogicalTimeFactory.h>
-
-namespace rti1516 {
- class VariableLengthData;
-}
-
-class FEDTIME_EXPORT RTI1516fedTime : public rti1516::LogicalTime
-{
-public:
- RTI1516fedTime(double timeVal);
- RTI1516fedTime(const RTI1516fedTime &other);
-
- virtual ~RTI1516fedTime()
- throw ();
-
- virtual
- void
- setInitial();
-
- virtual
- bool
- isInitial() const;
-
- virtual
- void
- setFinal();
-
- virtual
- bool
- isFinal() const;
-
- virtual
- rti1516::LogicalTime &
- operator=(rti1516::LogicalTime const & value)
- throw (rti1516::InvalidLogicalTime);
-
- virtual
- RTI1516fedTime &
- operator=(RTI1516fedTime const & value)
- throw ();
-
- virtual
- rti1516::LogicalTime &
- operator+=(rti1516::LogicalTimeInterval const & addend)
- throw (rti1516::IllegalTimeArithmetic,
rti1516::InvalidLogicalTimeInterval);
-
- virtual
- rti1516::LogicalTime &
- operator-=(rti1516::LogicalTimeInterval const & subtrahend)
- throw (rti1516::IllegalTimeArithmetic,
rti1516::InvalidLogicalTimeInterval);
-
- virtual
- bool
- operator>(rti1516::LogicalTime const & value) const
- throw (rti1516::InvalidLogicalTime);
-
- virtual
- bool
- operator<(rti1516::LogicalTime const & value) const
- throw (rti1516::InvalidLogicalTime);
-
- virtual
- bool
- operator==(rti1516::LogicalTime const & value) const
- throw (rti1516::InvalidLogicalTime);
-
- virtual
- bool
- operator>=(rti1516::LogicalTime const & value) const
- throw (rti1516::InvalidLogicalTime);
-
- virtual
- bool
- operator<=(rti1516::LogicalTime const & value) const
- throw (rti1516::InvalidLogicalTime);
-
- // Generates an encoded value that can be used to send
- // LogicalTimes to other federates in updates or interactions
- // Not implemented.
- virtual
- rti1516::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 (rti1516::CouldNotEncode);
-
- // Decode encodedLogicalTime into self
- // Not implemented.
- virtual
- void
- decode(rti1516::VariableLengthData const & encodedLogicalTime)
- throw (rti1516::InternalError,
- rti1516::CouldNotDecode);
-
- // Alternate decode that reads directly from a buffer
- virtual
- void
- decode(void* buffer, unsigned long bufferSize)
- throw (rti1516::InternalError,
- rti1516::CouldNotDecode);
-
- virtual
- std::wstring
- toString() const;
-
- // Returns the name of the implementation, as needed by
- // createFederationExecution.
- virtual
- std::wstring
- implementationName() const;
-
- double getFedTime() const
- { return _fedTime; }
-
- bool isInfinity() const
- { return _fedTime == _positiveInfinity; }
-
-
-private:
- double _fedTime;
- double _zero;
- double _epsilon;
- double _positiveInfinity;
-
-}; // class RTI_EXPORT_FEDTIME RTI1516fedTime
-
-class FEDTIME_EXPORT RTI1516fedTimeInterval : public
rti1516::LogicalTimeInterval
-{
-public:
- RTI1516fedTimeInterval(double timeVal);
- RTI1516fedTimeInterval(const RTI1516fedTimeInterval &other);
-
- virtual
- ~RTI1516fedTimeInterval()
- throw ();
-
- virtual
- void
- setZero();
-
- virtual
- bool
- isZero() const;
-
- virtual
- void
- setEpsilon();
-
- virtual
- bool
- isEpsilon() const;
-
- virtual
- rti1516::LogicalTimeInterval &
- operator=(rti1516::LogicalTimeInterval const & value)
- throw (rti1516::InvalidLogicalTimeInterval);
-
- virtual
- RTI1516fedTimeInterval &
- operator=(RTI1516fedTimeInterval const & other)
- throw ();
-
- // Set self to the difference between two LogicalTimes
- virtual
- void
- setToDifference(rti1516::LogicalTime const & minuend,
- rti1516::LogicalTime const& subtrahend)
- throw (rti1516::InvalidLogicalTime);
-
- virtual
- rti1516::LogicalTimeInterval &
- operator+=(rti1516::LogicalTimeInterval const & addend)
- throw (rti1516::InvalidLogicalTimeInterval);
-
- virtual
- rti1516::LogicalTimeInterval &
- operator-=(rti1516::LogicalTimeInterval const & subtrahend)
- throw (rti1516::InvalidLogicalTimeInterval);
-
- virtual
- bool
- operator>(rti1516::LogicalTimeInterval const & value) const
- throw (rti1516::InvalidLogicalTimeInterval);
-
- virtual
- bool
- operator<(rti1516::LogicalTimeInterval const & value) const
- throw (rti1516::InvalidLogicalTimeInterval);
-
- virtual
- bool
- operator==(rti1516::LogicalTimeInterval const & value) const
- throw (rti1516::InvalidLogicalTimeInterval);
-
- virtual
- bool
- operator>=(rti1516::LogicalTimeInterval const & value) const
- throw (rti1516::InvalidLogicalTimeInterval);
-
- virtual
- bool
- operator<=(rti1516::LogicalTimeInterval const & value) const
- throw (rti1516::InvalidLogicalTimeInterval);
-
- // Generates an encoded value that can be used to send
- // LogicalTimeIntervals to other federates in updates or interactions
- // Not implemented.
- virtual
- rti1516::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 (rti1516::CouldNotEncode);
-
- // Decode encodedValue into self
- // Not implemented.
- virtual
- void
- decode(rti1516::VariableLengthData const & encodedValue)
- throw (rti1516::InternalError, rti1516::CouldNotDecode);
-
- // Alternate decode that reads directly from a buffer
- virtual
- void
- decode(void* buffer, unsigned long bufferSize)
- throw (rti1516::InternalError, rti1516::CouldNotDecode);
-
- virtual
- std::wstring
- toString() const;
-
- // Returns the name of the implementation, as needed by
- // createFederationExecution.
- virtual
- std::wstring
- implementationName() const;
-
- double getInterval() const
- { return _fedInterval; }
-
- double getEpsilon() const
- { return _epsilon; }
-
-private:
- double _fedInterval;
- double _zero;
- double _epsilon;
- double _positiveInfinity;
-
-}; // class FEDTIME_EXPORT RTI1516fedTimeInterval
-
-class FEDTIME_EXPORT RTI1516fedTimeFactory : public rti1516::LogicalTimeFactory
-{
-public:
- virtual
- ~RTI1516fedTimeFactory()
- throw ();
-
- // Returns a LogicalTime with a value of "initial"
- virtual
- std::auto_ptr< rti1516::LogicalTime >
- makeLogicalTime()
- throw (rti1516::InternalError);
-
- virtual
- std::auto_ptr< rti1516::LogicalTime >
- makeLogicalTime(double timeVal)
- throw (rti1516::InternalError);
-
- // Returns a LogicalTimeInterval with a value of "zero"
- virtual
- std::auto_ptr< rti1516::LogicalTimeInterval >
- makeLogicalTimeInterval()
- throw (rti1516::InternalError);
-
- virtual
- std::auto_ptr< rti1516::LogicalTimeInterval >
- makeLogicalTimeInterval(double timeInterval)
- throw (rti1516::InternalError);
-
-private:
- friend class rti1516::LogicalTimeFactoryFactory;
-
- // Private constructor - Only for LogicalTimeFactoryFactory to access.
- RTI1516fedTimeFactory()
- throw();
-
-}; // class FEDTIME_EXPORT RTI1516fedTimeFactory
-
-
-
-// The LogicalTimeFactoryFactory must also be implemented by the
-// federate. The definition is copied here (though commented out)
-// for reference.
-
-//namespace rti1516
-//{
-// class FEDTIME_EXPORT LogicalTimeFactoryFactory
-// {
-// public:
-//
-// // The name is used to choose among several LogicalTimeFactories that
might
-// // be present in the fedtime library. Each federation chooses its
-// // implementation by passing the appropriate name to
createFederationExecution.
-// // If the supplied name is the empty string, a default
LogicalTimeFactory is
-// // returned. If the supplied implementation name does not match any
name
-// // supported by the library, then a NULL pointer is returned.
-// static std::auto_ptr< LogicalTimeFactory >
-// makeLogicalTimeFactory(std::wstring const & implementationName);
-// };
-//}
-
-
-
-
-# endif // RTI1516_FED_TIME_H
Index: RTI1516fedTime.cpp
===================================================================
RCS file: RTI1516fedTime.cpp
diff -N RTI1516fedTime.cpp
--- RTI1516fedTime.cpp 24 May 2011 05:54:56 -0000 1.5
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,849 +0,0 @@
-#include <RTI/certiLogicalTime.h>
-#include <RTI/certiLogicalTimeInterval.h>
-#include <RTI/certiLogicalTimeFactory.h>
-
-#include <limits>
-#include <memory>
-#include <cstdlib>
-#include <cstring>
-
-#include "RTI1516fedTime.h"
-#include "certi.hh"
-
-rti1516::LogicalTime &
-rti1516::LogicalTime::operator=(rti1516::LogicalTime const & value)
-throw (rti1516::InvalidLogicalTime)
-{
- throw std::wstring(L"Operator should be overloaded");
- //throw rti1516::InvalidLogicalTime(L"Operator should be overloaded");
-}
-
-rti1516::LogicalTimeInterval &
-rti1516::LogicalTimeInterval::operator=(rti1516::LogicalTimeInterval const &
value)
-throw (rti1516::InvalidLogicalTimeInterval)
-{
- throw std::wstring(L"Operator should be overloaded");
- //throw rti1516::InvalidLogicalTimeInterval(L"Operator should be
overloaded");
-}
-
-
-/////////////////////////////////////////////////////////////
-//------------------- RTI1516fedTime ----------------------//
-/////////////////////////////////////////////////////////////
-
-
-RTI1516fedTime::RTI1516fedTime(double timeVal)
-: _fedTime(timeVal)
-, _zero(0)
-, _epsilon(std::numeric_limits<double>::epsilon())
-, _positiveInfinity(std::numeric_limits<double>::infinity())
-{
-}
-
-RTI1516fedTime::RTI1516fedTime(const RTI1516fedTime &other)
-: _fedTime(other._fedTime)
-, _zero(other._zero)
-, _epsilon(other._epsilon)
-, _positiveInfinity(other._positiveInfinity)
-{
-}
-
-RTI1516fedTime::~RTI1516fedTime()
-throw ()
-{
-}
-
-
-void
-RTI1516fedTime::setInitial()
-{
- _fedTime = (0);
- _zero = (0);
- _epsilon = (std::numeric_limits<double>::epsilon());
- _positiveInfinity = (std::numeric_limits<double>::infinity());
-}
-
-
-bool
-RTI1516fedTime::isInitial() const
-{
- return (_fedTime == _zero);
-}
-
-
-void
-RTI1516fedTime::setFinal()
-{
- _fedTime = (0);
- _zero = (0);
- _epsilon = (std::numeric_limits<double>::epsilon());
- _positiveInfinity = (std::numeric_limits<double>::infinity());
-}
-
-
-bool
-RTI1516fedTime::isFinal() const
-{
- return (_fedTime == _zero);
-}
-
-
-rti1516::LogicalTime &
-RTI1516fedTime::operator=(rti1516::LogicalTime const & value)
-throw (rti1516::InvalidLogicalTime)
-{
- if (this != &value)
- {
- const RTI1516fedTime * other = dynamic_cast<const
RTI1516fedTime *>(&value);
- if (other == NULL)
- {
-#if defined(_WIN32)
- throw std::wstring(L"Different LogicalTime
implementation");
- //throw rti1516::InvalidLogicalTime(L"Different
LogicalTime implementation");
-#else
- //throw rti1516::InvalidLogicalTime(L"Different
LogicalTime implementation");
-#endif
- } else
- {
- _fedTime = other->_fedTime;
- _zero = other->_zero;
- _epsilon = other->_epsilon;
- _positiveInfinity = other->_positiveInfinity;
- }
- }
-
- return *this;
-}
-
-RTI1516fedTime &
-RTI1516fedTime::operator=(RTI1516fedTime const & other)
-throw ()
-{
- if (this != &other)
- {
- _fedTime = other._fedTime;
- _zero = other._zero;
- _epsilon = other._epsilon;
- _positiveInfinity = other._positiveInfinity;
- }
- return *this;
-}
-
-
-rti1516::LogicalTime &
-RTI1516fedTime::operator+=(rti1516::LogicalTimeInterval const & value)
-throw (rti1516::IllegalTimeArithmetic, rti1516::InvalidLogicalTimeInterval)
-{
- const RTI1516fedTimeInterval * other = dynamic_cast<const
RTI1516fedTimeInterval *>(&value);
- if (other == NULL)
- {
-#if defined(_WIN32)
- throw std::wstring(L"Different LogicalTime implementation");
-#else
- //throw rti1516::InvalidLogicalTime(L"Different LogicalTime
implementation");
-#endif
- } else
- {
- _fedTime += other->getInterval();
- }
-
- return *this;
-}
-
-
-rti1516::LogicalTime &
-RTI1516fedTime::operator-=(rti1516::LogicalTimeInterval const & value)
-throw (rti1516::IllegalTimeArithmetic, rti1516::InvalidLogicalTimeInterval)
-{
- const RTI1516fedTimeInterval * other = dynamic_cast<const
RTI1516fedTimeInterval *>(&value);
- if (other == NULL)
- {
-#if defined(_WIN32)
- throw std::wstring(L"Different LogicalTime implementation");
-#else
- //throw rti1516::InvalidLogicalTime(L"Different LogicalTime
implementation");
-#endif
- } else
- {
- _fedTime -= other->getInterval();
- }
-
- return *this;
-}
-
-
-bool
-RTI1516fedTime::operator>(rti1516::LogicalTime const & value) const
-throw (rti1516::InvalidLogicalTime)
-{
- const RTI1516fedTime * other = dynamic_cast<const RTI1516fedTime
*>(&value);
- if (other == NULL)
- {
-#if defined(_WIN32)
- throw std::wstring(L"Different LogicalTime implementation");
-#else
- //throw rti1516::InvalidLogicalTime(L"Different LogicalTime
implementation");
-#endif
- } else
- {
- return _fedTime > other->_fedTime;
- }
- return false;
-}
-
-
-bool
-RTI1516fedTime::operator<(rti1516::LogicalTime const & value) const
-throw (rti1516::InvalidLogicalTime)
-{
- const RTI1516fedTime * other = dynamic_cast<const RTI1516fedTime
*>(&value);
- if (other == NULL)
- {
-#if defined(_WIN32)
- throw std::wstring(L"Different LogicalTime implementation");
-#else
- //throw rti1516::InvalidLogicalTime(L"Different LogicalTime
implementation");
-#endif
- } else
- {
- return _fedTime < other->_fedTime;
- }
- return false;
-}
-
-
-bool
-RTI1516fedTime::operator==(rti1516::LogicalTime const & value) const
-throw (rti1516::InvalidLogicalTime)
-{
- const RTI1516fedTime * other = dynamic_cast<const RTI1516fedTime
*>(&value);
- if (other == NULL)
- {
-#if defined(_WIN32)
- throw std::wstring(L"Different LogicalTime implementation");
-#else
- //throw rti1516::InvalidLogicalTime(L"Different LogicalTime
implementation");
-#endif
- } else
- {
- // TODO Should use epsilon during comparison
- return _fedTime == other->_fedTime;
- }
- return false;
-}
-
-
-bool
-RTI1516fedTime::operator>=(rti1516::LogicalTime const & value) const
-throw (rti1516::InvalidLogicalTime)
-{
- const RTI1516fedTime * other = dynamic_cast<const RTI1516fedTime
*>(&value);
- if (other == NULL)
- {
-#if defined(_WIN32)
- throw std::wstring(L"Different LogicalTime implementation");
-#else
- //throw rti1516::InvalidLogicalTime(L"Different LogicalTime
implementation");
-#endif
- } else
- {
- return _fedTime >= other->_fedTime;
- }
- return false;
-}
-
-
-bool
-RTI1516fedTime::operator<=(rti1516::LogicalTime const & value) const
-throw (rti1516::InvalidLogicalTime)
-{
- const RTI1516fedTime * other = dynamic_cast<const RTI1516fedTime
*>(&value);
- if (other == NULL)
- {
-#if defined(_WIN32)
- throw std::wstring(L"Different LogicalTime implementation");
-#else
- //throw rti1516::InvalidLogicalTime(L"Different LogicalTime
implementation");
-#endif
- } else
- {
- return _fedTime <= other->_fedTime;
- }
- return false;
-}
-
-// Generates an encoded value that can be used to send
-// LogicalTimes to other federates in updates or interactions
-
-rti1516::VariableLengthData
-RTI1516fedTime::encode() const
-{
- uint64_t value;
-#ifdef HOST_IS_BIG_ENDIAN
- memcpy(&value, &_fedTime, sizeof(double));
-#else
- value = CERTI_ENCODE_DOUBLE_TO_UINT64BE(&_fedTime);
-#endif
- return rti1516::VariableLengthData(&value,sizeof(uint64_t));
-}
-
-// Alternate encode for directly filling a buffer
-
-unsigned long
-RTI1516fedTime::encodedLength() const
-{
- return sizeof(double);
-}
-
-
-unsigned long
-RTI1516fedTime::encode(void* buffer, unsigned long bufferSize) const
-throw (rti1516::CouldNotEncode)
-{
- if (bufferSize >= sizeof(double))
- {
-#ifdef HOST_IS_BIG_ENDIAN
- memcpy(buffer, &_fedTime, sizeof(double));
-#else
- uint64_t value;
- value = CERTI_ENCODE_DOUBLE_TO_UINT64BE(&_fedTime);
- memcpy(buffer,&value,sizeof(double));
-#endif
- return sizeof(double);
- } else
- {
-#if defined(_WIN32)
- throw std::wstring(L"Not enough space in buffer to encode
RTI1516fedTime");
-#else
- return 0;
- //throw rti1516::CouldNotEncode(L"Not enough space in buffer to
encode RTI1516fedTime");
-#endif
- }
-}
-
-// Decode encodedLogicalTime into self
-
-void
-RTI1516fedTime::decode(rti1516::VariableLengthData const & encodedLogicalTime)
-throw (rti1516::InternalError,
- rti1516::CouldNotDecode)
-{
- union ud {
- double dv;
- uint64_t uv;
- } value;
-#ifdef HOST_IS_BIG_ENDIAN
- memcpy(&(value.uv), encodedLogicalTime.data(), sizeof(double));
-#else
- value.uv = CERTI_DECODE_DOUBLE_FROM_UINT64BE(encodedLogicalTime.data());
-#endif
- _fedTime = value.dv;
-}
-
-// Alternate decode that reads directly from a buffer
-
-void
-RTI1516fedTime::decode(void* buffer, unsigned long bufferSize)
-throw (rti1516::InternalError,
- rti1516::CouldNotDecode)
-{
- if (bufferSize >= sizeof(double))
- {
- union ud {
- double dv;
- uint64_t uv;
- } value;
- value.uv = CERTI_DECODE_DOUBLE_FROM_UINT64BE(buffer);
- _fedTime = value.dv;
- } else
- {
-#if defined(_WIN32) && defined(_MSC_VER)
- throw std::wstring(L"Not enough space in buffer to decode
RTI1516fedTime");
-#else
- //throw rti1516::CouldNotEncode(L"Not enough space in buffer to
decode RTI1516fedTime");
-#endif
- }
-}
-
-
-std::wstring
-RTI1516fedTime::toString() const
-{
- std::wstringstream stream;
-
- stream << _fedTime;
-
- return stream.str();
-}
-
-// Returns the name of the implementation, as needed by
-// createFederationExecution.
-
-std::wstring
-RTI1516fedTime::implementationName() const
-{
- static std::wstring implName(L"certiFedTime1516");
- return implName;
-}
-
-
-/////////////////////////////////////////////////////////////
-//--------------- RTI1516fedTimeInterval ------------------//
-/////////////////////////////////////////////////////////////
-
-RTI1516fedTimeInterval::RTI1516fedTimeInterval(double timeVal)
-: _fedInterval(timeVal)
-, _zero(0)
-, _epsilon(std::numeric_limits<double>::epsilon())
-, _positiveInfinity(std::numeric_limits<double>::infinity())
-{
-}
-
-RTI1516fedTimeInterval::RTI1516fedTimeInterval(const RTI1516fedTimeInterval
&other)
-: _fedInterval(other._fedInterval)
-, _zero(other._zero)
-, _epsilon(other._epsilon)
-, _positiveInfinity(other._positiveInfinity)
-{
-}
-
-
-RTI1516fedTimeInterval::~RTI1516fedTimeInterval()
-throw ()
-{
-}
-
-
-void
-RTI1516fedTimeInterval::setZero()
-{
- _fedInterval = _zero;
-}
-
-
-bool
-RTI1516fedTimeInterval::isZero() const
-{
- return _fedInterval == _zero;
-}
-
-
-void
-RTI1516fedTimeInterval::setEpsilon()
-{
- _epsilon = (std::numeric_limits<double>::epsilon());
-}
-
-
-bool
-RTI1516fedTimeInterval::isEpsilon() const
-{
-
- return abs(_fedInterval) <= abs(_epsilon);
-}
-
-
-rti1516::LogicalTimeInterval &
-RTI1516fedTimeInterval::operator=(rti1516::LogicalTimeInterval const & value)
-throw (rti1516::InvalidLogicalTimeInterval)
-{
- if (this != &value)
- {
- const RTI1516fedTimeInterval * other = dynamic_cast<const
RTI1516fedTimeInterval *>(&value);
- if (other == NULL)
- {
-#if defined(_WIN32) && defined(_MSC_VER)
- throw std::wstring(L"Different LogicalTimeInterval
implementation");
-#else
- //throw rti1516::InvalidLogicalTimeInterval(L"Different
LogicalTimeInterval implementation");
-#endif
- } else
- {
- _fedInterval = other->_fedInterval;
- _zero = other->_zero;
- _epsilon = other->_epsilon;
- _positiveInfinity = other->_positiveInfinity;
- }
- }
-
- return *this;
-}
-
-RTI1516fedTimeInterval &
-RTI1516fedTimeInterval::operator=(RTI1516fedTimeInterval const & other)
-throw ()
-{
- if (this != &other)
- {
- _fedInterval = other._fedInterval;
- _zero = other._zero;
- _epsilon = other._epsilon;
- _positiveInfinity = other._positiveInfinity;
- }
- return *this;
-}
-
-
-// Set self to the difference between two LogicalTimes
-
-void
-RTI1516fedTimeInterval::setToDifference(rti1516::LogicalTime const & minuend,
-
rti1516::LogicalTime const& subtrahend)
-
throw (rti1516::InvalidLogicalTime)
-{
- const RTI1516fedTime * val1 = dynamic_cast<const RTI1516fedTime
*>(&minuend);
- const RTI1516fedTime * val2 = dynamic_cast<const RTI1516fedTime
*>(&subtrahend);
-
- if (val1 == 0 && val2 == 0)
- {
- // Both wrong
- std::wstring message(L"First and second argument are different
LogicalTime implementations.");
-#if defined(_WIN32) && defined(_MSC_VER)
- throw message;
-#else
- //throw rti1516::InvalidLogicalTime(message);
-#endif
- } else if (val1 == 0)
- {
- // first wrong
- std::wstring message(L"First argument uses a different
LogicalTime implementations.");
-#if defined(_WIN32) && defined(_MSC_VER)
- throw message;
-#else
- //throw rti1516::InvalidLogicalTime(message);
-#endif
- } else if (val2 == 0)
- {
- // second wrong
- std::wstring message(L"Second argument uses a different
LogicalTime implementations.");
-#if defined(_WIN32) && defined(_MSC_VER)
- throw message;
-#else
- //throw rti1516::InvalidLogicalTime(message);
-#endif
- } else
- {
- // Both correct
- // TODO Should handle infinity?
- _fedInterval = val1->getFedTime() - val2->getFedTime();
- }
-} /* end of RTI1516fedTimeInterval::setToDifference */
-
-
-rti1516::LogicalTimeInterval &
-RTI1516fedTimeInterval::operator+=(rti1516::LogicalTimeInterval const & value)
-throw (rti1516::InvalidLogicalTimeInterval)
-{
- const RTI1516fedTimeInterval * other = dynamic_cast<const
RTI1516fedTimeInterval *>(&value);
- if (other == NULL)
- {
-#if defined(_WIN32) && defined(_MSC_VER)
- throw std::wstring(L"Different LogicalTimeInterval
implementation");
-#else
- //throw rti1516::InvalidLogicalTimeInterval(L"Different
LogicalTimeInterval implementation");
-#endif
- } else
- {
- _fedInterval += other->getInterval();
- }
- return *this;
-}
-
-
-rti1516::LogicalTimeInterval &
-RTI1516fedTimeInterval::operator-=(rti1516::LogicalTimeInterval const & value)
-throw (rti1516::InvalidLogicalTimeInterval)
-{
- const RTI1516fedTimeInterval * other = dynamic_cast<const
RTI1516fedTimeInterval *>(&value);
- if (other == NULL)
- {
-#if defined(_WIN32) && defined(_MSC_VER)
- throw std::wstring(L"Different LogicalTimeInterval
implementation");
-#else
- //throw rti1516::InvalidLogicalTimeInterval(L"Different
LogicalTimeInterval implementation");
-#endif
- } else
- {
- _fedInterval -= other->getInterval();
- }
- return *this;
-}
-
-
-bool
-RTI1516fedTimeInterval::operator>(rti1516::LogicalTimeInterval const & value)
const
-throw (rti1516::InvalidLogicalTimeInterval)
-{
- const RTI1516fedTimeInterval * other = dynamic_cast<const
RTI1516fedTimeInterval *>(&value);
- if (other == NULL)
- {
-#if defined(_WIN32) && defined(_MSC_VER)
- throw std::wstring(L"Different LogicalTimeInterval
implementation");
-#else
- //throw rti1516::InvalidLogicalTimeInterval(L"Different
LogicalTimeInterval implementation");
-#endif
- } else
- {
- return getInterval() > other->getInterval();
- }
- return false;
-} /* end of RTI1516fedTimeInterval::operator> */
-
-
-bool
-RTI1516fedTimeInterval::operator<(rti1516::LogicalTimeInterval const & value)
const
-throw (rti1516::InvalidLogicalTimeInterval)
-{
- const RTI1516fedTimeInterval * other = dynamic_cast<const
RTI1516fedTimeInterval *>(&value);
- if (other == NULL)
- {
-#if defined(_WIN32) && defined(_MSC_VER)
- throw std::wstring(L"Different LogicalTimeInterval
implementation");
-#else
- //throw rti1516::InvalidLogicalTimeInterval(L"Different
LogicalTimeInterval implementation");
-#endif
- } else
- {
- return getInterval() > other->getInterval();
- }
- return false;
-}
-
-
-bool
-RTI1516fedTimeInterval::operator==(rti1516::LogicalTimeInterval const & value)
const
-throw (rti1516::InvalidLogicalTimeInterval)
-{
- const RTI1516fedTimeInterval * other = dynamic_cast<const
RTI1516fedTimeInterval *>(&value);
- if (other == NULL)
- {
-#if defined(_WIN32) && defined(_MSC_VER)
- throw std::wstring(L"Different LogicalTimeInterval
implementation");
-#else
- //throw rti1516::InvalidLogicalTimeInterval(L"Different
LogicalTimeInterval implementation");
-#endif
- } else
- {
- return getInterval() == other->getInterval();
- }
- return false;
-}
-
-
-bool
-RTI1516fedTimeInterval::operator>=(rti1516::LogicalTimeInterval const & value)
const
-throw (rti1516::InvalidLogicalTimeInterval)
-{
- const RTI1516fedTimeInterval * other = dynamic_cast<const
RTI1516fedTimeInterval *>(&value);
- if (other == NULL)
- {
-#if defined(_WIN32) && defined(_MSC_VER)
- throw std::wstring(L"Different LogicalTimeInterval
implementation");
-#else
- //throw rti1516::InvalidLogicalTimeInterval(L"Different
LogicalTimeInterval implementation");
-#endif
- } else
- {
- return getInterval() >= other->getInterval();
- }
- return false;
-}
-
-
-bool
-RTI1516fedTimeInterval::operator<=(rti1516::LogicalTimeInterval const & value)
const
-throw (rti1516::InvalidLogicalTimeInterval)
-{
- const RTI1516fedTimeInterval * other = dynamic_cast<const
RTI1516fedTimeInterval *>(&value);
- if (other == NULL)
- {
-#if defined(_WIN32) && defined(_MSC_VER)
- throw std::wstring(L"Different LogicalTimeInterval
implementation");
-#else
- //throw rti1516::InvalidLogicalTimeInterval(L"Different
LogicalTimeInterval implementation");
-#endif
- } else
- {
- return getInterval() <= other->getInterval();
- }
- return false;
-}
-
-// Generates an encoded value that can be used to send
-// LogicalTimeIntervals to other federates in updates or interactions
-
-rti1516::VariableLengthData
-RTI1516fedTimeInterval::encode() const
-{
- uint64_t value;
-#ifdef HOST_IS_BIG_ENDIAN
- memcpy(&value, &_fedTime, sizeof(double));
-#else
- value = CERTI_ENCODE_DOUBLE_TO_UINT64BE(&_fedInterval);
-#endif
- return rti1516::VariableLengthData(&value,sizeof(uint64_t));
-}
-
-// Alternate encode for directly filling a buffer
-
-unsigned long
-RTI1516fedTimeInterval::encodedLength() const
-{
- return sizeof(double);
-}
-
-
-unsigned long
-RTI1516fedTimeInterval::encode(void* buffer, unsigned long bufferSize) const
-throw (rti1516::CouldNotEncode)
-{
- if (bufferSize >= sizeof(double))
- {
-#ifdef HOST_IS_BIG_ENDIAN
- memcpy(buffer, &_fedInterval, sizeof(double));
-#else
- uint64_t value;
- value = CERTI_ENCODE_DOUBLE_TO_UINT64BE(&_fedInterval);
- memcpy(buffer,&value,sizeof(double));
-#endif
- return sizeof(double);
- } else
- {
-#if defined(_WIN32) && defined(_MSC_VER)
- throw std::wstring(L"Not enough space in buffer to encode
RTI1516fedTimeInterval");
-#else
- //throw rti1516::CouldNotEncode(L"Not enough space in buffer to
encode RTI1516fedTimeInterval");
-#endif
- }
- return false;
-}
-
-// Decode encodedValue into self
-
-void
-RTI1516fedTimeInterval::decode(rti1516::VariableLengthData const &
encodedValue)
-throw (rti1516::InternalError, rti1516::CouldNotDecode)
-{
- union ud {
- double dv;
- uint64_t uv;
- } value;
-#ifdef HOST_IS_BIG_ENDIAN
- memcpy(&(value.uv), encodedValue.data(), sizeof(double));
-#else
- value.uv = CERTI_DECODE_DOUBLE_FROM_UINT64BE(encodedValue.data());
-#endif
- _fedInterval = value.dv;
-}
-
-// Alternate decode that reads directly from a buffer
-
-void
-RTI1516fedTimeInterval::decode(void* buffer, unsigned long bufferSize)
-throw (rti1516::InternalError, rti1516::CouldNotDecode)
-{
- if (bufferSize >= sizeof(double))
- {
- union ud {
- double dv;
- uint64_t uv;
- } value;
- value.uv = CERTI_DECODE_DOUBLE_FROM_UINT64BE(buffer);
- _fedInterval = value.dv;
- } else
- {
-#if defined(_WIN32) && defined(_MSC_VER)
- throw std::wstring(L"Not enough space in buffer to decode
RTI1516fedTimeInterval");
-#else
- //throw rti1516::CouldNotEncode(L"Not enough space in buffer to
decode RTI1516fedTimeInterval");
-#endif
- }
-}
-
-
-std::wstring
-RTI1516fedTimeInterval::toString() const
-{
- std::wstringstream stream;
- stream << _fedInterval;
-
- return stream.str();
-}
-
-// Returns the name of the implementation, as needed by
-// createFederationExecution.
-
-std::wstring
-RTI1516fedTimeInterval::implementationName() const
-{
- static std::wstring implName(L"certiFedTime1516");
- return implName;
-}
-
-
-/////////////////////////////////////////////////////////////
-//---------------- RTI1516fedTimeFactory ------------------//
-/////////////////////////////////////////////////////////////
-
-RTI1516fedTimeFactory::RTI1516fedTimeFactory()
-throw ()
-{
-}
-
-
-RTI1516fedTimeFactory::~RTI1516fedTimeFactory()
-throw ()
-{
-}
-
-// Returns a LogicalTime with a value of "initial"
-
-std::auto_ptr< rti1516::LogicalTime >
-RTI1516fedTimeFactory::makeLogicalTime()
-throw (rti1516::InternalError)
-{
- RTI1516fedTime *fedTime = new RTI1516fedTime(0);
-
- return std::auto_ptr< rti1516::LogicalTime >(fedTime);
-}
-
-
-std::auto_ptr< rti1516::LogicalTime >
-RTI1516fedTimeFactory::makeLogicalTime(double timeVal)
-throw (rti1516::InternalError)
-{
- RTI1516fedTime *fedTime = new RTI1516fedTime(timeVal);
-
- return std::auto_ptr< rti1516::LogicalTime >(fedTime);
-}
-
-// Returns a LogicalTimeInterval with a value of "zero"
-
-std::auto_ptr< rti1516::LogicalTimeInterval >
-RTI1516fedTimeFactory::makeLogicalTimeInterval()
-throw (rti1516::InternalError)
-{
- RTI1516fedTimeInterval *fedTimeInterval = new RTI1516fedTimeInterval(0);
-
- return std::auto_ptr< rti1516::LogicalTimeInterval >(fedTimeInterval);
-}
-
-
-std::auto_ptr< rti1516::LogicalTimeInterval >
-RTI1516fedTimeFactory::makeLogicalTimeInterval(double timeInterval)
-throw (rti1516::InternalError)
-{
- RTI1516fedTimeInterval *fedTimeInterval = new
RTI1516fedTimeInterval(timeInterval);
-
- return std::auto_ptr< rti1516::LogicalTimeInterval >(fedTimeInterval);
-}
-
-
-
-std::auto_ptr< rti1516::LogicalTimeFactory >
-rti1516::LogicalTimeFactoryFactory::makeLogicalTimeFactory(std::wstring const
& implementationName)
-{
- RTI1516fedTimeFactory *fedTimeFactory = new RTI1516fedTimeFactory();
-
- return std::auto_ptr< rti1516::LogicalTimeFactory >(fedTimeFactory);
-}
Index: RTIambPrivateRefs.cc
===================================================================
RCS file: RTIambPrivateRefs.cc
diff -N RTIambPrivateRefs.cc
--- RTIambPrivateRefs.cc 13 Jul 2011 15:43:16 -0000 3.29
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,986 +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: RTIambPrivateRefs.cc,v 3.29 2011/07/13 15:43:16 erk Exp $
-// ----------------------------------------------------------------------------
-
-#include <config.h>
-#include "RTIambPrivateRefs.hh"
-#include "RTItypesImp.hh"
-#include "PrettyDebug.hh"
-#include "M_Classes.hh"
-#include <sstream>
-#include <iostream>
-#include <memory>
-
-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).begin(),
request->getValues(i).end());
- }
-
- return result;
-}
-
-template<typename T>
-std::vector<std::pair<RTI::ParameterHandle, ParameterValue_t> >
-getPHVPSFromRequest(T* request)
-{
- uint32_t size = request->getParametersSize();
-
- std::vector<std::pair<RTI::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).begin(),
request->getValues(i).end());
- }
-
- return result;
-}
-}
-
-RTIambPrivateRefs::RTIambPrivateRefs()
-{
- fed_amb = NULL;
-#ifdef _WIN32
- handle_RTIA = (HANDLE)-1;
-#else
- pid_RTIA = (pid_t)-1;
-#endif
- is_reentrant = false;
- _theRootObj = NULL;
- socketUn = NULL;
-}
-
-RTIambPrivateRefs::~RTIambPrivateRefs()
-{
- delete socketUn ;
-}
-
-// ----------------------------------------------------------------------------
-void
-RTIambPrivateRefs::leave(const char *msg) throw (RTI::RTIinternalError)
-{
- std::stringstream smsg;
- smsg << "RTI called leave because <" <<msg<<">";
- throw RTI::RTIinternalError(smsg.str().c_str());
-}
-
-// ----------------------------------------------------------------------------
-void
-RTIambPrivateRefs::executeService(Message *req, Message *rep)
-{
- G.Out(pdGendoc,"enter
RTIambPrivateRefs::executeService(%s,%s)",req->getMessageName(),rep->getMessageName());
-
- D.Out(pdDebug, "sending request to RTIA.");
-
- try {
- req->send(socketUn,msgBufSend);
- }
- catch (NetworkError) {
- std::cerr << "libRTI: exception: NetworkError (write)" <<
std::endl ;
- throw RTI::RTIinternalError("libRTI: Network Write Error");
- }
-
- D.Out(pdDebug, "waiting RTIA reply.");
-
- // waiting RTI reply.
- try {
- rep->receive(socketUn,msgBufReceive);
- }
- catch (NetworkError) {
- std::cerr << "libRTI: exception: NetworkError (read)" <<
std::endl ;
- throw RTI::RTIinternalError("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 RTI::RTIinternalError("RTIambPrivateRefs::executeService:
"
- "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 RTIambPrivateRefs::executeService");
-}
-
-void
-RTIambPrivateRefs::sendTickRequestStop()
-{
- G.Out(pdGendoc,"enter RTIambPrivateRefs::sendTickRequestStop");
-
- M_Tick_Request_Stop req, rep ;
-
- try {
- req.send(socketUn, msgBufSend);
- }
- catch (NetworkError) {
- std::cerr << "libRTI: exception: NetworkError (write)" <<
std::endl ;
- throw RTI::RTIinternalError("libRTI: Network Write Error");
- }
-
- try {
- rep.receive(socketUn, msgBufReceive);
- }
- catch (NetworkError) {
- std::cerr << "libRTI: exception: NetworkError (read)" <<
std::endl ;
- throw RTI::RTIinternalError("libRTI: Network Read Error waiting
RTI reply");
- }
-
- // ignore the response, ignore exceptions
- // rep->type == Message::TICK_REQUEST;
-
- G.Out(pdGendoc,"exit RTIambPrivateRefs::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
-RTIambPrivateRefs::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.");
- throw RTI::ArrayIndexOutOfBounds(msg->getExceptionReason());
- } break ;
-
- case e_AsynchronousDeliveryAlreadyEnabled: {
- D.Out(pdExcept, "Throwing e_AsynchronousDeliveryAlreadyEnabled
exception.");
- throw
RTI::AsynchronousDeliveryAlreadyEnabled(msg->getExceptionReason());
- } break ;
-
- case e_AsynchronousDeliveryAlreadyDisabled: {
- D.Out(pdExcept, "Throwing e_AsynchronousDeliveryAlreadyDisabled
exception.");
- throw
RTI::AsynchronousDeliveryAlreadyDisabled(msg->getExceptionReason());
- } break ;
-
- case e_AttributeAlreadyOwned: {
- D.Out(pdExcept, "Throwing e_AttributeAlreadyOwned exception.");
- throw RTI::AttributeAlreadyOwned(msg->getExceptionReason());
- } break ;
-
- case e_AttributeAlreadyBeingAcquired: {
- D.Out(pdExcept,
- "Throwing e_AttributeAlreadyBeingAcquired
exception.");
- throw
RTI::AttributeAlreadyBeingAcquired(msg->getExceptionReason());
- } break ;
-
- case e_AttributeAlreadyBeingDivested: {
- D.Out(pdExcept,
- "Throwing e_AttributeAlreadyBeingDivested
exception.");
- throw
RTI::AttributeAlreadyBeingDivested(msg->getExceptionReason());
- } break ;
-
- case e_AttributeDivestitureWasNotRequested: {
- D.Out(pdExcept,
- "Throwing e_AttributeDivestitureWasNotRequested
exception.");
- throw
RTI::AttributeDivestitureWasNotRequested(msg->getExceptionReason());
- } break ;
-
- case e_AttributeAcquisitionWasNotRequested: {
- D.Out(pdExcept,
- "Throwing e_AttributeAcquisitionWasNotRequested
exception.");
- throw
RTI::AttributeAcquisitionWasNotRequested(msg->getExceptionReason());
- } break ;
-
- case e_AttributeNotDefined: {
- D.Out(pdExcept, "Throwing e_AttributeNotDefined exception.");
- throw RTI::AttributeNotDefined(msg->getExceptionReason());
- } break ;
-
- case e_AttributeNotKnown: {
- D.Out(pdExcept, "Throwing e_AttributeNotKnown exception.");
- throw RTI::AttributeNotKnown(msg->getExceptionReason());
- } break ;
-
- case e_AttributeNotOwned: {
- D.Out(pdExcept, "Throwing e_AttributeNotOwned exception.");
- throw RTI::AttributeNotOwned(msg->getExceptionReason());
- } break ;
-
- case e_AttributeNotPublished: {
- D.Out(pdExcept, "Throwing e_AttributeNotPublished exception.");
- throw RTI::AttributeNotPublished(msg->getExceptionReason());
- } break ;
-
- case e_AttributeNotSubscribed: {
- D.Out(pdExcept, "Throwing e_AttributeNotSubscribed exception.");
- throw RTI::RTIinternalError(msg->getExceptionReason());
- } break ;
-
- case e_ConcurrentAccessAttempted: {
- D.Out(pdExcept, "Throwing e_ConcurrentAccessAttempted
exception.");
- throw RTI::ConcurrentAccessAttempted(msg->getExceptionReason());
- } break ;
-
- case e_CouldNotDiscover: {
- D.Out(pdExcept, "Throwing e_CouldNotDiscover exception.");
- throw RTI::CouldNotDiscover(msg->getExceptionReason());
- } break ;
-
- case e_CouldNotOpenFED: {
- D.Out(pdExcept, "Throwing e_CouldNotOpenFED exception.");
- throw RTI::CouldNotOpenFED(msg->getExceptionReason());
- } break ;
-
- case e_CouldNotOpenRID: {
- D.Out(pdExcept, "Throwing e_CouldNotOpenRID exception.");
- throw RTI::RTIinternalError(msg->getExceptionReason());
- } break ;
-
- case e_CouldNotRestore: {
- D.Out(pdExcept, "Throwing e_CouldNotRestore exception.");
- throw RTI::CouldNotRestore(msg->getExceptionReason());
- } break ;
-
- case e_DeletePrivilegeNotHeld: {
- D.Out(pdExcept, "Throwing e_DeletePrivilegeNotHeld exception.");
- throw RTI::DeletePrivilegeNotHeld(msg->getExceptionReason());
- } break ;
-
- case e_ErrorReadingRID: {
- D.Out(pdExcept, "Throwing e_ErrorReadingRID exception.");
- throw RTI::RTIinternalError(msg->getExceptionReason());
- } break ;
-
- case e_ErrorReadingFED: {
- D.Out(pdExcept, "Throwing e_ErrorReadingFED exception.");
- throw RTI::ErrorReadingFED(msg->getExceptionReason());
- } break ;
-
- case e_EventNotKnown: {
- D.Out(pdExcept, "Throwing e_EventNotKnown exception.");
- throw RTI::EventNotKnown(msg->getExceptionReason());
- } break ;
-
- case e_FederateAlreadyPaused: {
- D.Out(pdExcept, "Throwing e_FederateAlreadyPaused exception.");
- throw RTI::RTIinternalError(msg->getExceptionReason());
- } break ;
-
- case e_FederateAlreadyExecutionMember: {
- D.Out(pdExcept,
- "Throwing e_FederateAlreadyExecutionMember
exception.");
- throw
RTI::FederateAlreadyExecutionMember(msg->getExceptionReason());
- } break ;
-
- case e_FederateDoesNotExist: {
- D.Out(pdExcept, "Throwing e_FederateDoesNotExist exception.");
- throw RTI::RTIinternalError(msg->getExceptionReason());
- } break ;
-
- case e_FederateInternalError: {
- D.Out(pdExcept, "Throwing e_FederateInternalError exception.");
- throw RTI::FederateInternalError(msg->getExceptionReason());
- } break ;
-
- case e_FederateNameAlreadyInUse: {
- D.Out(pdExcept, "Throwing e_FederateNameAlreadyInUse
exception.");
- throw RTI::RTIinternalError(msg->getExceptionReason());
- } break ;
-
- case e_FederateNotExecutionMember: {
- D.Out(pdExcept, "Throwing e_FederateNotExecutionMember
exception.");
- throw
RTI::FederateNotExecutionMember(msg->getExceptionReason());
- } break ;
-
- case e_FederateNotPaused: {
- D.Out(pdExcept, "Throwing e_FederateNotPaused exception.");
- throw RTI::RTIinternalError(msg->getExceptionReason());
- } break ;
-
- case e_FederateOwnsAttributes: {
- D.Out(pdExcept, "Throwing e_FederateOwnsAttributes exception.");
- throw RTI::FederateOwnsAttributes(msg->getExceptionReason());
- } break ;
-
- case e_FederatesCurrentlyJoined: {
- D.Out(pdExcept, "Throwing e_FederatesCurrentlyJoined
exception.");
- throw RTI::FederatesCurrentlyJoined(msg->getExceptionReason());
- } break ;
-
- case e_FederateWasNotAskedToReleaseAttribute: {
- D.Out(pdExcept,
- "Throwing
e_FederateWasNotAskedToReleaseAttribute exception.");
- D.Out(pdDebug,
- "Throwing
e_FederateWasNotAskedToReleaseAttribute exception.");
- throw
RTI::FederateWasNotAskedToReleaseAttribute(msg->getExceptionReason());
- } break ;
-
- case e_FederationAlreadyPaused: {
- D.Out(pdExcept, "Throwing e_FederationAlreadyPaused
exception.");
- throw RTI::RTIinternalError(msg->getExceptionReason());
- } break ;
-
- case e_FederationExecutionAlreadyExists: {
- D.Out(pdExcept, "Throwing e_FederationExecutionAlreadyExists
excep.");
- throw
RTI::FederationExecutionAlreadyExists(msg->getExceptionReason());
- } break ;
-
- case e_FederationExecutionDoesNotExist: {
- D.Out(pdExcept, "Throwing e_FederationExecutionDoesNotExist
except.");
- throw
RTI::FederationExecutionDoesNotExist(msg->getExceptionReason());
- } break ;
-
- case e_FederationNotPaused: {
- D.Out(pdExcept, "Throwing e_FederationNotPaused exception.");
- throw RTI::RTIinternalError(msg->getExceptionReason());
- } break ;
-
- case e_FederationTimeAlreadyPassed: {
- D.Out(pdExcept, "Throwing e_FederationTimeAlreadyPassed
exception.");
- throw
RTI::FederationTimeAlreadyPassed(msg->getExceptionReason());
- } break ;
-
- case e_FederateNotPublishing: {
- D.Out(pdExcept, "Throwing e_FederateNotPublishing exception.");
- throw RTI::RTIinternalError(msg->getExceptionReason());
- } break ;
-
- case e_FederateNotSubscribing: {
- D.Out(pdExcept, "Throwing e_FederateNotSubscribing exception.");
- throw RTI::RTIinternalError(msg->getExceptionReason());
- } break ;
-
- case e_RegionNotKnown: {
- D.Out(pdExcept, "Throwing e_RegionNotKnown exception.");
- throw RTI::RegionNotKnown(msg->getExceptionReason());
- } break ;
-
- case e_IDsupplyExhausted: {
- D.Out(pdExcept, "Throwing e_IDsupplyExhausted exception.");
- throw RTI::RTIinternalError(msg->getExceptionReason());
- } break ;
-
- case e_InteractionClassNotDefined: {
- D.Out(pdExcept, "Throwing e_InteractionClassNotDefined
exception.");
- throw
RTI::InteractionClassNotDefined(msg->getExceptionReason());
- } break ;
-
- case e_InteractionClassNotKnown: {
- D.Out(pdExcept, "Throwing e_InteractionClassNotKnown
exception.");
- throw RTI::InteractionClassNotKnown(msg->getExceptionReason());
- } break ;
-
- case e_InteractionClassNotPublished: {
- D.Out(pdExcept, "Throwing e_InteractionClassNotPublished
exception.");
- throw
RTI::InteractionClassNotPublished(msg->getExceptionReason());
- } break ;
-
- case e_InteractionParameterNotDefined: {
- D.Out(pdExcept,
- "Throwing e_InteractionParameterNotDefined
exception.");
- throw
RTI::InteractionParameterNotDefined(msg->getExceptionReason());
- } break ;
-
- case e_InteractionParameterNotKnown: {
- D.Out(pdExcept, "Throwing e_InteractionParameterNotKnown
exception.");
- throw
RTI::InteractionParameterNotKnown(msg->getExceptionReason());
- } break ;
-
- case e_InvalidDivestitureCondition: {
- D.Out(pdExcept, "Throwing e_InvalidDivestitureCondition
exception.");
- throw RTI::RTIinternalError(msg->getExceptionReason());
- } break ;
-
- case e_InvalidExtents: {
- D.Out(pdExcept, "Throwing e_InvalidExtents exception.");
- throw RTI::InvalidExtents(msg->getExceptionReason());
- } break ;
-
- case e_InvalidFederationTime: {
- D.Out(pdExcept, "Throwing e_InvalidFederationTime exception.");
- throw RTI::InvalidFederationTime(msg->getExceptionReason());
- } break ;
-
- case e_InvalidFederationTimeDelta: {
- D.Out(pdExcept, "Throwing e_InvalidFederationTimeDelta
exception.");
- throw RTI::RTIinternalError(msg->getExceptionReason());
- } break ;
-
- case e_InvalidLookahead: {
- D.Out(pdExcept, "Throwing e_InvalidLookahead.");
- throw RTI::InvalidLookahead(msg->getExceptionReason());
- } break ;
-
- case e_InvalidObjectHandle: {
- D.Out(pdExcept, "Throwing e_InvalidObjectHandle exception.");
- throw RTI::RTIinternalError(msg->getExceptionReason());
- } break ;
-
- case e_InvalidOrderingHandle: {
- D.Out(pdExcept, "Throwing e_InvalidOrderingHandle exception.");
- throw RTI::InvalidOrderingHandle(msg->getExceptionReason());
- } break ;
-
- case e_InvalidResignAction: {
- D.Out(pdExcept, "Throwing e_InvalidResignAction exception.");
- throw RTI::InvalidResignAction(msg->getExceptionReason());
- } break ;
-
- case e_InvalidRetractionHandle: {
- D.Out(pdExcept, "Throwing e_InvalidRetractionHandle
exception.");
- throw RTI::InvalidRetractionHandle(msg->getExceptionReason());
- } break ;
-
- case e_InvalidRoutingSpace: {
- D.Out(pdExcept, "Throwing e_InvalidRoutingSpace exception.");
- throw RTI::RTIinternalError(msg->getExceptionReason());
- } break ;
-
- case e_InvalidTransportationHandle: {
- D.Out(pdExcept, "Throwing e_InvalidTransportationHandle
exception.");
- throw
RTI::InvalidTransportationHandle(msg->getExceptionReason());
- } break ;
-
- case e_MemoryExhausted: {
- D.Out(pdExcept, "Throwing e_MemoryExhausted exception.");
- throw RTI::MemoryExhausted(msg->getExceptionReason());
- } break ;
-
- case e_NameNotFound: {
- D.Out(pdExcept, "Throwing e_NameNotFound exception.");
- throw RTI::NameNotFound(msg->getExceptionReason());
- } break ;
-
- case e_NoPauseRequested: {
- D.Out(pdExcept, "Throwing e_NoPauseRequested exception.");
- throw RTI::RTIinternalError(msg->getExceptionReason());
- } break ;
-
- case e_NoResumeRequested: {
- D.Out(pdExcept, "Throwing e_NoResumeRequested exception.");
- throw RTI::RTIinternalError(msg->getExceptionReason());
- } break ;
-
- case e_ObjectClassNotDefined: {
- D.Out(pdExcept, "Throwing e_ObjectClassNotDefined exception.");
- throw RTI::ObjectClassNotDefined(msg->getExceptionReason());
- } break ;
-
- case e_ObjectClassNotKnown: {
- D.Out(pdExcept, "Throwing e_ObjectClassNotKnown exception.");
- throw RTI::ObjectClassNotKnown(msg->getExceptionReason());
- } break ;
-
- case e_ObjectClassNotPublished: {
- D.Out(pdExcept, "Throwing e_ObjectClassNotPublished
exception.");
- throw RTI::ObjectClassNotPublished(msg->getExceptionReason());
- } break ;
-
- case e_ObjectClassNotSubscribed: {
- D.Out(pdExcept, "Throwing e_ObjectClassNotSubscribed
exception.");
- throw RTI::ObjectClassNotSubscribed(msg->getExceptionReason());
- } break ;
-
- case e_ObjectNotKnown: {
- D.Out(pdExcept, "Throwing e_ObjectNotKnown exception.");
- throw RTI::ObjectNotKnown(msg->getExceptionReason());
- } break ;
-
- case e_ObjectAlreadyRegistered: {
- D.Out(pdExcept, "Throwing e_ObjectAlreadyRegistered
exception.");
- throw RTI::ObjectAlreadyRegistered(msg->getExceptionReason());
- } break ;
-
- case e_RestoreInProgress: {
- D.Out(pdExcept, "Throwing e_RestoreInProgress exception.");
- throw RTI::RestoreInProgress(msg->getExceptionReason());
- } break ;
-
- case e_RestoreNotRequested: {
- D.Out(pdExcept, "Throwing e_RestoreNotRequested exception.");
- throw RTI::RestoreNotRequested(msg->getExceptionReason());
- } break ;
-
- case e_RTIinternalError: {
- D.Out(pdExcept, "Throwing e_RTIinternalError exception.");
- throw RTI::RTIinternalError(msg->getExceptionReason());
- } break ;
-
- case e_SpaceNotDefined: {
- D.Out(pdExcept, "Throwing e_SpaceNotDefined exception.");
- throw RTI::SpaceNotDefined(msg->getExceptionReason());
- } break ;
-
- case e_SaveInProgress: {
- D.Out(pdExcept, "Throwing e_SaveInProgress exception.");
- throw RTI::SaveInProgress(msg->getExceptionReason());
- } break ;
-
- case e_SaveNotInitiated: {
- D.Out(pdExcept, "Throwing e_SaveNotInitiated exception.");
- throw RTI::SaveNotInitiated(msg->getExceptionReason());
- } break ;
-
- case e_SecurityError: {
- D.Out(pdExcept, "Throwing e_SecurityError exception.");
- throw RTI::RTIinternalError(msg->getExceptionReason());
- } break ;
-
- case e_SpecifiedSaveLabelDoesNotExist: {
- D.Out(pdExcept,
- "Throwing e_SpecifiedSaveLabelDoesNotExist
exception.");
- throw
RTI::SpecifiedSaveLabelDoesNotExist(msg->getExceptionReason());
- } break ;
-
- case e_TimeAdvanceAlreadyInProgress: {
- D.Out(pdExcept, "Throwing e_TimeAdvanceAlreadyInProgress
exception.");
- throw
RTI::TimeAdvanceAlreadyInProgress(msg->getExceptionReason());
- } break ;
-
- case e_TimeAdvanceWasNotInProgress: {
- D.Out(pdExcept, "Throwing e_TimeAdvanceWasNotInProgress
exception.");
- throw
RTI::TimeAdvanceWasNotInProgress(msg->getExceptionReason());
- } break ;
-
- case e_TooManyIDsRequested: {
- D.Out(pdExcept, "Throwing e_TooManyIDsRequested exception.");
- throw RTI::RTIinternalError(msg->getExceptionReason());
- } break ;
-
- case e_UnableToPerformSave: {
- D.Out(pdExcept, "Throwing e_UnableToPerformSave exception.");
- throw RTI::UnableToPerformSave(msg->getExceptionReason());
- } break ;
-
- case e_UnimplementedService: {
- D.Out(pdExcept, "Throwing e_UnimplementedService exception.");
- throw RTI::RTIinternalError(msg->getExceptionReason());
- } break ;
-
- case e_UnknownLabel: {
- D.Out(pdExcept, "Throwing e_UnknownLabel exception.");
- throw RTI::RTIinternalError(msg->getExceptionReason());
- } break ;
-
- case e_ValueCountExceeded: {
- D.Out(pdExcept, "Throwing e_ValueCountExceeded exception.");
- throw RTI::ValueCountExceeded(msg->getExceptionReason());
- } break ;
-
- case e_ValueLengthExceeded: {
- D.Out(pdExcept, "Throwing e_ValueLengthExceeded exception.");
- throw RTI::ValueLengthExceeded(msg->getExceptionReason());
- } break ;
-
- default: {
- D.Out(pdExcept, "Throwing unknown exception !");
- std::cout << "LibRTI: Receiving unknown RTI exception." <<
std::endl;
- throw RTI::RTIinternalError(msg->getExceptionReason());
- } break ;
- }
-}
-
-#define CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS(service) \
- catch (RTI::Exception &e) { \
- std::stringstream msg; \
- msg << "Error in " << service << ": " << e._name << "["
<< e._reason << "]"; \
- throw RTI::RTIinternalError(msg.str().c_str()); \
- }
-
-void
-RTIambPrivateRefs::callFederateAmbassador(Message *msg)
-throw (RTI::RTIinternalError)
-{
- switch (msg->getMessageType()) {
-
- case Message::SYNCHRONIZATION_POINT_REGISTRATION_SUCCEEDED:
- try {
-
fed_amb->synchronizationPointRegistrationSucceeded((msg->getLabel()).c_str());
- }
-
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("synchronizationPointRegistrationSucceeded")
- break ;
-
- case Message::SYNCHRONIZATION_POINT_REGISTRATION_FAILED:
- try {
-
fed_amb->synchronizationPointRegistrationFailed((msg->getLabel()).c_str());
- }
-
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("synchronizationPointRegistrationFailed")
- break ;
-
- case Message::ANNOUNCE_SYNCHRONIZATION_POINT:
- try {
-
fed_amb->announceSynchronizationPoint((msg->getLabel()).c_str(),(msg->getTag()).c_str());
- }
-
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("announceSynchronizationPoint")
- break ;
-
- case Message::FEDERATION_SYNCHRONIZED:
- try {
-
fed_amb->federationSynchronized((msg->getLabel()).c_str());
- }
- CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("federationSynchronized")
- break ;
-
- case Message::INITIATE_FEDERATE_SAVE:
- try {
-
fed_amb->initiateFederateSave((msg->getLabel()).c_str());
- }
- CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("initiateFederateSave")
- break ;
-
- case Message::FEDERATION_SAVED:
- try {
- fed_amb->federationSaved();
- }
- CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("federationSaved")
- break ;
-
- case Message::REQUEST_FEDERATION_RESTORE_SUCCEEDED:
- try {
- fed_amb->requestFederationRestoreSucceeded(
- (msg->getLabel()).c_str());
- }
-
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("requestFederationRestoreSucceeded")
- break ;
-
- case Message::REQUEST_FEDERATION_RESTORE_FAILED:
- try {
-
fed_amb->requestFederationRestoreFailed((msg->getLabel()).c_str(),
- (msg->getTag()).c_str());
- }
-
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("requestFederationRestoreFailed")
- break ;
-
- case Message::FEDERATION_RESTORE_BEGUN:
- try {
- fed_amb->federationRestoreBegun();
- }
- CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("federationRestoreBegun")
- break ;
-
- case Message::INITIATE_FEDERATE_RESTORE:
- try {
- M_Initiate_Federate_Restore *IFR =
static_cast<M_Initiate_Federate_Restore *>(msg);
-
fed_amb->initiateFederateRestore((IFR->getLabel()).c_str(),
- IFR->getFederate());
- }
- CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("initiateFederateRestore")
- break ;
-
- case Message::FEDERATION_RESTORED:
- try {
- fed_amb->federationRestored();
- }
- CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("federationRestored")
- break ;
-
- case Message::FEDERATION_NOT_RESTORED:
- try {
- fed_amb->federationNotRestored();
- }
- CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("federationNotRestored")
- break ;
-
- case Message::START_REGISTRATION_FOR_OBJECT_CLASS:
- try {
-
fed_amb->startRegistrationForObjectClass(static_cast<M_Start_Registration_For_Object_Class
*>(msg)->getObjectClass());
- }
-
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("startRegistrationForObjectClass")
- break ;
-
- case Message::STOP_REGISTRATION_FOR_OBJECT_CLASS:
- try {
-
fed_amb->stopRegistrationForObjectClass(static_cast<M_Stop_Registration_For_Object_Class
*>(msg)->getObjectClass());
- }
-
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("stopRegistrationForObjectClass")
- break ;
-
- case Message::TURN_INTERACTIONS_ON:
- try {
-
fed_amb->turnInteractionsOn(static_cast<M_Turn_Interactions_On
*>(msg)->getInteractionClass());
- }
- CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("turnInteractionsOn")
- break ;
-
- case Message::TURN_INTERACTIONS_OFF:
- try {
-
fed_amb->turnInteractionsOff(static_cast<M_Turn_Interactions_Off
*>(msg)->getInteractionClass());
- }
- CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("turnInteractionsOff")
- break ;
-
- case Message::DISCOVER_OBJECT_INSTANCE:
- try {
- M_Discover_Object_Instance* DOI =
static_cast<M_Discover_Object_Instance *>(msg);
- fed_amb->discoverObjectInstance(DOI->getObject(),
- DOI->getObjectClass(),
- DOI->getObjectName().c_str());
- }
- CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("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");
- RTI::AttributeHandleValuePairSet *attributes =
- new
AttributeHandleValuePairSetImp(getAHVPSFromRequest(RAV));
-
- if (msg->isDated()) {
- RTI::EventRetractionHandle event;
- event.theSerialNumber =
RAV->getEventRetraction().getSN();
- event.sendingFederate =
RAV->getEventRetraction().getSendingFederate();
-
fed_amb->reflectAttributeValues(RAV->getObject(),
- *attributes,
-
RTIfedTime(msg->getDate().getTime()),
- (msg->getTag()).c_str(),
- event);
- }
- else {
-
fed_amb->reflectAttributeValues(RAV->getObject(),
- *attributes,
- (msg->getTag()).c_str());
- }
- delete attributes ;
- }
- CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("reflectAttributeValues")
- break ;
-
- case Message::RECEIVE_INTERACTION:
- try {
- M_Receive_Interaction* RI =
static_cast<M_Receive_Interaction *>(msg);
- RTI::ParameterHandleValuePairSet *parameters =
- new
ParameterHandleValuePairSetImp(getPHVPSFromRequest(RI));
-
- if (msg->isDated()) {
- RTI::EventRetractionHandle event;
- event.theSerialNumber =
RI->getEventRetraction().getSN();
- event.sendingFederate =
RI->getEventRetraction().getSendingFederate();
- fed_amb->receiveInteraction(
- RI->getInteractionClass(),
- *parameters,
-
RTIfedTime(msg->getDate().getTime()),
- (msg->getTag()).c_str(),
- event);
- }
- else {
- fed_amb->receiveInteraction(
- RI->getInteractionClass(),
- *parameters,
- (msg->getTag()).c_str());
- }
- delete parameters ;
- }
- CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("receiveInteraction")
- break ;
-
- case Message::REMOVE_OBJECT_INSTANCE:
- try {
- M_Remove_Object_Instance* ROI =
static_cast<M_Remove_Object_Instance *>(msg);
- RTI::EventRetractionHandle event;
- event.theSerialNumber =
ROI->getEventRetraction().getSN();
- event.sendingFederate =
ROI->getEventRetraction().getSendingFederate();
- if (msg->isDated()) {
- fed_amb->removeObjectInstance(
- ROI->getObject(),
-
RTIfedTime(msg->getDate().getTime()),
- (msg->getTag()).c_str(),
- event);
- }
- else {
- fed_amb->removeObjectInstance(
- ROI->getObject(),
- (msg->getTag()).c_str());
- }
- }
- CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("removeObjectInstance")
- break ;
-
- case Message::PROVIDE_ATTRIBUTE_VALUE_UPDATE:
- try {
- M_Provide_Attribute_Value_Update* PAVU =
static_cast<M_Provide_Attribute_Value_Update *>(msg);
- std::auto_ptr<RTI::AttributeHandleSet> attributeSet(
- new
AttributeHandleSetImp(PAVU->getAttributes()));
-
-
fed_amb->provideAttributeValueUpdate(PAVU->getObject(),*attributeSet);
- }
-
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("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);
- RTI::AttributeHandleSet *attributeSet =
- new
AttributeHandleSetImp(RAOA->getAttributes());
-
- fed_amb->
- requestAttributeOwnershipAssumption(RAOA->getObject(),
- *attributeSet,
- (msg->getTag()).c_str());
- delete attributeSet ;
- }
-
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("requestAttributeOwnershipAssumption")
- break ;
-
- case Message::REQUEST_ATTRIBUTE_OWNERSHIP_RELEASE:
- try {
- M_Request_Attribute_Ownership_Release* RAOR =
static_cast<M_Request_Attribute_Ownership_Release *>(msg);
- RTI::AttributeHandleSet *attributeSet =
- new
AttributeHandleSetImp(RAOR->getAttributes());
-
- fed_amb->requestAttributeOwnershipRelease(
- RAOR->getObject(),
- *attributeSet,
- (msg->getTag()).c_str());
-
- delete attributeSet ;
- }
-
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("requestAttributeOwnershipRelease")
- break ;
-
- case Message::ATTRIBUTE_OWNERSHIP_UNAVAILABLE:
- try {
- M_Attribute_Ownership_Unavailable* AOU =
static_cast<M_Attribute_Ownership_Unavailable *>(msg);
- RTI::AttributeHandleSet *attributeSet =
- new
AttributeHandleSetImp(AOU->getAttributes());
-
- fed_amb->attributeOwnershipUnavailable(AOU->getObject(),
- *attributeSet);
-
- delete attributeSet ;
- }
-
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("attributeOwnershipUnavailable")
- break ;
-
- case Message::ATTRIBUTE_OWNERSHIP_ACQUISITION_NOTIFICATION:
- try {
- M_Attribute_Ownership_Acquisition_Notification* AOAN =
static_cast<M_Attribute_Ownership_Acquisition_Notification *>(msg);
- RTI::AttributeHandleSet *attributeSet =
- new
AttributeHandleSetImp(AOAN->getAttributes());
-
- fed_amb->attributeOwnershipAcquisitionNotification(
- AOAN->getObject(),
- *attributeSet);
-
- delete attributeSet ;
- }
-
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("attributeOwnershipAcquisitionNotification")
- break ;
-
- case Message::ATTRIBUTE_OWNERSHIP_DIVESTITURE_NOTIFICATION:
- try {
- M_Attribute_Ownership_Divestiture_Notification* AODN =
static_cast<M_Attribute_Ownership_Divestiture_Notification *>(msg);
- RTI::AttributeHandleSet *attributeSet =
- new
AttributeHandleSetImp(AODN->getAttributes());
-
- fed_amb->attributeOwnershipDivestitureNotification(
- AODN->getObject(),
- *attributeSet);
-
- delete attributeSet ;
- }
-
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("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);
- RTI::AttributeHandleSet *attributeSet =
- new
AttributeHandleSetImp(CAOAC->getAttributes());
-
-
fed_amb->confirmAttributeOwnershipAcquisitionCancellation(
- CAOAC->getObject(),
- *attributeSet);
-
- delete attributeSet ;
- }
-
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("confirmAttributeOwnershipAcquisitionCancellation")
- break ;
-
- case Message::INFORM_ATTRIBUTE_OWNERSHIP:
- try {
- M_Inform_Attribute_Ownership* IAO =
static_cast<M_Inform_Attribute_Ownership *>(msg);
- fed_amb->
- informAttributeOwnership(IAO->getObject(),
- IAO->getAttribute(),
- IAO->getFederate());
- }
- CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("informAttributeOwnership")
- break ;
-
- case Message::ATTRIBUTE_IS_NOT_OWNED:
- try {
- M_Attribute_Is_Not_Owned* AINO =
static_cast<M_Attribute_Is_Not_Owned *>(msg);
- fed_amb->attributeIsNotOwned(AINO->getObject(),
- AINO->getAttribute());
- }
- CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("attributeIsNotOwned")
- break ;
-
- case Message::TIME_ADVANCE_GRANT:
- try {
-
fed_amb->timeAdvanceGrant(RTIfedTime(msg->getDate().getTime()));
- }
- CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("timeAdvanceGrant")
- break ;
-
- case Message::TIME_REGULATION_ENABLED:
- try {
-
fed_amb->timeRegulationEnabled(RTIfedTime(msg->getDate().getTime()));
- }
- CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("timeRegulationEnabled")
- break ;
-
- case Message::TIME_CONSTRAINED_ENABLED:
- try {
-
fed_amb->timeConstrainedEnabled(RTIfedTime(msg->getDate().getTime()));
- }
- CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("timeConstrainedEnabled")
- break ;
-
- default:
- leave("RTI service requested by RTI is unknown.");
- }
-}
-
-// $Id: RTIambPrivateRefs.cc,v 3.29 2011/07/13 15:43:16 erk Exp $
Index: LogicalTimeDouble.h
===================================================================
RCS file: LogicalTimeDouble.h
diff -N LogicalTimeDouble.h
--- LogicalTimeDouble.h 31 May 2010 11:58:27 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,415 +0,0 @@
-#ifndef LogicalTimeDouble_INCLUDED
-#define LogicalTimeDouble_INCLUDED
-
-#ifdef _WIN32
-#pragma warning(disable:4290)
-#endif
-
-// Standard integer types.
-#ifdef _MSC_VER
-#ifndef FAKED_INTTYPES_DEFINED
-#define FAKED_INTTYPES_DEFINED
-typedef unsigned __int64 uint64_t;
-typedef signed __int64 int64_t;
-typedef unsigned __int32 uint32_t;
-typedef signed __int32 int32_t;
-typedef unsigned __int16 uint16_t;
-typedef signed __int16 int16_t;
-typedef unsigned __int8 uint8_t;
-typedef signed __int8 int8_t;
-typedef short int int_least16_t;
-#endif
-#else
-#include <inttypes.h>
-#endif
-
-#include "RTI/certiLogicalTime.h"
-#include "RTI/certiLogicalTimeInterval.h"
-#include "RTI/certiLogicalTimeFactory.h"
-
-// Microsoft has not implemented the swprintf function according
-// to the ISO C standard. However, they have a function _snwprintf
-// that matches the standardized prototype for swprintf.
-#ifdef _WIN32
-#define swprintf _snwprintf
-#endif
-
-class RTI_EXPORT_FEDTIME LogicalTimeDouble : public rti1516::LogicalTime
-{
-public:
- LogicalTimeDouble(double value);
-
- virtual ~LogicalTimeDouble()
- throw ();
-
- virtual void setInitial();
-
- virtual bool isInitial() const;
-
- virtual void setFinal();
-
- virtual bool isFinal() const;
-
- virtual long getSeconds() const;
- virtual int getMicros() const;
-
- virtual void setTo(rti1516::LogicalTime const & value)
- throw (rti1516::InvalidLogicalTime);
-
- virtual void increaseBy(rti1516::LogicalTimeInterval const & addend)
- throw (rti1516::IllegalTimeArithmetic,
rti1516::InvalidLogicalTimeInterval);
-
- virtual void decreaseBy(rti1516::LogicalTimeInterval const & subtrahend)
- throw (rti1516::IllegalTimeArithmetic,
rti1516::InvalidLogicalTimeInterval);
-
- virtual std::auto_ptr< rti1516::LogicalTimeInterval >
subtract(rti1516::LogicalTime const & subtrahend) const
- throw (rti1516::InvalidLogicalTime);
-
- virtual bool isGreaterThan(rti1516::LogicalTime const & value) const
- throw (rti1516::InvalidLogicalTime);
-
- virtual bool isLessThan(rti1516::LogicalTime const & value) const
- throw (rti1516::InvalidLogicalTime);
-
- virtual bool isEqualTo(rti1516::LogicalTime const & value) const
- throw (rti1516::InvalidLogicalTime);
-
- virtual bool isGreaterThanOrEqualTo(rti1516::LogicalTime const & value)
const
- throw (rti1516::InvalidLogicalTime);
-
- virtual bool isLessThanOrEqualTo(rti1516::LogicalTime const & value) const
- throw (rti1516::InvalidLogicalTime);
-
- // JvY Begin
- virtual
- rti1516::LogicalTime &
- operator=(rti1516::LogicalTime const & value)
- throw (rti1516::InvalidLogicalTime);
-
- virtual
- LogicalTimeDouble &
- operator=(LogicalTimeDouble const & value)
- throw (rti1516::InvalidLogicalTime);
-
-
- virtual
- rti1516::LogicalTime &
- operator+=(rti1516::LogicalTimeInterval const & addend)
- throw (rti1516::IllegalTimeArithmetic,
rti1516::InvalidLogicalTimeInterval)
- {
- increaseBy(addend);
- return *this;
- }
-
- virtual
- rti1516::LogicalTime &
- operator-=(rti1516::LogicalTimeInterval const & subtrahend)
- throw (rti1516::IllegalTimeArithmetic,
rti1516::InvalidLogicalTimeInterval)
- {
- decreaseBy(subtrahend);
- return *this;
- }
-
- virtual
- bool
- operator>(rti1516::LogicalTime const & value) const
- throw (rti1516::InvalidLogicalTime)
- {
- return isGreaterThan(value);
- }
-
- virtual
- bool
- operator<(rti1516::LogicalTime const & value) const
- throw (rti1516::InvalidLogicalTime)
- {
- return isLessThan(value);
- }
-
- virtual
- bool
- operator>=(rti1516::LogicalTime const & value) const
- throw (rti1516::InvalidLogicalTime)
- {
- return isGreaterThanOrEqualTo(value);
- }
-
- virtual
- bool
- operator<=(rti1516::LogicalTime const & value) const
- throw (rti1516::InvalidLogicalTime)
- {
- return isLessThanOrEqualTo(value);
- }
-
- // Generates an encoded value that can be used to send
- // LogicalTimes to other federates in updates or interactions
- virtual rti1516::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 (rti1516::CouldNotEncode);
-
- // Decode encodedLogicalTime into self
- virtual void decode(rti1516::VariableLengthData const & encodedLogicalTime)
- throw (rti1516::InternalError,
- rti1516::CouldNotDecode);
-
- // Alternate decode that reads directly from a buffer
- virtual void decode(void* buffer, unsigned long bufferSize)
- throw (rti1516::InternalError,
- rti1516::CouldNotDecode);
-
- // Returns the name of the implementation, as needed by
- // createFederationExecution.
- virtual std::wstring implementationName() const
- {
- return L"BITS_LogicalTimeDouble";
- }
-
- // JvY End
-
- //virtual std::auto_ptr< rti1516::EncodedLogicalTime > encode() const;
-
- virtual std::wstring toString() const;
-
- virtual bool operator==(LogicalTime const & left) const
- throw (rti1516::InvalidLogicalTime);
-
- virtual int64_t toMilliseconds() const;
-
-private:
- explicit LogicalTimeDouble(int64_t value);
-
- int64_t _value;
-
- friend class LogicalTimeDoubleFactory;
- friend class LogicalTimeFactoryDouble;
-};
-
-class RTI_EXPORT_FEDTIME LogicalTimeIntervalDouble : public
rti1516::LogicalTimeInterval
-{
-public:
- LogicalTimeIntervalDouble(double value);
-
- virtual ~LogicalTimeIntervalDouble()
- throw ();
-
- virtual void setZero();
-
- virtual bool isZero() const;
-
- virtual void setEpsilon();
-
- virtual bool isEpsilon() const;
-
- virtual long getSeconds() const;
- virtual int getMicros() const;
-
- virtual void setTo(rti1516::LogicalTimeInterval const & value)
- throw (rti1516::InvalidLogicalTimeInterval);
-
- virtual std::auto_ptr< rti1516::LogicalTimeInterval >
subtract(rti1516::LogicalTimeInterval const & subtrahend) const
- throw (rti1516::InvalidLogicalTimeInterval);
-
- virtual bool isGreaterThan(rti1516::LogicalTimeInterval const & value) const
- throw (rti1516::InvalidLogicalTimeInterval);
-
- virtual bool isLessThan(rti1516::LogicalTimeInterval const & value) const
- throw (rti1516::InvalidLogicalTimeInterval);
-
- virtual bool isEqualTo(rti1516::LogicalTimeInterval const & value) const
- throw (rti1516::InvalidLogicalTimeInterval);
-
- virtual bool isGreaterThanOrEqualTo(rti1516::LogicalTimeInterval const &
value) const
- throw (rti1516::InvalidLogicalTimeInterval);
-
- virtual bool isLessThanOrEqualTo(rti1516::LogicalTimeInterval const &
value) const
- throw (rti1516::InvalidLogicalTimeInterval);
-
- //virtual std::auto_ptr< rti1516::EncodedLogicalTimeInterval > encode()
const;
-
- virtual std::wstring toString() const;
-
- // JvY Begin
- virtual
- LogicalTimeInterval &
- operator=(rti1516::LogicalTimeInterval const & value)
- throw (rti1516::InvalidLogicalTimeInterval)
- {
- setTo(value);
- return *this;
- }
-
-
- // Set self to the difference between two LogicalTimes
- virtual
- void
- setToDifference(rti1516::LogicalTime const & minuend,
- rti1516::LogicalTime const& subtrahend)
- throw (rti1516::InvalidLogicalTime);
-
- virtual
- rti1516::LogicalTimeInterval &
- operator+=(rti1516::LogicalTimeInterval const & addend)
- throw (rti1516::InvalidLogicalTimeInterval);
-
- virtual
- rti1516::LogicalTimeInterval &
- operator-=(rti1516::LogicalTimeInterval const & subtrahend)
- throw (rti1516::InvalidLogicalTimeInterval);
-
- virtual
- bool
- operator>(rti1516::LogicalTimeInterval const & value) const
- throw (rti1516::InvalidLogicalTimeInterval)
- {
- return isGreaterThan(value);
- }
-
- virtual
- bool
- operator<(rti1516::LogicalTimeInterval const & value) const
- throw (rti1516::InvalidLogicalTimeInterval)
- {
- return isLessThan(value);
- }
-
- virtual
- bool
- operator==(rti1516::LogicalTimeInterval const & value) const
- throw (rti1516::InvalidLogicalTimeInterval)
- {
- return isEqualTo(value);
- }
-
- virtual
- bool
- operator>=(rti1516::LogicalTimeInterval const & value) const
- throw (rti1516::InvalidLogicalTimeInterval)
- {
- return isGreaterThanOrEqualTo(value);
- }
-
- virtual
- bool
- operator<=(rti1516::LogicalTimeInterval const & value) const
- throw (rti1516::InvalidLogicalTimeInterval)
- {
- return isLessThanOrEqualTo(value);
- }
-
- // Generates an encoded value that can be used to send
- // LogicalTimeIntervals to other federates in updates or interactions
- virtual rti1516::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 (rti1516::CouldNotEncode);
-
- // Decode encodedValue into self
- virtual void decode(rti1516::VariableLengthData const & encodedValue)
- throw (rti1516::InternalError,
- rti1516::CouldNotDecode);
-
- // Alternate decode that reads directly from a buffer
- virtual void decode(void* buffer, unsigned long bufferSize)
- throw (rti1516::InternalError,
- rti1516::CouldNotDecode);
-
- // Returns the name of the implementation, as needed by
- // createFederationExecution.
- virtual std::wstring implementationName() const
- {
- return L"BITS_LogicalTimeIntervalDouble";
- }
-
- // JvY End
-
-private:
- explicit LogicalTimeIntervalDouble(int64_t value);
-
- int64_t _value;
-
- friend class LogicalTimeDouble;
- friend class LogicalTimeDoubleFactory;
- friend class LogicalTimeFactoryDouble;
- friend class LogicalTimeIntervalDoubleFactory;
- friend class LogicalTimeIntervalFactoryDouble;
-};
-
-
-class RTI_EXPORT_FEDTIME LogicalTimeDoubleFactory : public
rti1516::LogicalTimeFactory
-{
-public:
- virtual ~LogicalTimeDoubleFactory()
- throw ();
-
- virtual std::auto_ptr< rti1516::LogicalTime > makeInitial()
- throw (rti1516::InternalError);
-
- // Returns a LogicalTime with a value of "initial"
- virtual
- std::auto_ptr< rti1516::LogicalTime >
- makeLogicalTime()
- throw (rti1516::InternalError)
- {
- return makeInitial();
- }
-
- // Returns a LogicalTimeInterval with a value of "zero"
- virtual
- std::auto_ptr< rti1516::LogicalTimeInterval >
- makeLogicalTimeInterval()
- throw (rti1516::InternalError)
- {
- return makeZero();
- }
-
- virtual std::auto_ptr< rti1516::LogicalTimeInterval > makeZero()
- throw (rti1516::InternalError);
-
- virtual std::auto_ptr< rti1516::LogicalTimeInterval > epsilon()
- throw (rti1516::InternalError);
-
- //virtual std::auto_ptr< rti1516::LogicalTime >
decode(rti1516::EncodedLogicalTime const & encodedLogicalTime)
- // throw (rti1516::InternalError, rti1516::CouldNotDecode);
-};
-
-class RTI_EXPORT_FEDTIME LogicalTimeFactoryDouble : public
LogicalTimeDoubleFactory
-{
-public:
- virtual ~LogicalTimeFactoryDouble()
- throw ();
-
-};
-
-class RTI_EXPORT_FEDTIME LogicalTimeIntervalDoubleFactory : public
LogicalTimeDoubleFactory
-{
-public:
- virtual ~LogicalTimeIntervalDoubleFactory()
- throw ();
-
-};
-
-class RTI_EXPORT_FEDTIME LogicalTimeIntervalFactoryDouble : public
LogicalTimeDoubleFactory
-{
-public:
- virtual ~LogicalTimeIntervalFactoryDouble()
- throw ()
- {
- }
-
-};
-
-class RTI_EXPORT_FEDTIME LogicalTimeDoubleFactoryFactory : public
rti1516::LogicalTimeFactoryFactory
-{
-public:
- static std::auto_ptr< rti1516::LogicalTimeFactory >
- makeLogicalTimeFactory(std::wstring const & implementationName);
-
-};
-
-#endif // LogicalTimeDouble_INCLUDED
Index: RTIfedTime.cc
===================================================================
RCS file: RTIfedTime.cc
diff -N RTIfedTime.cc
--- RTIfedTime.cc 28 Feb 2010 18:54:44 -0000 3.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,515 +0,0 @@
-// ----------------------------------------------------------------------------
-// CERTI - HLA RunTime Infrastructure
-// Copyright (C) 2002-2006 ONERA
-//
-// This file is part of CERTI-libCERTI
-//
-// CERTI-libCERTI 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-libCERTI 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 <math.h>
-
-#include "certi.hh"
-#include "fedtime.hh"
-#include "FedTimeD.hh"
-
-#include <algorithm>
-#include <limits>
-#include <sstream>
-#include <typeinfo>
-
-using std::stringstream ;
-
-namespace
-{
-
-// ----------------------------------------------------------------------------
-/** FedTime to RTIfedTime reference cast
- */
-inline const RTIfedTime &
-rft(const RTI::FedTime &time)
- throw (RTI::InvalidFederationTime)
-{
- try {
- return dynamic_cast<const RTIfedTime &>(time);
- }
- catch (std::bad_cast) {
- //throw RTI::InvalidFederationTime("Could not cast to RTIfedTime");
- }
-}
-
-inline bool
-is_infinity(const RTI::FedTime &time)
-{
- return const_cast<RTI::FedTime &>(time).isPositiveInfinity() ==
RTI::RTI_TRUE ;
-}
-
-const char *infinity_str = "+inf" ;
-
-} // anonymous namespace
-
-// ----------------------------------------------------------------------------
-// FedTimeFactory
-RTI::FedTime *
-RTI::FedTimeFactory::makeZero()
- throw (RTI::MemoryExhausted)
-{
- try {
- return new RTIfedTime();
- }
- catch (std::bad_alloc) {
- //throw RTI::MemoryExhausted("Cannot allocate RTI::FedTime.");
- }
-}
-
-RTI::FedTime *
-RTI::FedTimeFactory::decode(const char *buf)
- throw (RTI::MemoryExhausted)
-{
- union ud {
- double dv;
- uint64_t uv;
- } value;
- try {
- value.uv = CERTI_DECODE_DOUBLE_FROM_UINT64BE(buf);
- return new RTIfedTime(value.dv);
- }
- catch (std::bad_alloc) {
- //throw RTI::MemoryExhausted("Cannot allocate RTI::FedTime.");
- }
-}
-
-// ----------------------------------------------------------------------------
-// RTIfedTime
-RTIfedTime::RTIfedTime()
- : _fedTime(0),
- _zero(0),
- _epsilon(std::numeric_limits<double>::epsilon()),
- _positiveInfinity(std::numeric_limits<double>::infinity()) { }
-
-RTIfedTime::RTIfedTime(const RTI::Double &time)
- : _fedTime(time),
- _zero(0),
- _epsilon(std::numeric_limits<double>::epsilon()),
- _positiveInfinity(std::numeric_limits<double>::infinity()) { }
-
-RTIfedTime::RTIfedTime(const RTI::FedTime &time)
- : _fedTime(rft(time).getTime()),
- _zero(0),
- _epsilon(std::numeric_limits<double>::epsilon()),
- _positiveInfinity(std::numeric_limits<double>::infinity()) { }
-
-// ----------------------------------------------------------------------------
-RTIfedTime::RTIfedTime(const RTIfedTime &time)
- : FedTime(),
- _fedTime(time._fedTime),
- _zero(time._zero),
- _epsilon(time._epsilon),
- _positiveInfinity(time._positiveInfinity) { }
-
-// ----------------------------------------------------------------------------
-RTIfedTime::~RTIfedTime()
-{
-}
-
-// ----------------------------------------------------------------------------
-void
-RTIfedTime::setZero()
-{
- _fedTime = _zero;
-}
-
-// ----------------------------------------------------------------------------
-RTI::Boolean
-RTIfedTime::isZero()
-{
- return RTI::Boolean(_fedTime == _zero);
-}
-
-// ----------------------------------------------------------------------------
-void
-RTIfedTime::setEpsilon()
-{
- _fedTime = _epsilon;
-}
-
-// ----------------------------------------------------------------------------
-void
-RTIfedTime::setPositiveInfinity()
-{
- _fedTime = _positiveInfinity;
-}
-
-// ----------------------------------------------------------------------------
-RTI::Boolean
-RTIfedTime::isPositiveInfinity()
-{
- return RTI::Boolean(_fedTime == _positiveInfinity);
-}
-
-// ----------------------------------------------------------------------------
-int
-RTIfedTime::encodedLength() const
-{
- // current implementation of RTIfedtime takes
- // four IEEE-754 double values:
- // _fedTime
- // _zero
- // _epsilon
- // _positiveInfinity
- // but we only transmit _fedTime because other value will
- // be reconstructed autonomously
- return (sizeof(double));
-}
-
-// ----------------------------------------------------------------------------
-void
-RTIfedTime::encode(char *buffer) const
-{
-#ifdef HOST_IS_BIG_ENDIAN
- memcpy(buffer, &_fedTime, sizeof(double));
-#else
- uint64_t value;
- value = CERTI_ENCODE_DOUBLE_TO_UINT64BE(&_fedTime);
- memcpy(buffer,&value,sizeof(double));
-#endif
-}
-
-// ----------------------------------------------------------------------------
-int
-RTIfedTime::getPrintableLength() const
-{
- stringstream s ;
-
- if (is_infinity(*this))
- s << infinity_str ;
- else
- s << _fedTime ;
-
- return s.str().length() + 1 ;
-}
-
-// ----------------------------------------------------------------------------
-void
-RTIfedTime::getPrintableString(char *str)
-{
- stringstream s ;
-
- if (is_infinity(*this))
- s << infinity_str ;
- else
- s << _fedTime ;
-
- s >> str ;
- str[s.str().length()] = 0 ;
-}
-
-// ----------------------------------------------------------------------------
-RTI::FedTime &
-RTIfedTime::operator+=(const RTI::FedTime &time)
- throw (RTI::InvalidFederationTime)
-{
- _fedTime += rft(time)._fedTime ;
- return *this;
-}
-
-// ----------------------------------------------------------------------------
-RTI::FedTime &
-RTIfedTime::operator-=(const RTI::FedTime &time)
- throw (RTI::InvalidFederationTime)
-{
- _fedTime -= rft(time)._fedTime ;
- return *this;
-}
-
-// ----------------------------------------------------------------------------
-RTI::Boolean
-RTIfedTime::operator<=(const RTI::FedTime &time) const
- throw (RTI::InvalidFederationTime)
-{
- if (const_cast<RTI::FedTime &>(time).isPositiveInfinity())
- return RTI::RTI_TRUE ;
- else if (is_infinity(*this))
- return RTI::RTI_FALSE ;
- else
- return RTI::Boolean(certi::fcmp(_fedTime, rft(time)._fedTime, _epsilon)
<= 0);
-}
-
-// ----------------------------------------------------------------------------
-RTI::Boolean
-RTIfedTime::operator<(const RTI::FedTime &time) const
- throw (RTI::InvalidFederationTime)
-{
- if (is_infinity(*this))
- return RTI::RTI_FALSE ;
- else
- return RTI::Boolean(is_infinity(time) || certi::fcmp(_fedTime,
rft(time)._fedTime, _epsilon) < 0);
-}
-
-// ----------------------------------------------------------------------------
-RTI::Boolean
-RTIfedTime::operator>=(const RTI::FedTime &time) const
- throw (RTI::InvalidFederationTime)
-{
- if (is_infinity(*this))
- return RTI::RTI_TRUE ;
- else if (is_infinity(time))
- return RTI::RTI_FALSE ;
- else
- return RTI::Boolean(certi::fcmp(_fedTime, rft(time)._fedTime, _epsilon)
>= 0);
-}
-
-// ----------------------------------------------------------------------------
-RTI::Boolean
-RTIfedTime::operator>(const RTI::FedTime &time) const
- throw (RTI::InvalidFederationTime)
-{
- if (is_infinity(time))
- return RTI::RTI_FALSE ;
- else
- return RTI::Boolean(is_infinity(*this) || certi::fcmp(_fedTime,
rft(time)._fedTime, _epsilon) > 0);
-}
-
-// ----------------------------------------------------------------------------
-inline RTI::Boolean
-RTIfedTime::operator==(const RTI::FedTime &time) const
- throw (RTI::InvalidFederationTime)
-{
- if (is_infinity(*this) && is_infinity(time))
- return RTI::RTI_TRUE ;
- else if (is_infinity(*this) || is_infinity(time))
- return RTI::RTI_FALSE ;
- else
- return RTI::Boolean(certi::fcmp(_fedTime, rft(time)._fedTime, _epsilon)
== 0);
-}
-
-// ----------------------------------------------------------------------------
-RTI::FedTime &
-RTIfedTime::operator=(const RTI::FedTime &time)
- throw (RTI::InvalidFederationTime)
-{
- _fedTime = rft(time)._fedTime ;
- return *this ;
-}
-
-// ----------------------------------------------------------------------------
-RTI::Double
-RTIfedTime::getTime() const
-{
- return _fedTime ;
-}
-
-// ----------------------------------------------------------------------------
-RTI::Boolean
-RTIfedTime::operator==(const RTI::Double &time) const
- throw (RTI::InvalidFederationTime)
-{
- return RTI::Boolean(!is_infinity(*this) && certi::fcmp(_fedTime, time,
_epsilon) == 0);
-}
-
-// ----------------------------------------------------------------------------
-RTI::Boolean
-RTIfedTime::operator!=(const RTI::FedTime &time) const
- throw (RTI::InvalidFederationTime)
-{
- return RTI::Boolean(certi::fcmp(_fedTime, rft(time)._fedTime, _epsilon) !=
0);
-}
-
-// ----------------------------------------------------------------------------
-RTI::Boolean
-RTIfedTime::operator!=(const RTI::Double &time) const
- throw (RTI::InvalidFederationTime)
-{
- return RTI::Boolean(is_infinity(*this) || certi::fcmp(_fedTime, time,
_epsilon) != 0);
-}
-
-// ----------------------------------------------------------------------------
-RTI::FedTime &
-RTIfedTime::operator=(const RTIfedTime &time)
- throw (RTI::InvalidFederationTime)
-{
- _fedTime = time._fedTime ;
- return *this ;
-}
-
-// ----------------------------------------------------------------------------
-RTI::FedTime &
-RTIfedTime::operator=(const RTI::Double &time)
- throw (RTI::InvalidFederationTime)
-{
- _fedTime = time ;
- return *this ;
-}
-
-RTI::FedTime &
-RTIfedTime::operator*=(const RTI::FedTime &time)
- throw (RTI::InvalidFederationTime)
-{
- _fedTime *= rft(time)._fedTime ;
- return *this ;
-}
-
-RTI::FedTime &
-RTIfedTime::operator/=(const RTI::FedTime &time)
- throw (RTI::InvalidFederationTime)
-{
- _fedTime /= rft(time)._fedTime ;
- return *this ;
-}
-
-RTI::FedTime &
-RTIfedTime::operator+=(const RTI::Double &time)
- throw (RTI::InvalidFederationTime)
-{
- _fedTime += time ;
- return *this ;
-}
-
-RTI::FedTime &
-RTIfedTime::operator-=(const RTI::Double &time)
- throw (RTI::InvalidFederationTime)
-{
- _fedTime -= time ;
- return *this ;
-}
-
-RTI::FedTime &
-RTIfedTime::operator*=(const RTI::Double &time)
- throw (RTI::InvalidFederationTime)
-{
- _fedTime *= time ;
- return *this ;
-}
-
-RTI::FedTime &
-RTIfedTime::operator/=(const RTI::Double &time)
- throw (RTI::InvalidFederationTime)
-{
- _fedTime /= time ;
- return *this ;
-}
-
-// ----------------------------------------------------------------------------
-RTIfedTime
-RTIfedTime::operator+(const RTI::FedTime &time)
- throw (RTI::InvalidFederationTime)
-{
- RTIfedTime fedtime = _fedTime + rft(time)._fedTime ;
- return fedtime ;
-}
-
-RTIfedTime
-RTIfedTime::operator+(const RTI::Double &time)
- throw (RTI::InvalidFederationTime)
-{
- RTIfedTime fedtime = _fedTime + time ;
- return fedtime ;
-}
-
-// ----------------------------------------------------------------------------
-RTIfedTime
-RTIfedTime::operator-(const RTI::FedTime &time)
- throw (RTI::InvalidFederationTime)
-{
- RTIfedTime fedtime = _fedTime - rft(time)._fedTime ;
- return fedtime ;
-}
-
-RTIfedTime
-RTIfedTime::operator-(const RTI::Double &time)
- throw (RTI::InvalidFederationTime)
-{
- RTIfedTime fedtime = _fedTime - time ;
- return fedtime ;
-}
-
-// ----------------------------------------------------------------------------
-RTIfedTime
-RTIfedTime::operator*(const RTI::FedTime &time)
- throw (RTI::InvalidFederationTime)
-{
- RTIfedTime fedtime = _fedTime * rft(time)._fedTime ;
- return fedtime ;
-}
-
-RTIfedTime
-RTIfedTime::operator*(const RTI::Double &time)
- throw (RTI::InvalidFederationTime)
-{
- RTIfedTime fedtime = _fedTime * time ;
- return fedtime ;
-}
-
-// ----------------------------------------------------------------------------
-RTIfedTime
-RTIfedTime::operator/(const RTI::FedTime &time)
- throw (RTI::InvalidFederationTime)
-{
- RTIfedTime fedtime = _fedTime / rft(time)._fedTime ;
- return fedtime ;
-}
-
-RTIfedTime
-RTIfedTime::operator/(const RTI::Double &time)
- throw (RTI::InvalidFederationTime)
-{
- RTIfedTime fedtime = _fedTime / time ;
- return fedtime ;
-}
-
-// ----------------------------------------------------------------------------
-std::ostream &
-operator<<(std::ostream &s, const RTI::FedTime &time)
-{
- if (is_infinity(time))
- s << infinity_str ;
- else
- s << rft(time).getTime();
- return s ;
-}
-
-// ============================================================================
-
-// ----------------------------------------------------------------------------
-RTIfedTime
-operator+(const RTI::Double &d, const RTI::FedTime &time)
-{
- RTIfedTime fedtime = d + rft(time).getTime();
- return fedtime ;
-}
-
-// ----------------------------------------------------------------------------
-RTIfedTime
-operator-(const RTI::Double &d, const RTI::FedTime &time)
-{
- RTIfedTime fedtime = d - rft(time).getTime();
- return fedtime ;
-}
-
-// ----------------------------------------------------------------------------
-RTIfedTime
-operator*(const RTI::Double &d, const RTI::FedTime &time)
-{
- RTIfedTime fedtime = d * rft(time).getTime();
- return fedtime ;
-}
-
-// ----------------------------------------------------------------------------
-RTIfedTime
-operator/(const RTI::Double &d, const RTI::FedTime &time)
-{
- RTIfedTime fedtime = d / rft(time).getTime();
- return fedtime ;
-}
Index: RTI1516ambTime.cpp
===================================================================
RCS file: RTI1516ambTime.cpp
diff -N RTI1516ambTime.cpp
--- RTI1516ambTime.cpp 28 Apr 2010 18:48:30 -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: RTI1516variableLengthDataImplementation.h
===================================================================
RCS file: RTI1516variableLengthDataImplementation.h
diff -N RTI1516variableLengthDataImplementation.h
--- RTI1516variableLengthDataImplementation.h 28 Apr 2010 18:48:30 -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: RTI1516HandleImplementation.h
===================================================================
RCS file: RTI1516HandleImplementation.h
diff -N RTI1516HandleImplementation.h
--- RTI1516HandleImplementation.h 8 Jun 2011 14:42:08 -0000 1.4
+++ /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: RTItypesImp.hh
===================================================================
RCS file: RTItypesImp.hh
diff -N RTItypesImp.hh
--- RTItypesImp.hh 7 Mar 2010 18:23:39 -0000 3.5
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,278 +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: RTItypesImp.hh,v 3.5 2010/03/07 18:23:39 erk Exp $
-// ----------------------------------------------------------------------------
-
-#ifndef _RTI_TYPESIMP_HH
-#define _RTI_TYPESIMP_HH
-
-#include "Extent.hh"
-#include "RTI.hh"
-#include "certi.hh"
-
-namespace certi {
-
-template<class I>
-struct certi_cast
-{
- template<class R>
- const I& operator()(const R& imp)
- {
- try {
- return dynamic_cast<const I&>(imp);
- }
- catch (...)
- {
- throw RTI::RTIinternalError("Incompatible object on input.");
- }
- }
-
- template<class R>
- I& operator()(R& imp)
- {
- try {
- return dynamic_cast<I&>(imp);
- }
- catch (...)
- {
- throw RTI::RTIinternalError("Incompatible object on input.");
- }
- }
-};
-
-typedef std::pair<AttributeHandle, AttributeValue_t>
AttributeHandleValuePair_t;
-
-class RTI_EXPORT AttributeHandleValuePairSetImp : public
RTI::AttributeHandleValuePairSet
-{
-public:
- AttributeHandleValuePairSetImp(RTI::ULong);
- AttributeHandleValuePairSetImp(const
std::vector<AttributeHandleValuePair_t> &);
-
- virtual ~AttributeHandleValuePairSetImp();
-
- virtual RTI::ULong size() const;
-
- virtual RTI::Handle getHandle(RTI::ULong) const
- throw (RTI::ArrayIndexOutOfBounds);
-
- virtual RTI::ULong getValueLength(RTI::ULong) const
- throw (RTI::ArrayIndexOutOfBounds);
-
- virtual void getValue(RTI::ULong, char *, RTI::ULong &) const
- throw (RTI::ArrayIndexOutOfBounds);
-
- virtual char *getValuePointer(RTI::ULong, RTI::ULong &) const
- throw (RTI::ArrayIndexOutOfBounds);
-
- virtual RTI::TransportType getTransportType(RTI::ULong) const
- throw (RTI::InvalidHandleValuePairSetContext);
-
- virtual RTI::OrderType getOrderType(RTI::ULong) const
- throw (RTI::ArrayIndexOutOfBounds,
RTI::InvalidHandleValuePairSetContext);
-
- virtual RTI::Region *getRegion(RTI::ULong) const
- throw (RTI::ArrayIndexOutOfBounds,
RTI::InvalidHandleValuePairSetContext);
-
- virtual void add(RTI::Handle, const char *,RTI:: ULong)
- throw (RTI::ValueLengthExceeded, RTI::ValueCountExceeded);
-
- virtual void remove(RTI::Handle h)
- throw (RTI::ArrayIndexOutOfBounds);
-
- virtual void moveFrom(const AttributeHandleValuePairSet &, RTI::ULong &)
- throw (RTI::ValueCountExceeded, RTI::ArrayIndexOutOfBounds);
-
- virtual void empty();
-
- virtual RTI::ULong start() const;
- virtual RTI::ULong valid(RTI::ULong i) const;
- virtual RTI::ULong next(RTI::ULong i) const;
-
- const std::vector<AttributeHandleValuePair_t>&
getAttributeHandleValuePairs() const;
-
-protected:
- std::vector<AttributeHandleValuePair_t> _set;
- OrderType _order ;
- TransportType _transport ;
-};
-
-class RTI_EXPORT AttributeHandleSetImp : public RTI::AttributeHandleSet
-{
-public:
- AttributeHandleSetImp(RTI::ULong);
- AttributeHandleSetImp(const std::vector<RTI::AttributeHandle> &val);
- AttributeHandleSetImp(const std::vector<certi::AttributeHandle> &val);
-
- virtual ~AttributeHandleSetImp();
-
- virtual RTI::ULong size() const;
-
- virtual RTI::AttributeHandle getHandle(RTI::ULong) const
- throw (RTI::ArrayIndexOutOfBounds);
-
- virtual void add(RTI::AttributeHandle)
- throw (RTI::ArrayIndexOutOfBounds, RTI::AttributeNotDefined);
-
- virtual void remove(RTI::AttributeHandle)
- throw (RTI::AttributeNotDefined);
-
- virtual void empty();
-
- virtual RTI::Boolean isEmpty() const;
- virtual RTI::Boolean isMember(RTI::AttributeHandle h) const;
-
- const std::vector<RTI::AttributeHandle>& getAttributeHandles() const;
-
-protected:
- std::vector<RTI::AttributeHandle> _set;
-};
-
-class RTI_EXPORT FederateHandleSetImp : public RTI::FederateHandleSet
-{
-public:
- FederateHandleSetImp(RTI::ULong);
- virtual ~FederateHandleSetImp();
-
- virtual RTI::ULong size() const;
-
- virtual RTI::FederateHandle getHandle(RTI::ULong) const
- throw (RTI::ArrayIndexOutOfBounds);
-
- virtual void add(RTI::FederateHandle)
- throw (RTI::ValueCountExceeded);
-
- virtual void remove(RTI::FederateHandle)
- throw (RTI::ArrayIndexOutOfBounds);
-
- virtual void empty();
-
- virtual RTI::Boolean isMember(RTI::FederateHandle) const;
-
-protected:
- std::vector<RTI::FederateHandle> _set;
-};
-
-typedef std::pair<RTI::ParameterHandle, ParameterValue_t>
ParameterHandleValuePair_t;
-
-class RTI_EXPORT ParameterHandleValuePairSetImp : public
RTI::ParameterHandleValuePairSet
-{
-public:
- ParameterHandleValuePairSetImp(RTI::ULong);
- ParameterHandleValuePairSetImp(const
std::vector<ParameterHandleValuePair_t> &);
- virtual ~ParameterHandleValuePairSetImp();
-
- virtual RTI::ULong size() const;
-
- virtual RTI::Handle getHandle(RTI::ULong) const
- throw (RTI::ArrayIndexOutOfBounds);
-
- virtual RTI::ULong getValueLength(RTI::ULong) const
- throw (RTI::ArrayIndexOutOfBounds);
-
- virtual void getValue(RTI::ULong, char *, RTI::ULong &) const
- throw (RTI::ArrayIndexOutOfBounds);
-
- virtual char *getValuePointer(RTI::ULong, RTI::ULong &) const
- throw (RTI::ArrayIndexOutOfBounds);
-
- virtual RTI::TransportType getTransportType() const
- throw (RTI::InvalidHandleValuePairSetContext);
-
- virtual RTI::OrderType getOrderType() const
- throw (RTI::InvalidHandleValuePairSetContext);
-
- virtual RTI::Region *getRegion() const
- throw (RTI::InvalidHandleValuePairSetContext);
-
- virtual void add(RTI::Handle, const char *, RTI::ULong)
- throw (RTI::ValueLengthExceeded, RTI::ValueCountExceeded);
-
- virtual void remove(RTI::Handle)
- throw (RTI::ArrayIndexOutOfBounds);
-
- virtual void moveFrom(const ParameterHandleValuePairSet &, RTI::ULong &)
- throw (RTI::ValueCountExceeded, RTI::ArrayIndexOutOfBounds);
-
- virtual void empty();
-
- virtual RTI::ULong start() const;
- virtual RTI::ULong valid(RTI::ULong i) const;
- virtual RTI::ULong next(RTI::ULong i) const;
-
- const std::vector<ParameterHandleValuePair_t>&
getParameterHandleValuePairs() const;
-
-protected:
- std::vector<ParameterHandleValuePair_t> _set;
- RTI::OrderType _order ;
- RTI::TransportType _transport ;
-};
-
-
-class RTI_EXPORT RegionImp : public RTI::Region
-{
-public:
- RegionImp(RegionHandle, RTI::SpaceHandle, const std::vector<Extent>&);
- virtual ~RegionImp();
-
- virtual RTI::ULong getRangeLowerBound(RTI::ExtentIndex,
RTI::DimensionHandle) const
- throw (RTI::ArrayIndexOutOfBounds);
-
- virtual RTI::ULong getRangeUpperBound(RTI::ExtentIndex,
RTI::DimensionHandle) const
- throw (RTI::ArrayIndexOutOfBounds);
-
- virtual void setRangeLowerBound(RTI::ExtentIndex, RTI::DimensionHandle,
RTI::ULong)
- throw (RTI::ArrayIndexOutOfBounds);
-
- virtual void setRangeUpperBound(RTI::ExtentIndex, RTI::DimensionHandle,
RTI::ULong)
- throw (RTI::ArrayIndexOutOfBounds);
-
- virtual RTI::SpaceHandle getSpaceHandle() const
- throw ();
-
- virtual RTI::ULong getNumberOfExtents() const
- throw ();
-
- virtual RTI::ULong getRangeLowerBoundNotificationLimit(RTI::ExtentIndex,
RTI::DimensionHandle) const
- throw (RTI::ArrayIndexOutOfBounds);
-
- virtual RTI::ULong getRangeUpperBoundNotificationLimit(RTI::ExtentIndex,
RTI::DimensionHandle) const
- throw (RTI::ArrayIndexOutOfBounds);
-
- RegionHandle getHandle() const;
-
- const std::vector<Extent>& getExtents() const;
-
- void commit();
-
-private:
- RegionHandle handle;
- RTI::SpaceHandle space;
- std::vector<Extent> extents;
- // extents used in last notifyAboutRegionModification
- std::vector<Extent> effectiveExtents;
-};
-
-}
-
-#endif // _RTI_TYPESIMP_HH
-
-// $Id: RTItypesImp.hh,v 3.5 2010/03/07 18:23:39 erk Exp $
Index: RTI1516HandleFactory.h
===================================================================
RCS file: RTI1516HandleFactory.h
diff -N RTI1516HandleFactory.h
--- RTI1516HandleFactory.h 8 Jun 2011 14:42:08 -0000 1.2
+++ /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: RTI1516ambassador.cpp
===================================================================
RCS file: RTI1516ambassador.cpp
diff -N RTI1516ambassador.cpp
--- RTI1516ambassador.cpp 3 Oct 2011 07:01:21 -0000 1.10
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,2859 +0,0 @@
-#include "RTI1516ambassador.h"
-#include <RTI/RangeBounds.h>
-
-#ifndef _WIN32
-#include <cstdlib>
-#include <cstring>
-#endif
-
-#include "PrettyDebug.hh"
-
-#include "M_Classes.hh"
-//#include "RTItypesImp.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: RTIambPrivateRefs.hh
===================================================================
RCS file: RTIambPrivateRefs.hh
diff -N RTIambPrivateRefs.hh
--- RTIambPrivateRefs.hh 24 Nov 2009 21:44:48 -0000 3.10
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,63 +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: RTIambPrivateRefs.hh,v 3.10 2009/11/24 21:44:48 erk Exp $
-// ----------------------------------------------------------------------------
-
-#include "RTI.hh"
-#include "fedtime.hh"
-#include "Message.hh"
-#include "RootObject.hh"
-#include "MessageBuffer.hh"
-
-using namespace certi ;
-
-class RTIambPrivateRefs
-{
-public:
- RTIambPrivateRefs();
- ~RTIambPrivateRefs();
-
- void processException(Message *);
- void executeService(Message *requete, Message *reponse);
- void sendTickRequestStop();
- void callFederateAmbassador(Message *msg) throw (RTI::RTIinternalError);
- void leave(const char *msg) throw (RTI::RTIinternalError);
-
-#ifdef _WIN32
- HANDLE handle_RTIA;
-#else
- pid_t pid_RTIA ; //!< pid associated with rtia fork (private).
-#endif
-
- //! Federate Ambassador reference for module calls.
- RTI::FederateAmbassador *fed_amb ;
-
- //! used to prevent reentrant calls (see tick() and executeService()).
- bool is_reentrant ;
-
- RootObject *_theRootObj ;
-
- SocketUN *socketUn ;
- MessageBuffer msgBufSend,msgBufReceive ;
-};
-
-// $Id: RTIambPrivateRefs.hh,v 3.10 2009/11/24 21:44:48 erk Exp $
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [certi-cvs] certi/libRTI CMakeLists.txt ieee1516-2000/RTI15...,
CERTI CVS commits <=