├── ChangeLog ├── doc ├── certi.bmp ├── certi.png ├── favicon.ico ├── certi-favi.jpg ├── certi-favi.png ├── images │ ├── rtig.png │ ├── billard.png │ ├── cmake-binaries.png │ ├── cmake-generate.png │ ├── cmake-launch.png │ ├── cmake-verify.png │ ├── cmake-vsfiles.png │ ├── cmake-generator.png │ ├── cmake-vsproject.png │ └── putty-portforwarding.png ├── RTIA-model-shot.png ├── certi-favi-16x16.png ├── libRTI-model-shot.png ├── certi-ui-dialog-493x312.jpg ├── certi-ui-dialog-493x312.png ├── certi-installer-banner-493x58.jpg ├── certi-installer-banner-493x58.png ├── CERTI-HLA-ImplementationStatusList.ods ├── CERTI-tickHandling.q ├── certi_footer.html ├── certi_header.html ├── certi_user_header.html ├── certi_install_header.html ├── doc_install.in ├── index.html ├── introduction.dox ├── install.dox ├── certi_install_doc.tree └── certi_user_doc.tree ├── scripts ├── GenMsgC.pyc ├── GenMsgAST.pyc ├── GenMsgCXX.pyc ├── parsetab.pyc ├── GenMsgBase.pyc ├── GenMsgJava.pyc ├── GenMsgPython.pyc ├── GenMsgSpec.pyc ├── runtest.sh ├── GeneratePackageType.cmake ├── PackageType.cmake.in ├── certi-cdash ├── sanitize-blacklist.txt.in ├── genallmsg.sh ├── testallmsg.sh ├── package_source_dated.cmake ├── TestMessageSpec.msg ├── call_Uncrustify.sh ├── CreatePatchCVS.cmake ├── UseCERTI.cmake ├── Toolchain-cross-mingw-Win32.cmake ├── Toolchain-cross-mingw-Win64.cmake ├── GenMsgPython.py ├── UsePackageBackup.cmake ├── FindMd5sum.cmake ├── FindLexYacc.cmake └── TODO.GenMsg ├── CERTIBuildTreeSettings.cmake.in ├── include ├── CMakeLists.txt ├── ieee1516-2010 │ ├── CMakeLists.txt │ └── RTI │ │ ├── encoding │ │ ├── EncodingExceptions.h │ │ └── EncodingConfig.h │ │ ├── RTIambassadorFactory.h │ │ └── RangeBounds.h ├── ieee1516-2000 │ ├── CMakeLists.txt │ └── RTI │ │ ├── RTIambassadorFactory.h │ │ ├── RangeBounds.h │ │ └── RTI1516.h ├── hla-1_3 │ ├── CMakeLists.txt │ └── baseTypes.hh └── make_unique.hh ├── test ├── utility │ ├── SharedStruct.hh │ ├── T2010VerySmallO.xml │ ├── CMakeLists.txt │ └── T2010VerySmallOI.xml ├── InteractiveFederate │ ├── 1.3 │ │ ├── Makefile │ │ └── Interactive_Federation.fed │ ├── 1516-2010 │ │ ├── Makefile │ │ └── Certi-Test-02.xml │ ├── 1516-2000 │ │ └── Makefile │ └── README ├── ModernBillard │ ├── Create.xml │ ├── Join.xml │ ├── Base.xml │ ├── CMakeLists.txt │ └── main.cc ├── CMakeLists.txt ├── testFederate │ ├── testFederate.ggo │ ├── testFederation.fed │ └── testFederateMain.cc ├── Billard │ ├── Test.fed │ ├── Billard.ggo │ ├── ColoredBall.hh │ ├── Test.xml │ ├── Display.hh │ ├── BillardTest2010.xml │ ├── Ball.hh │ ├── ColoredBall.cc │ └── BillardDDM.hh ├── libgraphc │ └── CMakeLists.txt ├── mom_explorer │ ├── cli.h │ └── CMakeLists.txt └── TimeMaster │ └── CMakeLists.txt ├── tests ├── main.cpp ├── RTIG │ ├── temporaryfedfile.h │ ├── temporaryenvironmentlocation.h │ └── Sample.fed ├── mocks │ ├── sockettcp_mock.h │ └── securityserver_mock.h ├── LibCERTI │ ├── socketserver_test.cpp │ ├── networkmessage_test.cpp │ ├── CMakeLists.txt │ └── auditline_test.cpp ├── fakes │ └── socketserver_fake.h ├── LibHLA │ ├── CMakeLists.txt │ └── clock_test.cpp ├── LibRTI │ └── hla-1_3 │ │ └── CMakeLists.txt └── CMakeLists.txt ├── xml ├── CMakeLists.txt └── README.txt ├── libHLA ├── 00README_libHLA.txt ├── COPYING.MurmurHash ├── tlsf_target.h ├── SHMPosix.hh ├── WinClock.cc ├── SHMWin32.hh ├── PosixClock.cc ├── WinPerfClock.cc ├── MurmurHash3.h ├── SemaphoreWin32.hh ├── SemaphorePosix.hh ├── WinClock.hh ├── WinPerfClock.hh ├── TSCClock.cc ├── Semaphore.hh ├── MurmurHash2.h ├── COPYING.tlsf ├── tlsf.h ├── PosixClock.hh ├── Clock.cc ├── TSCClock.hh ├── SemaphoreSysV.hh ├── SHMSysV.hh ├── GettimeofdayClock.cc ├── ClockFactory.cc └── SHM.hh ├── AUTHORS ├── ReleaseNotes.txt ├── CERTIConfigVersion.cmake.in ├── CTestConfig.cmake ├── libCERTI ├── SocketSHMPosix.hh ├── SocketSHMSysV.hh ├── SocketSHMWin32.hh ├── SocketSHM.hh ├── Exception.cc ├── SocketHTTPProxy.hh ├── RTIRegion.hh ├── Parameter.cc ├── Parameter.hh ├── NameReservation.hh ├── FederateLevelList.hh ├── Dimension.cc ├── Handle.hh ├── InteractionBroadcastList.hh ├── SecurityLevel.hh ├── Message.cc ├── FederateLevelList.cc ├── RTIRegion.cc ├── helper.hh ├── SocketMC.hh ├── BaseRegion.hh ├── fed.hh └── FedRegion.hh ├── libRTI ├── CMakeLists.txt ├── ieee1516-2000 │ ├── RTIambassador.cpp │ ├── RTIfedAmbassador.cpp │ ├── RTIvariableLengthDataImplementation.h │ └── RTIambPrivateRefs.h ├── ieee1516-2010 │ ├── RTIambassador.cpp │ ├── RTIfedAmbassador.cpp │ └── RTIvariableLengthDataImplementation.h └── hla-1_3 │ └── RTIambPrivateRefs.hh ├── .gitignore ├── RTIG ├── RTIG.ggo └── CMakeLists.txt ├── RTIA ├── RTIA.ggo └── CMakeLists.txt ├── CERTI_DESCRIPTION.txt ├── CERTIConfig.cmake.in ├── cmake_uninstall.cmake.in ├── COPYING.txt ├── CERTICPackOptions.cmake.in └── README /ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etopzone/CERTI/HEAD/ChangeLog -------------------------------------------------------------------------------- /doc/certi.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etopzone/CERTI/HEAD/doc/certi.bmp -------------------------------------------------------------------------------- /doc/certi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etopzone/CERTI/HEAD/doc/certi.png -------------------------------------------------------------------------------- /doc/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etopzone/CERTI/HEAD/doc/favicon.ico -------------------------------------------------------------------------------- /doc/certi-favi.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etopzone/CERTI/HEAD/doc/certi-favi.jpg -------------------------------------------------------------------------------- /doc/certi-favi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etopzone/CERTI/HEAD/doc/certi-favi.png -------------------------------------------------------------------------------- /doc/images/rtig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etopzone/CERTI/HEAD/doc/images/rtig.png -------------------------------------------------------------------------------- /scripts/GenMsgC.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etopzone/CERTI/HEAD/scripts/GenMsgC.pyc -------------------------------------------------------------------------------- /scripts/GenMsgAST.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etopzone/CERTI/HEAD/scripts/GenMsgAST.pyc -------------------------------------------------------------------------------- /scripts/GenMsgCXX.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etopzone/CERTI/HEAD/scripts/GenMsgCXX.pyc -------------------------------------------------------------------------------- /scripts/parsetab.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etopzone/CERTI/HEAD/scripts/parsetab.pyc -------------------------------------------------------------------------------- /doc/RTIA-model-shot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etopzone/CERTI/HEAD/doc/RTIA-model-shot.png -------------------------------------------------------------------------------- /doc/certi-favi-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etopzone/CERTI/HEAD/doc/certi-favi-16x16.png -------------------------------------------------------------------------------- /doc/images/billard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etopzone/CERTI/HEAD/doc/images/billard.png -------------------------------------------------------------------------------- /scripts/GenMsgBase.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etopzone/CERTI/HEAD/scripts/GenMsgBase.pyc -------------------------------------------------------------------------------- /scripts/GenMsgJava.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etopzone/CERTI/HEAD/scripts/GenMsgJava.pyc -------------------------------------------------------------------------------- /scripts/GenMsgPython.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etopzone/CERTI/HEAD/scripts/GenMsgPython.pyc -------------------------------------------------------------------------------- /scripts/GenMsgSpec.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etopzone/CERTI/HEAD/scripts/GenMsgSpec.pyc -------------------------------------------------------------------------------- /doc/libRTI-model-shot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etopzone/CERTI/HEAD/doc/libRTI-model-shot.png -------------------------------------------------------------------------------- /doc/images/cmake-binaries.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etopzone/CERTI/HEAD/doc/images/cmake-binaries.png -------------------------------------------------------------------------------- /doc/images/cmake-generate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etopzone/CERTI/HEAD/doc/images/cmake-generate.png -------------------------------------------------------------------------------- /doc/images/cmake-launch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etopzone/CERTI/HEAD/doc/images/cmake-launch.png -------------------------------------------------------------------------------- /doc/images/cmake-verify.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etopzone/CERTI/HEAD/doc/images/cmake-verify.png -------------------------------------------------------------------------------- /doc/images/cmake-vsfiles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etopzone/CERTI/HEAD/doc/images/cmake-vsfiles.png -------------------------------------------------------------------------------- /doc/certi-ui-dialog-493x312.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etopzone/CERTI/HEAD/doc/certi-ui-dialog-493x312.jpg -------------------------------------------------------------------------------- /doc/certi-ui-dialog-493x312.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etopzone/CERTI/HEAD/doc/certi-ui-dialog-493x312.png -------------------------------------------------------------------------------- /doc/images/cmake-generator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etopzone/CERTI/HEAD/doc/images/cmake-generator.png -------------------------------------------------------------------------------- /doc/images/cmake-vsproject.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etopzone/CERTI/HEAD/doc/images/cmake-vsproject.png -------------------------------------------------------------------------------- /doc/images/putty-portforwarding.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etopzone/CERTI/HEAD/doc/images/putty-portforwarding.png -------------------------------------------------------------------------------- /doc/certi-installer-banner-493x58.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etopzone/CERTI/HEAD/doc/certi-installer-banner-493x58.jpg -------------------------------------------------------------------------------- /doc/certi-installer-banner-493x58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etopzone/CERTI/HEAD/doc/certi-installer-banner-493x58.png -------------------------------------------------------------------------------- /CERTIBuildTreeSettings.cmake.in: -------------------------------------------------------------------------------- 1 | set(SCHEDMCORE_INCLUDE_DIRS 2 | "@PROJECT_SOURCE_DIR@/lib" 3 | "@PROJECT_BINARY_DIR@/lib") 4 | -------------------------------------------------------------------------------- /doc/CERTI-HLA-ImplementationStatusList.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etopzone/CERTI/HEAD/doc/CERTI-HLA-ImplementationStatusList.ods -------------------------------------------------------------------------------- /scripts/runtest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | CERTI_NIGHTLY_BUILD_DIR=`pwd` 3 | /usr/local/bin/ctest -S ${CERTI_NIGHTLY_BUILD_DIR}/certi-ctest.cmake 4 | -------------------------------------------------------------------------------- /scripts/GeneratePackageType.cmake: -------------------------------------------------------------------------------- 1 | 2 | configure_file("${SRCDIR}/scripts/PackageType.cmake.in" 3 | "${DSTDIR}/PackageType.cmake" @ONLY) -------------------------------------------------------------------------------- /doc/CERTI-tickHandling.q: -------------------------------------------------------------------------------- 1 | //This file was generated from (Academic) UPPAAL 4.0.11 (rev. 4492), February 2010 2 | 3 | /* 4 | 5 | */ 6 | A[] not deadlock 7 | -------------------------------------------------------------------------------- /include/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Process version specific headers 2 | add_subdirectory(hla-1_3) 3 | add_subdirectory(ieee1516-2000) 4 | add_subdirectory(ieee1516-2010) 5 | -------------------------------------------------------------------------------- /scripts/PackageType.cmake.in: -------------------------------------------------------------------------------- 1 | 2 | if(@MSVC@) 3 | get_filename_component(PACKAGE_TYPE "@CMAKE_CFG_INTDIR@" NAME) 4 | else(@MSVC@) 5 | set(PACKAGE_TYPE "@CMAKE_BUILD_TYPE@") 6 | endif(@MSVC@) 7 | -------------------------------------------------------------------------------- /scripts/certi-cdash: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | CERTI_NIGHTLY_BUILD_DIR=/LOCAL/ERIC/CertiNightly 4 | cd ${CERTI_NIGHTLY_BUILD_DIR} 5 | runuser enoulard ${CERTI_NIGHTLY_BUILD_DIR}/runtest.sh 6 | 7 | exit 0 8 | -------------------------------------------------------------------------------- /include/ieee1516-2010/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Install public IEEE-1516-2010 DLC headers files 2 | # taken from http://standards.ieee.org/downloads/1516/1516.1-2010/ 3 | install(DIRECTORY RTI DESTINATION include/ieee1516-2010 PATTERN "CVS" EXCLUDE) 4 | -------------------------------------------------------------------------------- /test/utility/SharedStruct.hh: -------------------------------------------------------------------------------- 1 | #ifndef SHARED_STRUCT_H 2 | #define SHARED_STRUCT_H 3 | 4 | /* For FILE */ 5 | #include 6 | 7 | typedef struct { 8 | int Header; 9 | double Body; 10 | } shared_struct ; 11 | 12 | #endif 13 | 14 | 15 | -------------------------------------------------------------------------------- /test/InteractiveFederate/1.3/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | 3 | all : 4 | g++ -o Interactive_Federate Interactive_Federate.cc \ 5 | -L$(CERTI_HOME)/lib -lRTI-NGd -lCERTId -lFedTimed -DRTI_USES_STD_FSTREAM \ 6 | -I$(CERTI_HOME)/include/hla13 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #ifndef CERTI_TEST 4 | #error CERTI_TEST must be defined for tests 5 | #endif 6 | 7 | int main(int argc, char* argv[]) 8 | { 9 | testing::InitGoogleTest(&argc, argv); 10 | return RUN_ALL_TESTS(); 11 | } 12 | -------------------------------------------------------------------------------- /xml/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # install IEEE provided set of files 2 | # 3 | install(FILES README.txt DESTINATION share/xml) 4 | install(DIRECTORY ieee1516-2010 DESTINATION share/xml PATTERN "CVS" EXCLUDE) 5 | install(DIRECTORY ieee1516-2000 DESTINATION share/xml PATTERN "CVS" EXCLUDE) -------------------------------------------------------------------------------- /doc/certi_footer.html: -------------------------------------------------------------------------------- 1 |
2 | Generated on $datetime for $projectname by doxygen $doxygenversion
3 | 4 | 5 | -------------------------------------------------------------------------------- /libHLA/00README_libHLA.txt: -------------------------------------------------------------------------------- 1 | This directory will contain RTI independant source code 2 | which may help to develop HLA Federate 3 | 4 | see 5 | https://savannah.nongnu.org/patch/?6534 6 | https://savannah.nongnu.org/task/?8386 7 | http://lists.nongnu.org/archive/html/certi-devel/2008-07/msg00027.html 8 | -------------------------------------------------------------------------------- /include/ieee1516-2000/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Install public IEEE-1516 DLC headers files 2 | # taken from SISO-STD-004.1-2004 3 | # see http://www.sisostds.org/index.php?tg=fileman&idx=get&id=5&gr=Y&path=SISO+Products%2FSISO+Standards&file=SIS-STD-004.1-2004.zip 4 | install(DIRECTORY RTI DESTINATION include/ieee1516-2000 PATTERN "CVS" EXCLUDE) 5 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | * CERTI Authors and contributors: M. Adelantado, P. Bieber, S. Bonnet, 2 | B. Bréholée, P. Desseaux, F. Fayet, M. Fröhlich, P. Gotthard, A. Harzi, Ph. Hautesserres, M. Joubert 3 | J. Latour, S. Lemanceau, J.M. Mathé, P. Nortier, E. Noulard, S. Prunet, 4 | M. Raab, V. Raulet, J.-Y. Rousselot, P. Siron, C. Stenzel, P. Torguet, G. Zanon 5 | -------------------------------------------------------------------------------- /doc/certi_header.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | $title 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /doc/certi_user_header.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | $title 4 | 5 | Back to CERTI User Documentation index 6 | 7 | -------------------------------------------------------------------------------- /test/InteractiveFederate/1516-2010/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | 3 | all : 4 | g++ -g -o Interactive_Federate1516-2010 Interactive_Federate1516-2010.cc \ 5 | -L$(CERTI_HOME)/lib -lRTI1516ed -lCERTId -lFedTime1516ed -DRTI_USES_STD_FSTREAM -std=c++11 \ 6 | -I$(CERTI_HOME)/include/ieee1516-2010 -I$(CERTI_HOME)/include/libhla 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /doc/certi_install_header.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | $title 4 | 5 | Back to CERTI Installation Documentation index 6 | 7 | -------------------------------------------------------------------------------- /test/ModernBillard/Create.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /test/ModernBillard/Join.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /libHLA/COPYING.MurmurHash: -------------------------------------------------------------------------------- 1 | Taken from: http://code.google.com/p/smhasher 2 | On February, 24th 2015 3 | // MurmurHash2 was written by Austin Appleby, and is placed in the public 4 | // domain. The author hereby disclaims copyright to this source code. 5 | // MurmurHash3 was written by Austin Appleby, and is placed in the public 6 | // domain. The author hereby disclaims copyright to this source code. -------------------------------------------------------------------------------- /libHLA/tlsf_target.h: -------------------------------------------------------------------------------- 1 | #ifndef _TLSF_TARGET_H_ 2 | #define _TLSF_TARGET_H_ 3 | 4 | #include 5 | 6 | #define TLSF_MLOCK_T pthread_mutex_t 7 | #define TLSF_CREATE_LOCK(l) pthread_mutex_init(l, NULL) 8 | #define TLSF_DESTROY_LOCK(l) pthread_mutex_destroy(l) 9 | #define TLSF_ACQUIRE_LOCK(l) pthread_mutex_lock(l) 10 | #define TLSF_RELEASE_LOCK(l) pthread_mutex_unlock(l) 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /ReleaseNotes.txt: -------------------------------------------------------------------------------- 1 | Release Notes for CERTI X.Y.Z 2 | ============================== 3 | 4 | For now look at the ChangeLog file 5 | http://cvs.savannah.gnu.org/viewvc/certi/ChangeLog?root=certi&view=log 6 | FIXME: we should update this 7 | 8 | -- 9 | Home page http://www.nongnu.org/certi/ 10 | Project page https://savannah.nongnu.org/projects/certi/ 11 | Known bugs https://savannah.nongnu.org/bugs/?group=certi 12 | -------------------------------------------------------------------------------- /tests/RTIG/temporaryfedfile.h: -------------------------------------------------------------------------------- 1 | #ifndef TEMPORARYFEDFILE_H 2 | #define TEMPORARYFEDFILE_H 3 | 4 | #include 5 | 6 | class TemporaryFedFile { 7 | public: 8 | TemporaryFedFile(const std::string& path); 9 | 10 | ~TemporaryFedFile(); 11 | 12 | std::string path() const; 13 | 14 | private: 15 | void createFed(); 16 | 17 | std::string my_path; 18 | }; 19 | 20 | #endif // TEMPORARYFEDFILE_H 21 | -------------------------------------------------------------------------------- /tests/mocks/sockettcp_mock.h: -------------------------------------------------------------------------------- 1 | #ifndef MOCKSOCKETTCP_H 2 | #define MOCKSOCKETTCP_H 3 | 4 | #include 5 | 6 | #include 7 | 8 | class MockSocketTcp : public certi::SocketTCP { 9 | public: 10 | MOCK_METHOD2(send, void(const unsigned char* data, size_t size)); 11 | 12 | MOCK_METHOD2(receive, void(void* buffer, unsigned long size)); 13 | }; 14 | 15 | #endif // MOCKSOCKETTCP_H 16 | -------------------------------------------------------------------------------- /scripts/sanitize-blacklist.txt.in: -------------------------------------------------------------------------------- 1 | # Do not analyze libc or libstdc++ functions 2 | fun:*open* 3 | # Do not analyze gengetopt generated functions/files 4 | ## The functions 5 | fun:gengetopt_strdup 6 | fun:cmdline_parser 7 | fun:cmdline_parser2 8 | fun:update_arg 9 | ## the files 10 | src:${CMAKE_SOURCE_DIR}/RTIA/RTIA_cmdline.c 11 | src:${CMAKE_SOURCE_DIR}/RTIA/RTIA_main.cc 12 | src:${CMAKE_SOURCE_DIR}/test/testFederate/testFederate_cmdline.c -------------------------------------------------------------------------------- /CERTIConfigVersion.cmake.in: -------------------------------------------------------------------------------- 1 | set(PACKAGE_VERSION "@PACKAGE_VERSION@") 2 | 3 | # Check whether the requested PACKAGE_FIND_VERSION is compatible 4 | if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}") 5 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 6 | else() 7 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 8 | if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}") 9 | set(PACKAGE_VERSION_EXACT TRUE) 10 | endif() 11 | endif() 12 | -------------------------------------------------------------------------------- /CTestConfig.cmake: -------------------------------------------------------------------------------- 1 | SET(CTEST_PROJECT_NAME "CERTI") 2 | SET(CTEST_NIGHTLY_START_TIME "01:00:00 UTC") 3 | 4 | IF(NOT DEFINED CTEST_DROP_METHOD) 5 | SET(CTEST_DROP_METHOD "http") 6 | ENDIF(NOT DEFINED CTEST_DROP_METHOD) 7 | 8 | IF(CTEST_DROP_METHOD STREQUAL "http") 9 | SET(CTEST_DROP_SITE "my.cdash.org") 10 | SET(CTEST_DROP_LOCATION "/submit.php?project=CERTI") 11 | set(CTEST_DROP_SITE_CDASH TRUE) 12 | ENDIF(CTEST_DROP_METHOD STREQUAL "http") 13 | -------------------------------------------------------------------------------- /tests/RTIG/temporaryenvironmentlocation.h: -------------------------------------------------------------------------------- 1 | #ifndef TEMPORARYENVIRONMENTLOCATION_H 2 | #define TEMPORARYENVIRONMENTLOCATION_H 3 | 4 | #include 5 | 6 | class TemporaryEnvironmentLocation { 7 | public: 8 | TemporaryEnvironmentLocation(const std::string& name); 9 | ~TemporaryEnvironmentLocation(); 10 | 11 | std::string path() const; 12 | 13 | private: 14 | std::string my_name; 15 | std::string my_lastValue; 16 | }; 17 | 18 | #endif // TEMPORARYENVIRONMENTLOCATION_H 19 | -------------------------------------------------------------------------------- /libCERTI/SocketSHMPosix.hh: -------------------------------------------------------------------------------- 1 | #ifndef SOCKET_SHM_POSIX_H 2 | #define SOCKET_SHM_POSIX_H 3 | 4 | // Specifics includes 5 | #include "SocketSHM.hh" 6 | 7 | class CERTI_EXPORT SocketSHMPosix : public SocketSHM { 8 | private: 9 | public: 10 | // Constructor 11 | SocketSHMPosix(const std::string& Socket_Name, const SHM_SIDE_t& Socket_Side, const int Socket_Size); 12 | // Destructor 13 | virtual ~SocketSHMPosix(); 14 | 15 | void Open(); 16 | 17 | }; // End of --> class SocketSHM 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /test/InteractiveFederate/1.3/Interactive_Federation.fed: -------------------------------------------------------------------------------- 1 | ;; Federation_Interactive 2 | (Fed 3 | (Federation Federation_Interactive) 4 | (FedVersion v1.3) 5 | (Spaces 6 | ) 7 | (Objects 8 | (Class ObjectRoot 9 | (Attribute privilegeToDelete reliable timestamp) 10 | (Class RTIprivate) 11 | (Class Federation_InteractiveClass 12 | (Attribute NUMB RELIABLE RECEIVE) 13 | ) 14 | ) 15 | ) 16 | 17 | (Interactions 18 | (Class msg RELIABLE TIMESTAMP 19 | ) 20 | ) 21 | ) 22 | -------------------------------------------------------------------------------- /tests/mocks/securityserver_mock.h: -------------------------------------------------------------------------------- 1 | #ifndef MOCK_CERTI_SECURITY_SERVER_HH 2 | #define MOCK_CERTI_SECURITY_SERVER_HH 3 | 4 | #include 5 | 6 | #include 7 | 8 | class MockSecurityServer : public certi::SecurityServer { 9 | public: 10 | using certi::SecurityServer::SecurityServer; 11 | 12 | MOCK_CONST_METHOD2(getSocketLink, certi::Socket*(certi::FederateHandle theFederate, certi::TransportType theType)); 13 | }; 14 | 15 | #endif // MOCK_CERTI_SECURITY_SERVER_HH 16 | -------------------------------------------------------------------------------- /libRTI/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Include directories common to all standards 2 | include_directories(${CMAKE_SOURCE_DIR}/libCERTI) # for libCERTI :-) 3 | include_directories(${CMAKE_SOURCE_DIR}/libHLA) # for MessageBuffer 4 | include_directories(${CMAKE_BINARY_DIR}) # for the config.h file 5 | # Standard specific includes will then be added in the concerned directory 6 | 7 | # Process standard specific libRTI implementation 8 | add_subdirectory(hla-1_3) 9 | add_subdirectory(ieee1516-2000) 10 | add_subdirectory(ieee1516-2010) -------------------------------------------------------------------------------- /include/hla-1_3/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Generate public RTI header with appropriately configured values 2 | # like RTI_VERSION, RTI_INTERNAL_VERSION etc... 3 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/RTItypes.hh.cmake ${CMAKE_CURRENT_BINARY_DIR}/RTItypes.hh) 4 | # Install public HLA 1.3 DLC headers files 5 | install(FILES 6 | NullFederateAmbassador.hh 7 | RTI.hh 8 | RTIambServices.hh 9 | ${CMAKE_CURRENT_BINARY_DIR}/RTItypes.hh 10 | baseTypes.hh 11 | federateAmbServices.hh 12 | fedtime.hh 13 | DESTINATION include/hla13) 14 | -------------------------------------------------------------------------------- /xml/README.txt: -------------------------------------------------------------------------------- 1 | The file in there are xml related files coming from the IEEE-1516 norms. 2 | 3 | ieee1516-2000/1516_2-2000/ 4 | Contains IEEE-1516 version 2000 related files. 5 | The files comes from: 6 | http://www.sisostds.org/DigitalLibrary.aspx?Command=Core_Download&EntryId=29251 7 | http://www.sisostds.org/DigitalLibrary.aspx?EntryId=29241 8 | 9 | ieee1516-2010/1516_[12]-2010/ 10 | Contains IEEE-1516 version 2010 related files. 11 | The files comes from: 12 | http://standards.ieee.org/downloads/1516/ 13 | 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | build*/ 3 | .kdev4/ 4 | *.kdev4 5 | 6 | output 7 | install/ 8 | install*/ 9 | 10 | ## C++ 11 | 12 | # Prerequisites 13 | *.d 14 | 15 | # Compiled Object files 16 | *.slo 17 | *.lo 18 | *.o 19 | *.obj 20 | 21 | # Precompiled Headers 22 | *.gch 23 | *.pch 24 | 25 | # Compiled Dynamic libraries 26 | *.so 27 | *.dylib 28 | *.dll 29 | 30 | # Fortran module files 31 | *.mod 32 | *.smod 33 | 34 | # Compiled Static libraries 35 | *.lai 36 | *.la 37 | *.a 38 | *.lib 39 | 40 | # Executables 41 | *.exe 42 | *.out 43 | *.app 44 | -------------------------------------------------------------------------------- /include/make_unique.hh: -------------------------------------------------------------------------------- 1 | #ifndef MAKE_UNIQUE_FOR_OLDER_COMPILERS 2 | #define MAKE_UNIQUE_FOR_OLDER_COMPILERS 3 | 4 | #if defined(__clang__) 5 | 6 | using std::make_unique; 7 | 8 | #elif __GNUC__ < 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ < 9)) 9 | 10 | #include 11 | 12 | template 13 | std::unique_ptr make_unique(Args&&... args) 14 | { 15 | return std::unique_ptr(new T(std::forward(args)...)); 16 | } 17 | 18 | #else 19 | 20 | using std::make_unique; 21 | 22 | #endif 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /scripts/genallmsg.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ./GenerateMessages.py --input=CERTI_NetworkMessage.msg --language=CXXCERTINetworkMessage --type=header --output=../libCERTI/NM_Classes.hh 3 | ./GenerateMessages.py --input=CERTI_NetworkMessage.msg --language=CXXCERTINetworkMessage --type=body --output=../libCERTI/NM_Classes.cc 4 | ./GenerateMessages.py --input=CERTI_Message.msg --language=CXXCERTIMessage --type=header --output=../libCERTI/M_Classes.hh 5 | ./GenerateMessages.py --input=CERTI_Message.msg --language=CXXCERTIMessage --type=body --output=../libCERTI/M_Classes.cc -------------------------------------------------------------------------------- /test/InteractiveFederate/1516-2000/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | 3 | all : 4 | g++ -g -o Interactive_Federate1516 Interactive_Federate1516.cc \ 5 | -L$(CERTI_HOME)/lib -lRTI1516d -lCERTId -lFedTime1516d -DRTI_USES_STD_FSTREAM \ 6 | -I$(CERTI_HOME)/include/ieee1516-2000 -I$(CERTI_HOME)/include/libhla 7 | 8 | test_map : test_map.cc 9 | g++ -g -fpermissive -o test_map test_map.cc \ 10 | -L$(CERTI_HOME)/lib -lRTI1516d -lCERTId -lFedTime1516d -DRTI_USES_STD_FSTREAM \ 11 | -I$(CERTI_HOME)/include/ieee1516-2000 -I$(CERTI_HOME)/include/libhla 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /RTIG/RTIG.ggo: -------------------------------------------------------------------------------- 1 | # This is used by gengetopt to generate RTIG command line parser 2 | # see http://www.gnu.org/software/gengetopt/gengetopt.html#Basic-Usage 3 | 4 | package "RTIG" 5 | purpose "CERTI RunTime Infrastructure Gateway (RTIG)" 6 | usage "rtig [-v 2] [-l @IP]" 7 | 8 | # gengetopt options 9 | args "-F RTIG_cmdline -G" 10 | 11 | # Options 12 | option "verbose" v "verbosity level\n 0 -> no output\n 1 -> small amount\n 2 -> show fed parse" int optional 13 | option "listen" l "listen only on specified IP address (hostname may be used as well)" string optional 14 | # -------------------------------------------------------------------------------- /libCERTI/SocketSHMSysV.hh: -------------------------------------------------------------------------------- 1 | #ifndef SOCKET_SHM_SYSV_H 2 | #define SOCKET_SHM_SYSV_H 3 | 4 | // Specifics includes 5 | #include 6 | #include 7 | #include "SocketSHM.hh" 8 | 9 | class CERTI_EXPORT SocketSHMSysV : public SocketSHM { 10 | private: 11 | public: 12 | // Constructor 13 | SocketSHMSysV(const std::string& Socket_Name, const SHM_SIDE_t& Socket_Side, const int Socket_Size); 14 | // Destructor 15 | virtual ~SocketSHMSysV(); 16 | 17 | void Open(); 18 | 19 | }; // End of --> class SocketSHM 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /scripts/testallmsg.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | rm -f test_messages/* 3 | mkdir -p test_messages 4 | ./GenerateMessages.py --input=CERTI_NetworkMessage.msg --language=CXXCERTINetworkMessage --type=header --output=test_messages//NM_Classes.hh 5 | ./GenerateMessages.py --input=CERTI_NetworkMessage.msg --language=CXXCERTINetworkMessage --type=body --output=test_messages/NM_Classes.cc 6 | ./GenerateMessages.py --input=CERTI_Message.msg --language=CXXCERTIMessage --type=header --output=test_messages/M_Classes.hh 7 | ./GenerateMessages.py --input=CERTI_Message.msg --language=CXXCERTIMessage --type=body --output=test_messages/M_Classes.cc 8 | -------------------------------------------------------------------------------- /libCERTI/SocketSHMWin32.hh: -------------------------------------------------------------------------------- 1 | #ifndef SOCKET_SHM_WIN32_H 2 | #define SOCKET_SHM_WIN32_H 3 | 4 | // Specifics includes 5 | #include 6 | #include 7 | #include "SocketSHM.hh" 8 | #include 9 | 10 | class CERTI_EXPORT SocketSHMWin32 : public SocketSHM { 11 | private: 12 | public: 13 | // Constructor 14 | SocketSHMWin32(const std::string& Socket_Name, const SocketSHM::SHM_SIDE_t& Socket_Side, const int Socket_size); 15 | // Destructor 16 | virtual ~SocketSHMWin32(); 17 | 18 | void Open() throw(certi::SocketSHMNotOpen); 19 | 20 | }; // End of --> class SocketSHM 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /libHLA/SHMPosix.hh: -------------------------------------------------------------------------------- 1 | #ifndef SHM_POSIX_H 2 | #define SHM_POSIX_H 3 | 4 | // Specifics includes 5 | #include "SHM.hh" 6 | 7 | namespace libhla { 8 | namespace ipc { 9 | 10 | class HLA_EXPORT SHMPosix : public SHM { 11 | private: 12 | int _Id; // identifiant du segment memoire affecté dans la methode : Open() 13 | 14 | public: 15 | SHMPosix(const std::string& SHMName, const int SHMSize, const bool True); 16 | SHMPosix(const std::string& SHMName, const int SHMSize); 17 | virtual ~SHMPosix(); 18 | 19 | void Open(); 20 | void Attach(); 21 | void Close(); 22 | }; 23 | } /* end namespace ipc */ 24 | } /* end namespace libhla */ 25 | #endif 26 | -------------------------------------------------------------------------------- /tests/LibCERTI/socketserver_test.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #include "../mocks/sockettcp_mock.h" 6 | 7 | using ::certi::SocketServer; 8 | 9 | TEST(SocketServer, CtorThrowsIfNullTcpSocket) 10 | { 11 | ASSERT_THROW(SocketServer(nullptr, nullptr), ::certi::RTIinternalError); 12 | } 13 | 14 | TEST(SocketServer, CtorAcceptsNullUdpSocket) 15 | { 16 | MockSocketTcp socket; 17 | 18 | SocketServer(&socket, nullptr); 19 | } 20 | 21 | // BUG Throws a network error, but not in throw list 22 | // TEST(SocketServer, Open) 23 | // { 24 | // MockSocketTcp socket; 25 | // 26 | // SocketServer s(&socket, nullptr); 27 | // } 28 | -------------------------------------------------------------------------------- /RTIA/RTIA.ggo: -------------------------------------------------------------------------------- 1 | # This is used by gengetopt to generate RTIA command line parser 2 | # see http://www.gnu.org/software/gengetopt/gengetopt.html#Basic-Usage 3 | package "RTIA" 4 | purpose "CERTI RunTime Infrastructure Ambassador (RTIA)" 5 | usage "rtia [-v] [-p ]" 6 | description "Launched by the federate in order to handle RTI<-->Federate communication" 7 | 8 | # gengetopt options 9 | args "-F RTIA_cmdline -G" 10 | 11 | # Options 12 | option "fd" f "file descriptor number to be used to communicate with FederateAmbassador" int optional 13 | option "port" p "tcp port to be used to communicate with FederateAmbassador" int optional 14 | option "verbose" v "verbose mode" short optional 15 | -------------------------------------------------------------------------------- /doc/doc_install.in: -------------------------------------------------------------------------------- 1 | MESSAGE(STATUS "Now installing Doc set <@DOCSET@> ...") 2 | SET(HTMLGEN @genhtml@) 3 | IF (HTMLGEN) 4 | MESSAGE(STATUS "Installing HTML output for Doc set <@DOCSET@>...") 5 | EXECUTE_PROCESS(COMMAND @CMAKE_COMMAND@ -E copy_directory @DoxyTools_OUTPUT_DIR@/html $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/share/doc/certi/@DOCSET@/html) 6 | ENDIF (HTMLGEN) 7 | 8 | SET(PDFGEN @genpdf@) 9 | IF (PDFGEN) 10 | MESSAGE(STATUS "Installing PDF output for Doc set <@DOCSET@>...") 11 | EXECUTE_PROCESS(COMMAND @CMAKE_COMMAND@ -E copy @DoxyTools_OUTPUT_DIR@/latex/refman.pdf $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/share/doc/certi/@DOCSET@/CERTI_@DOCSET@.pdf) 12 | ENDIF (PDFGEN) 13 | MESSAGE(STATUS "Doc set <@DOCSET@> installed.") -------------------------------------------------------------------------------- /libHLA/WinClock.cc: -------------------------------------------------------------------------------- 1 | #include "WinClock.hh" 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | namespace libhla { 8 | namespace clock { 9 | 10 | WinClock::WinClock() : Clock("WinClock") 11 | { 12 | resolution = 1.0e9 / CLOCKS_PER_SEC; 13 | } 14 | 15 | double WinClock::getResolution() 16 | { 17 | return resolution; 18 | } 19 | 20 | uint64_t WinClock::getCurrentTicksValue() 21 | { 22 | return static_cast(::clock()); 23 | } 24 | 25 | double WinClock::tick2NanoSecond(const uint64_t ticks) 26 | { 27 | return resolution * ticks; 28 | } 29 | 30 | WinClock::~WinClock() 31 | { 32 | } 33 | 34 | } /* end namespace clock */ 35 | } /* end namespace libhla */ 36 | -------------------------------------------------------------------------------- /libHLA/SHMWin32.hh: -------------------------------------------------------------------------------- 1 | #ifndef SHM_WIN32_H 2 | #define SHM_WIN32_H 3 | 4 | // Specifics includes 5 | #include "SHM.hh" 6 | 7 | namespace libhla { 8 | namespace ipc { 9 | 10 | class HLA_EXPORT SHMWin32 : public SHM { 11 | private: 12 | HANDLE _hMapFile; 13 | LPCTSTR _pBuf; 14 | 15 | public: 16 | SHMWin32(const std::string& SHMName, const int SHMSize, const bool True); 17 | SHMWin32(const std::string& SHMName, const int SHMSize); 18 | virtual ~SHMWin32(); 19 | 20 | void Open() throw(SharedMemoryNotOpen); 21 | void Attach() throw(SharedMemoryNotAttached); 22 | void Close() throw(SharedMemoryNotClosed, HandleNotClosed); 23 | }; 24 | } /* end namespace ipc */ 25 | } /* end namespace libhla */ 26 | #endif 27 | -------------------------------------------------------------------------------- /test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(libgraphc) 2 | add_subdirectory(Billard) 3 | add_subdirectory(utility) 4 | add_subdirectory(mom_explorer) 5 | add_subdirectory(ModernBillard) 6 | add_subdirectory(TimeMaster) 7 | add_subdirectory(testFederate) 8 | 9 | # Do not compile this on Win32 (not very useful) 10 | if (NOT WIN32) 11 | if (CMAKE_SYSTEM_NAME MATCHES "Linux") 12 | set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/certiCheckHostAndIP.c PROPERTIES COMPILE_DEFINITIONS "LINUX") 13 | endif() 14 | add_executable(CertiCheckHostAndIP certiCheckHostAndIP.c) 15 | install(TARGETS CertiCheckHostAndIP 16 | RUNTIME DESTINATION bin 17 | LIBRARY DESTINATION lib 18 | ARCHIVE DESTINATION lib) 19 | endif(NOT WIN32) 20 | -------------------------------------------------------------------------------- /test/ModernBillard/Base.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /test/testFederate/testFederate.ggo: -------------------------------------------------------------------------------- 1 | # This is used by gengetopt to generate testFederate command line parser 2 | # see http://www.gnu.org/software/gengetopt/gengetopt.html#Basic-Usage 3 | 4 | package "testFederate" 5 | purpose "CERTI test Federate" 6 | usage "testFederate [-v] -n name" 7 | 8 | # gengetopt options 9 | args "-F testFederate_cmdline -G" 10 | 11 | # Options 12 | option "verbose" v "verbosity level\n 0 -> no output\n 1 -> small amount\n 2 -> show fed parse" int optional 13 | option "name" n "federate name used to join the federation" string required 14 | option "federation-name" f "federation name to be joined by the federate" string optional default="testFederation" 15 | option "fom-model" - "federation object model file" string optional default="testFederation.fed" 16 | # -------------------------------------------------------------------------------- /tests/RTIG/Sample.fed: -------------------------------------------------------------------------------- 1 | ;; testFederation 2 | ;; This is a sample FOM used by CERTI as a test federation 3 | ;; This is meant to be used with testFederate 4 | (Fed 5 | (Federation testFederation) 6 | (FedVersion v1.3) 7 | (Spaces 8 | ) 9 | (Objects 10 | (Class ObjectRoot 11 | (Attribute privilegeToDelete RELIABLE TIMESTAMP) 12 | (Class RTIprivate) 13 | (Class Data 14 | (Attribute Attr1 RELIABLE TIMESTAMP) 15 | (Attribute Attr2 RELIABLE TIMESTAMP) 16 | ) 17 | ) 18 | ) 19 | 20 | (Interactions 21 | (Class InteractionRoot RELIABLE RECEIVE 22 | (Class RTIprivate RELIABLE RECEIVE) 23 | (Class Message RELIABLE TIMESTAMP 24 | (Parameter Param1) 25 | (Parameter Param2) 26 | ) 27 | ) 28 | ) 29 | ) 30 | -------------------------------------------------------------------------------- /CERTI_DESCRIPTION.txt: -------------------------------------------------------------------------------- 1 | CERTI is an efficient and Open Source HLA Runtime Infrastructure (RTI). 2 | CERTI is currently near to full HLA 1.3 compliance and looks forward to IEEE-1516. 3 | 4 | CERTI is primarily developed and maintained by the Toulouse research center of ONERA [http://www.onera.fr], the French Aerospace Labs. 5 | The primary goal of CERTI is to be used in research activities but CERTI has a growing 6 | number of users and contributors among the CERTI Open Source community. 7 | 8 | People interested in CERTI may join the CERTI Open Source 9 | community at https://savannah.nongnu.org/projects/certi. 10 | by using the mailing list 11 | http://lists.nongnu.org/mailman/listinfo/certi-devel 12 | for discussion regarding CERTI usage. 13 | 14 | There is some online documentation for CERTI at: 15 | http://www.nongnu.org/certi -------------------------------------------------------------------------------- /test/testFederate/testFederation.fed: -------------------------------------------------------------------------------- 1 | ;; testFederation 2 | ;; This is a sample FOM used by CERTI as a test federation 3 | ;; This is meant to be used with testFederate 4 | (Fed 5 | (Federation testFederation) 6 | (FedVersion v1.3) 7 | (Spaces 8 | ) 9 | (Objects 10 | (Class ObjectRoot 11 | (Attribute privilegeToDelete RELIABLE TIMESTAMP) 12 | (Class RTIprivate) 13 | (Class Data 14 | (Attribute Attr1 RELIABLE TIMESTAMP) 15 | (Attribute Attr2 RELIABLE TIMESTAMP) 16 | ) 17 | ) 18 | ) 19 | 20 | (Interactions 21 | (Class InteractionRoot RELIABLE RECEIVE 22 | (Class RTIprivate RELIABLE RECEIVE) 23 | (Class Message RELIABLE TIMESTAMP 24 | (Parameter Param1) 25 | (Parameter Param2) 26 | ) 27 | ) 28 | ) 29 | ) 30 | -------------------------------------------------------------------------------- /doc/index.html: -------------------------------------------------------------------------------- 1 |

CERTI Available documentation set

2 |

Note that you may have only a part of this set installed

3 | 16 | 17 | -------------------------------------------------------------------------------- /test/Billard/Test.fed: -------------------------------------------------------------------------------- 1 | ;; Billard 2 | 3 | (Fed 4 | (Federation Test) 5 | (FedVersion v1.3) 6 | (Federate "fed" "Public") 7 | (Spaces 8 | (Space "Geo" 9 | (Dimension X) 10 | (Dimension Y) 11 | ) 12 | ) 13 | (Objects 14 | (Class ObjectRoot 15 | (Attribute privilegeToDelete reliable timestamp) 16 | (Class RTIprivate) 17 | (Class Bille 18 | (Attribute PositionX RELIABLE TIMESTAMP) 19 | (Attribute PositionY RELIABLE TIMESTAMP) 20 | (Class Boule 21 | (Attribute Color RELIABLE TIMESTAMP) 22 | ) 23 | ) 24 | ) 25 | ) 26 | (Interactions 27 | (Class InteractionRoot BEST_EFFORT RECEIVE 28 | (Class RTIprivate BEST_EFFORT RECEIVE) 29 | (Class Bing RELIABLE TIMESTAMP 30 | (Sec_Level "Public") 31 | (Parameter BoulNum) 32 | (Parameter DX) 33 | (Parameter DY) 34 | ) 35 | ) 36 | ) 37 | ) 38 | -------------------------------------------------------------------------------- /test/libgraphc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # FIXME I do not remember why this should be static? 2 | # on non WINDOWS platform 3 | set(BESTATIC "STATIC") 4 | if (WIN32 AND MINGW) 5 | set(BESTATIC "STATIC") 6 | endif(WIN32 AND MINGW) 7 | 8 | add_library(graph-nogui ${BESTATIC} graph_c.cc) 9 | set_target_properties(graph-nogui PROPERTIES COMPILE_FLAGS "-DX_DISPLAY_MISSING=1") 10 | 11 | 12 | install(TARGETS graph-nogui 13 | RUNTIME DESTINATION bin 14 | LIBRARY DESTINATION lib 15 | ARCHIVE DESTINATION lib) 16 | 17 | if (NOT X_DISPLAY_MISSING) 18 | include_directories(${X11_INCLUDE_DIR}) 19 | add_library(graph ${BESTATIC} graph_c.cc) 20 | target_link_libraries(graph ${X11_LIBRARIES}) 21 | 22 | install(TARGETS graph 23 | RUNTIME DESTINATION bin 24 | LIBRARY DESTINATION lib 25 | ARCHIVE DESTINATION lib) 26 | endif(NOT X_DISPLAY_MISSING) 27 | -------------------------------------------------------------------------------- /test/utility/T2010VerySmallO.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | HLAobjectRoot 6 | 7 | Customer 8 | PublishSubscribe 9 | Statement of money owed by the customer 10 | 11 | 12 | Employee 13 | 14 | PayRate 15 | PublishSubscribe 16 | HLAreliable 17 | TimeStamp 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /tests/LibCERTI/networkmessage_test.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "libCERTI/NetworkMessage.hh" 4 | 5 | #include 6 | 7 | using ::certi::NetworkMessage; 8 | 9 | TEST(NetworkMessageTest, CopyCtorExistsAndWorks) 10 | { 11 | NetworkMessage msg; 12 | msg.setFederate(1); 13 | msg.setFederation(3); 14 | 15 | NetworkMessage msg2 = msg; 16 | 17 | ASSERT_EQ(msg.getFederate(), msg2.getFederate()); 18 | ASSERT_EQ(msg.getFederation(), msg2.getFederation()); 19 | } 20 | 21 | TEST(NetworkMessageTest, CopyCtorInUniquePtrExistsAndWorks) 22 | { 23 | NetworkMessage msg; 24 | msg.setFederate(1); 25 | msg.setFederation(3); 26 | 27 | auto msg2 = make_unique(msg); 28 | 29 | ASSERT_EQ(msg.getFederate(), msg2->getFederate()); 30 | ASSERT_EQ(msg.getFederation(), msg2->getFederation()); 31 | } 32 | -------------------------------------------------------------------------------- /libHLA/PosixClock.cc: -------------------------------------------------------------------------------- 1 | #include "PosixClock.hh" 2 | 3 | #include "libhla.hh" 4 | 5 | namespace libhla { 6 | namespace clock { 7 | 8 | PosixClock::PosixClock(clockid_t newClockId) : Clock("PosixClock") 9 | { 10 | clockId = newClockId; 11 | clock_getres(newClockId, &resolution); 12 | } 13 | 14 | double PosixClock::getResolution() 15 | { 16 | return resolution.tv_sec * 1e9 + resolution.tv_nsec; 17 | } 18 | 19 | uint64_t PosixClock::getCurrentTicksValue() 20 | { 21 | struct timespec current; 22 | /* convert struct timespec to number of nano-second */ 23 | clock_gettime(clockId, ¤t); 24 | return current.tv_sec * 1000000000 + current.tv_nsec; 25 | } 26 | 27 | double PosixClock::tick2NanoSecond(const uint64_t ticks) 28 | { 29 | return ticks; 30 | } 31 | 32 | PosixClock::~PosixClock() 33 | { 34 | } 35 | 36 | } /* end namespace clock */ 37 | } /* end namespace libhla */ 38 | -------------------------------------------------------------------------------- /libHLA/WinPerfClock.cc: -------------------------------------------------------------------------------- 1 | #include "WinPerfClock.hh" 2 | #include 3 | 4 | namespace libhla { 5 | namespace clock { 6 | 7 | WinPerfClock::WinPerfClock() : Clock("WinPerfClock") 8 | { 9 | LARGE_INTEGER freq; 10 | if (QueryPerformanceFrequency(&freq)) { 11 | resolution = 1.0e9 / static_cast(freq.QuadPart); 12 | } 13 | else 14 | resolution = 0.0; 15 | } 16 | 17 | double WinPerfClock::getResolution() 18 | { 19 | return resolution; 20 | } 21 | 22 | uint64_t WinPerfClock::getCurrentTicksValue() 23 | { 24 | LARGE_INTEGER tick; 25 | QueryPerformanceCounter(&tick); 26 | return static_cast(tick.QuadPart); 27 | } 28 | 29 | double WinPerfClock::tick2NanoSecond(const uint64_t ticks) 30 | { 31 | return resolution * ticks; 32 | } 33 | 34 | WinPerfClock::~WinPerfClock() 35 | { 36 | } 37 | } /* end namespace clock */ 38 | } /* end namespace libhla */ 39 | -------------------------------------------------------------------------------- /tests/fakes/socketserver_fake.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class FakeSocketServer : public ::certi::SocketServer { 6 | using SocketServer::SocketServer; 7 | 8 | virtual ::certi::Socket* getSocketLink(::certi::FederationHandle /*the_federation*/, 9 | ::certi::FederateHandle /*the_federate*/, 10 | ::certi::TransportType /*the_type*/ = ::certi::RELIABLE) const override 11 | { 12 | return nullptr; 13 | } 14 | 15 | virtual void setReferences(long /*the_socket*/, 16 | ::certi::FederationHandle /*federation_reference*/, 17 | ::certi::FederateHandle /*federate_reference*/, 18 | unsigned long /*the_address*/, 19 | unsigned int /*the_port*/) override 20 | { 21 | } 22 | }; 23 | -------------------------------------------------------------------------------- /scripts/package_source_dated.cmake: -------------------------------------------------------------------------------- 1 | 2 | MESSAGE(STATUS "Package Backup running...") 3 | INCLUDE(CPackSourceConfig.cmake) 4 | MESSAGE(STATUS "Package Backup gets date...") 5 | # get the date 6 | EXECUTE_PROCESS(COMMAND date +%d%b%Y-%Hh%M 7 | TIMEOUT 5 8 | RESULT_VARIABLE DATE_RES 9 | OUTPUT_VARIABLE DATE_OUT 10 | ERROR_VARIABLE DATE_ERR 11 | OUTPUT_STRIP_TRAILING_WHITESPACE) 12 | # run cpack 13 | MESSAGE(STATUS "Package Backup running cpack...") 14 | EXECUTE_PROCESS(COMMAND cpack -G TGZ --config CPackSourceConfig.cmake 15 | TIMEOUT 3600 16 | WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) 17 | MESSAGE("Copy ${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.gz --> ${CPACK_SOURCE_PACKAGE_FILE_NAME}-${DATE_OUT}.tar.gz") 18 | EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy ${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.gz ${CPACK_SOURCE_PACKAGE_FILE_NAME}-${DATE_OUT}.tar.gz) 19 | MESSAGE(STATUS "Package backup done in: ${CPACK_SOURCE_PACKAGE_FILE_NAME}-${DATE_OUT}.tar.gz") 20 | -------------------------------------------------------------------------------- /libHLA/MurmurHash3.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // MurmurHash3 was written by Austin Appleby, and is placed in the public 3 | // domain. The author hereby disclaims copyright to this source code. 4 | 5 | #ifndef _MURMURHASH3_H_ 6 | #define _MURMURHASH3_H_ 7 | 8 | //----------------------------------------------------------------------------- 9 | 10 | #include "libhla.hh" 11 | 12 | namespace libhla { 13 | namespace hash { 14 | 15 | HLA_EXPORT void MurmurHash3_x86_32(const void* key, int len, uint32_t seed, void* out); 16 | 17 | HLA_EXPORT void MurmurHash3_x86_128(const void* key, int len, uint32_t seed, void* out); 18 | 19 | HLA_EXPORT void MurmurHash3_x64_128(const void* key, int len, uint32_t seed, void* out); 20 | 21 | } /* end of namespace hash */ 22 | } /* end of namespace libhla */ 23 | //----------------------------------------------------------------------------- 24 | 25 | #endif // _MURMURHASH3_H_ 26 | -------------------------------------------------------------------------------- /scripts/TestMessageSpec.msg: -------------------------------------------------------------------------------- 1 | // 2 | // CERTI message description spec test file 3 | // 4 | package my.hierarchy.pack 5 | 6 | // 7 | // This is a multiline 8 | // comment which may contains markup 9 | // @desc here comes the EType 10 | // 11 | enum EType { 12 | FIRST_VAL = 0, // one may specify the value of the first enum symbol 13 | REAL_VAL1 , //! the real value 1 14 | REAL_VAL2 , 15 | UNUSED 16 | } 17 | 18 | message MyMessage {} 19 | 20 | // blah 21 | native ANativeType { 22 | language CXX [typedef int ANativeType] 23 | } 24 | 25 | native AnotherNativeType { 26 | language CXX [#include "AnotherNativeType.hh"] 27 | } 28 | 29 | native MessageType2 { 30 | language CXX [] 31 | } 32 | 33 | message MyMessage2 { 34 | repeated int32 whatever 35 | } 36 | 37 | message MyOtherMessage : merge MyMessage { 38 | required bool constrained // constrain 39 | optional MessageType2 mytype 40 | required uint32 a { default=1 } 41 | } 42 | -------------------------------------------------------------------------------- /CERTIConfig.cmake.in: -------------------------------------------------------------------------------- 1 | # - Config file for the CERTI package 2 | # It defines the following variables 3 | # CERTI_INCLUDE_DIRS - include directories for CERTI 4 | # CERTI_LIBRARIES - libraries to link against 5 | # CERTI_RTIA_EXECUTABLE - the converter executable 6 | # CERTI_RTIG_EXECUTABLE - the tracer executable 7 | 8 | # Compute paths 9 | get_filename_component(CERTI_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) 10 | if(EXISTS "${CERTI_CMAKE_DIR}/CMakeCache.txt") 11 | # In build tree 12 | include("${CERTI_CMAKE_DIR}/CERTIBuildTreeSettings.cmake") 13 | else() 14 | set(CERTI_INCLUDE_DIRS "${CERTI_CMAKE_DIR}/@CONF_REL_INCLUDE_DIR@") 15 | endif() 16 | 17 | # Our library dependencies (contains definitions for IMPORTED targets) 18 | include("${CERTI_CMAKE_DIR}/CERTIDepends.cmake") 19 | 20 | # These are IMPORTED targets created by CERTIDepends.cmake 21 | set(CERTI_LIBRARIES CERTI RTI HLA) 22 | set(CERTI_RTIA_EXECUTABLE rtia) 23 | set(CERTI_RTIG_EXECUTABLE rtig) 24 | -------------------------------------------------------------------------------- /libHLA/SemaphoreWin32.hh: -------------------------------------------------------------------------------- 1 | #ifndef SEMAPHOREWIN32_H 2 | #define SEMAPHOREWIN32_H 3 | 4 | // Semaphores usefull systems includes 5 | #include 6 | #include 7 | #include 8 | 9 | // Others systems includes 10 | #include 11 | #include 12 | #include 13 | 14 | // Specifics includes 15 | #include "Semaphore.hh" 16 | 17 | namespace libhla { 18 | namespace ipc { 19 | 20 | class HLA_EXPORT SemaphoreWin32 : public Semaphore { 21 | private: 22 | HANDLE _hSemaphore; 23 | 24 | public: 25 | SemaphoreWin32(); 26 | virtual ~SemaphoreWin32(); 27 | void Create_Init(const int initval, const std::string& New_Semname) throw(SemaphoreNotCreated); 28 | void Attach(const std::string& New_Semname) throw(SemaphoreNotOpen); 29 | void P() throw(SemaphoreHandlingError); 30 | void V() throw(SemaphoreHandlingError); 31 | void Delete() throw(HandleNotClosed); 32 | }; 33 | } /* end namespace ipc */ 34 | } /* end namespace libhla */ 35 | #endif 36 | -------------------------------------------------------------------------------- /test/mom_explorer/cli.h: -------------------------------------------------------------------------------- 1 | #ifndef CLI_H 2 | #define CLI_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | class cli { 9 | public: 10 | cli(); 11 | 12 | void execute() const; 13 | 14 | static std::string requestArgument(const std::string& arg_name); 15 | 16 | static std::vector generateAliases(const std::string& command); 17 | 18 | protected: 19 | void registerCommand(const std::string& identifier, std::function callback); 20 | 21 | void registerAliasedCommand(std::vector identifiers, std::function callback); 22 | void registerSimpleCommand(const std::string& identifier, std::function callback); 23 | void registerAlias(const std::string& identifier, const std::string& alias); 24 | 25 | private: 26 | void help() const; 27 | 28 | std::map> my_commands; 29 | std::map my_aliases; 30 | }; 31 | 32 | #endif // CLI_H 33 | -------------------------------------------------------------------------------- /libHLA/SemaphorePosix.hh: -------------------------------------------------------------------------------- 1 | #ifndef SEMAPHORE_POSIX_H 2 | #define SEMAPHORE_POSIX_H 3 | 4 | // Others Systems includes 5 | #include 6 | // Mac OS doesn't have this header glib specific 7 | // see https://savannah.nongnu.org/bugs/?53592 8 | #ifndef __APPLE__ 9 | #include 10 | #endif 11 | 12 | #include "libhla.hh" 13 | 14 | // Specifics includes 15 | #include "Semaphore.hh" 16 | #ifndef _POSIX_C_SOURCE 17 | #define _POSIX_C_SOURCE 200112L 18 | #endif 19 | #include 20 | 21 | namespace libhla { 22 | namespace ipc { 23 | 24 | class HLA_EXPORT SemaphorePosix : public Semaphore { 25 | private: 26 | std::string _Semname; 27 | sem_t* _Sem; 28 | 29 | public: 30 | SemaphorePosix(); 31 | virtual ~SemaphorePosix(); 32 | void Create_Init(const int initval, const std::string& New_Semname); 33 | void Attach(const std::string& New_Semname); 34 | void P(); 35 | void V(); 36 | void Delete(); 37 | }; 38 | } /* end namespace ipc */ 39 | } /* end namespace libhla */ 40 | #endif 41 | -------------------------------------------------------------------------------- /cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 2 | MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") 3 | ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 4 | 5 | FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) 6 | STRING(REGEX REPLACE "\n" ";" files "${files}") 7 | FOREACH(file ${files}) 8 | MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") 9 | IF(EXISTS "$ENV{DESTDIR}${file}") 10 | EXEC_PROGRAM( 11 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 12 | OUTPUT_VARIABLE rm_out 13 | RETURN_VALUE rm_retval 14 | ) 15 | IF("${rm_retval}" STREQUAL 0) 16 | ELSE("${rm_retval}" STREQUAL 0) 17 | MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") 18 | ENDIF("${rm_retval}" STREQUAL 0) 19 | ELSE(EXISTS "$ENV{DESTDIR}${file}") 20 | MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") 21 | ENDIF(EXISTS "$ENV{DESTDIR}${file}") 22 | ENDFOREACH(file) -------------------------------------------------------------------------------- /libHLA/WinClock.hh: -------------------------------------------------------------------------------- 1 | #ifndef WinClock_HH_ 2 | #define WinClock_HH_ 3 | 4 | #include "Clock.hh" 5 | 6 | namespace libhla { 7 | namespace clock { 8 | /** 9 | */ 10 | class HLA_EXPORT WinClock : public Clock { 11 | public: 12 | WinClock(); 13 | /** 14 | * Get the clock resolution in nano-seconds. 15 | * @return the clock resolution in nano-seconds 16 | */ 17 | virtual double getResolution(); 18 | /** 19 | * Get the current ticks value. 20 | * @return the current ticks value 21 | */ 22 | virtual uint64_t getCurrentTicksValue(); 23 | /** 24 | * Convert a number of ticks into a double value 25 | * representing nanoseconds. 26 | * @param[in] ticks the number of tick to convert 27 | * @return the nano-seconds value 28 | */ 29 | virtual double tick2NanoSecond(const uint64_t ticks); 30 | virtual ~WinClock(); 31 | 32 | private: 33 | /** 34 | * The WinClock resolution in nano-seconds 35 | */ 36 | double resolution; 37 | }; 38 | } /* end namespace clock */ 39 | } /* end namespace libhla */ 40 | #endif /*WinClock_HH_*/ 41 | -------------------------------------------------------------------------------- /include/ieee1516-2000/RTI/RTIambassadorFactory.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | IEEE 1516.1 High Level Architecture Interface Specification C++ API 3 | File: RTI/RTIambassadorFactory.h 4 | ***********************************************************************/ 5 | 6 | #ifndef RTI_RTIambassadorFactory_h 7 | #define RTI_RTIambassadorFactory_h 8 | 9 | namespace rti1516 10 | { 11 | class RTIambassador; 12 | } 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | namespace rti1516 21 | { 22 | class RTI_EXPORT RTIambassadorFactory 23 | { 24 | public: 25 | RTIambassadorFactory(); 26 | 27 | virtual 28 | ~RTIambassadorFactory() 29 | throw (); 30 | 31 | // 10.35 32 | std::auto_ptr< RTIambassador > 33 | createRTIambassador(std::vector< std::wstring > & args) 34 | throw (BadInitializationParameter, 35 | RTIinternalError); 36 | }; 37 | } 38 | 39 | #endif // RTI_RTIambassadorFactory_h 40 | -------------------------------------------------------------------------------- /libHLA/WinPerfClock.hh: -------------------------------------------------------------------------------- 1 | #ifndef WinPerfClock_HH_ 2 | #define WinPerfClock_HH_ 3 | 4 | #include "Clock.hh" 5 | 6 | namespace libhla { 7 | namespace clock { 8 | 9 | /** 10 | */ 11 | class HLA_EXPORT WinPerfClock : public Clock { 12 | public: 13 | WinPerfClock(); 14 | /** 15 | * Get the clock resolution in nano-seconds. 16 | * @return the clock resolution in nano-seconds 17 | */ 18 | virtual double getResolution(); 19 | /** 20 | * Get the current ticks value. 21 | * @return the current ticks value 22 | */ 23 | virtual uint64_t getCurrentTicksValue(); 24 | /** 25 | * Convert a number of ticks into a double value 26 | * representing nanoseconds. 27 | * @param[in] ticks the number of tick to convert 28 | * @return the nano-seconds value 29 | */ 30 | virtual double tick2NanoSecond(const uint64_t ticks); 31 | virtual ~WinPerfClock(); 32 | 33 | private: 34 | /** 35 | * The WinPerfClock resolution in nano-seconds 36 | */ 37 | double resolution; 38 | }; 39 | 40 | } /* end namespace clock */ 41 | } /* end namespace libhla */ 42 | #endif /*WinPerfClock_HH_*/ 43 | -------------------------------------------------------------------------------- /test/InteractiveFederate/README: -------------------------------------------------------------------------------- 1 | Summary 2 | The InteractiveFederation is composed of a various number of interactive federates. 3 | These federates can use the 1.3 or IEEE 1516-2000 or IEEE 1516-2010 standard. 4 | Each federate has a loop around an interactive menu that allows the user 5 | to call the main HLA services, to test ou to understand them. 6 | Type h for help. 7 | The user can do mistakes, the exceptions are catched. 8 | This code can be read do see how each call is done in C++. 9 | An (optional) automatic preamble corresponds to a suite of calls for the 10 | initialization phase of the federate. 11 | 12 | To develop the federate : 13 | - choose a subdirectory 14 | - set up the CERTI environment 15 | - make 16 | The makefile is deliberately very simple (one target and four lines). 17 | (And source directory = install directory = execution directory) 18 | 19 | To execute the federation 20 | In different terminals, with the CERTI environment and the good working directory: 21 | rtig 22 | ./InteractiveFederate one 23 | ./InteractiveFederate two 24 | ... 25 | 26 | To do: 27 | to use all the HLA services 28 | 29 | -------------------------------------------------------------------------------- /libHLA/TSCClock.cc: -------------------------------------------------------------------------------- 1 | #include "TSCClock.hh" 2 | #include 3 | #include 4 | #include 5 | 6 | namespace libhla { 7 | namespace clock { 8 | 9 | TSCClock::TSCClock() : Clock("TSCClock") 10 | { 11 | resolution = 1.0e3 / getProcessorFrequency(); 12 | } 13 | 14 | double TSCClock::getResolution() 15 | { 16 | return resolution; 17 | } 18 | 19 | uint64_t TSCClock::getCurrentTicksValue() 20 | { 21 | return readTSC(); 22 | } 23 | 24 | double TSCClock::tick2NanoSecond(const uint64_t ticks) 25 | { 26 | return resolution * ticks; 27 | } 28 | 29 | TSCClock::~TSCClock() 30 | { 31 | } 32 | 33 | double TSCClock::getProcessorFrequency() 34 | { 35 | FILE* fdcpu; 36 | char left[256], right[256]; 37 | double freq = -1.0; 38 | 39 | fdcpu = fopen("/proc/cpuinfo", "r"); 40 | 41 | while (EOF != fscanf(fdcpu, "%s : %s \n", left, right)) { 42 | if (strstr(left, "MHz")) { 43 | freq = atof(right); 44 | break; 45 | } 46 | } 47 | fclose(fdcpu); 48 | return freq; 49 | } 50 | 51 | } /* end namespace clock */ 52 | } /* end namespace libhla */ 53 | -------------------------------------------------------------------------------- /test/TimeMaster/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(BEFORE 2 | ${CMAKE_SOURCE_DIR}/libCERTI 3 | ${CMAKE_SOURCE_DIR}/include/ 4 | ${CMAKE_SOURCE_DIR}/include/ieee1516-2010 5 | ${CMAKE_BINARY_DIR}/include/ieee1516-2010) 6 | include_directories(${CERTI_SOURCE_DIR}/libHLA) 7 | 8 | if (WIN32) 9 | add_definitions(-DHAVE_STRING_H) 10 | endif (WIN32) 11 | 12 | ########### next target ############### 13 | 14 | if(COMPILE_WITH_CXX11) 15 | if (CMAKE_VERSION VERSION_LESS 3.1.3) 16 | include(CheckCXXCompilerFlag) 17 | check_cxx_compiler_flag(-std=c++14 HAVE_FLAG_STD_CXX14) 18 | if(HAVE_FLAG_STD_CXX14) 19 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") 20 | else() 21 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y") 22 | endif() 23 | else() 24 | set_property(TARGET time_master PROPERTY CXX_STANDARD 14) 25 | endif() 26 | endif() 27 | 28 | add_executable(time_master main.cc) 29 | target_link_libraries(time_master RTI1516e FedTime1516e) 30 | 31 | install(TARGETS time_master 32 | RUNTIME DESTINATION bin 33 | LIBRARY DESTINATION lib 34 | ARCHIVE DESTINATION lib) 35 | -------------------------------------------------------------------------------- /test/Billard/Billard.ggo: -------------------------------------------------------------------------------- 1 | # This is used by gengetopt to generate Billard command line parser 2 | # see http://www.gnu.org/software/gengetopt/gengetopt.html#Basic-Usage 3 | 4 | package "billard" 5 | purpose "CERTI Billard test application" 6 | 7 | # gengetopt options 8 | args "-F Billard_cmdline -G" 9 | 10 | # Options 11 | option "auto" a "auto start" int no 12 | option "coordinated" c "coordinated time" flag on 13 | option "delay" d "delay before 1st step" int no 14 | option "notimestamp" e "no timestamp" flag off 15 | option "federation" f "federation name" string yes 16 | option "logfile" l "file to log events" string no 17 | option "name" n "federate name" string yes 18 | option "demo" o "select demo (static-ddm, dynamic-ddm)" string no 19 | option "timer" t "timer" int no 20 | option "verbose" v "verbose mode" flag off 21 | option "xoffset" x "X offset (X11)" int no 22 | option "yoffset" y "Y offset (X11)" int no 23 | option "initx" X "ball initial X value" int no 24 | option "inity" Y "ball initial Y value" int no 25 | option "filename" F "FED filename" string yes 26 | -------------------------------------------------------------------------------- /libHLA/Semaphore.hh: -------------------------------------------------------------------------------- 1 | #ifndef SEMAPHORE_H 2 | #define SEMAPHORE_H 3 | 4 | // Systems includes 5 | #include "libhla.hh" 6 | #include 7 | 8 | namespace libhla { 9 | namespace ipc { 10 | 11 | class HLA_EXPORT Semaphore { 12 | public: 13 | // Semaphore() ; 14 | virtual ~Semaphore(){}; 15 | virtual void Create_Init(const int initval, const std::string& New_Semname) = 0; 16 | virtual void Attach(const std::string& New_Semname) = 0; 17 | virtual void P() = 0; 18 | virtual void V() = 0; 19 | virtual void Delete() = 0; 20 | 21 | LIBHLA_EXCEPTION(SemaphoreNotCreated) 22 | LIBHLA_EXCEPTION(SemaphoreNotOpen) 23 | LIBHLA_EXCEPTION(SemaphoreHandlingError) 24 | LIBHLA_EXCEPTION(HandleNotClosed) 25 | 26 | /** 27 | * Build a proper Semaphore name from a user provided name. 28 | * Idea kindly borrowed from TSP (https://savannah.nongnu.org) 29 | * bb_utils_build_sem_name 30 | */ 31 | static std::string buildSemName(const std::string& SemName) 32 | { 33 | return "/" + SemName + "_sem"; 34 | } 35 | 36 | protected: 37 | }; 38 | } /* end namespace ipc */ 39 | } /* end namespace libhla */ 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /scripts/call_Uncrustify.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ ! -n "$1" ]; then 4 | echo "Syntax is: recurse.sh dirname filesuffix" 5 | echo "Syntax is: recurse.sh filename" 6 | echo "Example: recurse.sh temp cpp" 7 | exit 1 8 | fi 9 | 10 | if [ -d "$1" ]; then 11 | #echo "Dir ${1} exists" 12 | if [ -n "$2" ]; then 13 | filesuffix=$2 14 | else 15 | filesuffix="*" 16 | fi 17 | 18 | #echo "Filtering files using suffix ${filesuffix}" 19 | 20 | file_list=`find ${1} -name "*.${filesuffix}" -type f` 21 | for file2indent in $file_list 22 | do 23 | echo "Indenting file $file2indent" 24 | #!/bin/bash 25 | uncrustify -f "$file2indent" -c "./call_Uncrustify.cfg" -o indentoutput.tmp 26 | mv indentoutput.tmp "$file2indent" 27 | 28 | done 29 | else 30 | if [ -f "$1" ]; then 31 | echo "Indenting one file $1" 32 | #!/bin/bash 33 | uncrustify -f "$1" -c "./call_Uncrustify.cfg" -o indentoutput.tmp 34 | mv indentoutput.tmp "$1" 35 | 36 | else 37 | echo "ERROR: As parameter given directory or file does not exist!" 38 | echo "Syntax is: call_Uncrustify.sh dirname filesuffix" 39 | echo "Syntax is: call_Uncrustify.sh filename" 40 | echo "Example: call_Uncrustify.sh temp cpp" 41 | exit 1 42 | fi 43 | fi 44 | -------------------------------------------------------------------------------- /include/ieee1516-2000/RTI/RangeBounds.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | IEEE 1516.1 High Level Architecture Interface Specification C++ API 3 | File: RTI/RangeBounds.h 4 | ***********************************************************************/ 5 | 6 | #ifndef RTI_RangeBounds_h 7 | #define RTI_RangeBounds_h 8 | 9 | #include 10 | 11 | namespace rti1516 12 | { 13 | class RTI_EXPORT RangeBounds 14 | { 15 | public: 16 | RangeBounds(); 17 | 18 | RangeBounds(unsigned long lowerBound, 19 | unsigned long upperBound); 20 | 21 | ~RangeBounds() 22 | throw (); 23 | 24 | RangeBounds(RangeBounds const & rhs); 25 | 26 | RangeBounds & 27 | operator=(RangeBounds const & rhs); 28 | 29 | unsigned long 30 | getLowerBound() const; 31 | 32 | unsigned long 33 | getUpperBound() const; 34 | 35 | void 36 | setLowerBound(unsigned long lowerBound); 37 | 38 | void 39 | setUpperBound(unsigned long upperBound); 40 | 41 | private: 42 | unsigned long _lowerBound; 43 | unsigned long _upperBound; 44 | }; 45 | } 46 | 47 | #endif // RTI_RangeBounds_h 48 | -------------------------------------------------------------------------------- /COPYING.txt: -------------------------------------------------------------------------------- 1 | 2 | CERTI is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU General Public License as published by the Free 4 | Software Foundation; either version 2 of the License, or (at your 5 | option) any later version. 6 | 7 | This program is distributed in the hope that it will be useful, but 8 | WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 10 | General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program, in the file "gpl.txt"; if not, write to the 14 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 15 | 02111-1307 USA 16 | 17 | All the library components (e.g. libRTI, libCERTI, libHLA...) 18 | components are licensed under the GNU Lesser General Public License. 19 | This is a GPL-compatible license (this 20 | is why CERTI can be considered as GPL software). You should have 21 | received a copy of the GNU LGPL with this program, in the file 22 | "lesser.txt". 23 | 24 | In the "test" directory, the "Billard" application is GPL, and uses an 25 | LGPL graphics library called "libgraphc". 26 | -------------------------------------------------------------------------------- /tests/LibHLA/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | enable_testing() 2 | 3 | include_directories(${CERTI_SOURCE_DIR}) # include root to enable syntax #include 4 | include_directories(${CERTI_BINARY_DIR}) 5 | 6 | find_package(Threads REQUIRED) 7 | 8 | add_executable(TestHLA 9 | clock_test.cpp 10 | hlatypes_test.cpp 11 | messagebuffer_test.cpp 12 | msgbuffer_test.cpp 13 | ../main.cpp 14 | ) 15 | 16 | target_link_libraries(TestHLA 17 | HLA 18 | ${GTEST_BOTH_LIBRARIES} 19 | ${CMAKE_THREAD_LIBS_INIT} 20 | ) 21 | 22 | target_compile_definitions(TestHLA PRIVATE CERTI_TEST) 23 | 24 | if (COMPILE_WITH_COVERAGE) 25 | SETUP_TARGET_FOR_COVERAGE( 26 | NAME TestHLA_coverage 27 | EXECUTABLE TestHLA --gtest_output=xml:../output/results-TestHLA.xml 28 | DEPENDENCIES TestHLA 29 | ) 30 | 31 | SETUP_TARGET_FOR_COVERAGE_COBERTURA( 32 | NAME TestHLA_cobertura 33 | EXECUTABLE TestHLA --gtest_output=xml:../output/results-TestHLA.xml 34 | DEPENDENCIES TestHLA 35 | ) 36 | endif() 37 | 38 | add_test(AllTests TestHLA) 39 | -------------------------------------------------------------------------------- /libHLA/MurmurHash2.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // MurmurHash2 was written by Austin Appleby, and is placed in the public 3 | // domain. The author hereby disclaims copyright to this source code. 4 | 5 | #ifndef _MURMURHASH2_H_ 6 | #define _MURMURHASH2_H_ 7 | 8 | //----------------------------------------------------------------------------- 9 | 10 | #include "libhla.hh" 11 | 12 | namespace libhla { 13 | namespace hash { 14 | //----------------------------------------------------------------------------- 15 | 16 | HLA_EXPORT uint32_t MurmurHash2(const void* key, int len, uint32_t seed); 17 | HLA_EXPORT uint64_t MurmurHash64A(const void* key, int len, uint64_t seed); 18 | HLA_EXPORT uint64_t MurmurHash64B(const void* key, int len, uint64_t seed); 19 | HLA_EXPORT uint32_t MurmurHash2A(const void* key, int len, uint32_t seed); 20 | HLA_EXPORT uint32_t MurmurHashNeutral2(const void* key, int len, uint32_t seed); 21 | HLA_EXPORT uint32_t MurmurHashAligned2(const void* key, int len, uint32_t seed); 22 | 23 | //----------------------------------------------------------------------------- 24 | 25 | } /* end of namespace hash */ 26 | } /* end of namespace libhla */ 27 | 28 | #endif // _MURMURHASH2_H_ 29 | -------------------------------------------------------------------------------- /test/mom_explorer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(BEFORE 2 | ${CMAKE_SOURCE_DIR}/libCERTI 3 | ${CMAKE_SOURCE_DIR}/include/ 4 | ${CMAKE_SOURCE_DIR}/include/ieee1516-2010 5 | ${CMAKE_BINARY_DIR}/include/ieee1516-2010) 6 | include_directories(${CERTI_SOURCE_DIR}/libHLA) 7 | 8 | if (WIN32) 9 | add_definitions(-DHAVE_STRING_H) 10 | endif (WIN32) 11 | 12 | ########### next target ############### 13 | 14 | set(mom_explorer_SRCS 15 | main.cc 16 | momfederateambassador.cc 17 | cli.cc 18 | momcli.cpp 19 | ) 20 | 21 | if(COMPILE_WITH_CXX11) 22 | if (CMAKE_VERSION VERSION_LESS 3.1.3) 23 | include(CheckCXXCompilerFlag) 24 | check_cxx_compiler_flag(-std=c++14 HAVE_FLAG_STD_CXX14) 25 | if(HAVE_FLAG_STD_CXX14) 26 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") 27 | else() 28 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y") 29 | endif() 30 | else() 31 | set_property(TARGET mom_explorer PROPERTY CXX_STANDARD 14) 32 | endif() 33 | endif() 34 | 35 | add_executable(mom_explorer ${mom_explorer_SRCS}) 36 | target_link_libraries(mom_explorer RTI1516e FedTime1516e) 37 | 38 | install(TARGETS mom_explorer 39 | RUNTIME DESTINATION bin 40 | LIBRARY DESTINATION lib 41 | ARCHIVE DESTINATION lib) 42 | 43 | -------------------------------------------------------------------------------- /scripts/CreatePatchCVS.cmake: -------------------------------------------------------------------------------- 1 | # This CMake script may be used 2 | # with a command line like 3 | # cmake -DWDIR:PATH= -DODIR:PATH= -P CreatePatchCVS.cmake 4 | # 5 | # The script will 6 | # 1) find an appropriate cvs command. 7 | # 2) create a unified diff from CVS diff command 8 | # rooted at WDIR and put the resulting diff 9 | # in ODIR/patch.diff 10 | FIND_PROGRAM(CVS_COMMAND 11 | NAMES cvs 12 | DOC "The command line cvs command") 13 | 14 | # TODO: -kk doesn't work, googling only reports a few unsolved problem reports. 15 | SET(CVS_DIFF_ARGS "-uN") 16 | MESSAGE(STATUS "CVS Patch:: Generating patch using CVS...") 17 | MESSAGE(STATUS "CVS Patch:: Using command : ${CVS_COMMAND} diff ${CVS_DIFF_ARGS}") 18 | MESSAGE(STATUS "CVS Patch:: Rooted at Workdir : ${WDIR}") 19 | EXECUTE_PROCESS(COMMAND ${CVS_COMMAND} diff ${CVS_DIFF_ARGS} 20 | OUTPUT_FILE ${ODIR}/patch.diff 21 | RESULT_VARIABLE PATCHOK 22 | WORKING_DIRECTORY ${WDIR} 23 | ERROR_QUIET) 24 | IF(PATCHOK) 25 | MESSAGE(STATUS "CVS Patch:: Patch file is : ${ODIR}/patch.diff") 26 | ELSE(PATCHOK) 27 | MESSAGE(STATUS "Probably void patch content or diff failed: NO PATCH.") 28 | ENDIF(PATCHOK) 29 | -------------------------------------------------------------------------------- /scripts/UseCERTI.cmake: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # CMake include file CERTI usage helper 4 | # 5 | ################ Socket library Check #################### 6 | ENABLE_LANGUAGE(C) 7 | # Load Checker macros 8 | INCLUDE(CheckFunctionExists) 9 | INCLUDE(CheckLibraryExists) 10 | CHECK_LIBRARY_EXISTS("socket" "connect" "/usr/lib" SOCKET_LIBRARY_HAS_CONNECT) 11 | IF (SOCKET_LIBRARY_HAS_CONNECT) 12 | MESSAGE(STATUS "Socket library needed for system ${CMAKE_SYSTEM_NAME}") 13 | SET(SOCKET_LIBRARY "socket") 14 | ELSE (SOCKET_LIBRARY_HAS_CONNECT) 15 | SET(SOCKET_LIBRARY) 16 | ENDIF (SOCKET_LIBRARY_HAS_CONNECT) 17 | 18 | ################ LIBXML install Check #################### 19 | FIND_PACKAGE(LibXml2) 20 | IF (NOT LIBXML2_FOUND) 21 | MESSAGE(STATUS "Libxml2 NOT found, won't be able to use .xml FOM files") 22 | ELSE(NOT LIBXML2_FOUND) 23 | INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) 24 | ENDIF(NOT LIBXML2_FOUND) 25 | 26 | ################ CERTI install Check #################### 27 | FIND_PACKAGE(CERTI REQUIRED) 28 | 29 | ## Add libxml2 to CERTI_LIBRARIES if libxml2 is found 30 | IF (LIBXML2_FOUND) 31 | SET(CERTI_LIBRARIES ${CERTI_LIBRARIES} ${LIBXML2_LIBRARIES}) 32 | ENDIF(LIBXML2_FOUND) 33 | 34 | LINK_DIRECTORIES(${CERTI_LIBRARY_DIRS} ) 35 | INCLUDE_DIRECTORIES(${CERTI_INCLUDE_DIRS}) 36 | ADD_DEFINITIONS(${CERTI_DEFINITIONS}) 37 | -------------------------------------------------------------------------------- /tests/LibRTI/hla-1_3/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | enable_testing() 2 | 3 | include_directories(${CERTI_SOURCE_DIR}) 4 | include_directories(${CERTI_BINARY_DIR}) 5 | include_directories(${CMAKE_SOURCE_DIR}/include/hla-1_3) 6 | include_directories(${CMAKE_BINARY_DIR}/include/hla-1_3) 7 | 8 | find_package(Threads REQUIRED) 9 | 10 | add_executable(TestRTI-HLA-1_3 11 | fedtime_test.cpp 12 | ../../main.cpp 13 | ) 14 | 15 | target_link_libraries(TestRTI-HLA-1_3 16 | RTI FedTime 17 | ${GTEST_BOTH_LIBRARIES} 18 | ${CMAKE_THREAD_LIBS_INIT} 19 | ) 20 | 21 | target_compile_definitions(TestRTI-HLA-1_3 PRIVATE CERTI_TEST) 22 | 23 | 24 | if (COMPILE_WITH_COVERAGE) 25 | SETUP_TARGET_FOR_COVERAGE( 26 | NAME TestRTI-HLA-1_3_coverage 27 | EXECUTABLE TestRTI-HLA-1_3 --gtest_output=xml:../output/results-TestRTI-1_3.xml 28 | DEPENDENCIES TestRTI-HLA-1_3 29 | ) 30 | 31 | SETUP_TARGET_FOR_COVERAGE_COBERTURA( 32 | NAME TestRTI-HLA-1_3_cobertura 33 | EXECUTABLE TestRTI-HLA-1_3 --gtest_output=xml:../output/results-TestRTI-1_3.xml 34 | DEPENDENCIES TestRTI-HLA-1_3 35 | ) 36 | endif() 37 | 38 | add_test(AllTests TestRTI-HLA-1_3) 39 | 40 | -------------------------------------------------------------------------------- /CERTICPackOptions.cmake.in: -------------------------------------------------------------------------------- 1 | # Only mangle package name if binary package 2 | if ("${CPACK_INSTALL_CMAKE_PROJECT}" STRGREATER "") 3 | if (@MSVC@) 4 | # FIXME We have to find way to evaluate CMAKE_CFG_INTDIR at cpack time 5 | # or generate this current file at build time 6 | # message("CMAKE_CFG_INTDIR=${CMAKE_CFG_INTDIR}") 7 | set(PACKAGE_TYPE "NotSet") 8 | include(@CERTI_BINARY_DIR@/PackageType.cmake OPTIONAL) 9 | set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${PACKAGE_TYPE}-${CPACK_SYSTEM_NAME}") 10 | else(@MSVC@) 11 | set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-@CMAKE_BUILD_TYPE@-${CPACK_SYSTEM_NAME}") 12 | endif(@MSVC@) 13 | 14 | #Normalize CPACK_PACKAGE_VERSION for picky WiX 15 | if ("${CPACK_GENERATOR}" STREQUAL "WIX") 16 | string(REGEX MATCH "([0-9]*).*" CPACK_PACKAGE_VERSION_PATCH_WIX "${CPACK_PACKAGE_VERSION_PATCH}") 17 | set(CPACK_PACKAGE_VERSION_PATCH_WIX ${CMAKE_MATCH_1}) 18 | set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH_WIX}") 19 | endif() 20 | 21 | if("${CPACK_GENERATOR}" STREQUAL "PackageMaker") 22 | set(CPACK_PACKAGE_DEFAULT_LOCATION "/usr/local") 23 | set(CPACK_OSX_PACKAGE_VERSION "10.4") 24 | endif() 25 | endif() 26 | -------------------------------------------------------------------------------- /libRTI/ieee1516-2000/RTIambassador.cpp: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // CERTI - HLA RunTime Infrastructure 3 | // Copyright (C) 2002-2014 ONERA 4 | // 5 | // This file is part of CERTI-libRTI 6 | // 7 | // CERTI-libRTI is free software ; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public License 9 | // as published by the Free Software Foundation ; either version 2 of 10 | // the License, or (at your option) any later version. 11 | // 12 | // CERTI-libRTI is distributed in the hope that it will be useful, but 13 | // WITHOUT ANY WARRANTY ; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | // Lesser General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU Lesser General Public 18 | // License along with this program ; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 20 | // USA 21 | // 22 | // ---------------------------------------------------------------------------- 23 | 24 | #include 25 | 26 | namespace rti1516 27 | { 28 | RTIambassador::RTIambassador() throw() 29 | { 30 | } 31 | 32 | RTIambassador::~RTIambassador() 33 | { 34 | } 35 | } // end namespace rti1516 36 | -------------------------------------------------------------------------------- /libRTI/ieee1516-2010/RTIambassador.cpp: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // CERTI - HLA RunTime Infrastructure 3 | // Copyright (C) 2002-2014 ONERA 4 | // 5 | // This file is part of CERTI-libRTI 6 | // 7 | // CERTI-libRTI is free software ; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public License 9 | // as published by the Free Software Foundation ; either version 2 of 10 | // the License, or (at your option) any later version. 11 | // 12 | // CERTI-libRTI is distributed in the hope that it will be useful, but 13 | // WITHOUT ANY WARRANTY ; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | // Lesser General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU Lesser General Public 18 | // License along with this program ; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 20 | // USA 21 | // 22 | // ---------------------------------------------------------------------------- 23 | 24 | #include 25 | 26 | namespace rti1516e 27 | { 28 | RTIambassador::RTIambassador() throw() 29 | { 30 | } 31 | 32 | RTIambassador::~RTIambassador() 33 | { 34 | } 35 | } // end namespace rti1516 36 | -------------------------------------------------------------------------------- /scripts/Toolchain-cross-mingw-Win32.cmake: -------------------------------------------------------------------------------- 1 | # the name of the target operating system 2 | SET(CMAKE_SYSTEM_NAME Windows) 3 | 4 | # Choose an appropriate compiler prefix 5 | 6 | # for classical mingw32 7 | # see http://www.mingw.org/ 8 | #set(COMPILER_PREFIX "i586-mingw32msvc") 9 | 10 | # for 32 or 64 bits mingw-w64 11 | # see http://mingw-w64.sourceforge.net/ 12 | set(COMPILER_PREFIX "i686-w64-mingw32") 13 | #set(COMPILER_PREFIX "x86_64-w64-mingw32" 14 | 15 | # which compilers to use for C and C++ 16 | find_program(CMAKE_RC_COMPILER NAMES ${COMPILER_PREFIX}-windres) 17 | #SET(CMAKE_RC_COMPILER ${COMPILER_PREFIX}-windres) 18 | find_program(CMAKE_C_COMPILER NAMES ${COMPILER_PREFIX}-gcc) 19 | #SET(CMAKE_C_COMPILER ${COMPILER_PREFIX}-gcc) 20 | find_program(CMAKE_CXX_COMPILER NAMES ${COMPILER_PREFIX}-g++) 21 | #SET(CMAKE_CXX_COMPILER ${COMPILER_PREFIX}-g++) 22 | 23 | 24 | # here is the target environment located 25 | SET(USER_ROOT_PATH /home/erk/erk-win32-dev) 26 | SET(CMAKE_FIND_ROOT_PATH /usr/${COMPILER_PREFIX} ${USER_ROOT_PATH}) 27 | 28 | # adjust the default behaviour of the FIND_XXX() commands: 29 | # search headers and libraries in the target environment, search 30 | # programs in the host environment 31 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 32 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 33 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 34 | -------------------------------------------------------------------------------- /scripts/Toolchain-cross-mingw-Win64.cmake: -------------------------------------------------------------------------------- 1 | # the name of the target operating system 2 | SET(CMAKE_SYSTEM_NAME Windows) 3 | 4 | # Choose an appropriate compiler prefix 5 | 6 | # for classical mingw32 7 | # see http://www.mingw.org/ 8 | #set(COMPILER_PREFIX "i586-mingw32msvc") 9 | 10 | # for 32 or 64 bits mingw-w64 11 | # see http://mingw-w64.sourceforge.net/ 12 | #set(COMPILER_PREFIX "i686-w64-mingw32") 13 | set(COMPILER_PREFIX "x86_64-w64-mingw32") 14 | 15 | # which compilers to use for C and C++ 16 | find_program(CMAKE_RC_COMPILER NAMES ${COMPILER_PREFIX}-windres) 17 | #SET(CMAKE_RC_COMPILER ${COMPILER_PREFIX}-windres) 18 | find_program(CMAKE_C_COMPILER NAMES ${COMPILER_PREFIX}-gcc) 19 | #SET(CMAKE_C_COMPILER ${COMPILER_PREFIX}-gcc) 20 | find_program(CMAKE_CXX_COMPILER NAMES ${COMPILER_PREFIX}-g++) 21 | #SET(CMAKE_CXX_COMPILER ${COMPILER_PREFIX}-g++) 22 | 23 | 24 | # here is the target environment located 25 | SET(USER_ROOT_PATH /home/erk/erk-win32-dev) 26 | SET(CMAKE_FIND_ROOT_PATH /usr/${COMPILER_PREFIX} ${USER_ROOT_PATH}) 27 | 28 | # adjust the default behaviour of the FIND_XXX() commands: 29 | # search headers and libraries in the target environment, search 30 | # programs in the host environment 31 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 32 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 33 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 34 | -------------------------------------------------------------------------------- /doc/introduction.dox: -------------------------------------------------------------------------------- 1 | /** 2 | * \page intro Introduction 3 | * 4 | * \addindex Introduction 5 | * CERTI is an Open Source HLA compliant 6 | * RunTime Infrastructure (RTI), 7 | * which aims at being a multi-standard, multi-language RTI including: 8 | * - DoD HLA 1.3 (a.k.a. RTI-NGv6): C++, Java, Python, Fortran90, Matlab 9 | * - IEEE1516-2000 (a.k.a. HLA 1516): C++ 10 | * - IEEE1516-2010 (a.k.a. HLA Evolved): work-in-progress 11 | * 12 | * You'll find hereafter the documentation for building and installing CERTI. 13 | * CERTI is primarily developed and maintained by the Toulouse research center of ONERA [http://www.onera.fr], the French Aerospace Labs. 14 | * The primary goal of CERTI is to be used in research activities but CERTI has a growing 15 | * number of users and contributors among the CERTI Open Source community. 16 | * 17 | * People interested in CERTI may join the CERTI Open Source 18 | * community at 19 | * https://savannah.nongnu.org/projects/certi and/or 20 | * by using the mailing list 21 | * 22 | * http://lists.nongnu.org/mailman/listinfo/certi-devel 23 | * for discussion regarding CERTI usage. 24 | */ 25 | 26 | -------------------------------------------------------------------------------- /libHLA/COPYING.tlsf: -------------------------------------------------------------------------------- 1 | LICENSE INFORMATION 2 | 3 | TLSF is released as LGPL and GPL. A copy of both licences can be found in this 4 | directoy. For the GPL licence, the following exception applies. 5 | 6 | 7 | TLSF is free software; you can redistribute it and/or modify it under terms of 8 | the GNU General Public License as published by the Free Software Foundation; 9 | either version 2, or (at your option) any later version. TLSF is distributed 10 | in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the 11 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 12 | the GNU General Public License for more details. You should have received a 13 | copy of the GNU General Public License along with TLSF; see file COPYING. If 14 | not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, 15 | USA. 16 | 17 | As a special exception, including TLSF header files in a file, or linking with 18 | other files objects to produce an executable application, is merely considered 19 | normal use of the library, and does *not* fall under the heading of "derived 20 | work". Therfore does not by itself cause the resulting executable application 21 | to be covered by the GNU General Public License. This exception does not 22 | however invalidate any other reasons why the executable file might be covered 23 | by the GNU Public License. 24 | -------------------------------------------------------------------------------- /libRTI/ieee1516-2000/RTIfedAmbassador.cpp: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // CERTI - HLA RunTime Infrastructure 3 | // Copyright (C) 2002-2014 ONERA 4 | // 5 | // This file is part of CERTI-libRTI 6 | // 7 | // CERTI-libRTI is free software ; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public License 9 | // as published by the Free Software Foundation ; either version 2 of 10 | // the License, or (at your option) any later version. 11 | // 12 | // CERTI-libRTI is distributed in the hope that it will be useful, but 13 | // WITHOUT ANY WARRANTY ; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | // Lesser General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU Lesser General Public 18 | // License along with this program ; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 20 | // USA 21 | // 22 | // ---------------------------------------------------------------------------- 23 | #include 24 | #include 25 | 26 | rti1516::FederateAmbassador::FederateAmbassador() throw (FederateInternalError) 27 | { 28 | } 29 | 30 | rti1516::FederateAmbassador::~FederateAmbassador() throw() 31 | { 32 | } 33 | -------------------------------------------------------------------------------- /libRTI/ieee1516-2010/RTIfedAmbassador.cpp: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // CERTI - HLA RunTime Infrastructure 3 | // Copyright (C) 2002-2014 ONERA 4 | // 5 | // This file is part of CERTI-libRTI 6 | // 7 | // CERTI-libRTI is free software ; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public License 9 | // as published by the Free Software Foundation ; either version 2 of 10 | // the License, or (at your option) any later version. 11 | // 12 | // CERTI-libRTI is distributed in the hope that it will be useful, but 13 | // WITHOUT ANY WARRANTY ; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | // Lesser General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU Lesser General Public 18 | // License along with this program ; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 20 | // USA 21 | // 22 | // ---------------------------------------------------------------------------- 23 | #include 24 | #include 25 | 26 | rti1516e::FederateAmbassador::FederateAmbassador() throw (FederateInternalError) 27 | { 28 | } 29 | 30 | rti1516e::FederateAmbassador::~FederateAmbassador() throw() 31 | { 32 | } 33 | -------------------------------------------------------------------------------- /libCERTI/SocketSHM.hh: -------------------------------------------------------------------------------- 1 | #ifndef SOCKET_SHM_H 2 | #define SOCKET_SHM_H 3 | 4 | #include 5 | // libhla includes 6 | #include 7 | #include 8 | 9 | // Specifics includes 10 | #include "Exception.hh" 11 | #include 12 | 13 | class CERTI_EXPORT SocketSHM { 14 | public: 15 | // Typedef Side 16 | typedef enum { SHM_SC, SHM_CS } SHM_SIDE_t; 17 | 18 | // Constructor 19 | SocketSHM(const std::string& Socket_Name, const SHM_SIDE_t& Socket_Side, const int Socket_Size) 20 | { 21 | _Name = Socket_Name; 22 | _Side = Socket_Side; 23 | _Size_Side = Socket_Size; 24 | } 25 | // Destructor 26 | virtual ~SocketSHM(); 27 | 28 | virtual void Connect(); 29 | 30 | virtual void Send(void* Buffer); // To send Data on a memory segment 31 | virtual void Receive(void* Buffer); // To receive Data on a memory segment 32 | 33 | virtual void Close(); // To Close the two SHMs 34 | 35 | protected: 36 | std::string _Name; 37 | SHM_SIDE_t _Side; 38 | size_t _Size_Side; 39 | 40 | /***** Server -->>> Customer ******/ 41 | libhla::ipc::SHM* _Shm_SC; 42 | libhla::ipc::Semaphore *_Sem_full_SC, *_Sem_empty_SC; 43 | 44 | /***** Customer -->>> Server ******/ 45 | libhla::ipc::SHM* _Shm_CS; 46 | libhla::ipc::Semaphore *_Sem_full_CS, *_Sem_empty_CS; 47 | 48 | }; // End of --> class SocketSHM 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /libHLA/tlsf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Two Levels Segregate Fit memory allocator (TLSF) 3 | * Version 2.4.6 4 | * 5 | * Written by Miguel Masmano Tello 6 | * 7 | * Thanks to Ismael Ripoll for his suggestions and reviews 8 | * 9 | * Copyright (C) 2008, 2007, 2006, 2005, 2004 10 | * 11 | * This code is released using a dual license strategy: GPL/LGPL 12 | * You can choose the licence that better fits your requirements. 13 | * 14 | * Released under the terms of the GNU General Public License Version 2.0 15 | * Released under the terms of the GNU Lesser General Public License Version 2.1 16 | * 17 | */ 18 | 19 | #ifndef _TLSF_H_ 20 | #define _TLSF_H_ 21 | 22 | #include 23 | 24 | extern size_t init_memory_pool(size_t mem_pool_size, void* mem_pool); 25 | extern size_t get_used_size(void* mem_pool); 26 | extern size_t get_max_size(void* mem_pool); 27 | extern void destroy_memory_pool(void* mem_pool); 28 | extern size_t add_new_area(void* area, size_t area_size, void* mem_pool); 29 | extern void* malloc_ex(size_t size, void* mem_pool); 30 | extern void free_ex(void* ptr, void* mem_pool); 31 | extern void* realloc_ex(void* ptr, size_t new_size, void* mem_pool); 32 | extern void* calloc_ex(size_t nelem, size_t elem_size, void* mem_pool); 33 | 34 | extern void* tlsf_malloc(size_t size); 35 | extern void tlsf_free(void* ptr); 36 | extern void* tlsf_realloc(void* ptr, size_t size); 37 | extern void* tlsf_calloc(size_t nelem, size_t elem_size); 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /include/ieee1516-2010/RTI/encoding/EncodingExceptions.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | The IEEE hereby grants a general, royalty-free license to copy, distribute, 3 | display and make derivative works from this material, for all purposes, 4 | provided that any use of the material contains the following 5 | attribution: "Reprinted with permission from IEEE 1516.1(TM)-2010". 6 | Should you require additional information, contact the Manager, Standards 7 | Intellectual Property, IEEE Standards Association (stds-ipr@ieee.org). 8 | ***********************************************************************/ 9 | /*********************************************************************** 10 | IEEE 1516.1 High Level Architecture Interface Specification C++ API 11 | File: EncodingExceptions.h 12 | ***********************************************************************/ 13 | #ifndef RTI_EncodingExcpetions_H_ 14 | #define RTI_EncodingExcpetions_H_ 15 | 16 | #include 17 | #include 18 | #include 19 | 20 | namespace rti1516e 21 | { 22 | 23 | class RTI_EXPORT EncoderException: public Exception 24 | { 25 | public: 26 | EncoderException (std::wstring const & message) 27 | throw(); 28 | 29 | std::wstring what () const 30 | throw(); 31 | 32 | private: 33 | std::wstring _msg; 34 | }; 35 | } 36 | 37 | 38 | #endif // RTI_EncodingExcpetions_H_ 39 | 40 | -------------------------------------------------------------------------------- /test/Billard/ColoredBall.hh: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // CERTI - HLA RunTime Infrastructure 3 | // Copyright (C) 2002-2018 ISAE-SUPAERO & ONERA 4 | // 5 | // This file is part of CERTI 6 | // 7 | // CERTI is free software ; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation ; either version 2 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // CERTI is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY ; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program ; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | // 21 | // $Id: ColoredBall.hh,v 3.2 2005/04/30 17:55:43 breholee Exp $ 22 | // ---------------------------------------------------------------------------- 23 | 24 | #ifndef CERTI_COLORED_BALL_HH 25 | #define CERTI_COLORED_BALL_HH 26 | 27 | #include "Ball.hh" 28 | 29 | class ColoredBall : public Ball 30 | { 31 | public: 32 | int Color ; 33 | 34 | ColoredBall(RTI::ObjectHandle); 35 | 36 | void display(); 37 | }; 38 | 39 | #endif // CERTI_COLORED_BALL_HH 40 | 41 | // $Id: ColoredBall.hh,v 3.2 2005/04/30 17:55:43 breholee Exp $ 42 | -------------------------------------------------------------------------------- /libHLA/PosixClock.hh: -------------------------------------------------------------------------------- 1 | #ifndef POSIXCLOCK_HH_ 2 | #define POSIXCLOCK_HH_ 3 | 4 | #include "Clock.hh" 5 | 6 | #include 7 | #include 8 | 9 | namespace libhla { 10 | namespace clock { 11 | 12 | /** 13 | * A Clock implemented using POSIX clock_xxxxx API. 14 | */ 15 | class HLA_EXPORT PosixClock : public Clock { 16 | public: 17 | /** 18 | * Build a POSIX clock using clock id. 19 | * @param[in] clockId the POSIX clock identifier which may be 20 | * - CLOCK_REALTIME (default value) 21 | * - CLOCK_MONOTONIC 22 | * - CLOCK_PROCESS_CPUTIME_ID 23 | * - CLOCK_THREAD_CPUTIME_ID 24 | * - CLOCK_REALTIME_HR 25 | * - CLOCK_MONOTONIC_HR 26 | */ 27 | PosixClock(clockid_t newClockId = CLOCK_REALTIME); 28 | /** 29 | * Get the clock resolution in nano-seconds. 30 | * @return the clock resolution in nano-seconds 31 | */ 32 | virtual double getResolution(); 33 | /** 34 | * Get the current ticks value. 35 | * @return the current ticks value 36 | */ 37 | virtual uint64_t getCurrentTicksValue(); 38 | /** 39 | * Convert a number of ticks into a double value 40 | * representing nanoseconds. 41 | * @param[in] ticks the number of tick to convert 42 | * @return the nano-seconds value 43 | */ 44 | virtual double tick2NanoSecond(const uint64_t ticks); 45 | virtual ~PosixClock(); 46 | 47 | private: 48 | struct timespec resolution; 49 | clockid_t clockId; 50 | }; 51 | 52 | } /* end namespace clock */ 53 | } /* end namespace libhla */ 54 | #endif /*POSIXCLOCK_HH_*/ 55 | -------------------------------------------------------------------------------- /include/hla-1_3/baseTypes.hh: -------------------------------------------------------------------------------- 1 | // HLA 1.3 Header "baseTypes.hh" 2 | 3 | typedef unsigned short UShort ; 4 | typedef short Short ; 5 | #if defined(__alpha) || (defined(__sgi) && _MIPS_SZLONG == 64) 6 | typedef unsigned int ULong ; 7 | typedef int Long ; 8 | #else 9 | typedef unsigned long ULong ; 10 | typedef long Long ; 11 | #endif 12 | typedef double Double ; 13 | typedef float Float ; 14 | 15 | enum Boolean { 16 | RTI_FALSE = 0, 17 | RTI_TRUE 18 | }; 19 | 20 | class RTI_EXPORT Exception 21 | { 22 | public: 23 | ULong _serial ; 24 | char *_reason ; 25 | const char *_name ; 26 | Exception(const char *reason); 27 | Exception(ULong serial, const char *reason); 28 | Exception(const Exception &toCopy); 29 | virtual ~Exception(); 30 | Exception &operator=(const Exception &); 31 | virtual Exception *cloneSelf() const throw() = 0 ; 32 | virtual void throwSelf() const = 0 ; 33 | const std::string displayMe() const; 34 | }; 35 | 36 | #define RTI_EXCEPT(A) \ 37 | class A : public Exception { \ 38 | public: \ 39 | static RTI_EXPORT const char *_ex ; \ 40 | static RTI_EXPORT long type ; \ 41 | A (const char *reason) : Exception(reason) { _name = #A ; this->displayMe();} \ 42 | A (ULong serial, const char *reason = 0) \ 43 | : Exception(serial, reason) { _name = #A ; this->displayMe(); } \ 44 | A (A const &toCopy) : Exception(toCopy) { _name = #A ; this->displayMe();} \ 45 | Exception *cloneSelf() const throw() { return (new A(_reason)); } \ 46 | void throwSelf() const { throw *this ; } \ 47 | }; 48 | -------------------------------------------------------------------------------- /test/utility/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${CMAKE_SOURCE_DIR}) 2 | 3 | find_library(RT_LIBRARY rt) 4 | add_executable(CertiProcessus_A Main_SocketSHM.cc SharedStruct.hh) 5 | 6 | target_link_libraries(CertiProcessus_A CERTI HLA) 7 | if(RT_LIBRARY) 8 | target_link_libraries(CertiProcessus_A ${RT_LIBRARY}) 9 | endif() 10 | 11 | set_target_properties(CertiProcessus_A PROPERTIES COMPILE_FLAGS -DSIDE_SC) 12 | 13 | add_executable(CertiProcessus_B Main_SocketSHM.cc SharedStruct.hh) 14 | 15 | target_link_libraries(CertiProcessus_B CERTI HLA) 16 | if(RT_LIBRARY) 17 | target_link_libraries(CertiProcessus_B ${RT_LIBRARY}) 18 | endif() 19 | 20 | set_target_properties(CertiProcessus_B PROPERTIES COMPILE_FLAGS -DSIDE_CS) 21 | 22 | # Xml parsing test program 23 | if(LIBXML2_FOUND) 24 | add_executable(CertiCheckXML checkXML.cc) 25 | target_link_libraries(CertiCheckXML ${LIBXML2_LIBRARIES} RTI) 26 | 27 | add_test(NAME CheckXML2000 COMMAND CertiCheckXML ${CMAKE_CURRENT_SOURCE_DIR}/T2000.xml) 28 | set_property(TEST CheckXML2000 PROPERTY PASS_REGULAR_EXPRESSION "2000") 29 | add_test(NAME CheckXML2010 COMMAND CertiCheckXML ${CMAKE_CURRENT_SOURCE_DIR}/T2010.xml) 30 | set_property(TEST CheckXML2010 PROPERTY PASS_REGULAR_EXPRESSION "2010") 31 | 32 | install(TARGETS CertiCheckXML 33 | RUNTIME DESTINATION bin 34 | LIBRARY DESTINATION lib 35 | ARCHIVE DESTINATION lib) 36 | endif() 37 | 38 | install(TARGETS CertiProcessus_A CertiProcessus_B 39 | RUNTIME DESTINATION bin 40 | LIBRARY DESTINATION lib 41 | ARCHIVE DESTINATION lib) 42 | 43 | 44 | -------------------------------------------------------------------------------- /test/Billard/Test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /libCERTI/Exception.cc: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // CERTI - HLA RunTime Infrastructure 3 | // Copyright (C) 2002-2018 ISAE-SUPAERO & ONERA 4 | // 5 | // This file is part of CERTI-libCERTI 6 | // 7 | // CERTI-libCERTI is free software ; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public License 9 | // as published by the Free Software Foundation ; either version 2 of 10 | // the License, or (at your option) any later version. 11 | // 12 | // CERTI-libCERTI is distributed in the hope that it will be useful, but 13 | // WITHOUT ANY WARRANTY ; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | // Lesser General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU Lesser General Public 18 | // License along with this program ; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 20 | // USA 21 | // 22 | // ---------------------------------------------------------------------------- 23 | 24 | #include "Exception.hh" 25 | #include "PrettyDebug.hh" 26 | #include "certi.hh" 27 | 28 | static PrettyDebug PD_Exception("CERTI_EXCEPTION", __FILE__); 29 | 30 | const std::string certi::Exception::displayMe() const 31 | { 32 | std::string msg = "CERTI::Exception [" + ((name().empty()) ? "" : name()) 33 | + " - reason=" + ((_reason.empty()) ? "" : _reason) + "\n"; 34 | 35 | Debug(PD_Exception, pdExcept) << msg; 36 | return msg; 37 | } 38 | -------------------------------------------------------------------------------- /doc/install.dox: -------------------------------------------------------------------------------- 1 | /** 2 | * \page install Installing CERTI 3 | * 4 | * \addindex installation 5 | * 6 | * CERTI comes as a set of libraries and binary executables, which may 7 | * be used to build an HLA compliant simulation. 8 | * 9 | * \section certi_install Install the CERTI software 10 | * 11 | * \subsection certi_install_layout CERTI installation layout 12 | * CERTI components are installed in a user-chosen CERTI_HOME 13 | * directory. Below this root directory the layout is as described below: 14 | * \dot 15 | * digraph certi_layout { 16 | * size = "2.5,2.5"; 17 | * node [shape=record, fontname=Helvetica, fontsize=10]; 18 | * home [ label="CERTI_HOME"]; 19 | * bin [ label="bin"]; 20 | * lib [ label="lib"]; 21 | * share [ label="share"]; 22 | * doc [label="doc"]; 23 | * federations [label="federations"]; 24 | * home -> bin [ arrowhead="open", style="solid" ]; 25 | * home -> lib [ arrowhead="open", style="solid" ]; 26 | * home -> share [ arrowhead="open", style="solid" ]; 27 | * share -> doc [ arrowhead="open", style="solid" ]; 28 | * share -> federations [ arrowhead="open", style="solid" ]; 29 | * } 30 | * \enddot 31 | * 32 | * TODO: How to set $PATH, LD_LIBRARY_PATH 33 | * TODO: Where to store .fed files, what are the .fed files? 34 | * 35 | * \subsection certi_install_windows Windows installer 36 | * TODO: How to use the Windows installer. 37 | * 38 | * \subsection certi_install_rpm RPM package 39 | * TODO: How to install CERTI from a .RPM file. 40 | * 41 | */ 42 | 43 | // $Id: install.dox,v 3.4 2014/02/28 13:55:31 erk Exp $ 44 | -------------------------------------------------------------------------------- /include/ieee1516-2010/RTI/RTIambassadorFactory.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | The IEEE hereby grants a general, royalty-free license to copy, distribute, 3 | display and make derivative works from this material, for all purposes, 4 | provided that any use of the material contains the following 5 | attribution: "Reprinted with permission from IEEE 1516.1(TM)-2010". 6 | Should you require additional information, contact the Manager, Standards 7 | Intellectual Property, IEEE Standards Association (stds-ipr@ieee.org). 8 | ***********************************************************************/ 9 | /*********************************************************************** 10 | IEEE 1516.1 High Level Architecture Interface Specification C++ API 11 | File: RTI/RTIambassadorFactory.h 12 | ***********************************************************************/ 13 | 14 | #ifndef RTI_RTIambassadorFactory_h 15 | #define RTI_RTIambassadorFactory_h 16 | 17 | namespace rti1516e 18 | { 19 | class RTIambassador; 20 | } 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | namespace rti1516e 29 | { 30 | class RTI_EXPORT RTIambassadorFactory 31 | { 32 | public: 33 | RTIambassadorFactory(); 34 | 35 | virtual ~RTIambassadorFactory() 36 | throw (); 37 | 38 | // 10.35 39 | std::auto_ptr< RTIambassador > createRTIambassador () 40 | throw ( 41 | RTIinternalError); 42 | }; 43 | } 44 | 45 | #endif // RTI_RTIambassadorFactory_h 46 | -------------------------------------------------------------------------------- /test/testFederate/testFederateMain.cc: -------------------------------------------------------------------------------- 1 | #include "testFederate.hh" 2 | #include "testFederate_cmdline.h" 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | /** 9 | * The CERTI test Federate. 10 | * This is a sample federate which helps in testing RTI features. 11 | * This federate comes in 3 flavour: 12 | * - CertiTestFederate-HLA13 which uses HLA 1.3 API 13 | * - CertiTestFederate-IEEE1516_2000 which uses IEEE-1516 v2000 API 14 | * - CertiTestFederate-IEEE1516_2010 which uses IEEE-1516 v2010 API 15 | */ 16 | int main(int argc, char **argv) 17 | { 18 | gengetopt_args_info args ; 19 | if (cmdline_parser(argc, argv, &args)) exit(EXIT_FAILURE); 20 | /* The default verbose level is 2 */ 21 | uint32_t verboseLevel = 2; 22 | if (args.verbose_given) { 23 | verboseLevel = args.verbose_arg; 24 | } 25 | 26 | std::wstring federateName = testFederate::getWString(args.name_arg); 27 | std::wstring federationName = testFederate::getWString(args.federation_name_arg); 28 | std::wstring FOMpath = testFederate::getWString(args.fom_model_arg); 29 | 30 | // Create a federate object. 31 | // This object inherit from appropriate FederateAmbassador class 32 | // and embbed the appropriate RTIambassador object. 33 | testFederate myFederate(federateName); 34 | myFederate.setVerbosityLevel(verboseLevel); 35 | myFederate.createFederationExecution(federationName,FOMpath); 36 | myFederate.joinFederationExecution(); 37 | myFederate.getHandles(); 38 | 39 | myFederate.resignFederationExecution(); 40 | // Destroy the federation 41 | myFederate.destroyFederationExecution(); 42 | 43 | } 44 | 45 | -------------------------------------------------------------------------------- /libRTI/ieee1516-2000/RTIvariableLengthDataImplementation.h: -------------------------------------------------------------------------------- 1 | #ifndef RTI_VariableLengthDataImplementation_h 2 | #define RTI_VariableLengthDataImplementation_h 3 | 4 | namespace rti1516 5 | { 6 | class VariableLengthDataImplementation 7 | { 8 | public: 9 | VariableLengthDataImplementation(); 10 | // Caller is free to delete inData after the call 11 | VariableLengthDataImplementation(void const * inData, unsigned long inSize); 12 | // Caller is free to delete rhs after the call 13 | VariableLengthDataImplementation(VariableLengthDataImplementation const & rhs); 14 | 15 | ~VariableLengthDataImplementation(); 16 | 17 | // Caller is free to delete rhs after the call 18 | VariableLengthDataImplementation & 19 | operator=(VariableLengthDataImplementation const & rhs); 20 | 21 | // Caller is free to delete inData after the call 22 | void setData(void const * inData, unsigned long inSize); 23 | 24 | // Caller is responsible for ensuring that the data that is 25 | // pointed to is valid for the lifetime of this object, or past 26 | // the next time this object is given new data. 27 | void setDataPointer(void* inData, unsigned long inSize); 28 | 29 | // Caller gives up ownership of inData to this object. 30 | // This object assumes the responsibility of deleting inData 31 | // when it is no longer needed. 32 | void takeDataPointer(void* inData, unsigned long inSize); 33 | 34 | void const *getData() { return _data; } 35 | unsigned long getSize() { return _size; } 36 | 37 | private: 38 | void *_data; 39 | unsigned long _size; 40 | bool _dataOwner; 41 | }; 42 | } 43 | 44 | #endif // RTI_VariableLengthDataImplementation_h 45 | -------------------------------------------------------------------------------- /libCERTI/SocketHTTPProxy.hh: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // CERTI - HLA RunTime Infrastructure 3 | // Copyright (C) 2002-2018 ISAE-SUPAERO & ONERA 4 | // 5 | // This program is free software ; you can redistribute it and/or 6 | // modify it under the terms of the GNU Lesser General Public License 7 | // as published by the Free Software Foundation ; either version 2 of 8 | // the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, but 11 | // WITHOUT ANY WARRANTY ; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | // Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public 16 | // License along with this program ; if not, write to the Free Software 17 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | // ---------------------------------------------------------------------------- 19 | 20 | #ifndef CERTI_SOCKET_HTTP_PROXY_HH 21 | #define CERTI_SOCKET_HTTP_PROXY_HH 22 | 23 | #include "SocketTCP.hh" 24 | 25 | namespace certi { 26 | 27 | class CERTI_EXPORT SocketHTTPProxy : public SocketTCP { 28 | public: 29 | SocketHTTPProxy(); 30 | virtual ~SocketHTTPProxy(); 31 | 32 | virtual void createConnection(const char* server_name, unsigned int port); 33 | 34 | protected: 35 | int sendHTTPConnect(const char* addr, in_port_t port); 36 | size_t receiveLine(char* buffer, size_t max_size); 37 | }; 38 | 39 | } // namespace certi 40 | 41 | #endif // CERTI_SOCKET_HTTP_PROXY_HH 42 | -------------------------------------------------------------------------------- /libRTI/ieee1516-2010/RTIvariableLengthDataImplementation.h: -------------------------------------------------------------------------------- 1 | #ifndef RTI_VariableLengthDataImplementation_h 2 | #define RTI_VariableLengthDataImplementation_h 3 | 4 | namespace rti1516e 5 | { 6 | class VariableLengthDataImplementation 7 | { 8 | public: 9 | VariableLengthDataImplementation(); 10 | // Caller is free to delete inData after the call 11 | VariableLengthDataImplementation(void const * inData, size_t inSize); 12 | // Caller is free to delete rhs after the call 13 | VariableLengthDataImplementation(VariableLengthDataImplementation const & rhs); 14 | 15 | ~VariableLengthDataImplementation(); 16 | 17 | // Caller is free to delete rhs after the call 18 | VariableLengthDataImplementation & 19 | operator=(VariableLengthDataImplementation const & rhs); 20 | 21 | // Caller is free to delete inData after the call 22 | void setData(void const * inData, unsigned long inSize); 23 | 24 | // Caller is responsible for ensuring that the data that is 25 | // pointed to is valid for the lifetime of this object, or past 26 | // the next time this object is given new data. 27 | void setDataPointer(void* inData, unsigned long inSize); 28 | 29 | // Caller gives up ownership of inData to this object. 30 | // This object assumes the responsibility of deleting inData 31 | // when it is no longer needed. 32 | void takeDataPointer(void* inData, unsigned long inSize); 33 | 34 | void const *getData() { return _data; } 35 | unsigned long getSize() { return _size; } 36 | 37 | private: 38 | void *_data; 39 | unsigned long _size; 40 | bool _dataOwner; 41 | }; 42 | } 43 | 44 | #endif // RTI_VariableLengthDataImplementation_h 45 | -------------------------------------------------------------------------------- /test/Billard/Display.hh: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // CERTI - HLA RunTime Infrastructure 3 | // Copyright (C) 2003 ONERA 4 | // 5 | // This file is part of CERTI 6 | // 7 | // CERTI is free software ; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation ; either version 2 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // CERTI is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY ; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program ; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | // 21 | // $Id: Display.hh,v 3.1 2003/08/06 14:37:47 breholee Exp $ 22 | // ---------------------------------------------------------------------------- 23 | 24 | #ifndef CERTI_BILLARD_DISPLAY_HH 25 | #define CERTI_BILLARD_DISPLAY_HH 26 | 27 | class Display 28 | { 29 | public: 30 | static Display *instance(); 31 | 32 | int getHeight() const ; 33 | void setWindow(int, int); 34 | void show(); 35 | 36 | protected: 37 | Display(); 38 | 39 | private: 40 | static Display *myInstance ; 41 | 42 | const int XMAX ; // width 43 | const int YMAX ; // height 44 | 45 | int x, y ; 46 | }; 47 | 48 | #endif // CERTI_BILLARD_DISPLAY_HH 49 | 50 | // $Id: Display.hh,v 3.1 2003/08/06 14:37:47 breholee Exp $ 51 | -------------------------------------------------------------------------------- /doc/certi_install_doc.tree: -------------------------------------------------------------------------------- 1 | /* -*- c -*- 2 | // ---------------------------------------------------------------------------- 3 | // CERTI - HLA RunTime Infrastructure 4 | // Copyright (C) 2002, 2003, 2004 ONERA 5 | // 6 | // This file is part of CERTI 7 | // 8 | // CERTI-libCERTI is free software ; you can redistribute it and/or 9 | // modify it under the terms of the GNU Lesser General Public License 10 | // as published by the Free Software Foundation ; either version 2 of 11 | // the License, or (at your option) any later version. 12 | // 13 | // CERTI-libCERTI is distributed in the hope that it will be useful, but 14 | // WITHOUT ANY WARRANTY ; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | // Lesser General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU Lesser General Public 19 | // License along with this program ; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 21 | // USA 22 | // ---------------------------------------------------------------------------- 23 | */ 24 | 25 | /** 26 | * @mainpage 27 | *
28 | * \image html "certi.png" 29 | *
30 | *

Installation Documentation

31 | * 32 | * This documentation describes CERTI installation/configuration and simulation 33 | * execution. 34 | * If you want to develop own HLA simulations using CERTI, please refer the User documentation. 35 | * 36 | * This documentation is divided into several parts: 37 | * 38 | * - \ref intro 39 | * - \ref build 40 | * - \ref install 41 | * - \ref execute 42 | * - \ref certi_HTTP_proxy 43 | * 44 | */ 45 | 46 | -------------------------------------------------------------------------------- /libCERTI/RTIRegion.hh: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // CERTI - HLA RunTime Infrastructure 3 | // Copyright (C) 2005 ONERA 4 | // 5 | // This file is part of CERTI-libCERTI 6 | // 7 | // CERTI-libCERTI is free software ; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public License 9 | // as published by the Free Software Foundation ; either version 2 of 10 | // the License, or (at your option) any later version. 11 | // 12 | // CERTI-libCERTI is distributed in the hope that it will be useful, but 13 | // WITHOUT ANY WARRANTY ; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | // Lesser General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU Lesser General Public 18 | // License along with this program ; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 20 | // USA 21 | // 22 | // $Id: RTIRegion.hh,v 3.2 2007/10/31 10:30:20 erk Exp $ 23 | // ---------------------------------------------------------------------------- 24 | 25 | #ifndef CERTI_RTI_REGION_HH 26 | #define CERTI_RTI_REGION_HH 27 | 28 | #include "BaseRegion.hh" 29 | 30 | namespace certi { 31 | 32 | class RoutingSpace; 33 | 34 | class CERTI_EXPORT RTIRegion : public BaseRegion { 35 | public: 36 | RTIRegion(RegionHandle, const RoutingSpace&, size_t); 37 | virtual ~RTIRegion(); 38 | 39 | virtual SpaceHandle getSpaceHandle() const noexcept; 40 | 41 | protected: 42 | const RoutingSpace& space; 43 | }; 44 | 45 | } // namespace certi 46 | 47 | #endif // CERTI_RTI_REGION_HH 48 | 49 | // $Id: RTIRegion.hh,v 3.2 2007/10/31 10:30:20 erk Exp $ 50 | -------------------------------------------------------------------------------- /scripts/GenMsgPython.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | ## ---------------------------------------------------------------------------- 4 | ## CERTI - HLA RunTime Infrastructure 5 | ## Copyright (C) 2002-2018 ISAE-SUPAERO & ONERA 6 | ## 7 | ## This program is free software ; you can redistribute it and/or 8 | ## modify it under the terms of the GNU Lesser General Public License 9 | ## as published by the Free Software Foundation ; either version 2 of 10 | ## the License, or (at your option) Any later version. 11 | ## 12 | ## This program is distributed in the hope that it will be useful, but 13 | ## WITHOUT ANY WARRANTY ; without even the implied warranty of 14 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | ## Lesser General Public License for more details. 16 | ## 17 | ## You should have received a copy of the GNU Lesser General Public 18 | ## License along with this program ; if not, write to the Free Software 19 | ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 20 | ## USA 21 | ## 22 | ## $Id: GenMsgPython.py,v 1.3 2010/06/11 12:43:12 erk Exp $ 23 | ## ---------------------------------------------------------------------------- 24 | 25 | """ 26 | The CERTI Message Generator. 27 | Python Backend Generator 28 | """ 29 | 30 | import logging 31 | import GenMsgBase 32 | 33 | 34 | class PythonGenerator(GenMsgBase.CodeGenerator): 35 | 36 | """ 37 | This is a Python generator for C{MessageAST}. 38 | """ 39 | 40 | def generatorName(cls): 41 | return 'Python' 42 | 43 | generatorName = classmethod(generatorName) 44 | 45 | def __init__(self, MessageAST): 46 | super(PythonGenerator, self).__init__(MessageAST, '##') 47 | 48 | 49 | # Message builtin type to Python type 50 | -------------------------------------------------------------------------------- /include/ieee1516-2010/RTI/encoding/EncodingConfig.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | The IEEE hereby grants a general, royalty-free license to copy, distribute, 3 | display and make derivative works from this material, for all purposes, 4 | provided that any use of the material contains the following 5 | attribution: "Reprinted with permission from IEEE 1516.1(TM)-2010". 6 | Should you require additional information, contact the Manager, Standards 7 | Intellectual Property, IEEE Standards Association (stds-ipr@ieee.org). 8 | ***********************************************************************/ 9 | /*********************************************************************** 10 | IEEE 1516.1 High Level Architecture Interface Specification C++ API 11 | File: EncodingConfig.h 12 | ***********************************************************************/ 13 | #ifndef RTI_EncodingConfig_h_ 14 | #define RTI_EncodingConfig_h_ 15 | 16 | #include 17 | #include 18 | 19 | 20 | namespace rti1516e 21 | { 22 | // Platform Specific Typedefs 23 | #if defined(_WIN32) 24 | typedef char Integer8; 25 | typedef short Integer16; 26 | typedef int Integer32; 27 | typedef _int64 Integer64; 28 | #else 29 | #if defined(RTI_USE_64BIT_LONGS) 30 | typedef char Integer8; 31 | typedef short Integer16; 32 | typedef int Integer32; 33 | typedef long Integer64; 34 | #else 35 | typedef char Integer8; 36 | typedef short Integer16; 37 | typedef int Integer32; 38 | typedef long long Integer64; 39 | #endif 40 | #endif 41 | 42 | typedef Integer8 Octet; 43 | typedef std::pair< Octet, Octet > OctetPair; 44 | } 45 | 46 | #endif // RTI_EncodingConfig_h_ 47 | 48 | 49 | -------------------------------------------------------------------------------- /libHLA/Clock.cc: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // CERTI - HLA RunTime Infrastructure 3 | // Copyright (C) 2002-2018 ISAE-SUPAERO & ONERA 4 | // 5 | // This program is free software ; you can redistribute it and/or 6 | // modify it under the terms of the GNU Lesser General Public License 7 | // as published by the Free Software Foundation ; either version 2 of 8 | // the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, but 11 | // WITHOUT ANY WARRANTY ; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | // Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public 16 | // License along with this program ; if not, write to the Free Software 17 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | // ---------------------------------------------------------------------------- 19 | 20 | #include "Clock.hh" 21 | namespace libhla { 22 | namespace clock { 23 | 24 | Clock::Clock(const std::string& newName) 25 | { 26 | name = newName; 27 | } 28 | 29 | uint64_t Clock::getDeltaTicks(const uint64_t previousTicks) 30 | { 31 | return (getCurrentTicksValue() - previousTicks); 32 | } 33 | 34 | double Clock::getDeltaNanoSecond(const uint64_t firstTicks, const uint64_t secondTicks) 35 | { 36 | return tick2NanoSecond(secondTicks - firstTicks); 37 | } 38 | 39 | double Clock::getDeltaNanoSecond(const uint64_t previousTicks) 40 | { 41 | return tick2NanoSecond(getDeltaTicks(previousTicks)); 42 | } 43 | 44 | Clock::~Clock() 45 | { 46 | } 47 | 48 | } /* end namespace clock */ 49 | } /* end namespace libhla */ 50 | -------------------------------------------------------------------------------- /test/InteractiveFederate/1516-2010/Certi-Test-02.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /libCERTI/Parameter.cc: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // CERTI - HLA RunTime Infrastructure 3 | // Copyright (C) 2002-2018 ISAE-SUPAERO & ONERA 4 | // 5 | // This file is part of CERTI-libCERTI 6 | // 7 | // CERTI-libCERTI is free software ; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public License 9 | // as published by the Free Software Foundation ; either version 2 of 10 | // the License, or (at your option) any later version. 11 | // 12 | // CERTI-libCERTI is distributed in the hope that it will be useful, but 13 | // WITHOUT ANY WARRANTY ; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | // Lesser General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU Lesser General Public 18 | // License along with this program ; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 20 | // USA 21 | // 22 | // $Id: Parameter.cc,v 3.12 2009/11/24 16:39:20 erk Exp $ 23 | // ---------------------------------------------------------------------------- 24 | 25 | #include "Parameter.hh" 26 | 27 | #include 28 | 29 | namespace certi { 30 | 31 | Parameter::Parameter(const std::string& name, ParameterHandle parameterHandle) 32 | : Named(name), Handled(parameterHandle), LevelID(PublicLevelID) 33 | { 34 | } 35 | 36 | void Parameter::display(void) 37 | { 38 | std::cout << " Parameter " << getHandle() << ": " << (name.length() == 0 ? "(no name)" : name.c_str()) << " [Level " 39 | << LevelID << "]" << std::endl; 40 | } 41 | 42 | } // namespace certi 43 | 44 | // $Id: Parameter.cc,v 3.12 2009/11/24 16:39:20 erk Exp $ 45 | -------------------------------------------------------------------------------- /libCERTI/Parameter.hh: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // CERTI - HLA RunTime Infrastructure 3 | // Copyright (C) 2002, 2003, 2005 ONERA 4 | // 5 | // This file is part of CERTI-libCERTI 6 | // 7 | // CERTI-libCERTI is free software ; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public License 9 | // as published by the Free Software Foundation ; either version 2 of 10 | // the License, or (at your option) any later version. 11 | // 12 | // CERTI-libCERTI is distributed in the hope that it will be useful, but 13 | // WITHOUT ANY WARRANTY ; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | // Lesser General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU Lesser General Public 18 | // License along with this program ; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 20 | // USA 21 | // 22 | // $Id: Parameter.hh,v 3.9 2009/11/24 16:39:20 erk Exp $ 23 | // ---------------------------------------------------------------------------- 24 | 25 | #ifndef CERTI_PARAMETER_HH 26 | #define CERTI_PARAMETER_HH 27 | 28 | #include "Handled.hh" 29 | #include "Named.hh" 30 | #include "SecurityLevel.hh" 31 | #include 32 | 33 | #include 34 | 35 | namespace certi { 36 | 37 | class Parameter : public Named, public Handled { 38 | public: 39 | Parameter(const std::string& name, ParameterHandle parameterHandle); 40 | 41 | void display(); 42 | 43 | SecurityLevelID LevelID; 44 | }; 45 | 46 | } // namespace certi 47 | 48 | #endif // CERTI_PARAMETER_HH 49 | 50 | // $Id: Parameter.hh,v 3.9 2009/11/24 16:39:20 erk Exp $ 51 | -------------------------------------------------------------------------------- /test/Billard/BillardTest2010.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Bille 6 | 7 | PositionX 8 | HLAreliable 9 | TimeStamp 10 | 11 | 12 | PositionY 13 | HLAreliable" 14 | TimeStamp 15 | 16 | Boule 17 | 18 | Color 19 | HLAreliable 20 | TimeStamp 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | Bing 29 | HLAreliable 30 | TimeStamp 31 | 32 | BoulNum 33 | 34 | 35 | DX 36 | 37 | 38 | DY 39 | 40 | 41 | 42 | 43 | Geo 44 | 45 | X 46 | 47 | 48 | Y 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /include/ieee1516-2000/RTI/RTI1516.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | IEEE 1516.1 High Level Architecture Interface Specification C++ API 3 | File: RTI/1516.h 4 | ***********************************************************************/ 5 | 6 | // 7 | // This file is simply a convenience provided for those developers that would 8 | // like to include everything all at once 9 | // 10 | 11 | #ifndef RTI_1516_h 12 | #define RTI_1516_h 13 | 14 | // Identification of the API version number. 15 | #define HLA_SPECIFICATION_NAME "1516" 16 | #define HLA_API_MAJOR_VERSION 2 17 | #define HLA_API_MINOR_VERSION 0 18 | 19 | // This file contains platform specific configuration info. 20 | #include 21 | 22 | // These file include declarations/definitions for ISO 14882 standard C++ 23 | // classes, renamed for portability. 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | // This file contains standard RTI type declarations/definitions. 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | // This file contains standard RTI type declarations/definitions which depend on 37 | // RTI implementation specific declarations/definitions. 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | namespace rti1516 44 | { 45 | // Vendor-specific name and version of the RTI implementation 46 | std::wstring RTI_EXPORT RTIname(); 47 | std::wstring RTI_EXPORT RTIversion(); 48 | } 49 | 50 | #include 51 | #include 52 | #include 53 | 54 | #endif // RTI_1516_h 55 | -------------------------------------------------------------------------------- /test/utility/T2010VerySmallOI.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | HLAobjectRoot 6 | 7 | Customer 8 | PublishSubscribe 9 | Statement of money owed by the customer 10 | 11 | 12 | Employee 13 | 14 | PayRate 15 | PublishSubscribe 16 | HLAreliable 17 | TimeStamp 18 | 19 | 20 | 21 | 22 | 23 | 24 | HLAinteractionRoot 25 | 26 | CustomerTransactions 27 | Publish 28 | HLAreliable 29 | TimeStamp 30 | The base class of interactions between customers and employee 31 | 32 | CustomerSeated 33 | PublishSubscribe 34 | HLAreliable 35 | TimeStamp 36 | Customer has occupied a table 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /doc/certi_user_doc.tree: -------------------------------------------------------------------------------- 1 | /* -*- c -*- 2 | // ---------------------------------------------------------------------------- 3 | // CERTI - HLA RunTime Infrastructure 4 | // Copyright (C) 2002, 2003, 2004 ONERA 5 | // 6 | // This file is part of CERTI 7 | // 8 | // CERTI-libCERTI is free software ; you can redistribute it and/or 9 | // modify it under the terms of the GNU Lesser General Public License 10 | // as published by the Free Software Foundation ; either version 2 of 11 | // the License, or (at your option) any later version. 12 | // 13 | // CERTI-libCERTI is distributed in the hope that it will be useful, but 14 | // WITHOUT ANY WARRANTY ; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | // Lesser General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU Lesser General Public 19 | // License along with this program ; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 21 | // USA 22 | // ---------------------------------------------------------------------------- 23 | */ 24 | 25 | /** 26 | * @mainpage 27 | *
28 | * \image html "certi.png" 29 | *
30 | *

User Documentation

31 | * 32 | * This is the CERTI user documentation. 33 | * The user documentation is divided into several part: 34 | * 35 | *
    36 | *
  • \ref intro
  • 37 | *
  • \ref execute
  • 38 | *
  • \ref certi_HLAtypesIEEE1516
  • 39 | *
      40 | *
    • \ref certi_HLAbasicType
    • 41 | *
    • \ref certi_HLAenumeratedType
    • 42 | *
    • \ref certi_HLAfixedArray
    • 43 | *
    • \ref certi_HLAfixedRecord
    • 44 | *
    • \ref certi_HLAvariableArray
    • 45 | *
    • \ref certi_HLAvariantRecord
    • 46 | *
    47 | *
48 | * 49 | */ 50 | 51 | -------------------------------------------------------------------------------- /tests/LibCERTI/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | enable_testing() 2 | 3 | include_directories(${CERTI_SOURCE_DIR}) # include root to enable syntax #include 4 | include_directories(${CERTI_BINARY_DIR}) 5 | 6 | find_package(Threads REQUIRED) 7 | 8 | include_directories(${CERTI_SOURCE_DIR}) 9 | 10 | ## Used for testing libcerti internal classes 11 | set(lib_certi_SRCS 12 | ${CERTI_SOURCE_DIR}/libCERTI/ObjectClassBroadcastList.cc 13 | ) 14 | 15 | add_executable(TestLibCERTI 16 | 17 | ../mocks/sockettcp_mock.h 18 | 19 | auditline_test.cpp 20 | 21 | networkmessage_test.cpp 22 | 23 | socketserver_test.cpp 24 | 25 | objectclassbroadcastlist_test.cpp 26 | objectclassbroadcastlist_benchmark.cpp 27 | 28 | ${lib_certi_SRCS} 29 | ../main.cpp 30 | ) 31 | 32 | target_link_libraries(TestLibCERTI 33 | CERTI 34 | ${GTEST_BOTH_LIBRARIES} 35 | ${GMOCK_BOTH_LIBRARIES} 36 | ${CMAKE_THREAD_LIBS_INIT} 37 | ) 38 | 39 | target_compile_definitions(TestLibCERTI PRIVATE CERTI_TEST) 40 | 41 | if (COMPILE_WITH_COVERAGE) 42 | SETUP_TARGET_FOR_COVERAGE( 43 | NAME TestLibCERTI_coverage 44 | EXECUTABLE TestLibCERTI --gtest_output=xml:../output/results-TestLibCERTI.xml 45 | DEPENDENCIES TestLibCERTI 46 | ) 47 | 48 | SETUP_TARGET_FOR_COVERAGE_COBERTURA( 49 | NAME TestLibCERTI_cobertura 50 | EXECUTABLE TestLibCERTI --gtest_output=xml:../output/results-TestLibCERTI.xml 51 | DEPENDENCIES TestLibCERTI 52 | ) 53 | endif() 54 | 55 | add_test(AllTests TestLibCERTI) 56 | -------------------------------------------------------------------------------- /include/ieee1516-2010/RTI/RangeBounds.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | The IEEE hereby grants a general, royalty-free license to copy, distribute, 3 | display and make derivative works from this material, for all purposes, 4 | provided that any use of the material contains the following 5 | attribution: "Reprinted with permission from IEEE 1516.1(TM)-2010". 6 | Should you require additional information, contact the Manager, Standards 7 | Intellectual Property, IEEE Standards Association (stds-ipr@ieee.org). 8 | ***********************************************************************/ 9 | /*********************************************************************** 10 | IEEE 1516.1 High Level Architecture Interface Specification C++ API 11 | File: RTI/RangeBounds.h 12 | ***********************************************************************/ 13 | 14 | #ifndef RTI_RangeBounds_h 15 | #define RTI_RangeBounds_h 16 | 17 | #include 18 | 19 | namespace rti1516e 20 | { 21 | class RTI_EXPORT RangeBounds 22 | { 23 | public: 24 | RangeBounds (); 25 | 26 | RangeBounds ( 27 | unsigned long lowerBound, 28 | unsigned long upperBound); 29 | 30 | ~RangeBounds () 31 | throw (); 32 | 33 | RangeBounds ( 34 | RangeBounds const & rhs); 35 | 36 | RangeBounds & operator= ( 37 | RangeBounds const & rhs); 38 | 39 | unsigned long getLowerBound () const; 40 | 41 | unsigned long getUpperBound () const; 42 | 43 | void setLowerBound ( 44 | unsigned long lowerBound); 45 | 46 | void setUpperBound ( 47 | unsigned long upperBound); 48 | 49 | private: 50 | unsigned long _lowerBound; 51 | unsigned long _upperBound; 52 | }; 53 | } 54 | 55 | #endif // RTI_RangeBounds_h 56 | -------------------------------------------------------------------------------- /libCERTI/NameReservation.hh: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // CERTI - HLA RunTime Infrastructure 3 | // Copyright (C) 2004 ONERA 4 | // 5 | // This file is part of CERTI-libCERTI 6 | // 7 | // CERTI-libCERTI is free software ; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public License 9 | // as published by the Free Software Foundation ; either version 2 of 10 | // the License, or (at your option) any later version. 11 | // 12 | // CERTI-libCERTI is distributed in the hope that it will be useful, but 13 | // WITHOUT ANY WARRANTY ; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | // Lesser General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU Lesser General Public 18 | // License along with this program ; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 20 | // USA 21 | // 22 | // ---------------------------------------------------------------------------- 23 | 24 | #ifndef LIBCERTI_NAME_RESERVATION_HH 25 | #define LIBCERTI_NAME_RESERVATION_HH 26 | 27 | #include "Handled.hh" 28 | #include "Named.hh" 29 | #include 30 | #include 31 | 32 | namespace certi { 33 | 34 | class NameReservation; 35 | 36 | typedef std::map NameReservationSet; 37 | 38 | class CERTI_EXPORT NameReservation : public Named, public Handled { 39 | public: 40 | NameReservation(FederateHandle the_owner, std::string the_name) 41 | : Named(the_name), Handled(the_owner) 42 | { 43 | } 44 | 45 | virtual ~NameReservation() 46 | { 47 | } 48 | }; 49 | 50 | } // namespace certi 51 | #endif // LIBCERTI_NAME_RESERVATION_HH 52 | -------------------------------------------------------------------------------- /libCERTI/FederateLevelList.hh: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // CERTI - HLA RunTime Infrastructure 3 | // Copyright (C) 2002-2018 ISAE-SUPAERO & ONERA 4 | // 5 | // This program is free software ; you can redistribute it and/or 6 | // modify it under the terms of the GNU Lesser General Public License 7 | // as published by the Free Software Foundation ; either version 2 of 8 | // the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, but 11 | // WITHOUT ANY WARRANTY ; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | // Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public 16 | // License along with this program ; if not, write to the Free Software 17 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 18 | // USA 19 | // 20 | // ---------------------------------------------------------------------------- 21 | 22 | #ifndef CERTI_FEDERATE_LEVEL_LIST_HH 23 | #define CERTI_FEDERATE_LEVEL_LIST_HH 24 | 25 | #include "SecurityLevel.hh" 26 | 27 | #include 28 | #include 29 | 30 | namespace certi { 31 | 32 | class CERTI_EXPORT FederateLevelList { 33 | public: 34 | FederateLevelList(); 35 | ~FederateLevelList(); 36 | 37 | void addFederate(const std::string& the_name, SecurityLevelID the_level_id); 38 | 39 | // Try to find the given principal name in the database, and return 40 | // its associated level. If not found, return PublicLevelID. 41 | SecurityLevelID getLevel(const std::string& theName) const; 42 | 43 | protected: 44 | std::map tuple; 45 | }; 46 | 47 | } // namespace certi 48 | 49 | #endif // CERTI_FEDERATE_LEVEL_LIST_HH 50 | -------------------------------------------------------------------------------- /scripts/UsePackageBackup.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # - Define a toplevel package_source_backup target 3 | # which build a dated tarball 4 | # 5 | # Those CMake macros are provided by the TSP Developer Team 6 | # https://savannah.nongnu.org/projects/tsp 7 | # 8 | IF (UNIX) 9 | FILE(WRITE ${CMAKE_BINARY_DIR}/PackageBackup.cmake 10 | "MESSAGE(STATUS \"Package Backup running...\") 11 | INCLUDE(CPackSourceConfig.cmake) 12 | MESSAGE(STATUS \"Package Backup gets username...\") 13 | # get the date 14 | EXECUTE_PROCESS(COMMAND whoami 15 | TIMEOUT 5 16 | RESULT_VARIABLE WHO_RES 17 | OUTPUT_VARIABLE WHO_OUT 18 | ERROR_VARIABLE WHO_ERR 19 | OUTPUT_STRIP_TRAILING_WHITESPACE) 20 | MESSAGE(STATUS \"Package Backup got \${WHO_OUT}.\") 21 | MESSAGE(STATUS \"Package Backup gets date...\") 22 | # get the date 23 | EXECUTE_PROCESS(COMMAND date +%d%b%Y-%Hh%M 24 | TIMEOUT 5 25 | RESULT_VARIABLE DATE_RES 26 | OUTPUT_VARIABLE DATE_OUT 27 | ERROR_VARIABLE DATE_ERR 28 | OUTPUT_STRIP_TRAILING_WHITESPACE) 29 | MESSAGE(STATUS \"Package Backup got \${DATE_OUT}.\") 30 | # run cpack 31 | MESSAGE(STATUS \"Package Backup running cpack...\") 32 | EXECUTE_PROCESS(COMMAND cpack -G TGZ --config CPackSourceConfig.cmake 33 | TIMEOUT 3600 34 | WORKING_DIRECTORY \${CMAKE_BINARY_DIR}) 35 | MESSAGE(STATUS \"Copy \${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.gz --> \${CPACK_SOURCE_PACKAGE_FILE_NAME}-\${WHO_OUT}-\${DATE_OUT}.tar.gz\") 36 | EXECUTE_PROCESS(COMMAND \${CMAKE_COMMAND} -E copy \${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.gz \${CPACK_SOURCE_PACKAGE_FILE_NAME}-\${WHO_OUT}-\${DATE_OUT}.tar.gz) 37 | MESSAGE(STATUS \"Package backup done in: \${CPACK_SOURCE_PACKAGE_FILE_NAME}-\${WHO_OUT}-\${DATE_OUT}.tar.gz\")" 38 | ) 39 | # 40 | # Add custom target 41 | # 42 | ADD_CUSTOM_TARGET(package_source_backup 43 | COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/PackageBackup.cmake 44 | ) 45 | 46 | ENDIF(UNIX) 47 | -------------------------------------------------------------------------------- /RTIG/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${CMAKE_SOURCE_DIR}) 2 | 3 | find_program(GENGETOPT_PROGRAM NAMES gengetopt) 4 | if (GENGETOPT_PROGRAM) 5 | set(GGOFILE ${CMAKE_CURRENT_SOURCE_DIR}/RTIG.ggo) 6 | add_custom_target(GenRTIGCmdline 7 | COMMAND ${GENGETOPT_PROGRAM} --no-handle-error --show-required -i ${GGOFILE} 8 | DEPENDS ${GGOFILE} 9 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 10 | COMMENT "Regenerate RTIG command line C files -- (from ${GGOFILE})" 11 | ) 12 | endif(GENGETOPT_PROGRAM) 13 | set(rtig_SRCS_generated 14 | ${CMAKE_CURRENT_SOURCE_DIR}/RTIG_cmdline.c ${CMAKE_CURRENT_SOURCE_DIR}/RTIG_cmdline.h) 15 | 16 | if (CMAKE_COMPILER_IS_GNUCC) 17 | message(STATUS "INHIBIT Compiler (GCC) warning for gengetopt generated files: ${rtig_SRCS_generated}.") 18 | set_source_files_properties(${rtig_SRCS_generated} 19 | PROPERTIES COMPILE_FLAGS "-w") 20 | endif(CMAKE_COMPILER_IS_GNUCC) 21 | 22 | if (MSVC) 23 | message(STATUS "INHIBIT Compiler (MSVC) warning for gengetopt generated files: ${rtig_SRCS_generated}.") 24 | set_source_files_properties(${rtig_SRCS_generated} 25 | PROPERTIES COMPILE_FLAGS "-D_CRT_SECURE_NO_WARNINGS") 26 | endif(MSVC) 27 | 28 | set(rtig_SRCS 29 | Federate.cc Federate.hh 30 | Federation.cc Federation_fom.cc Federation.hh 31 | FederationsList.cc FederationsList.hh 32 | main.cc 33 | 34 | MessageProcessor.cc MessageProcessor.hh 35 | Mom.cc Mom_interactions.cc Mom_objects.cc Mom.hh 36 | 37 | RTIG.cc RTIG.hh 38 | ${rtig_SRCS_generated} 39 | ) 40 | 41 | add_executable(rtig ${rtig_SRCS}) 42 | target_link_libraries(rtig CERTI) 43 | 44 | install(TARGETS rtig 45 | EXPORT CERTIDepends 46 | RUNTIME DESTINATION bin 47 | LIBRARY DESTINATION lib 48 | ARCHIVE DESTINATION lib) 49 | -------------------------------------------------------------------------------- /libCERTI/Dimension.cc: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // CERTI - HLA RunTime Infrastructure 3 | // Copyright (C) 2003-2005 ONERA 4 | // 5 | // This file is part of CERTI-libCERTI 6 | // 7 | // CERTI-libCERTI is free software ; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public License 9 | // as published by the Free Software Foundation ; either version 2 of 10 | // the License, or (at your option) any later version. 11 | // 12 | // CERTI-libCERTI is distributed in the hope that it will be useful, but 13 | // WITHOUT ANY WARRANTY ; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | // Lesser General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU Lesser General Public 18 | // License along with this program ; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 20 | // USA 21 | // 22 | // ---------------------------------------------------------------------------- 23 | 24 | #include "Dimension.hh" 25 | #include 26 | 27 | namespace certi { 28 | 29 | uint32_t Dimension::axisLowerBound = 0; 30 | uint32_t Dimension::axisUpperBound = UINT_MAX; 31 | 32 | Dimension::Dimension(DimensionHandle dimensionHandle) 33 | { 34 | /* initialize handle from superclass */ 35 | this->handle = dimensionHandle; 36 | } 37 | 38 | // ---------------------------------------------------------------------------- 39 | void Dimension::setLowerBound(uint32_t lowerBound) 40 | { 41 | Dimension::axisLowerBound = lowerBound; 42 | } 43 | 44 | // ---------------------------------------------------------------------------- 45 | void Dimension::setUpperBound(uint32_t upperBound) 46 | { 47 | Dimension::axisUpperBound = upperBound; 48 | } 49 | 50 | } // namespace certi 51 | -------------------------------------------------------------------------------- /test/Billard/Ball.hh: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // CERTI - HLA RunTime Infrastructure 3 | // Copyright (C) 2002-2018 ISAE-SUPAERO & ONERA 4 | // 5 | // This file is part of CERTI 6 | // 7 | // CERTI is free software ; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation ; either version 2 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // CERTI is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY ; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program ; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | // 21 | // $Id: Ball.hh,v 3.5 2005/04/30 17:55:43 breholee Exp $ 22 | // ---------------------------------------------------------------------------- 23 | 24 | #ifndef CERTI_BALL_HH 25 | #define CERTI_BALL_HH 26 | 27 | #include "RTI.hh" 28 | 29 | class Ball 30 | { 31 | public: 32 | Ball(RTI::ObjectHandle); 33 | 34 | float x, y ; 35 | float dx, dy ; 36 | float radius ; 37 | 38 | float olddx, olddy ; 39 | float color ; 40 | 41 | bool active ; 42 | 43 | unsigned long ID ; // object handle 44 | 45 | void display(); 46 | void erase(); 47 | void move(); 48 | void setPosition(float, float); 49 | void setDirection(float, float); 50 | void checkBorderCollision(float, float); 51 | bool checkBallCollision(Ball *); 52 | 53 | void init(int); 54 | void init(int, int); 55 | }; 56 | 57 | #endif // CERTI_BALL_HH 58 | 59 | // $Id: Ball.hh,v 3.5 2005/04/30 17:55:43 breholee Exp $ 60 | -------------------------------------------------------------------------------- /scripts/FindMd5sum.cmake: -------------------------------------------------------------------------------- 1 | # find md5sum 2 | 3 | SET(Md5sum_FOUND FALSE) 4 | FIND_PROGRAM(Md5sum_EXECUTABLE md5sum) 5 | MARK_AS_ADVANCED(Md5sum_EXECUTABLE) 6 | 7 | IF (Md5sum_EXECUTABLE) 8 | SET(Md5sum_FOUND TRUE) 9 | ENDIF (Md5sum_EXECUTABLE) 10 | 11 | # Compute the md5sums file by doing a recursion of directory: `DIRECTORY` 12 | MACRO(COMPUTE_MD5SUMS DIRECTORY OUTPUT_FILE) 13 | 14 | # Super ugly and barely readable but you need that in order to 15 | # work around a deficiency in EXECUTE_PROCESS which does not have dependencie scanning 16 | FILE(WRITE 17 | ${CMAKE_BINARY_DIR}/md5sum.cmake 18 | " 19 | FILE(GLOB_RECURSE MD5SUM_INPUT_FILES 20 | ${DIRECTORY}/* 21 | ) 22 | 23 | EXECUTE_PROCESS( 24 | COMMAND md5sum \${MD5SUM_INPUT_FILES} 25 | WORKING_DIRECTORY ${DIRECTORY} 26 | OUTPUT_VARIABLE md5sum_VAR 27 | # OUTPUT_STRIP_TRAILING_WHITESPACE 28 | RESULT_VARIABLE md5sum_RES 29 | ) 30 | # apparently md5sums start with: usr/... 31 | STRING(REPLACE ${DIRECTORY}/ 32 | \"\" md5sum_VAR_clean 33 | \${md5sum_VAR}) 34 | FILE(WRITE ${CMAKE_BINARY_DIR}/md5sums \${md5sum_VAR_clean}) 35 | " 36 | ) 37 | 38 | ADD_CUSTOM_COMMAND( 39 | OUTPUT ${OUTPUT_FILE} 40 | COMMAND cmake 41 | ARGS -P ${CMAKE_BINARY_DIR}/md5sum.cmake 42 | WORKING_DIRECTORY ${CMAKE_BINARY_DIR} 43 | DEPENDS ${DIRECTORY} ${CMAKE_BINARY_DIR}/md5sum.cmake 44 | COMMENT "Generating md5sums" 45 | ) 46 | 47 | ENDMACRO(COMPUTE_MD5SUMS) 48 | 49 | # Report the results. 50 | IF(NOT Md5sum_FOUND) 51 | SET(Md5sum_DIR_MESSAGE 52 | "Md5sum was not found. Make sure the entries Md5sum_* are set.") 53 | IF(NOT Md5sum_FIND_QUIETLY) 54 | MESSAGE(STATUS "${Md5sum_DIR_MESSAGE}") 55 | ELSE(NOT Md5sum_FIND_QUIETLY) 56 | IF(Md5sum_FIND_REQUIRED) 57 | MESSAGE(FATAL_ERROR "${Md5sum_DIR_MESSAGE}") 58 | ENDIF(Md5sum_FIND_REQUIRED) 59 | ENDIF(NOT Md5sum_FIND_QUIETLY) 60 | ENDIF(NOT Md5sum_FOUND) 61 | 62 | -------------------------------------------------------------------------------- /libHLA/TSCClock.hh: -------------------------------------------------------------------------------- 1 | #ifndef TSCCLOCK_HH_ 2 | #define TSCCLOCK_HH_ 3 | 4 | #include "Clock.hh" 5 | 6 | namespace libhla { 7 | namespace clock { 8 | /** 9 | * The TSCClock is a Clock using the Time Stamp Counter 10 | * which may be found in Pentium-like processors 11 | * http://en.wikipedia.org/wiki/Time_Stamp_Counter 12 | * Note that using TSC on a symmetric (or multi-core) 13 | * multi-processor system may gives unexpected results 14 | * moreover TSC behavior may be biaised if processor 15 | * supports dynamic frequency scaling such as Pentium M 16 | * used on mobile device. 17 | * If you want a more "robust" Clock class you may use PosixClock. 18 | */ 19 | class HLA_EXPORT TSCClock : public Clock { 20 | public: 21 | TSCClock(); 22 | /** 23 | * Get the clock resolution in nano-seconds. 24 | * @return the clock resolution in nano-seconds 25 | */ 26 | virtual double getResolution(); 27 | /** 28 | * Get the current ticks value. 29 | * @return the current ticks value 30 | */ 31 | virtual uint64_t getCurrentTicksValue(); 32 | /** 33 | * Convert a number of ticks into a double value 34 | * representing nanoseconds. 35 | * @param[in] ticks the number of tick to convert 36 | * @return the nano-seconds value 37 | */ 38 | virtual double tick2NanoSecond(const uint64_t ticks); 39 | virtual ~TSCClock(); 40 | 41 | private: 42 | /** 43 | * Get processor frequency 44 | * @return the processor frequency in MHz 45 | */ 46 | static double getProcessorFrequency(); 47 | 48 | /** 49 | * Read the Time Stamp Counter using 50 | * rdtsc assembly instruction 51 | */ 52 | inline uint64_t readTSC() 53 | { 54 | uint64_t tsc; 55 | __asm__ __volatile__("rdtsc" : "=A"(tsc)); 56 | return tsc; 57 | }; 58 | 59 | /** 60 | * The TSC clock resolution in nano-seconds 61 | */ 62 | double resolution; 63 | }; 64 | 65 | } /* end namespace clock */ 66 | } /* end namespace libhla */ 67 | #endif /*TSCCLOCK_HH_*/ 68 | -------------------------------------------------------------------------------- /libCERTI/Handle.hh: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // CERTI - HLA RunTime Infrastructure 3 | // Copyright (C) 2003 ONERA 4 | // 5 | // This file is part of CERTI-libCERTI 6 | // 7 | // CERTI-libCERTI is free software ; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public License 9 | // as published by the Free Software Foundation ; either version 2 of 10 | // the License, or (at your option) any later version. 11 | // 12 | // CERTI-libCERTI is distributed in the hope that it will be useful, but 13 | // WITHOUT ANY WARRANTY ; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | // Lesser General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU Lesser General Public 18 | // License along with this program ; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 20 | // USA 21 | // 22 | // ---------------------------------------------------------------------------- 23 | 24 | #ifndef _CERTI_HANDLE_HH 25 | #define _CERTI_HANDLE_HH 26 | 27 | #include 28 | 29 | #include "StrongType.hh" 30 | 31 | namespace certi { 32 | 33 | typedef uint32_t Handle; 34 | 35 | typedef Handle FederateHandle; 36 | // // // // // using FederateHandle = NamedType; 37 | // typedef Handle FederationHandle; 38 | using FederationHandle 39 | = NamedType; 40 | 41 | typedef Handle ObjectClassHandle; 42 | typedef Handle InteractionClassHandle; 43 | typedef Handle AttributeHandle; 44 | typedef Handle ParameterHandle; 45 | typedef Handle ObjectHandle; 46 | typedef Handle DimensionHandle; 47 | typedef Handle SpaceHandle; 48 | typedef Handle EventRetractionHandle; 49 | typedef Handle RegionHandle; 50 | } 51 | 52 | #endif // _CERTI_HANDLE_HH 53 | -------------------------------------------------------------------------------- /libCERTI/InteractionBroadcastList.hh: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // CERTI - HLA RunTime Infrastructure 3 | // Copyright (C) 2002-2018 ISAE-SUPAERO & ONERA 4 | // 5 | // This program is free software ; you can redistribute it and/or 6 | // modify it under the terms of the GNU Lesser General Public License 7 | // as published by the Free Software Foundation ; either version 2 of 8 | // the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, but 11 | // WITHOUT ANY WARRANTY ; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | // Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public 16 | // License along with this program ; if not, write to the Free Software 17 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 18 | // USA 19 | // 20 | // ---------------------------------------------------------------------------- 21 | 22 | #ifndef CERTI_INTERACTION_BROADCAST_LIST_HH 23 | #define CERTI_INTERACTION_BROADCAST_LIST_HH 24 | 25 | #include "MessageEvent.hh" 26 | #include "NM_Classes.hh" 27 | #include "NetworkMessage.hh" 28 | #include "SecurityServer.hh" 29 | #include 30 | 31 | #include 32 | 33 | namespace certi { 34 | 35 | class InteractionBroadcastList { 36 | public: 37 | InteractionBroadcastList(NM_Receive_Interaction message); 38 | 39 | ~InteractionBroadcastList() = default; 40 | 41 | void addFederate(FederateHandle theFederate); 42 | 43 | Responses preparePendingMessage(SecurityServer& server); 44 | 45 | NM_Receive_Interaction& getMessage(); 46 | 47 | private: 48 | enum class State { Sent, Waiting, NotSub }; 49 | 50 | NM_Receive_Interaction my_message; 51 | 52 | std::unordered_map my_lines; 53 | }; 54 | } 55 | 56 | #endif // CERTI_INTERACTION_BROADCAST_LIST_HH 57 | -------------------------------------------------------------------------------- /test/Billard/ColoredBall.cc: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // CERTI - HLA RunTime Infrastructure 3 | // Copyright (C) 2002-2018 ISAE-SUPAERO & ONERA 4 | // 5 | // This file is part of CERTI 6 | // 7 | // CERTI is free software ; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation ; either version 2 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // CERTI is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY ; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program ; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | // 21 | // $Id: ColoredBall.cc,v 3.6 2007/07/06 09:25:19 erk Exp $ 22 | // ---------------------------------------------------------------------------- 23 | 24 | #include "ColoredBall.hh" 25 | 26 | #include 27 | 28 | 29 | #include "graph_c.hh" 30 | 31 | using namespace std ; 32 | 33 | // ---------------------------------------------------------------------------- 34 | //! CBoule constructor. 35 | ColoredBall::ColoredBall(RTI::ObjectHandle h) : Ball(h) 36 | { 37 | #ifndef X_DISPLAY_MISSING 38 | Color = RED ; 39 | #endif 40 | } 41 | 42 | // ---------------------------------------------------------------------------- 43 | //! Displays the 'boule' on the right place in window. 44 | void 45 | ColoredBall::display() 46 | { 47 | #ifndef X_DISPLAY_MISSING 48 | cercler disque ; 49 | point centre ; 50 | 51 | centre.X = (int) x ; 52 | centre.Y = (int) y ; 53 | disque = Definecr(centre, (int) radius, COUL_UNIE, (couleur) Color); 54 | Drawcr(disque); 55 | #endif 56 | } 57 | 58 | // $Id: ColoredBall.cc,v 3.6 2007/07/06 09:25:19 erk Exp $ 59 | -------------------------------------------------------------------------------- /libCERTI/SecurityLevel.hh: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // CERTI - HLA RunTime Infrastructure 3 | // Copyright (C) 2002, 2003 ONERA 4 | // 5 | // This file is part of CERTI-libCERTI 6 | // 7 | // CERTI-libCERTI is free software ; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public License 9 | // as published by the Free Software Foundation ; either version 2 of 10 | // the License, or (at your option) any later version. 11 | // 12 | // CERTI-libCERTI is distributed in the hope that it will be useful, but 13 | // WITHOUT ANY WARRANTY ; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | // Lesser General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU Lesser General Public 18 | // License along with this program ; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 20 | // USA 21 | // 22 | // $Id: SecurityLevel.hh,v 3.12 2009/11/19 18:15:30 erk Exp $ 23 | // ---------------------------------------------------------------------------- 24 | 25 | #ifndef _CERTI_SECURITY_LEVEL_HH 26 | #define _CERTI_SECURITY_LEVEL_HH 27 | 28 | #include "Exception.hh" 29 | #include 30 | 31 | #include 32 | 33 | typedef std::string SecurityLevelName; 34 | typedef unsigned short SecurityLevelID; 35 | 36 | #define PublicLevelID 0 37 | #define PublicLevelName "Public" 38 | 39 | namespace certi { 40 | 41 | class SecurityLevel { 42 | public: 43 | SecurityLevelName Name; 44 | SecurityLevelID LevelID; 45 | 46 | SecurityLevel(const std::string& InitName, SecurityLevelID InitLevelID) 47 | { 48 | if (InitName.empty()) 49 | throw RTIinternalError("Bad Security Level Name."); 50 | Name = InitName; 51 | LevelID = InitLevelID; 52 | } 53 | }; 54 | } 55 | 56 | #endif // _CERTI_SECURITY_LEVEL_HH 57 | 58 | // $Id: SecurityLevel.hh,v 3.12 2009/11/19 18:15:30 erk Exp $ 59 | -------------------------------------------------------------------------------- /scripts/FindLexYacc.cmake: -------------------------------------------------------------------------------- 1 | IF(UNIX) 2 | FILE(TO_CMAKE_PATH "/usr/local/bin" PATH_DIR) 3 | ENDIF(UNIX) 4 | 5 | IF(WIN32) 6 | SET(PATH_DIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32;InstallPath]/bin") 7 | ENDIF(WIN32) 8 | 9 | MESSAGE(STATUS "Looking for lex...") 10 | # FIND_PROGRAM twice using NO_DEFAULT_PATH on first shot 11 | FIND_PROGRAM(LEX_PROGRAM 12 | NAMES flex lex 13 | PATHS ${PATH_DIR} 14 | NO_DEFAULT_PATH 15 | DOC "A lex-compatible lexer generator") 16 | FIND_PROGRAM(LEX_PROGRAM 17 | NAMES flex lex 18 | PATHS ${PATH_DIR} 19 | DOC "A lex-compatible lexer generator") 20 | 21 | IF (LEX_PROGRAM) 22 | MESSAGE(STATUS "Looking for lex... - found lex is ${LEX_PROGRAM}") 23 | SET(LEX_FOUND "YES") 24 | ELSE (LEX_PROGRAM) 25 | SET(LEX_FOUND "NO") 26 | MESSAGE(STATUS "Looking for lex... - NOT found") 27 | ENDIF (LEX_PROGRAM) 28 | 29 | MESSAGE(STATUS "Looking for yacc...") 30 | # FIND_PROGRAM twice using NO_DEFAULT_PATH on first shot 31 | FIND_PROGRAM(YACC_PROGRAM 32 | NAMES bison yacc yacc.bison 33 | PATHS ${PATH_DIR} 34 | NO_DEFAULT_PATH 35 | DOC "A yacc-compatible parser generator") 36 | FIND_PROGRAM(YACC_PROGRAM 37 | NAMES bison yacc yacc.bison 38 | PATHS ${PATH_DIR} 39 | DOC "A yacc-compatible parser generator") 40 | 41 | IF (YACC_PROGRAM) 42 | SET(YACC_FOUND "YES") 43 | MESSAGE(STATUS "Looking for yacc... - found yacc is ${YACC_PROGRAM}") 44 | IF ("${YACC_PROGRAM}" MATCHES ".*bison.*") 45 | SET(YACC_COMPAT_ARG -y) 46 | ELSE ("${YACC_PROGRAM}" MATCHES ".*bison.*") 47 | SET(YACC_COMPAT_ARG ) 48 | ENDIF ("${YACC_PROGRAM}" MATCHES ".*bison.*") 49 | ELSE (YACC_PROGRAM) 50 | SET(YACC_FOUND "NO") 51 | MESSAGE(STATUS "Looking for yacc... - NOT found") 52 | ENDIF (YACC_PROGRAM) 53 | 54 | IF(WIN32) 55 | IF(LEX_FOUND) 56 | get_filename_component(PATH_LEX ${LEX_PROGRAM} PATH) 57 | get_filename_component(INCLUDE_LEX ${PATH_LEX} PATH) 58 | if (NOT CMAKE_CROSSCOMPILING) 59 | INCLUDE_DIRECTORIES(${INCLUDE_LEX}/include) 60 | endif() 61 | ENDIF(LEX_FOUND) 62 | ENDIF(WIN32) -------------------------------------------------------------------------------- /tests/LibHLA/clock_test.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | using ::std::cout; 6 | using ::std::cerr; 7 | using ::std::endl; 8 | 9 | // #include 10 | #include 11 | 12 | #include 13 | 14 | void clockTests(libhla::clock::Clock& aClock) 15 | { 16 | cout << "Testing clock <" << aClock.getName() << "> BEGIN..." << endl; 17 | cout << " Clock resolution is: " << aClock.getResolution() << " nano-seconds" << endl; 18 | 19 | uint64_t tick1 = aClock.getCurrentTicksValue(); 20 | uint64_t tick2 = aClock.getCurrentTicksValue(); 21 | 22 | cout << " Tick1 = " << tick1 << endl; 23 | cout << " Tick2 = " << tick2 << endl; 24 | 25 | cout << " Delta = " << aClock.getDeltaNanoSecond(tick1, tick2) << " nano-seconds" << endl; 26 | cout << "Testing clock <" << aClock.getName() << "> END." << endl; 27 | } 28 | 29 | #ifdef HAVE_TSC_CLOCK 30 | #include 31 | 32 | TEST(ClockTest, TscClock) 33 | { 34 | libhla::clock::TSCClock tscClk; 35 | 36 | clockTests(tscClk); 37 | } 38 | #endif 39 | 40 | #ifdef HAVE_POSIX_CLOCK 41 | #include 42 | 43 | TEST(ClockTest, PosixClock) 44 | { 45 | libhla::clock::PosixClock posixClk; 46 | 47 | clockTests(posixClk); 48 | } 49 | #endif 50 | 51 | #ifdef HAVE_GETTIMEOFDAY 52 | #include 53 | 54 | TEST(ClockTest, GetTimeOfDayClock) 55 | { 56 | libhla::clock::GettimeofdayClock gettimeofdayClock; 57 | 58 | clockTests(gettimeofdayClock); 59 | } 60 | #endif 61 | 62 | #ifdef HAVE_WIN_CLOCK 63 | #include 64 | #include 65 | 66 | TEST(ClockTest, WinClock) 67 | { 68 | libhla::clock::WinClock WinClk; 69 | libhla::clock::WinPerfClock WinPerfClk; 70 | 71 | clockTests(WinClk); 72 | clockTests(WinPerfClk); 73 | } 74 | #endif 75 | 76 | TEST(ClockTest, BestClock) 77 | { 78 | libhla::clock::Clock* myClock = libhla::clock::Clock::getBestClock(); 79 | clockTests(*myClock); 80 | delete myClock; 81 | } 82 | -------------------------------------------------------------------------------- /test/ModernBillard/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(BEFORE 2 | ${CMAKE_SOURCE_DIR}/libCERTI 3 | ${CMAKE_SOURCE_DIR}/test/libgraphc 4 | ${CMAKE_SOURCE_DIR}/include/ 5 | ${CMAKE_SOURCE_DIR}/include/ieee1516-2010 6 | ${CMAKE_BINARY_DIR}/include/ieee1516-2010) 7 | include_directories(${CERTI_SOURCE_DIR}/libHLA) 8 | 9 | if (WIN32) 10 | add_definitions(-DHAVE_STRING_H) 11 | endif (WIN32) 12 | 13 | set(modern_billard_SRCS 14 | main.cc 15 | billard.cc 16 | ) 17 | 18 | if(X_DISPLAY_MISSING) 19 | message(STATUS "Some X11 header were not found: only Billard Test Application with no GUI will be built.") 20 | else() 21 | add_executable(modern_billard ${modern_billard_SRCS}) 22 | target_link_libraries(modern_billard 23 | graph RTI1516e FedTime1516e) 24 | 25 | install(TARGETS modern_billard 26 | RUNTIME DESTINATION bin 27 | LIBRARY DESTINATION lib 28 | ARCHIVE DESTINATION lib 29 | ) 30 | endif(X_DISPLAY_MISSING) 31 | 32 | add_executable(modern_billard-nogui ${modern_billard_SRCS}) 33 | 34 | set_target_properties(modern_billard-nogui 35 | PROPERTIES COMPILE_FLAGS "-DX_DISPLAY_MISSING=1") 36 | target_link_libraries(modern_billard-nogui 37 | RTI1516e FedTime1516e) 38 | 39 | install(TARGETS modern_billard-nogui 40 | RUNTIME DESTINATION bin 41 | LIBRARY DESTINATION lib 42 | ARCHIVE DESTINATION lib 43 | ) 44 | 45 | if (CMAKE_VERSION VERSION_LESS 3.1.3) 46 | include(CheckCXXCompilerFlag) 47 | check_cxx_compiler_flag(-std=c++14 HAVE_FLAG_STD_CXX14) 48 | if(HAVE_FLAG_STD_CXX14) 49 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") 50 | else() 51 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y") 52 | endif() 53 | else() 54 | if(TARGET modern_billard) 55 | set_property(TARGET modern_billard PROPERTY CXX_STANDARD 14) 56 | endif() 57 | 58 | set_property(TARGET modern_billard-nogui PROPERTY CXX_STANDARD 14) 59 | endif() 60 | 61 | install(FILES 62 | Base.xml Create.xml Join.xml 63 | DESTINATION share/federations) 64 | -------------------------------------------------------------------------------- /libHLA/SemaphoreSysV.hh: -------------------------------------------------------------------------------- 1 | #ifndef SEMAPHORESYSV_H 2 | #define SEMAPHORESYSV_H 3 | 4 | #include 5 | #include 6 | 7 | #include "Semaphore.hh" 8 | 9 | #include "libhla.hh" 10 | 11 | namespace libhla { 12 | namespace ipc { 13 | 14 | class HLA_EXPORT SemaphoreSysV : public Semaphore { 15 | private: 16 | int _Sem_Id; 17 | key_t _Sem_Key; 18 | 19 | public: 20 | SemaphoreSysV(); 21 | virtual ~SemaphoreSysV(); 22 | void Create_Init(const int initval, const std::string& New_Semname); 23 | void Attach(const std::string& New_Semname); 24 | void P(); 25 | void V(); 26 | void Delete(); 27 | 28 | /** 29 | * Build a SysV IPC key from a name and user specific value. 30 | * The purpose of this function is to build a (quasi) unique 31 | * key from unique entry as ftok(3) do with existing file name. 32 | * We use SHA1 hash function Xored with the user_specific 33 | * value supplied. 34 | * @param[in] name, the name representing the IPC element for which 35 | * we want a key. 36 | * @param[in] user_specific_value, any user specific value 37 | * (for example uid). 38 | * @return The generated SysV IPC key corresponding to the specified entry 39 | */ 40 | key_t static ntokUser(const char* name, int32_t user_specific_value); 41 | 42 | /** 43 | * Build a SysV IPC key from a name. 44 | * L'objectif de cette fonction est de generer des 45 | * clefs differentes pour des noms differents, a la maniere 46 | * d'une fonction de hachage ou checksum parfaite. 47 | * Cette fonction vise les meme objectifs que ftok(3) 48 | * avec les noms de fichiers mais avec une chaine 49 | * de caractere quelconque. 50 | * @param name un nom representant l'element IPC pour lequel on 51 | * veut generer une clef. 52 | * @return SysV IPC key corresponding to the specified name. 53 | */ 54 | key_t static ntok(const char* name); 55 | }; 56 | } /* end namespace ipc */ 57 | } /* end namespace libhla */ 58 | #endif 59 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | 2 | License 3 | ------- 4 | 5 | See COPYING file for use/modification/distribution conditions. 6 | The main license (GPL) can be found in the file "gpl.txt". The license 7 | for libraries librti and libcerti (LGPL) can be found in the file 8 | "lesser.txt". 9 | 10 | Installation 11 | ------------ 12 | 13 | The CERTI build system is using CMake 14 | (http://www.cmake.org/HTML/RunningCMake.html) such that 15 | you need to have a working CMake on your system in order to build CERTI. 16 | 17 | Depending on the target platform (Windows, Linux, Solaris...) and 18 | the compiler (GCC, Visual Studio, MinGW, ...) the CERTI CMake build 19 | system should discover and require the needed dependency. 20 | 21 | The fast (and hopefully easy) way to build CERTI is: 22 | 23 | 1) Get the CERTI tarball or zip from 24 | http://download.savannah.nongnu.org/releases/certi/ 25 | 26 | 2) Unzip/Untar the archive 27 | This will create CERTI-X.Y.Z-Source/ directory 28 | 29 | on Unix this would be 30 | tar zxvf CERTI-X.Y.Z.tar.gz 31 | 32 | 3) Create a build directory 33 | Build_CERTI-X.Y.Z/ 34 | mkdir Build_CERTI-X.Y.Z 35 | 36 | 4) Go to the build directory and launch CMake 37 | cd Build_CERTI-X.Y.Z 38 | cmake /CERTI-X.Y.Z-Source 39 | 40 | may be 41 | cmake ../CERTI-X.Y.Z-Source 42 | 43 | one may choose the installation prefix with 44 | cmake -DCMAKE_INSTALL_PREFIX=/path/to/install ../CERTI-X.Y.Z-Source 45 | 46 | or launch an interactive CMake UI in order to modify CMAKE_INSTALL_PREFIX. 47 | cmake-gui ../CERTI-X.Y.Z-Source 48 | or 49 | ccmake ../CERTI-X.Y.Z-Source 50 | 51 | 5) Build 52 | make 53 | 54 | 6) Install 55 | make install 56 | 57 | The command used for building and installing CERTI depends 58 | on the platform/compiler combination you chose. The previous 59 | examples are for Unix-like system with make. 60 | You may look at 61 | http://www.nongnu.org/certi/certi_doc/Install/html/index.html 62 | for other build examples. 63 | or generic CMake usage: 64 | http://www.cmake.org/cmake/help/runningcmake.html -------------------------------------------------------------------------------- /libHLA/SHMSysV.hh: -------------------------------------------------------------------------------- 1 | #ifndef SHM_SYSV_H 2 | #define SHM_SYSV_H 3 | 4 | // SHMs useful systems includes 5 | #ifndef _POSIX_C_SOURCE 6 | #define _POSIX_C_SOURCE 200112L 7 | #endif 8 | 9 | #include 10 | 11 | #include "SHM.hh" 12 | 13 | namespace libhla { 14 | namespace ipc { 15 | 16 | class HLA_EXPORT SHMSysV : public SHM { 17 | private: 18 | int _Id; 19 | key_t _Key; 20 | 21 | public: 22 | SHMSysV(const std::string& SHMName, const int SHMSize, const bool True); 23 | SHMSysV(const std::string& SHMName, const int SHMSize); 24 | virtual ~SHMSysV(); 25 | void Open(); 26 | void Attach(); 27 | void Close(); 28 | 29 | /** 30 | * Build a SysV IPC key from a name and user specific value. 31 | * The purpose of this function is to build a (quasi) unique 32 | * key from unique entry as ftok(3) do with existing file name. 33 | * We use SHA1 hash function Xored with the user_specific 34 | * value supplied. 35 | * @param[in] name, the name representing the IPC element for which 36 | * we want a key. 37 | * @param[in] user_specific_value, any user specific value 38 | * (for example uid). 39 | * @return The generated SysV IPC key corresponding to the specified entry 40 | */ 41 | key_t static ntokUser(const char* name, int32_t user_specific_value); 42 | 43 | /** 44 | * Build a SysV IPC key from a name. 45 | * L'objectif de cette fonction est de generer des 46 | * clefs differentes pour des noms differents, a la maniere 47 | * d'une fonction de hachage ou checksum parfaite. 48 | * Cette fonction vise les meme objectifs que ftok(3) 49 | * avec les noms de fichiers mais avec une chaine 50 | * de caractere quelconque. 51 | * @param name un nom representant l'element IPC pour lequel on 52 | * veut generer une clef. 53 | * @return SysV IPC key corresponding to the specified name. 54 | */ 55 | key_t static ntok(const char* name); 56 | }; 57 | 58 | } /* end namespace ipc */ 59 | } /* end namespace libhla */ 60 | #endif 61 | -------------------------------------------------------------------------------- /libCERTI/Message.cc: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // CERTI - HLA RunTime Infrastructure 3 | // Copyright (C) 2002-2018 ISAE-SUPAERO & ONERA 4 | // 5 | // This program is free software ; you can redistribute it and/or 6 | // modify it under the terms of the GNU Lesser General Public License 7 | // as published by the Free Software Foundation ; either version 2 of 8 | // the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, but 11 | // WITHOUT ANY WARRANTY ; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | // Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public 16 | // License along with this program ; if not, write to the Free Software 17 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | // ---------------------------------------------------------------------------- 19 | 20 | #include "Message.hh" 21 | #include "PrettyDebug.hh" 22 | #include "certi.hh" 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | using std::vector; 30 | 31 | namespace certi { 32 | 33 | static PrettyDebug G("GENDOC", __FILE__); 34 | 35 | Message::Message() 36 | { 37 | exception = Exception::Type::NO_EXCEPTION; 38 | exceptionReason = ""; 39 | messageName = "Message (generic)"; 40 | type = NOT_USED; 41 | resignAction = certi::NO_ACTION; 42 | space = 0; 43 | dimension = 0; 44 | } /* end of Message default constructor */ 45 | 46 | // ---------------------------------------------------------------------------- 47 | /** Store exception into message 48 | @param the_exception : exception type (enum) 49 | @param the_reason : exception reason 50 | */ 51 | void Message::setException(const Exception::Type the_exception, const std::string& the_reason) 52 | { 53 | exception = the_exception; 54 | exceptionReason = the_reason; 55 | } 56 | 57 | } // namespace certi 58 | -------------------------------------------------------------------------------- /libCERTI/FederateLevelList.cc: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // CERTI - HLA RunTime Infrastructure 3 | // Copyright (C) 2002, 2003 ONERA 4 | // 5 | // This file is part of CERTI-libCERTI 6 | // 7 | // CERTI-libCERTI is free software ; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public License 9 | // as published by the Free Software Foundation ; either version 2 of 10 | // the License, or (at your option) any later version. 11 | // 12 | // CERTI-libCERTI is distributed in the hope that it will be useful, but 13 | // WITHOUT ANY WARRANTY ; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | // Lesser General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU Lesser General Public 18 | // License along with this program ; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 20 | // USA 21 | // 22 | // ---------------------------------------------------------------------------- 23 | 24 | #include "FederateLevelList.hh" 25 | 26 | namespace certi { 27 | 28 | // ---------------------------------------------------------------------------- 29 | //! add a new federate to Tuple. 30 | /*! Register a new federate principal name, and associate the given level 31 | with it. 32 | */ 33 | void FederateLevelList::addFederate(const std::string& the_name, SecurityLevelID the_level_id) 34 | { 35 | tuple[the_name] = the_level_id; 36 | } 37 | 38 | //! FederateLevelList constructor. 39 | FederateLevelList::FederateLevelList() 40 | { 41 | } 42 | 43 | /** Destructor */ 44 | FederateLevelList::~FederateLevelList() 45 | { 46 | } 47 | 48 | // getLevel returns the level id associated the federate name given. 49 | SecurityLevelID FederateLevelList::getLevel(const std::string& theName) const 50 | { 51 | std::map::const_iterator i = tuple.find(theName); 52 | 53 | if (i != tuple.end()) 54 | return i->second; 55 | 56 | return PublicLevelID; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /RTIA/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${CMAKE_SOURCE_DIR}) 2 | 3 | find_program(GENGETOPT_PROGRAM NAMES gengetopt) 4 | if (GENGETOPT_PROGRAM) 5 | set(GGOFILE ${CMAKE_CURRENT_SOURCE_DIR}/RTIA.ggo) 6 | add_custom_target(GenRTIACmdline 7 | COMMAND ${GENGETOPT_PROGRAM} --no-handle-error --show-required -i ${GGOFILE} 8 | DEPENDS ${GGOFILE} 9 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 10 | COMMENT "Regenerate RTIA command line C files -- (from ${GGOFILE})" 11 | ) 12 | endif(GENGETOPT_PROGRAM) 13 | set(rtia_SRCS_generated 14 | ${CMAKE_CURRENT_SOURCE_DIR}/RTIA_cmdline.c ${CMAKE_CURRENT_SOURCE_DIR}/RTIA_cmdline.h) 15 | 16 | IF (CMAKE_COMPILER_IS_GNUCC) 17 | message(STATUS "INHIBIT Compiler (GCC) warning for gengetopt generated files: ${rtia_SRCS_generated}.") 18 | set_source_files_properties(${rtia_SRCS_generated} 19 | PROPERTIES COMPILE_FLAGS "-w") 20 | ENDIF(CMAKE_COMPILER_IS_GNUCC) 21 | 22 | if (MSVC) 23 | message(STATUS "INHIBIT Compiler (MSVC) warning for gengetopt generated files: ${rtia_SRCS_generated}.") 24 | set_source_files_properties(${rtia_SRCS_generated} 25 | PROPERTIES COMPILE_FLAGS "-D_CRT_SECURE_NO_WARNINGS") 26 | endif(MSVC) 27 | 28 | set(rtia_SRCS 29 | Communications.cc Communications.hh 30 | DataDistribution.cc DataDistribution.hh 31 | DeclarationManagement.cc DeclarationManagement.hh 32 | FederationManagement.cc FederationManagement.hh 33 | Files.cc Files.hh 34 | main.cc 35 | ObjectManagement.cc ObjectManagement.hh 36 | OwnershipManagement.cc OwnershipManagement.hh 37 | RTIA.cc RTIA.hh 38 | RTIA_federate.cc 39 | RTIA_network.cc 40 | ${rtia_SRCS_generated} 41 | Statistics.cc Statistics.hh 42 | TimeManagement.cc TimeManagement.hh 43 | ) 44 | 45 | add_executable(rtia ${rtia_SRCS}) 46 | target_link_libraries(rtia CERTI) 47 | target_link_libraries(rtia HLA) 48 | 49 | install(TARGETS rtia 50 | EXPORT CERTIDepends 51 | RUNTIME DESTINATION bin 52 | LIBRARY DESTINATION lib 53 | ARCHIVE DESTINATION lib) 54 | -------------------------------------------------------------------------------- /tests/LibCERTI/auditline_test.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include "libCERTI/AuditLine.hh" 8 | 9 | using ::certi::AuditLine; 10 | 11 | TEST(AuditLineTest, CtorDefaultsToAllZeros) 12 | { 13 | AuditLine l; 14 | auto time_at_construction = std::to_string(std::time(nullptr)); 15 | 16 | std::stringstream ss; 17 | l.write(ss); 18 | 19 | EXPECT_EQ(time_at_construction + "\t0\t0\t0\t0\t0\t\n", 20 | ss.str()); 21 | } 22 | 23 | /** Ensure the output follows the legend : 24 | * 25 | *
    26 | *
  • date
  • 27 | *
  • federation
  • 28 | *
  • federate
  • 29 | *
  • type
  • 30 | *
  • level
  • 31 | *
  • status
  • 32 | *
  • comment
  • 33 | *
34 | */ 35 | TEST(AuditLineTest, OutputIsInTheRightOrder) 36 | { 37 | AuditLine l { 38 | AuditLine::Type(3), 39 | AuditLine::Level(4), 40 | AuditLine::Status(static_cast<::certi::Exception::Type>(5)), 41 | "reason" 42 | }; 43 | auto time_at_construction = std::to_string(std::time(nullptr)); 44 | 45 | l.setFederation(1); 46 | l.setFederate(2); 47 | 48 | std::stringstream ss; 49 | l.write(ss); 50 | 51 | ASSERT_EQ(std::to_string(std::time(nullptr)) + "\t1\t2\t3\t4\t5\treason\n", 52 | ss.str()); 53 | } 54 | 55 | TEST(AuditLineTest, SettersImpactOutput) 56 | { 57 | AuditLine l; 58 | auto time_at_construction = std::to_string(std::time(nullptr)); 59 | 60 | auto level = AuditLine::Level(1); 61 | 62 | l.addComment("reason"); 63 | l.setLevel(level); 64 | 65 | l.setFederation(2); 66 | l.setFederate(3); 67 | 68 | l.end(AuditLine::Status(static_cast<::certi::Exception::Type>(4)), "end"); 69 | 70 | std::stringstream ss; 71 | l.write(ss); 72 | 73 | ASSERT_EQ(level.get(), l.getLevel().get()); 74 | ASSERT_EQ(AuditLine::Status(static_cast<::certi::Exception::Type>(4)).get(), l.getStatus().get()); 75 | 76 | EXPECT_EQ(time_at_construction + "\t2\t3\t0\t1\t4\treasonend\n", 77 | ss.str()); 78 | } 79 | -------------------------------------------------------------------------------- /libHLA/GettimeofdayClock.cc: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // CERTI - HLA RunTime Infrastructure 3 | // Copyright (C) 2002-2018 ISAE-SUPAERO & ONERA 4 | // Copyright (C) 2009 Mathias Froehlich 5 | // 6 | // This file is part of CERTI-libCERTI 7 | // 8 | // CERTI-libCERTI is free software ; you can redistribute it and/or 9 | // modify it under the terms of the GNU Lesser General Public License 10 | // as published by the Free Software Foundation ; either version 2 of 11 | // the License, or (at your option) any later version. 12 | // 13 | // CERTI-libCERTI is distributed in the hope that it will be useful, but 14 | // WITHOUT ANY WARRANTY ; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | // Lesser General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU Lesser General Public 19 | // License along with this program ; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 21 | // USA 22 | // 23 | // $Id: GettimeofdayClock.cc,v 1.1 2010/03/21 17:10:10 erk Exp $ 24 | // ---------------------------------------------------------------------------- 25 | 26 | #include "GettimeofdayClock.hh" 27 | 28 | #include 29 | #include 30 | 31 | namespace libhla { 32 | namespace clock { 33 | 34 | GettimeofdayClock::GettimeofdayClock() : Clock("GettimeofdayClock") 35 | { 36 | } 37 | 38 | double GettimeofdayClock::getResolution() 39 | { 40 | return 1000; 41 | } 42 | 43 | uint64_t GettimeofdayClock::getCurrentTicksValue() 44 | { 45 | struct timeval tv; 46 | if (-1 == gettimeofday(&tv, 0)) 47 | std::cerr << "Cannot get current timestamp!" << std::endl; 48 | /* convert struct timespec to number of micro-seconds */ 49 | return tv.tv_sec * 1000000 + tv.tv_usec; 50 | } 51 | 52 | double GettimeofdayClock::tick2NanoSecond(const uint64_t ticks) 53 | { 54 | return 1e3 * ticks; 55 | } 56 | 57 | GettimeofdayClock::~GettimeofdayClock() 58 | { 59 | } 60 | 61 | } /* end of clock namespace */ 62 | } /* and of libhla namespace */ 63 | -------------------------------------------------------------------------------- /scripts/TODO.GenMsg: -------------------------------------------------------------------------------- 1 | TODO list for the CERTI Message generator: 2 | 3 | 0) Write the documentation (and may be BNF or ANTLR or Lex grammar) for 4 | the CERTI Message specification language 5 | 6 | 1) Modularize generator such that 7 | each backend generator (C++, Java, Python etc...) may be loaded separately 8 | PARTIALLY DONE --> need to automatize the backend loading. 9 | 10 | 2) Support variant for sequences (vector/list/queue/...) 11 | 12 | 3) Explain the on-the-wire encoding scheme (i.e. MessageBuffer) 13 | Document the CDR-like encoding used by the MessageBuffer 14 | Justify the use of fixed-size encoding (not the default of Google proto buf.) 15 | 16 | 4) Add a display method for each message (C++ generator) 17 | or an helper method which may authorize 18 | cout << msg; 19 | DONE --> this is the show(ostream& out) method 20 | 21 | 5) Parser --> improve syntax error reporting 22 | 23 | 6) Enhance C++ generator (or write another one) for which 24 | runtime check is done for setting 'required' field before sending 25 | (or default value exists) 26 | 27 | 7) Handle natively defined default values for members 28 | 29 | 8) Add "merge" qualifier for fields which should be applicable 30 | only for "message type" fields. This would "merge-in" 31 | the field of the target message as if it were written 32 | in the body of the merger message itself. 33 | 34 | 9) May be it would be worth implementing a "clone" method. 35 | 36 | 10) Add a "bounded" qualifier for "repeated" field such 37 | that the buffer size may be statically bounded 38 | or may be repeated[10] 39 | 40 | 11) Run the set of python code through checker in order to prune 41 | the source code quality 42 | see: http://stackoverflow.com/questions/1318799/tool-to-enforce-python-code-style-standards 43 | 44 | reindent.py 45 | PyLint 46 | epylint 47 | epydoc 48 | 49 | Pylint: http://www.logilab.org/project/pylint 50 | PyCheker: http://pychecker.sourceforge.net/ 51 | PyFlakes: http://divmod.org/trac/wiki/DivmodPyflakes 52 | 53 | PylLint with PyDev (Eclipse) 54 | http://pydev.org/manual_adv_pylint.html 55 | PyLint with emacs: 56 | http://atomized.org/2010/02/pep8-pylint-in-emacs/ -------------------------------------------------------------------------------- /libHLA/ClockFactory.cc: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // CERTI - HLA RunTime Infrastructure 3 | // Copyright (C) 2002-2018 ISAE-SUPAERO & ONERA 4 | // 5 | // This program is free software ; you can redistribute it and/or 6 | // modify it under the terms of the GNU Lesser General Public License 7 | // as published by the Free Software Foundation ; either version 2 of 8 | // the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, but 11 | // WITHOUT ANY WARRANTY ; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | // Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public 16 | // License along with this program ; if not, write to the Free Software 17 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | // ---------------------------------------------------------------------------- 19 | 20 | #include "Clock.hh" 21 | #include "config.h" 22 | 23 | #ifdef HAVE_TSC_CLOCK 24 | #include "TSCClock.hh" 25 | #endif 26 | 27 | #ifdef HAVE_POSIX_CLOCK 28 | #include "PosixClock.hh" 29 | #endif 30 | 31 | #ifdef HAVE_GETTIMEOFDAY 32 | #include "GettimeofdayClock.hh" 33 | #endif 34 | 35 | #ifdef HAVE_WIN_CLOCK 36 | #include "WinClock.hh" 37 | #include "WinPerfClock.hh" 38 | #endif 39 | 40 | namespace libhla { 41 | namespace clock { 42 | 43 | Clock* Clock::getBestClock() 44 | { 45 | // clang-format off 46 | #ifdef _WIN32 47 | #ifdef HAVE_WIN_CLOCK 48 | return new WinPerfClock(); 49 | #else 50 | return new WinClock(); 51 | #endif 52 | #else 53 | #ifdef HAVE_TSC_CLOCK 54 | return new TSCClock(); 55 | #else 56 | #ifdef HAVE_POSIX_CLOCK 57 | return new PosixClock(); 58 | #else 59 | #ifdef HAVE_GETTIMEOFDAY 60 | return new GettimeofdayClock(); 61 | #else 62 | return nullptr; 63 | #endif 64 | #endif 65 | #endif 66 | #endif 67 | // clang-format off 68 | } /* end of getBestClock */ 69 | 70 | } /* end namespace clock */ 71 | } /* end namespace libhla */ 72 | -------------------------------------------------------------------------------- /tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | find_package(GTest) 2 | find_package(GMock) 3 | 4 | if(GTest_FOUND AND GMock_FOUND) 5 | message( STATUS "GoogleTest: Found on the build system") 6 | 7 | include_directories(${GTEST_INCLUDE_DIRS}) 8 | 9 | include_directories(${GMOCK_INCLUDE_DIRS}) 10 | 11 | else() 12 | message( STATUS "GoogleTest: Not found on the build system, fetching and building locally") 13 | # Enable ExternalProject CMake module 14 | include(ExternalProject) 15 | 16 | # Download and install GoogleTest 17 | ExternalProject_Add( 18 | gtest 19 | URL https://github.com/google/googletest/archive/master.zip 20 | PREFIX ${CMAKE_CURRENT_BINARY_DIR}/gtest 21 | # Disable install step 22 | INSTALL_COMMAND "" 23 | ) 24 | 25 | # Get GTest source and binary directories from CMake project 26 | ExternalProject_Get_Property(gtest source_dir binary_dir) 27 | 28 | # Create a libgtest target to be used as a dependency by test programs 29 | add_library(libgtest IMPORTED STATIC GLOBAL) 30 | add_dependencies(libgtest gtest) 31 | 32 | # Set libgtest properties 33 | set_target_properties(libgtest PROPERTIES 34 | "IMPORTED_LOCATION" "${binary_dir}/googlemock/gtest/libgtest.a" 35 | "IMPORTED_LINK_INTERFACE_LIBRARIES" "${CMAKE_THREAD_LIBS_INIT}" 36 | ) 37 | 38 | # Create a libgmock target to be used as a dependency by test programs 39 | add_library(libgmock IMPORTED STATIC GLOBAL) 40 | add_dependencies(libgmock gtest) 41 | 42 | # Set libgmock properties 43 | set_target_properties(libgmock PROPERTIES 44 | "IMPORTED_LOCATION" "${binary_dir}/googlemock/libgmock.a" 45 | "IMPORTED_LINK_INTERFACE_LIBRARIES" "${CMAKE_THREAD_LIBS_INIT}" 46 | ) 47 | 48 | # I couldn't make it work with INTERFACE_INCLUDE_DIRECTORIES 49 | include_directories("${source_dir}/googletest/include" 50 | "${source_dir}/googlemock/include") 51 | 52 | set(GTEST_BOTH_LIBRARIES libgtest) 53 | set(GMOCK_BOTH_LIBRARIES libgmock) 54 | endif() 55 | 56 | add_subdirectory( LibHLA ) 57 | add_subdirectory( LibRTI/hla-1_3 ) 58 | #add_subdirectory( LibRTI/ieee1516-2000 ) 59 | add_subdirectory( LibCERTI ) 60 | add_subdirectory( RTIG ) 61 | -------------------------------------------------------------------------------- /libCERTI/RTIRegion.cc: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // CERTI - HLA RunTime Infrastructure 3 | // Copyright (C) 2005 ONERA 4 | // 5 | // This file is part of CERTI-libCERTI 6 | // 7 | // CERTI-libCERTI is free software ; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public License 9 | // as published by the Free Software Foundation ; either version 2 of 10 | // the License, or (at your option) any later version. 11 | // 12 | // CERTI-libCERTI is distributed in the hope that it will be useful, but 13 | // WITHOUT ANY WARRANTY ; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | // Lesser General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU Lesser General Public 18 | // License along with this program ; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 20 | // USA 21 | // 22 | // $Id: RTIRegion.cc,v 3.4 2007/07/06 09:25:18 erk Exp $ 23 | // ---------------------------------------------------------------------------- 24 | 25 | #include "RTIRegion.hh" 26 | #include "RoutingSpace.hh" 27 | 28 | namespace certi { 29 | 30 | // ---------------------------------------------------------------------------- 31 | /** Region Constructor 32 | @param region_handle Handle of this Region 33 | @param routing_space RoutingSpace of this Region 34 | @param nb_extents Number of extents 35 | */ 36 | RTIRegion::RTIRegion(RegionHandle region_handle, const RoutingSpace& routing_space, size_t nb_extents) 37 | : BaseRegion(region_handle), space(routing_space) 38 | { 39 | setExtents(std::vector(nb_extents, space.createExtent())); 40 | } 41 | 42 | // ---------------------------------------------------------------------------- 43 | RTIRegion::~RTIRegion() 44 | { 45 | } 46 | 47 | // ---------------------------------------------------------------------------- 48 | /** Get the handle of the routing space having this region. 49 | */ 50 | SpaceHandle RTIRegion::getSpaceHandle() const noexcept 51 | { 52 | return space.getHandle(); 53 | } 54 | 55 | } // namespace certi 56 | 57 | // $Id: RTIRegion.cc,v 3.4 2007/07/06 09:25:18 erk Exp $ 58 | -------------------------------------------------------------------------------- /libCERTI/helper.hh: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // CERTI - HLA RunTime Infrastructure 3 | // Copyright (C) 2004, 2006 ONERA 4 | // 5 | // This file is part of CERTI-libCERTI 6 | // 7 | // CERTI-libCERTI is free software ; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public License 9 | // as published by the Free Software Foundation ; either version 2 of 10 | // the License, or (at your option) any later version. 11 | // 12 | // CERTI-libCERTI is distributed in the hope that it will be useful, but 13 | // WITHOUT ANY WARRANTY ; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | // Lesser General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU Lesser General Public 18 | // License along with this program ; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 20 | // USA 21 | // 22 | // ---------------------------------------------------------------------------- 23 | 24 | #ifndef LIBCERTI_HELPER_HH 25 | #define LIBCERTI_HELPER_HH 26 | 27 | #include 28 | 29 | namespace certi { 30 | 31 | /** HandleComparator is a comparison functor for objects having a getHandle() 32 | method. 33 | */ 34 | template 35 | class HandleComparator { 36 | public: 37 | HandleComparator(Handle h) : handle(h){}; 38 | bool operator()(const T* op) const 39 | { 40 | return op->getHandle() == handle; 41 | }; 42 | bool operator()(const T& op) const 43 | { 44 | return op.getHandle() == handle; 45 | }; 46 | 47 | private: 48 | Handle handle; 49 | }; 50 | 51 | /** NameComparator is a comparison functor for objects having a getName() 52 | method. 53 | */ 54 | template 55 | class NameComparator { 56 | public: 57 | NameComparator(const std::string& h) : name(h){}; 58 | bool operator()(const T* op) const 59 | { 60 | return name == op->getName(); 61 | }; 62 | bool operator()(const T& op) const 63 | { 64 | return name == op.getName(); 65 | }; 66 | 67 | private: 68 | std::string name; 69 | }; 70 | 71 | } // certi 72 | 73 | #endif // LIBCERTI_HELPER_HH 74 | -------------------------------------------------------------------------------- /libCERTI/SocketMC.hh: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // CERTI - HLA RunTime Infrastructure 3 | // Copyright (C) 2002-2018 ISAE-SUPAERO & ONERA 4 | // 5 | // This program is free software ; you can redistribute it and/or 6 | // modify it under the terms of the GNU Lesser General Public License 7 | // as published by the Free Software Foundation ; either version 2 of 8 | // the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, but 11 | // WITHOUT ANY WARRANTY ; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | // Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public 16 | // License along with this program ; if not, write to the Free Software 17 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | // ---------------------------------------------------------------------------- 19 | 20 | #ifndef CERTI_SOCKET_MC_HH 21 | #define CERTI_SOCKET_MC_HH 22 | 23 | #include 24 | #include "NetworkMessage.hh" 25 | #include "Socket.hh" 26 | 27 | namespace certi { 28 | 29 | class SocketMC : public Socket { 30 | public: 31 | int _socket_mc; 32 | bool _est_init_mc; 33 | 34 | SocketMC(); 35 | virtual ~SocketMC(); 36 | 37 | void CreerSocketMC(char* addr, unsigned long port); 38 | void CreerSocketMC(unsigned long addr, unsigned long port); 39 | 40 | virtual void send(const unsigned char*, size_t); 41 | virtual void receive(void* Buffer, unsigned long Size); 42 | 43 | SOCKET returnSocket(); 44 | 45 | virtual unsigned long returnAdress() const; 46 | virtual void close(); 47 | 48 | void sendMC(NetworkMessage* msg); 49 | char* receiveMC(NetworkMessage* msg); 50 | 51 | private: 52 | struct sockaddr_in _sin; 53 | struct sockaddr_in _sin_e; 54 | #ifdef _WIN32 55 | int _sinlen; 56 | #else 57 | socklen_t _sinlen; 58 | #endif 59 | SOCKET _socket_emetteur; 60 | int _sinlen_e; 61 | 62 | int timeoutMC(int, int); 63 | 64 | int _num_msg; 65 | MessageBuffer MCMessageBuffer; 66 | }; 67 | 68 | } // namespace certi 69 | 70 | #endif // CERTI_SOCKET_MC_HH 71 | -------------------------------------------------------------------------------- /libCERTI/BaseRegion.hh: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // CERTI - HLA RunTime Infrastructure 3 | // Copyright (C) 2002-2018 ISAE-SUPAERO & ONERA 4 | // 5 | // This file is part of CERTI-libRTI 6 | // 7 | // CERTI-libRTI is free software ; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public License 9 | // as published by the Free Software Foundation ; either version 2 of 10 | // the License, or (at your option) any later version. 11 | // 12 | // CERTI-libRTI is distributed in the hope that it will be useful, but 13 | // WITHOUT ANY WARRANTY ; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | // Lesser General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU Lesser General Public 18 | // License along with this program ; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 20 | // USA 21 | // 22 | // ---------------------------------------------------------------------------- 23 | 24 | #ifndef CERTI_BASE_REGION_HH 25 | #define CERTI_BASE_REGION_HH 26 | 27 | #include "Extent.hh" 28 | #include "Handled.hh" 29 | 30 | #include 31 | 32 | namespace certi { 33 | 34 | typedef Handle RegionHandle; 35 | 36 | class CERTI_EXPORT BaseRegion : public Handled { 37 | public: 38 | BaseRegion(RegionHandle); 39 | virtual ~BaseRegion(); 40 | 41 | virtual uint32_t getRangeLowerBound(ExtentIndex, DimensionHandle) const; 42 | 43 | virtual uint32_t getRangeUpperBound(ExtentIndex, DimensionHandle) const; 44 | 45 | virtual void setRangeLowerBound(ExtentIndex, DimensionHandle, uint32_t); 46 | 47 | virtual void setRangeUpperBound(ExtentIndex, DimensionHandle, uint32_t); 48 | 49 | virtual uint32_t getNumberOfExtents() const noexcept; 50 | 51 | virtual SpaceHandle getSpaceHandle() const noexcept = 0; 52 | 53 | const std::vector& getExtents() const; 54 | void replaceExtents(const std::vector&); 55 | bool overlaps(const BaseRegion& region) const; 56 | 57 | protected: 58 | void setExtents(const std::vector&); 59 | 60 | std::vector extents; 61 | }; 62 | 63 | } // namespace certi 64 | 65 | #endif // CERTI_BASE_REGION_HH 66 | -------------------------------------------------------------------------------- /libCERTI/fed.hh: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // CERTI - HLA RunTime Infrastructure 3 | // Copyright (C) 2003 ONERA 4 | // 5 | // This file is part of CERTI-libCERTI 6 | // 7 | // CERTI-libCERTI is free software ; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public License 9 | // as published by the Free Software Foundation ; either version 2 of 10 | // the License, or (at your option) any later version. 11 | // 12 | // CERTI-libCERTI is distributed in the hope that it will be useful, but 13 | // WITHOUT ANY WARRANTY ; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | // Lesser General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU Lesser General Public 18 | // License along with this program ; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 20 | // USA 21 | // 22 | // ---------------------------------------------------------------------------- 23 | 24 | #ifndef _FED_HH 25 | #define _FED_HH 26 | 27 | #include "RootObject.hh" 28 | 29 | namespace certi { 30 | namespace fedparser { 31 | 32 | /** 33 | * Main function for parsing FED file. 34 | * @param[in] filename the FED file to be parsed 35 | * @param[out] the RootObject to build during the FED file parse 36 | * @param[in] verboseArg, if true the parsed element will printed on stdout. 37 | */ 38 | CERTI_EXPORT 39 | int build(const char* filename, RootObject* root, bool verboseArg); 40 | 41 | // internal functions 42 | void indent(); 43 | void printOrder(); 44 | void printTransport(); 45 | 46 | // parser requests 47 | void startFed(); 48 | void startFederate(); 49 | void startInteraction(); 50 | void startInteractions(); 51 | void startObject(); 52 | void startObjects(); 53 | void startSpace(); 54 | void startSpaces(); 55 | void checkSpaceName(); 56 | 57 | void addAttribute(); 58 | void addDimension(); 59 | void addFederation(); 60 | void addFedVersion(); 61 | void addInteractionSecurityLevel(); 62 | void addObjectSecurityLevel(); 63 | void addParameter(); 64 | 65 | void end(); 66 | void endFed(); 67 | void endFederate(); 68 | void endInteraction(); 69 | void endObject(); 70 | void endSpace(); 71 | } 72 | } 73 | 74 | #endif // _FED_HH 75 | -------------------------------------------------------------------------------- /libRTI/hla-1_3/RTIambPrivateRefs.hh: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // CERTI - HLA RunTime Infrastructure 3 | // Copyright (C) 2002-2018 ISAE-SUPAERO & ONERA 4 | // 5 | // This file is part of CERTI-libRTI 6 | // 7 | // CERTI-libRTI is free software ; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public License 9 | // as published by the Free Software Foundation ; either version 2 of 10 | // the License, or (at your option) any later version. 11 | // 12 | // CERTI-libRTI is distributed in the hope that it will be useful, but 13 | // WITHOUT ANY WARRANTY ; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | // Lesser General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU Lesser General Public 18 | // License along with this program ; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 20 | // USA 21 | // 22 | // $Id: RTIambPrivateRefs.hh,v 1.1 2014/03/03 15:18:23 erk Exp $ 23 | // ---------------------------------------------------------------------------- 24 | 25 | #include "RTI.hh" 26 | #include "fedtime.hh" 27 | #include "Message.hh" 28 | #include "RootObject.hh" 29 | #include "MessageBuffer.hh" 30 | 31 | using namespace certi ; 32 | 33 | class RTIambPrivateRefs 34 | { 35 | public: 36 | RTIambPrivateRefs(); 37 | ~RTIambPrivateRefs(); 38 | 39 | void processException(Message *); 40 | void executeService(Message *req, Message *rep); 41 | void sendTickRequestStop(); 42 | void callFederateAmbassador(Message *msg) throw (RTI::RTIinternalError); 43 | void leave(const char *msg) throw (RTI::RTIinternalError); 44 | 45 | #ifdef _WIN32 46 | HANDLE handle_RTIA; 47 | #else 48 | pid_t pid_RTIA ; //!< pid associated with rtia fork (private). 49 | #endif 50 | 51 | //! Federate Ambassador reference for module calls. 52 | RTI::FederateAmbassador *fed_amb ; 53 | 54 | //! used to prevent reentrant calls (see tick() and executeService()). 55 | bool is_reentrant ; 56 | 57 | RootObject *_theRootObj ; 58 | 59 | SocketUN *socketUn ; 60 | MessageBuffer msgBufSend,msgBufReceive ; 61 | }; 62 | 63 | // $Id: RTIambPrivateRefs.hh,v 1.1 2014/03/03 15:18:23 erk Exp $ 64 | -------------------------------------------------------------------------------- /test/ModernBillard/main.cc: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // CERTI - HLA RunTime Infrastructure 3 | // Copyright (C) 2002-2018 ISAE-SUPAERO & ONERA 4 | // 5 | // This file is part of CERTI-libCERTI 6 | // 7 | // CERTI-libCERTI is free software ; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public License 9 | // as published by the Free Software Foundation ; either version 2 of 10 | // the License, or (at your option) any later version. 11 | // 12 | // CERTI-libCERTI is distributed in the hope that it will be useful, but 13 | // WITHOUT ANY WARRANTY ; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | // Lesser General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU Lesser General Public 18 | // License along with this program ; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 20 | // USA 21 | // 22 | // ---------------------------------------------------------------------------- 23 | 24 | #include 25 | #include 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | #include "billard.hh" 36 | 37 | using namespace std; 38 | 39 | static bool loop_state{false}; 40 | 41 | void signalHandler(int /*signal*/) 42 | { 43 | if (loop_state) { 44 | loop_state = false; 45 | } 46 | else { 47 | std::exit(0); 48 | } 49 | } 50 | 51 | int main(int argc, char** argv) 52 | { 53 | cout << "== CERTI MODERN BILLARD ==" << endl; 54 | 55 | std::signal(SIGINT, signalHandler); 56 | 57 | if (argc != 3) { 58 | cout << "usage: ./modern_billard federate_name federation_name" << endl; 59 | return EXIT_FAILURE; 60 | } 61 | 62 | wstring federate_name(argv[1], argv[1] + strlen(argv[1])); 63 | wstring federation_name(argv[2], argv[2] + strlen(argv[2])); 64 | 65 | try { 66 | Billard billard(federation_name, federate_name, loop_state); 67 | } 68 | catch (rti1516e::Exception& e) { 69 | wcout << "* Error: " << e.what() << endl; 70 | 71 | return EXIT_FAILURE; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /libCERTI/FedRegion.hh: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // CERTI - HLA RunTime Infrastructure 3 | // Copyright (C) 2002-2018 ISAE-SUPAERO & ONERA 4 | // 5 | // This file is part of CERTI-libCERTI 6 | // 7 | // CERTI-libCERTI is free software ; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public License 9 | // as published by the Free Software Foundation ; either version 2 of 10 | // the License, or (at your option) any later version. 11 | // 12 | // CERTI-libCERTI is distributed in the hope that it will be useful, but 13 | // WITHOUT ANY WARRANTY ; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | // Lesser General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU Lesser General Public 18 | // License along with this program ; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 20 | // USA 21 | // 22 | // ---------------------------------------------------------------------------- 23 | 24 | #ifndef CERTI_FED_REGION_HH 25 | #define CERTI_FED_REGION_HH 26 | 27 | #include "BaseRegion.hh" 28 | #include 29 | 30 | namespace certi { 31 | 32 | class RoutingSpace; 33 | 34 | class CERTI_EXPORT FedRegion : public BaseRegion { 35 | public: 36 | FedRegion(RegionHandle, SpaceHandle, const std::vector&); 37 | virtual ~FedRegion(); 38 | 39 | virtual uint32_t getRangeLowerBound(ExtentIndex, DimensionHandle) const; 40 | 41 | virtual uint32_t getRangeUpperBound(ExtentIndex, DimensionHandle) const; 42 | 43 | virtual void setRangeLowerBound(ExtentIndex, DimensionHandle, uint32_t); 44 | 45 | virtual void setRangeUpperBound(ExtentIndex, DimensionHandle, uint32_t); 46 | 47 | virtual SpaceHandle getSpaceHandle() const noexcept; 48 | 49 | virtual uint32_t getNumberOfExtents() const noexcept; 50 | 51 | virtual uint32_t getRangeLowerBoundNotificationLimit(ExtentIndex, DimensionHandle) const; 52 | 53 | virtual uint32_t getRangeUpperBoundNotificationLimit(ExtentIndex, DimensionHandle) const; 54 | 55 | void commit(); 56 | 57 | private: 58 | SpaceHandle space; 59 | std::vector coExtents; 60 | }; 61 | } 62 | 63 | #endif // CERTI_FED_REGION_HH 64 | -------------------------------------------------------------------------------- /libHLA/SHM.hh: -------------------------------------------------------------------------------- 1 | #ifndef SHM_H 2 | #define SHM_H 3 | 4 | #include "libhla.hh" // IWYU pragma: export 5 | #include // IWYU pragma: export 6 | 7 | namespace libhla { 8 | namespace ipc { 9 | 10 | /** 11 | * A Shared Memory class. 12 | * This class is an abstract base for representing a shared memory 13 | * segment. A shared memory segment is identified by its name and 14 | * has a size and a creator process. 15 | */ 16 | class HLA_EXPORT SHM { 17 | public: 18 | /** 19 | * Constructor. 20 | * @param[in] SHMName, the name of the shared memory segment. 21 | * this should be unique on a specified host. 22 | * @param[in] SHMSize, the requested size of the SHM 23 | * @param[in] creator, true if we are trying to create the SHM, false 24 | * if we want to attach to the SHM. 25 | */ 26 | SHM(const std::string& SHMName, const int SHMSize, const bool creator) 27 | { 28 | _Name = SHMName; 29 | _Size = SHMSize; 30 | _IsCreator = creator; 31 | } 32 | SHM(const std::string& SHMName, const int SHMSize) 33 | { 34 | _Name = SHMName; 35 | _Size = SHMSize; 36 | _IsCreator = false; 37 | } 38 | virtual ~SHM(){}; 39 | 40 | LIBHLA_EXCEPTION(SharedMemoryNotOpen) 41 | LIBHLA_EXCEPTION(SharedMemoryNotAttached) 42 | LIBHLA_EXCEPTION(SharedMemoryNotClosed) 43 | LIBHLA_EXCEPTION(HandleNotClosed) 44 | 45 | const std::string getName() const 46 | { 47 | return _Name; 48 | }; 49 | inline void* GetShm() 50 | { 51 | return _Shm; 52 | }; 53 | inline bool IsCreator() 54 | { 55 | return _IsCreator; 56 | }; 57 | inline int GetSize() 58 | { 59 | return _Size; 60 | }; 61 | virtual void Open() = 0; 62 | virtual void Attach() = 0; 63 | virtual void Close() = 0; 64 | 65 | /** 66 | * Build a proper SHM name from a user provided name. 67 | * Idea kindly borrowed from TSP (https://savannah.nongnu.org) 68 | * bb_utils_build_shm_name 69 | */ 70 | static std::string buildShmName(const std::string& ShmName) 71 | { 72 | return "/" + ShmName + "_shm"; 73 | } 74 | 75 | protected: 76 | std::string _Name; 77 | int _Size; 78 | bool _IsCreator; 79 | void* _Shm; 80 | }; 81 | } /* end namespace ipc */ 82 | } /* end namespace libhla */ 83 | #endif 84 | -------------------------------------------------------------------------------- /libRTI/ieee1516-2000/RTIambPrivateRefs.h: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // CERTI - HLA RunTime Infrastructure 3 | // Copyright (C) 2002-2018 ISAE-SUPAERO & ONERA 4 | // 5 | // This file is part of CERTI-libRTI 6 | // 7 | // CERTI-libRTI is free software ; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public License 9 | // as published by the Free Software Foundation ; either version 2 of 10 | // the License, or (at your option) any later version. 11 | // 12 | // CERTI-libRTI is distributed in the hope that it will be useful, but 13 | // WITHOUT ANY WARRANTY ; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | // Lesser General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU Lesser General Public 18 | // License along with this program ; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 20 | // USA 21 | // 22 | // $Id: RTIambPrivateRefs.h,v 1.1 2014/03/03 16:41:48 erk Exp $ 23 | // ---------------------------------------------------------------------------- 24 | 25 | #include 26 | #include "Message.hh" 27 | #include "RootObject.hh" 28 | #include "MessageBuffer.hh" 29 | 30 | using namespace certi ; 31 | 32 | class RTI1516ambPrivateRefs 33 | { 34 | public: 35 | RTI1516ambPrivateRefs(); 36 | ~RTI1516ambPrivateRefs(); 37 | 38 | void processException(Message *); 39 | void executeService(Message *req, Message *rep); 40 | void sendTickRequestStop(); 41 | void callFederateAmbassador(Message *msg) throw (rti1516::RTIinternalError); 42 | void leave(const char *msg) throw (rti1516::RTIinternalError); 43 | 44 | #ifdef _WIN32 45 | HANDLE handle_RTIA; 46 | #else 47 | pid_t pid_RTIA ; //!< pid associated with rtia fork (private). 48 | #endif 49 | 50 | //! Federate Ambassador reference for module calls. 51 | rti1516::FederateAmbassador *fed_amb ; 52 | 53 | //! used to prevent reentrant calls (see tick() and executeService()). 54 | bool is_reentrant ; 55 | 56 | RootObject *_theRootObj ; 57 | 58 | SocketUN *socketUn ; 59 | MessageBuffer msgBufSend,msgBufReceive ; 60 | }; 61 | 62 | // $Id: RTIambPrivateRefs.h,v 1.1 2014/03/03 16:41:48 erk Exp $ 63 | -------------------------------------------------------------------------------- /test/Billard/BillardDDM.hh: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // CERTI - HLA RunTime Infrastructure 3 | // Copyright (C) 2004-2005 ONERA 4 | // 5 | // This file is part of Billard 6 | // 7 | // Billard is free software ; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation ; either version 2 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // Billard is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY ; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program ; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | // ---------------------------------------------------------------------------- 21 | 22 | #ifndef CERTI_BILLARD_DDM_HH 23 | #define CERTI_BILLARD_DDM_HH 24 | 25 | #include "RTI.hh" 26 | #include "Billard.hh" 27 | 28 | class BillardStaticDDM : public Billard 29 | { 30 | public: 31 | BillardStaticDDM(std::string); 32 | virtual ~BillardStaticDDM() throw (RTI::FederateInternalError) { }; 33 | 34 | virtual void checkRegions(); 35 | virtual void declare(); 36 | virtual void publishAndSubscribe(); 37 | virtual void resign(); 38 | 39 | protected: 40 | const int numberOfRegions ; 41 | std::vector sub ; 42 | std::vector pub ; 43 | int subRegion ; 44 | int pubRegion ; 45 | RTI::SpaceHandle GeoID ; 46 | RTI::DimensionHandle dimX ; 47 | RTI::DimensionHandle dimY ; 48 | }; 49 | 50 | class BillardDynamicDDM : public Billard 51 | { 52 | public: 53 | BillardDynamicDDM(std::string); 54 | virtual ~BillardDynamicDDM() throw (RTI::FederateInternalError) { }; 55 | 56 | virtual void checkRegions(); 57 | virtual void declare(); 58 | virtual void publishAndSubscribe(); 59 | virtual void resign(); 60 | 61 | protected: 62 | RTI::Region *region ; 63 | RTI::SpaceHandle GeoID ; 64 | RTI::DimensionHandle dimX ; 65 | RTI::DimensionHandle dimY ; 66 | }; 67 | 68 | #endif // CERTI_BILLARD_DDM_HH 69 | --------------------------------------------------------------------------------