├── acinclude.m4 ├── bootstrap ├── AUTHORS ├── src ├── monitor_protocol-v3.txt ├── playerparamtest.cpp ├── serverparamtest.cpp ├── fix_lexer_file.cmake ├── version.h ├── resultsaver.cpp ├── rcssexceptions.cpp ├── pcombuilder.cpp ├── pcomparser.cpp ├── weather.h ├── rcssexceptions.h ├── serializerplayerstdv5.h ├── serializeronlinecoachstdv13.h ├── serializeronlinecoachstdv14.h ├── synctimer.h ├── visual.h ├── serializeronlinecoachstdv6.h ├── sender.h ├── serializeronlinecoachstdv8.h ├── stdtimer.h ├── timer.h ├── player_command_tok.h ├── serializerplayerstdv5.cpp ├── serializeronlinecoachstdv13.cpp ├── serializeronlinecoachstdv7.h ├── timeable.h ├── serializerplayerstdv14.h ├── xpmholder.h ├── serializercoachstdv14.h ├── serializercoachstdv13.h ├── weather.cpp ├── serializeronlinecoachstdv6.cpp ├── xmlreader.h ├── serializercommonstdv8.h ├── pcomparser.h ├── field.h ├── field.cpp ├── serializerplayerstdv18.h ├── leg.h ├── serializeronlinecoachstdv1.h ├── serializercommonjson.h ├── stdoutsaver.h ├── serializercommonstdv1.h ├── serializercommonstdv7.h ├── observer.h ├── serializeronlinecoachstdv14.cpp ├── remoteclient.h ├── serializeronlinecoachstdv8.cpp └── main.cpp ├── Makefile.am ├── rcss ├── Makefile.am ├── CMakeLists.txt ├── clang │ ├── fix_lexer_file.cmake │ ├── clangbuilder.cpp │ ├── clangparser.cpp │ ├── clangunsuppmsg.h │ ├── clangunsuppmsg.cpp │ ├── clangfreeformmsg.h │ ├── clangdelmsg.cpp │ ├── clangfreeformmsg.cpp │ ├── clangdelmsg.h │ ├── clangrulemsg.h │ ├── clangdefmsg.h │ ├── clanginfomsg.h │ ├── clangadvicemsg.h │ ├── clangrulemsg.cpp │ ├── arithop.cpp │ ├── clangparser.h │ ├── clangdefmsg.cpp │ ├── clanginfomsg.cpp │ ├── clangmsg.h │ ├── CMakeLists.txt │ └── clangadvicemsg.cpp ├── gzip │ ├── CMakeLists.txt │ └── Makefile.am ├── net │ ├── CMakeLists.txt │ ├── Makefile.am │ ├── udpsocket.hpp │ ├── tcpsocket.hpp │ ├── handler.hpp │ ├── osocketstream.hpp │ ├── isocketstream.hpp │ ├── handler.cpp │ ├── udpsocket.cpp │ ├── tcpsocket.cpp │ ├── addr.hpp │ ├── iosocketstream.hpp │ └── socketstreambuf.hpp └── conf │ ├── CMakeLists.txt │ ├── Makefile.am │ └── streamstatushandler.hpp ├── runpath.awk ├── config.h.cmake ├── spec.tmpl.in ├── BUGS ├── PLATFORMS ├── rel.awk ├── Acknowledgement ├── .circleci └── config.yml ├── CMakeLists.txt ├── m4 ├── ax_cxx_compile_stdcxx_14.m4 ├── ax_cxx_compile_stdcxx_17.m4 ├── ax_prog_flex.m4 └── ax_prog_bison.m4 └── missingflex /acinclude.m4: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /bootstrap: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -x 3 | autoreconf --install --force 4 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | The RoboCup Soccer Simulator Maintenance Committee 2 | https://github.com/rcsoccersim 3 | -------------------------------------------------------------------------------- /src/monitor_protocol-v3.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rcsoccersim/rcssserver/HEAD/src/monitor_protocol-v3.txt -------------------------------------------------------------------------------- /src/playerparamtest.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "playerparam.h" 3 | int main() 4 | { 5 | PlayerParam::instance(); 6 | std::cout << "success\n"; 7 | } 8 | -------------------------------------------------------------------------------- /src/serverparamtest.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "serverparam.h" 3 | int main( int argc, char ** argv ) 4 | { 5 | ServerParam::init( argc, argv ); 6 | ServerParam::instance(); 7 | std::cout << "success\n"; 8 | } 9 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | ACLOCAL_AMFLAGS=-I m4 2 | 3 | LIBTOOL_DEPS = @LIBTOOL_DEPS@ 4 | libtool: $(LIBTOOL_DEPS) 5 | $(SHELL) ./config.status --recheck 6 | 7 | SUBDIRS = \ 8 | rcss \ 9 | src \ 10 | . 11 | 12 | EXTRA_DIST = \ 13 | README.md \ 14 | CMakeLists.txt \ 15 | config.h.cmake 16 | 17 | CLEANFILES = \ 18 | *~ \ 19 | core \ 20 | *.tar.gz \ 21 | *.tmp 22 | 23 | #DISTCLEANFILES = 24 | -------------------------------------------------------------------------------- /rcss/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | SUBDIRS = net conf gzip clang 3 | 4 | rcssincludedir = $(includedir)/rcss 5 | 6 | rcssinclude_HEADERS = \ 7 | factory.hpp \ 8 | parser.h \ 9 | vector.h 10 | 11 | AM_CPPFLAGS = -I$(top_srcdir) 12 | AM_CFLAGS = -W -Wall 13 | AM_CXXFLAGS = -W -Wall 14 | AM_LDFLAGS = 15 | 16 | EXTRA_DIST = \ 17 | CMakeLists.txt 18 | 19 | CLEANFILES = \ 20 | *~ \ 21 | core 22 | -------------------------------------------------------------------------------- /runpath.awk: -------------------------------------------------------------------------------- 1 | /\${[^}]*}/ { 2 | while( match( $0, /\\\${[^}]*}/ ) ) 3 | { 4 | token = substr( $0, RSTART+3, RLENGTH-4 ); 5 | token_length = RLENGTH-4; 6 | "grep ^" token " libtool" | getline tmp; 7 | x = match( tmp, /".*"/ ); 8 | rep = substr( tmp, RSTART+1, RLENGTH-2 ); 9 | idx = index( $0, token ); 10 | while( idx ) 11 | { 12 | $0 = substr( $0, 0, idx - 4 ) rep substr( $0, idx + 1 + token_length); 13 | idx = index( $0, token ); 14 | } 15 | } 16 | print substr( $0, 2, length() -2 ); 17 | } 18 | -------------------------------------------------------------------------------- /config.h.cmake: -------------------------------------------------------------------------------- 1 | #define VERSION "${PROJECT_VERSION}" 2 | #define PACKAGE "rcssserver" 3 | 4 | #cmakedefine HAVE_LIBZ 1 5 | #cmakedefine HAVE_SYS_SOCKET_H 1 6 | #cmakedefine HAVE_NETINET_IN_H 1 7 | #cmakedefine HAVE_ARPA_INET_H 1 8 | #cmakedefine HAVE_POLL_H 1 9 | #cmakedefine HAVE_NETDB_H 1 10 | #cmakedefine HAVE_SYS_TIME_H 1 11 | #cmakedefine HAVE_PWD_H 1 12 | #cmakedefine HAVE_SYS_PARAM_H 1 13 | #cmakedefine HAVE_UNISTD_H 1 14 | #cmakedefine HAVE_SYS_TYPES_H 1 15 | #cmakedefine HAVE_STDINT_H 1 16 | #cmakedefine HAVE_STDDEF_H 1 17 | 18 | #define HAVE_SOCKLEN_T 1 19 | -------------------------------------------------------------------------------- /rcss/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(net) 2 | add_subdirectory(conf) 3 | add_subdirectory(gzip) 4 | add_subdirectory(clang) 5 | 6 | add_library(RCSSBase INTERFACE) 7 | add_library(RCSS::Base ALIAS RCSSBase) 8 | 9 | target_compile_definitions(RCSSBase 10 | INTERFACE 11 | HAVE_CONFIG_H 12 | ) 13 | 14 | target_include_directories(RCSSBase 15 | INTERFACE 16 | ${PROJECT_SOURCE_DIR} 17 | ${PROJECT_BINARY_DIR} 18 | ) 19 | 20 | #set_property(TARGET RCSSBase PROPERTY 21 | # PUBLIC_HEADER 22 | # factory.hpp 23 | # parser.h 24 | #) 25 | 26 | target_link_libraries(RCSSBase 27 | INTERFACE 28 | # Boost::filesystem 29 | ) 30 | 31 | #install(TARGETS RCSSBase 32 | # PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rcssbase 33 | #) 34 | 35 | install(FILES 36 | factory.hpp 37 | parser.h 38 | vector.h 39 | DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rcss 40 | ) 41 | -------------------------------------------------------------------------------- /spec.tmpl.in: -------------------------------------------------------------------------------- 1 | Summary: The RoboCup Soccer Simulator 2 | Name: @PACKAGE@ 3 | Version: @VERSION@ 4 | Release: 0 5 | Copyright: LGPL 6 | Group: Applications/Engineering 7 | Source0: http://prdownloads.sourceforge.net/sserver/%{name}-%{version}.tar.gz 8 | URL: http://sserver.sf.net 9 | BuildRoot: %{_tmppath}/%{name}-root 10 | Requires: rcssbase >= 10.0.9 11 | Prefix: %{_prefix} 12 | 13 | %description 14 | The RoboCup Soccer Simulator Server (rcssserver) is a research and 15 | educational tool for mutli-agent systems and artificial 16 | intelligence. It allows 11 simulated autonomous robotic players to 17 | play soccer (football). 18 | 19 | %prep 20 | %setup 21 | 22 | %build 23 | %configure 24 | make 25 | 26 | %install 27 | %makeinstall 28 | 29 | %clean 30 | rm -rf $RPM_BUILD_ROOT 31 | 32 | %files 33 | %defattr(-,root,root) 34 | 35 | %doc AUTHORS Acknowledgement BUGS COPYING INSTALL NEWS README 36 | 37 | %changelog 38 | -------------------------------------------------------------------------------- /BUGS: -------------------------------------------------------------------------------- 1 | DEFECT DESCRIPTION STATUS RESOVLED VERSION 2 | =============================================================================== 3 | #1235911 clang CondAnd problem Fixed 10.0.6 4 | #1235909 player say parse error Fixed 10.0.6 5 | #1222129 config parser not handling embeded - Fixed rcssbase 10.0.10 6 | #1182281 linking problem Fixed 10.0.5 7 | #1222143 keepaway kickable area too small Fixed 10.0.4 8 | #1186996 compile problem with gcc 3.4 Fixed 10.0.4 9 | #1189976 offline coach move command User Error n/a 10 | #1183388 .conf files duplicated Fixed 10.0.3 11 | #1183390 clang crash Fixed 10.0.3 12 | #754241 memory leak Fixed 10.0.3 13 | #773792 free kick fault bugs Fixed 10.0.3 14 | -------------------------------------------------------------------------------- /src/fix_lexer_file.cmake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/cmake 2 | 3 | # This file contains the fix for the legacy code 4 | 5 | if(NOT DEFINED GENERATED_FILE_PATH) 6 | message(FATAL_ERROR "Missing arguments for the fix_lexer_file script: GENERATED_FILE_PATH") 7 | elseif(NOT DEFINED CORRECT_HEADER_NAME) 8 | message(FATAL_ERROR "Missing arguments for the fix_lexer_file script: CORRECT_HEADER_NAME") 9 | elseif(NOT DEFINED OUTPUT_FILE_PATH) 10 | message(FATAL_ERROR "Missing arguments for the fix_lexer_file script: OUTPUT_FILE_PATH") 11 | endif() 12 | 13 | # Replace #include in generated lexer files 14 | file(READ ${GENERATED_FILE_PATH} FILE_CONTENTS) 15 | string(REPLACE 16 | "#include " # String to match 17 | "#include \"${CORRECT_HEADER_NAME}\"" # With what to replace 18 | FILE_CONTENTS # Where to put the result 19 | "${FILE_CONTENTS}" # Input 20 | ) 21 | file(WRITE ${OUTPUT_FILE_PATH} "${FILE_CONTENTS}") 22 | -------------------------------------------------------------------------------- /rcss/clang/fix_lexer_file.cmake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/cmake 2 | 3 | # This file contains the fix for the legacy code 4 | 5 | if(NOT DEFINED GENERATED_FILE_PATH) 6 | message(FATAL_ERROR "Missing arguments for the fix_lexer_file script: GENERATED_FILE_PATH") 7 | elseif(NOT DEFINED CORRECT_HEADER_NAME) 8 | message(FATAL_ERROR "Missing arguments for the fix_lexer_file script: CORRECT_HEADER_NAME") 9 | elseif(NOT DEFINED OUTPUT_FILE_PATH) 10 | message(FATAL_ERROR "Missing arguments for the fix_lexer_file script: OUTPUT_FILE_PATH") 11 | endif() 12 | 13 | # Replace #include in generated lexer files 14 | file(READ ${GENERATED_FILE_PATH} FILE_CONTENTS) 15 | string(REPLACE 16 | "#include " # String to match 17 | "#include \"${CORRECT_HEADER_NAME}\"" # With what to replace 18 | FILE_CONTENTS # Where to put the result 19 | "${FILE_CONTENTS}" # Input 20 | ) 21 | file(WRITE ${OUTPUT_FILE_PATH} "${FILE_CONTENTS}") 22 | -------------------------------------------------------------------------------- /PLATFORMS: -------------------------------------------------------------------------------- 1 | This software has been tested on the platforms listed below. Please 2 | see the notes for your platform if you have problems building 3 | rcssserver. 4 | 5 | If you find solutions to any of the issues listed below, please sumbit 6 | a patch on the http://sf.net/projects/sserver site or email 7 | sserver-admin@users.sf.net 8 | 9 | i686 SuSE 9.1 (Linux kernel 2.6.5-7.111-default): 10 | * No issues 11 | 12 | i686 RedHat 9 (Linux kernel 2.4.20-19.9bigmem): 13 | * No issues 14 | 15 | PowerPC Mac OS X: 16 | * No issues 17 | 18 | i686 Cygwin 1.3.22 on Win2K SP4 19 | * Well, cygwin is basically screwed for us at the moment. Please 20 | see the thread started at 21 | 22 | http://www.mail-archive.com/cygwin@cygwin.com/msg25851.html 23 | 24 | for more details. 25 | 26 | Sparc Solaris 9 with gcc 3.1 27 | * use `--without-ncurses` during configure. This prevents the sample 28 | client from being built with the ncurses GUI, because of problems found 29 | building against it on this platform. 30 | -------------------------------------------------------------------------------- /rcss/gzip/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(RCSSGZ SHARED 2 | gzfstream.cpp 3 | gzstream.cpp 4 | ) 5 | add_library(RCSS::GZ ALIAS RCSSGZ) 6 | 7 | target_compile_definitions(RCSSGZ 8 | PUBLIC 9 | HAVE_CONFIG_H 10 | ) 11 | 12 | target_include_directories(RCSSGZ 13 | PUBLIC 14 | ${PROJECT_SOURCE_DIR} 15 | ${PROJECT_BINARY_DIR} 16 | ) 17 | 18 | target_compile_options(RCSSGZ 19 | PRIVATE 20 | -W -Wall 21 | ) 22 | 23 | set_target_properties(RCSSGZ 24 | PROPERTIES 25 | SOVERSION 1 26 | VERSION 1.0.0 27 | LIBRARY_OUTPUT_NAME "rcssgz" 28 | ) 29 | 30 | set_property(TARGET RCSSGZ PROPERTY 31 | PUBLIC_HEADER 32 | gzstream.hpp 33 | gzfstream.hpp 34 | ) 35 | 36 | target_link_libraries(RCSSGZ 37 | PRIVATE 38 | ZLIB::ZLIB 39 | ) 40 | 41 | install(TARGETS RCSSGZ 42 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 43 | COMPONENT Libraries 44 | PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE 45 | PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rcss/gzip 46 | ) 47 | -------------------------------------------------------------------------------- /rel.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | if( change <= 0 ) 3 | exit -1; 4 | } 5 | 6 | /AC_INIT/ { 7 | if( $2 ~ /\)$/ ) 8 | { 9 | ver = substr( $2, 0, length( $2 ) - 1 ); 10 | tail=")"; 11 | } 12 | else 13 | ver = $2; 14 | if( $2 ~ /\]$/ ) 15 | { 16 | ver = substr( $2, 0, length( $2 ) - 1 ); 17 | tail="]"; 18 | } 19 | else 20 | ver = $2; 21 | 22 | if( $2 ~ /\,$/ ) 23 | { 24 | ver = substr( $2, 0, length( $2 ) - 1 ); 25 | tail=","; 26 | } 27 | else 28 | ver = $2; 29 | 30 | n = split( ver, ver_array, "." ); 31 | 32 | while( change > n ) 33 | ver_array[ ++n ] = 0; 34 | 35 | ver_array[ change ]++; 36 | 37 | while( ++change <= n ) 38 | ver_array[ change ] = 0; 39 | 40 | $2 = ""; 41 | for( i = 1; i < n; ++i ) 42 | $2 = $2 ver_array[ i ] "."; 43 | $2 = $2 ver_array[ n ]; 44 | if( tail ) 45 | $2 = $2 tail; 46 | } 47 | 48 | { print $0; } 49 | 50 | -------------------------------------------------------------------------------- /Acknowledgement: -------------------------------------------------------------------------------- 1 | Many contributers help us to build this system. Especially, 2 | following people send helpful information about bugs, patchs for 3 | various system, and performance of the system in various environment. 4 | 5 | * Peter Stone [CMU] 6 | * Yuichi Motomura [ETL] 7 | * Susumu TAKAKI [Chukyo Univ.] 8 | * Harukazu Igarashi [Ricoh] 9 | * HIRONORI MIZUNO [Waseda Univ.] 10 | * Milind Tambe [USC] 11 | * LiWu Chang [Naval Research Laboratory] 12 | * David W. Aha [Naval Research Laboratory] 13 | * Jonathan Kelley [CalTech] 14 | * Masahito Mori [Sony] 15 | * Tohru Takeyama [Gifu Univ.] 16 | * Simon Ch'ng [Royal Melbourne Institute of Melbourne] 17 | * David E. Moriarty [Naval Research Laboratory] 18 | * KOICHI OGAWARA [Tokyo Univ.] 19 | * Sebastien ROUGEAUX [ETL] 20 | * Naomichi Inoue [Waseda Univ.] 21 | * Jukka Riekki [Univ.of Oulu] 22 | * Youichi Ishiwata [RWC] 23 | * Hidetosi SIRAI [Chukyo Univ.] 24 | * Shinobu Takasugi [Justsystem Corporation] 25 | * Masamitsu Uno [Nagoya University] 26 | * Jussi Pajala [] 27 | * Chad Ryan [umn] 28 | * William Webber [RMIT] 29 | 30 | 31 | -------------------------------------------------------------------------------- /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | defaults: &defaults 4 | working_directory: /home/circleci/rcssserver 5 | docker: 6 | - image: ubuntu-2004 7 | 8 | jobs: 9 | build: 10 | <<: *defaults 11 | parallelism: 1 12 | steps: 13 | - checkout 14 | - run: 15 | name: Update system 16 | command: apt-get update 17 | - run: 18 | name: Install dependencies 19 | command: apt-get install build-essential flex bison libboost-all-dev -y 20 | - run: 21 | name: Install autotools libraries 22 | command: apt-get install autoconf automake libtool -y 23 | - run: 24 | name: Generate configure file 25 | command: | 26 | aclocal 27 | autoreconf --install 28 | automake --add-missing 29 | - run: 30 | name: Configure, run make and install 31 | command: | 32 | ./configure 33 | make 34 | make install 35 | ldconfig 36 | - run: 37 | name: Check if rcssserver can run 38 | command: RCSS_CONF_DIR=. timeout 3 rcssserver || echo Run successfully 39 | 40 | workflows: 41 | version: 2 42 | deploy: 43 | jobs: 44 | - build 45 | -------------------------------------------------------------------------------- /rcss/net/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(RCSSNet SHARED 2 | addr.cpp 3 | socket.cpp 4 | socketstreambuf.cpp 5 | tcpsocket.cpp 6 | udpsocket.cpp 7 | isocketstream.hpp 8 | osocketstream.hpp 9 | iosocketstream.hpp 10 | ) 11 | add_library(RCSS::Net ALIAS RCSSNet) 12 | 13 | target_compile_definitions(RCSSNet 14 | PUBLIC 15 | HAVE_CONFIG_H 16 | ) 17 | 18 | target_include_directories(RCSSNet 19 | PUBLIC 20 | ${PROJECT_SOURCE_DIR} 21 | ${PROJECT_BINARY_DIR} 22 | ) 23 | 24 | target_compile_options(RCSSNet 25 | PRIVATE 26 | -W -Wall 27 | ) 28 | 29 | set_target_properties(RCSSNet 30 | PROPERTIES 31 | SOVERSION 1 32 | VERSION 1.0.1 33 | LIBRARY_OUTPUT_NAME "rcssnet" 34 | ) 35 | 36 | set_property(TARGET RCSSNet PROPERTY 37 | PUBLIC_HEADER 38 | addr.hpp 39 | socket.hpp 40 | udpsocket.hpp 41 | tcpsocket.hpp 42 | socketstreambuf.hpp 43 | isocketstream.hpp 44 | osocketstream.hpp 45 | iosocketstream.hpp 46 | ) 47 | 48 | install(TARGETS RCSSNet 49 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 50 | COMPONENT Libraries 51 | PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE 52 | PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rcss/net 53 | ) 54 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5.1) 2 | 3 | project(RCSSServer VERSION 19.0.0) 4 | 5 | set(CMAKE_CXX_STANDARD 17) 6 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 7 | 8 | if(NOT CMAKE_BUILD_TYPE) 9 | set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE) 10 | endif() 11 | 12 | set(CMAKE_INCLUDE_CURRENT_DIR ON) 13 | set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON) 14 | 15 | find_package(ZLIB REQUIRED) 16 | if(ZLIB_FOUND) 17 | set(HAVE_LIBZ TRUE) 18 | endif() 19 | find_package(BISON REQUIRED) 20 | find_package(FLEX REQUIRED) 21 | #find_package(Boost COMPONENTS system filesystem REQUIRED) 22 | find_package(Boost 1.44.0 COMPONENTS system REQUIRED) 23 | 24 | include(GNUInstallDirs) 25 | include(CheckIncludeFileCXX) 26 | 27 | check_include_file_cxx("sys/socket.h" HAVE_SYS_SOCKET_H) 28 | check_include_file_cxx("sys/param.h" HAVE_SYS_PARAM_H) 29 | check_include_file_cxx("sys/time.h" HAVE_SYS_TIME_H) 30 | check_include_file_cxx("netinet/in.h" HAVE_NETINET_IN_H) 31 | check_include_file_cxx("arpa/inet.h" HAVE_ARPA_INET_H) 32 | check_include_file_cxx("netdb.h" HAVE_NETDB_H) 33 | check_include_file_cxx("unistd.h" HAVE_UNISTD_H) 34 | check_include_file_cxx("poll.h" HAVE_POLL_H) 35 | check_include_file_cxx("pwd.h" HAVE_PWD_H) 36 | 37 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake config.h) 38 | 39 | add_subdirectory(rcss) 40 | add_subdirectory(src) 41 | -------------------------------------------------------------------------------- /rcss/conf/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(RCSSConfParser SHARED 2 | parser.cpp 3 | builder.cpp 4 | statushandler.cpp 5 | streamstatushandler.cpp 6 | paramgetter.hpp 7 | paramsetter.hpp 8 | ) 9 | add_library(RCSS::ConfParser ALIAS RCSSConfParser) 10 | 11 | target_link_libraries(RCSSConfParser 12 | PUBLIC 13 | # Boost::filesystem 14 | PRIVATE 15 | Boost::boost 16 | ) 17 | 18 | target_compile_definitions(RCSSConfParser 19 | PUBLIC 20 | HAVE_CONFIG_H 21 | ) 22 | 23 | target_include_directories(RCSSConfParser 24 | PUBLIC 25 | ${PROJECT_SOURCE_DIR} 26 | ${PROJECT_BINARY_DIR} 27 | ) 28 | 29 | target_compile_options(RCSSConfParser 30 | PRIVATE 31 | -W -Wall 32 | ) 33 | 34 | set_target_properties(RCSSConfParser 35 | PROPERTIES 36 | SOVERSION 18 37 | VERSION 18.0.0 38 | LIBRARY_OUTPUT_NAME "rcssconfparser" 39 | ) 40 | 41 | set_property(TARGET RCSSConfParser PROPERTY 42 | PUBLIC_HEADER 43 | builder.hpp 44 | parser.hpp 45 | paramgetter.hpp 46 | paramsetter.hpp 47 | statushandler.hpp 48 | streamstatushandler.hpp 49 | ) 50 | 51 | install(TARGETS RCSSConfParser 52 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 53 | COMPONENT Libraries 54 | PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE 55 | PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rcss/conf 56 | ) 57 | -------------------------------------------------------------------------------- /src/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * version.h 3 | */ 4 | 5 | /* 6 | *Copyright: 7 | 8 | Copyright (C) 1996-2000 Electrotechnical Laboratory. 9 | Itsuki Noda, Yasuo Kuniyoshi and Hitoshi Matsubara. 10 | Copyright (C) 2000 - 2002 RoboCup Soccer Server Maintainance Group. 11 | Patrick Riley, Tom Howard, Daniel Polani, Itsuki Noda, 12 | Mikhail Prokopenko, Jan Wendler 13 | Copyright (C) 2002- RoboCup Soccer Simulator Maintainance Group. 14 | 15 | This file is a part of SoccerServer. 16 | 17 | This code is free software; you can redistribute it and/or 18 | modify it under the terms of the GNU Lesser General Public 19 | License as published by the Free Software Foundation; either 20 | version 3 of the License, or (at your option) any later version. 21 | 22 | This library is distributed in the hope that it will be useful, 23 | but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 25 | Lesser General Public License for more details. 26 | 27 | You should have received a copy of the GNU Lesser General Public 28 | License along with this library; if not, write to the Free Software 29 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 30 | 31 | *EndCopyright: 32 | */ 33 | 34 | 35 | char Copyright[] = "Copyright (C) 1995, 1996, 1997, 1998, 1999 Electrotechnical Laboratory.\n\ 36 | 2000 - RoboCup Soccer Simulator Maintenance Group.\n"; 37 | -------------------------------------------------------------------------------- /rcss/gzip/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | lib_LTLIBRARIES = librcssgz.la 3 | 4 | librcssgz_la_SOURCES= \ 5 | gzfstream.hpp \ 6 | gzfstream.cpp \ 7 | gzstream.hpp \ 8 | gzstream.cpp 9 | 10 | librcssgz_la_LDFLAGS = -version-info 1:0:0 11 | # 1. Start with version information of `0:0:0' for each libtool library. 12 | # 13 | # 2. Update the version information only immediately before a public 14 | # release of your software. More frequent updates are unnecessary, 15 | # and only guarantee that the current interface number gets larger 16 | # faster. 17 | # 18 | # 3. If the library source code has changed at all since the last 19 | # update, then increment REVISION (`C:R:A' becomes `C:r+1:A'). 20 | # 21 | # 4. If any interfaces have been added, removed, or changed since the 22 | # last update, increment CURRENT, and set REVISION to 0. 23 | # 24 | # 5. If any interfaces have been added since the last public release, 25 | # then increment AGE. 26 | # 27 | # 6. If any interfaces have been removed since the last public release, 28 | # then set AGE to 0. 29 | 30 | librcssgz_la_LIBADD = 31 | 32 | librcssgzincludedir = $(includedir)/rcss/gzip 33 | 34 | librcssgzinclude_HEADERS = \ 35 | gzstream.hpp \ 36 | gzfstream.hpp 37 | 38 | AM_CPPFLAGS = -I$(top_srcdir) 39 | AM_CFLAGS = -W -Wall 40 | AM_CXXFLAGS = -W -Wall 41 | AM_LDFLAGS = 42 | 43 | EXTRA_DIST = \ 44 | CMakeLists.txt 45 | 46 | CLEANFILES = \ 47 | *~ \ 48 | core 49 | -------------------------------------------------------------------------------- /src/resultsaver.cpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | resultsaver.cpp 5 | Abstract Base Class for saving results 6 | ------------------- 7 | begin : 06-JUNE-2004 8 | copyright : (C) 2004 by The RoboCup Soccer Simulator 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | 26 | #include "resultsaver.hpp" 27 | 28 | ResultSaver::FactoryHolder & 29 | ResultSaver::factory() 30 | { 31 | static FactoryHolder fact; 32 | return fact; 33 | } 34 | -------------------------------------------------------------------------------- /m4/ax_cxx_compile_stdcxx_14.m4: -------------------------------------------------------------------------------- 1 | # ============================================================================= 2 | # https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_14.html 3 | # ============================================================================= 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_CXX_COMPILE_STDCXX_14([ext|noext], [mandatory|optional]) 8 | # 9 | # DESCRIPTION 10 | # 11 | # Check for baseline language coverage in the compiler for the C++14 12 | # standard; if necessary, add switches to CXX and CXXCPP to enable 13 | # support. 14 | # 15 | # This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX 16 | # macro with the version set to C++14. The two optional arguments are 17 | # forwarded literally as the second and third argument respectively. 18 | # Please see the documentation for the AX_CXX_COMPILE_STDCXX macro for 19 | # more information. If you want to use this macro, you also need to 20 | # download the ax_cxx_compile_stdcxx.m4 file. 21 | # 22 | # LICENSE 23 | # 24 | # Copyright (c) 2015 Moritz Klammler 25 | # 26 | # Copying and distribution of this file, with or without modification, are 27 | # permitted in any medium without royalty provided the copyright notice 28 | # and this notice are preserved. This file is offered as-is, without any 29 | # warranty. 30 | 31 | #serial 5 32 | 33 | AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX]) 34 | AC_DEFUN([AX_CXX_COMPILE_STDCXX_14], [AX_CXX_COMPILE_STDCXX([14], [$1], [$2])]) 35 | -------------------------------------------------------------------------------- /m4/ax_cxx_compile_stdcxx_17.m4: -------------------------------------------------------------------------------- 1 | # ============================================================================= 2 | # https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_17.html 3 | # ============================================================================= 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_CXX_COMPILE_STDCXX_17([ext|noext], [mandatory|optional]) 8 | # 9 | # DESCRIPTION 10 | # 11 | # Check for baseline language coverage in the compiler for the C++17 12 | # standard; if necessary, add switches to CXX and CXXCPP to enable 13 | # support. 14 | # 15 | # This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX 16 | # macro with the version set to C++17. The two optional arguments are 17 | # forwarded literally as the second and third argument respectively. 18 | # Please see the documentation for the AX_CXX_COMPILE_STDCXX macro for 19 | # more information. If you want to use this macro, you also need to 20 | # download the ax_cxx_compile_stdcxx.m4 file. 21 | # 22 | # LICENSE 23 | # 24 | # Copyright (c) 2015 Moritz Klammler 25 | # Copyright (c) 2016 Krzesimir Nowak 26 | # 27 | # Copying and distribution of this file, with or without modification, are 28 | # permitted in any medium without royalty provided the copyright notice 29 | # and this notice are preserved. This file is offered as-is, without any 30 | # warranty. 31 | 32 | #serial 2 33 | 34 | AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX]) 35 | AC_DEFUN([AX_CXX_COMPILE_STDCXX_17], [AX_CXX_COMPILE_STDCXX([17], [$1], [$2])]) 36 | -------------------------------------------------------------------------------- /rcss/conf/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | lib_LTLIBRARIES = librcssconfparser.la 3 | 4 | librcssconfparser_la_SOURCES = \ 5 | parser.cpp \ 6 | builder.cpp \ 7 | statushandler.cpp \ 8 | streamstatushandler.cpp 9 | 10 | librcssconfparser_la_LDFLAGS = -version-info 18:0:0 11 | # 1. Start with version information of `0:0:0' for each libtool library. 12 | # 13 | # 2. Update the version information only immediately before a public 14 | # release of your software. More frequent updates are unnecessary, 15 | # and only guarantee that the current interface number gets larger 16 | # faster. 17 | # 18 | # 3. If the library source code has changed at all since the last 19 | # update, then increment REVISION (`C:R:A' becomes `C:r+1:A'). 20 | # 21 | # 4. If any interfaces have been added, removed, or changed since the 22 | # last update, increment CURRENT, and set REVISION to 0. 23 | # 24 | # 5. If any interfaces have been added since the last public release, 25 | # then increment AGE. 26 | # 27 | # 6. If any interfaces have been removed since the last public release, 28 | # then set AGE to 0. 29 | 30 | #librcssconfparser_la_LIBADD = $(BOOST_FILESYSTEM_LIB) 31 | 32 | librcssconfparserincludedir = $(includedir)/rcss/conf 33 | 34 | librcssconfparserinclude_HEADERS = \ 35 | builder.hpp \ 36 | parser.hpp \ 37 | paramgetter.hpp \ 38 | paramsetter.hpp \ 39 | statushandler.hpp \ 40 | streamstatushandler.hpp 41 | 42 | AM_CPPFLAGS = -I$(top_srcdir) 43 | AM_CFLAGS = -W -Wall 44 | AM_CXXFLAGS = -W -Wall 45 | AM_LD_FLAGS = 46 | 47 | EXTRA_DIST = \ 48 | CMakeLists.txt 49 | 50 | CLEANFILES = \ 51 | *~ \ 52 | core 53 | -------------------------------------------------------------------------------- /src/rcssexceptions.cpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | rcssexceptions.cpp 5 | exceptions for rcss 6 | ------------------- 7 | begin : 2008-08-27 8 | copyright : (C) 2008 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | 26 | #include "rcssexceptions.h" 27 | 28 | #include 29 | 30 | namespace rcss { 31 | namespace util { 32 | 33 | NullErr::NullErr( const char * file, 34 | const int & line, 35 | const char * msg ) throw() 36 | { 37 | std::ostringstream tmp; 38 | tmp << file << ": " << line << ": " << msg; 39 | M_msg = tmp.str(); 40 | } 41 | 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/pcombuilder.cpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | pcombuilder.cpp 5 | Interface for building a player command message 6 | ------------------- 7 | begin : 2008-08-27 8 | copyright : (C) 2008 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | 26 | #include 27 | 28 | #include "pcombuilder.h" 29 | 30 | namespace rcss { 31 | namespace pcom { 32 | 33 | BuilderErr::BuilderErr( const char * file, 34 | const int & line, 35 | const char * msg ) throw() 36 | { 37 | std::ostringstream tmp; 38 | tmp << file << ": " << line << ": " << msg; 39 | M_msg = tmp.str(); 40 | } 41 | 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /rcss/clang/clangbuilder.cpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | clangbuilder.cc 5 | Interface for building a clang message 6 | ------------------- 7 | begin : 25-FEB-2002 8 | copyright : (C) 2002 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | 26 | #include 27 | 28 | #include "clangbuilder.h" 29 | 30 | namespace rcss { 31 | namespace clang { 32 | 33 | BuilderErr::BuilderErr( const char * file, 34 | const int & line, 35 | const char * msg ) throw() 36 | { 37 | std::ostringstream tmp; 38 | tmp << file << ": " << line << ": " << msg; 39 | M_msg = tmp.str(); 40 | } 41 | 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /rcss/net/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | lib_LTLIBRARIES = librcssnet.la 3 | 4 | librcssnet_la_SOURCES = \ 5 | addr.cpp \ 6 | socket.cpp \ 7 | socketstreambuf.cpp \ 8 | udpsocket.cpp \ 9 | tcpsocket.cpp 10 | 11 | #librcssnet_la_LDFLAGS = -version-info 1:1:0 -L../error 12 | librcssnet_la_LDFLAGS = -version-info 1:1:0 13 | # 1. Start with version information of `0:0:0' for each libtool library. 14 | # 15 | # 2. Update the version information only immediately before a public 16 | # release of your software. More frequent updates are unnecessary, 17 | # and only guarantee that the current interface number gets larger 18 | # faster. 19 | # 20 | # 3. If the library source code has changed at all since the last 21 | # update, then increment REVISION (`C:R:A' becomes `C:r+1:A'). 22 | # 23 | # 4. If any interfaces have been added, removed, or changed since the 24 | # last update, increment CURRENT, and set REVISION to 0. 25 | # 26 | # 5. If any interfaces have been added since the last public release, 27 | # then increment AGE. 28 | # 29 | # 6. If any interfaces have been removed since the last public release, 30 | # then set AGE to 0. 31 | 32 | #librcssnet_la_LIBADD = @NET_LIBS@ -lrcsserror 33 | librcssnet_la_LIBADD = 34 | 35 | librcssnetincludedir = $(includedir)/rcss/net 36 | 37 | librcssnetinclude_HEADERS = \ 38 | addr.hpp \ 39 | socket.hpp \ 40 | udpsocket.hpp \ 41 | tcpsocket.hpp \ 42 | socketstreambuf.hpp \ 43 | isocketstream.hpp \ 44 | osocketstream.hpp \ 45 | iosocketstream.hpp 46 | 47 | AM_CPPFLAGS = -I$(top_srcdir) 48 | AM_CFLAGS = -W -Wall 49 | AM_CXXFLAGS = -W -Wall 50 | AM_LDFLAGS = 51 | 52 | EXTRA_DIST = \ 53 | CMakeLists.txt 54 | 55 | CLEANFILES = \ 56 | *~ \ 57 | core 58 | -------------------------------------------------------------------------------- /src/pcomparser.cpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | pcomparser.cpp 5 | Parser for Player Commands 6 | ------------------- 7 | begin : 2008-08-27 8 | copyright : (C) 2008 by The RoboCup Soccer Server 9 | Maintainance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | 26 | #include 27 | 28 | #include "pcomparser.h" 29 | 30 | namespace rcss { 31 | namespace pcom { 32 | 33 | Parser::Parser( Builder & builder ) 34 | : M_param( *this, builder ), 35 | M_parser( &RCSS_PCOM_parse ) 36 | { 37 | 38 | } 39 | 40 | int 41 | Parser::parse( const char * msg ) 42 | { 43 | std::istringstream strm( msg ); 44 | 45 | return ( rcss::Parser::parse( strm ) ? 0 : 1 ); 46 | } 47 | 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /rcss/clang/clangparser.cpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | clangparser.cpp 5 | Parser for the Coach Lang 6 | ------------------- 7 | begin : 2008-08-22 8 | copyright : (C) 2008 by The RoboCup Soccer Server 9 | Maintainance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | 26 | #include 27 | 28 | #include "clangparser.h" 29 | 30 | namespace rcss { 31 | namespace clang { 32 | 33 | Parser::Parser( Builder & builder ) 34 | : M_param( *this, builder ), 35 | M_parser( &RCSS_CLANG_parse ) 36 | { 37 | 38 | } 39 | 40 | int 41 | Parser::parse( const char * msg ) 42 | { 43 | std::istringstream strm( msg ); 44 | return ( rcss::Parser::parse( strm ) ? 0 : 1 ); 45 | } 46 | 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/weather.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | weather.h 5 | Class for weather effects control 6 | ------------------- 7 | begin : 2009-11-18 8 | copyright : (C) 2009 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifndef RCSSSERVER_WEATHER_H 23 | #define RCSSSERVER_WEATHER_H 24 | 25 | #include "object.h" 26 | 27 | class Weather { 28 | private: 29 | 30 | PVector M_wind_vector; 31 | double M_wind_rand; 32 | 33 | const Weather & operator=( const Weather & ); 34 | public: 35 | Weather(); 36 | ~Weather(); 37 | 38 | void init(); 39 | void halfTime(); 40 | 41 | const PVector & windVector() const { return M_wind_vector; } 42 | const double & windRand() const { return M_wind_rand; } 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /rcss/net/udpsocket.hpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | udpsocket.hpp - A simple udp socket class 5 | ------------------- 6 | begin : 08-JAN-2003 7 | copyright : (C) 2003 by The RoboCup Soccer Server 8 | Maintenance Group. 9 | email : sserver-admin@lists.sourceforge.net 10 | ***************************************************************************/ 11 | 12 | /*************************************************************************** 13 | * * 14 | * This program is free software; you can redistribute it and/or modify * 15 | * it under the terms of the GNU LGPL as published by the Free Software * 16 | * Foundation; either version 2 of the License, or (at your option) any * 17 | * later version. * 18 | * * 19 | ***************************************************************************/ 20 | 21 | 22 | #ifndef RCSS_NET_UDPSOCKET_HPP 23 | #define RCSS_NET_UDPSOCKET_HPP 24 | 25 | #include 26 | 27 | namespace rcss { 28 | namespace net { 29 | 30 | class UDPSocket 31 | : public Socket { 32 | public: 33 | 34 | UDPSocket(); 35 | 36 | UDPSocket( SocketDesc & s ); 37 | 38 | UDPSocket( const Addr & addr ); 39 | 40 | UDPSocket( const Addr & addr, 41 | const Addr & dest ); 42 | 43 | protected: 44 | virtual 45 | bool doOpen( SocketDesc & fd ); 46 | }; 47 | 48 | } 49 | } 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /src/rcssexceptions.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | rcssexceptions.h 5 | exceptions for rcss 6 | ------------------- 7 | begin : 27-JUN-2002 8 | copyright : (C) 2002 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifndef RCSS_EXCEPTIONS_H 23 | #define RCSS_EXCEPTIONS_H 24 | 25 | #include 26 | #include 27 | 28 | namespace rcss { 29 | namespace util { 30 | 31 | class NullErr 32 | : public std::exception { 33 | protected: 34 | std::string M_msg; 35 | public: 36 | NullErr( const char * file, 37 | const int & line, 38 | const char * msg ) throw(); 39 | 40 | ~NullErr() throw() 41 | { } 42 | 43 | const char * what() const throw() 44 | { 45 | return M_msg.c_str(); 46 | } 47 | }; 48 | 49 | } 50 | } 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/serializerplayerstdv5.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | serializerplayerstdv5.h 5 | Class for serializing data to std v5 players 6 | ------------------- 7 | begin : 2023-01-27 8 | copyright : (C) 2023 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | ***************************************************************************/ 11 | 12 | /*************************************************************************** 13 | * * 14 | * This program is free software; you can redistribute it and/or modify * 15 | * it under the terms of the GNU LGPL as published by the Free Software * 16 | * Foundation; either version 3 of the License, or (at your option) any * 17 | * later version. * 18 | * * 19 | ***************************************************************************/ 20 | 21 | 22 | #ifndef SERIALIZERPLAYERSTDV5_H 23 | #define SERIALIZERPLAYERSTDV5_H 24 | 25 | #include "serializerplayerstdv1.h" 26 | 27 | namespace rcss { 28 | 29 | class SerializerPlayerStdv5 30 | : public SerializerPlayerStdv1 { 31 | protected: 32 | explicit 33 | SerializerPlayerStdv5( const SerializerCommon::Ptr common ); 34 | 35 | public: 36 | virtual 37 | ~SerializerPlayerStdv5() override; 38 | 39 | static 40 | const 41 | Ptr create(); 42 | 43 | virtual 44 | void serializeBodyCounts( std::ostream &, 45 | const Player & ) const override; 46 | 47 | }; 48 | 49 | } 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /rcss/net/tcpsocket.hpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | tcpsocket.hpp - A simple tcp socket class 5 | ------------------- 6 | begin : 2003-11-11 7 | copyright : (C) 2003 by The RoboCup Soccer Server 8 | Maintenance Group. 9 | email : sserver-admin@lists.sourceforge.net 10 | ***************************************************************************/ 11 | 12 | /*************************************************************************** 13 | * * 14 | * This program is free software; you can redistribute it and/or modify * 15 | * it under the terms of the GNU LGPL as published by the Free Software * 16 | * Foundation; either version 2 of the License, or (at your option) any * 17 | * later version. * 18 | * * 19 | ***************************************************************************/ 20 | 21 | 22 | #ifndef RCSS_NET_TCPSOCKET_HPP 23 | #define RCSS_NET_TCPSOCKET_HPP 24 | 25 | 26 | #include 27 | 28 | namespace rcss { 29 | namespace net { 30 | 31 | class TCPSocket 32 | : public Socket { 33 | public: 34 | 35 | TCPSocket(); 36 | 37 | TCPSocket( SocketDesc & s ); 38 | 39 | TCPSocket( const Addr & addr ); 40 | 41 | TCPSocket( const Addr & addr, 42 | const Addr & dest ); 43 | 44 | bool accept( TCPSocket & sock ); 45 | 46 | bool listen( int backlog ); 47 | 48 | protected: 49 | virtual 50 | bool doOpen( SocketDesc& fd ); 51 | }; 52 | 53 | } 54 | } 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /src/serializeronlinecoachstdv13.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | serializeronlinecoachstdv13.h 5 | Class for serializing data to std v13 online coaches 6 | ------------------- 7 | begin : 2008-11-03 8 | copyright : (C) 2008 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifndef SERIALIZERONLINECOACHSTDV13_H 23 | #define SERIALIZERONLINECOACHSTDV13_H 24 | 25 | #include "serializeronlinecoachstdv8.h" 26 | 27 | namespace rcss { 28 | 29 | class SerializerOnlineCoachStdv13 30 | : public SerializerOnlineCoachStdv8 { 31 | protected: 32 | SerializerOnlineCoachStdv13( const SerializerCommon::Ptr common, 33 | const SerializerCoach::Ptr coach ); 34 | 35 | public: 36 | virtual 37 | ~SerializerOnlineCoachStdv13() override; 38 | 39 | static 40 | const Ptr create(); 41 | 42 | }; 43 | 44 | } 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/serializeronlinecoachstdv14.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | serializeronlinecoachstdv14.h 5 | Class for serializing data to std v14 online coaches 6 | ------------------- 7 | begin : 2009-10-26 8 | copyright : (C) 2009 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifndef SERIALIZERONLINECOACHSTDV14_H 23 | #define SERIALIZERONLINECOACHSTDV14_H 24 | 25 | #include "serializeronlinecoachstdv13.h" 26 | 27 | namespace rcss { 28 | 29 | class SerializerOnlineCoachStdv14 30 | : public SerializerOnlineCoachStdv13 { 31 | protected: 32 | SerializerOnlineCoachStdv14( const SerializerCommon::Ptr common, 33 | const SerializerCoach::Ptr coach ); 34 | 35 | public: 36 | virtual 37 | ~SerializerOnlineCoachStdv14() override; 38 | 39 | static 40 | const Ptr create(); 41 | 42 | }; 43 | 44 | } 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/synctimer.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | synctimer.h 5 | The synchronous timer used by the simulator 6 | ------------------- 7 | begin : AUG-2002 8 | copyright : (C) 2002 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifndef SYNCTIMER_H 23 | #define SYNCTIMER_H 24 | 25 | #include "timer.h" 26 | 27 | /** This is a subclass of the timer class. The run method specifes the 28 | synchronization timer. This timer waits till all messages are received by 29 | the client before continuing. */ 30 | class SyncTimer 31 | : public Timer 32 | { 33 | public: 34 | explicit 35 | SyncTimer( Timeable &timeable ) 36 | : Timer( timeable ) 37 | { } 38 | 39 | void run() override; 40 | 41 | // static 42 | // void 43 | // destroy( SyncTimer* c ); 44 | 45 | // static 46 | // Ptr 47 | // create( Timeable& t ); 48 | }; 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/visual.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | visual.h 5 | Classes for building visual messages 6 | ------------------- 7 | begin : 5-AUG-2002 8 | copyright : (C) 2002 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifndef RCSS_VISUAL_H 23 | #define RCSS_VISUAL_H 24 | 25 | #include "sender.h" 26 | 27 | namespace rcss { 28 | 29 | /*! 30 | //=================================================================== 31 | // 32 | // CLASS: VisualSendor 33 | // 34 | // DESC: Base class for the visual protocol. 35 | // 36 | //=================================================================== 37 | */ 38 | 39 | class VisualSender 40 | : protected Sender { 41 | protected: 42 | VisualSender( std::ostream & transport ) 43 | : Sender( transport ) 44 | { } 45 | 46 | public: 47 | virtual 48 | ~VisualSender() override 49 | { } 50 | 51 | virtual 52 | void sendVisual() = 0; 53 | }; 54 | 55 | 56 | } 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /src/serializeronlinecoachstdv6.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | serializeronlinecoachstdv6.h 5 | Class for serializing data to std v6 online coaches 6 | ------------------- 7 | begin : 24-JAN-2003 8 | copyright : (C) 2003 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifndef SERIALIZERONLINECOACHSTDV6_H 23 | #define SERIALIZERONLINECOACHSTDV6_H 24 | 25 | #include "serializeronlinecoachstdv1.h" 26 | 27 | namespace rcss { 28 | 29 | class SerializerOnlineCoachStdv6 30 | : public SerializerOnlineCoachStdv1 { 31 | protected: 32 | SerializerOnlineCoachStdv6( const SerializerCommon::Ptr common, 33 | const SerializerCoach::Ptr coach ); 34 | 35 | public: 36 | virtual 37 | ~SerializerOnlineCoachStdv6() override; 38 | 39 | static 40 | const Ptr create(); 41 | 42 | virtual 43 | void serializeInit( std::ostream &, 44 | const int side = 0 ) const override; 45 | }; 46 | 47 | } 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/sender.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | sender.h 5 | Base for sender classes 6 | ------------------- 7 | begin : 2002-10-07 8 | copyright : (C) 2002 by The RoboCup Soccer Simulator 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | 23 | #ifndef RCSSSENDER_H 24 | #define RCSSSENDER_H 25 | 26 | #include 27 | 28 | 29 | namespace rcss { 30 | 31 | /*! 32 | //=================================================================== 33 | // 34 | // CLASS: Sender 35 | // 36 | // DESC: Base sender. 37 | // 38 | //=================================================================== 39 | */ 40 | 41 | class Sender { 42 | private: 43 | std::ostream & M_transport; 44 | 45 | protected: 46 | Sender( std::ostream & transport ) 47 | : M_transport( transport ) 48 | { } 49 | 50 | std::ostream & transport() 51 | { 52 | return M_transport; 53 | } 54 | 55 | public: 56 | virtual 57 | ~Sender() 58 | { } 59 | 60 | }; 61 | 62 | } 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /rcss/clang/clangunsuppmsg.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | clangunsuppmsg.h 5 | Class for CLang unsupported messages 6 | ------------------- 7 | begin : 28-MAY-2002 8 | copyright : (C) 2002 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifndef RCSS_CLANGUNSUPPMSG_H 23 | #define RCSS_CLANGUNSUPPMSG_H 24 | 25 | #include 26 | 27 | namespace rcss { 28 | namespace clang { 29 | 30 | class UnsuppMsg 31 | : public Msg { 32 | public: 33 | UnsuppMsg(); 34 | 35 | virtual 36 | ~UnsuppMsg() override; 37 | 38 | virtual 39 | std::shared_ptr< Msg > deepCopy() const override; 40 | 41 | virtual 42 | std::ostream & print( std::ostream & out ) const override; 43 | 44 | virtual 45 | std::ostream & printPretty( std::ostream & out, 46 | const std::string & line_header ) const override; 47 | 48 | virtual 49 | Types getType() const 50 | { 51 | return UNSUP; 52 | } 53 | 54 | }; 55 | 56 | } 57 | } 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /rcss/net/handler.hpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | handler.hpp - handles network startup 5 | ------------------- 6 | begin : 14-AUG-2003 7 | copyright : (C) 2003 by The RoboCup Soccer Server 8 | Maintenance Group. 9 | email : sserver-admin@lists.sourceforge.net 10 | ***************************************************************************/ 11 | 12 | /*************************************************************************** 13 | * * 14 | * This program is free software; you can redistribute it and/or modify * 15 | * it under the terms of the GNU LGPL as published by the Free Software * 16 | * Foundation; either version 2 of the License, or (at your option) any * 17 | * later version. * 18 | * * 19 | ***************************************************************************/ 20 | 21 | #ifndef RCSS_NET_HANDLER_HPP 22 | #define RCSS_NET_HANDLER_HPP 23 | 24 | #ifdef __CYGWIN__ 25 | // cygwin is not win32 26 | #elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) 27 | #include 28 | #endif 29 | 30 | namespace rcss { 31 | namespace net { 32 | 33 | class Handler { 34 | 35 | public: 36 | static 37 | Handler & instance(); 38 | 39 | bool valid() const 40 | { 41 | return M_valid; 42 | } 43 | 44 | private: 45 | 46 | Handler(); 47 | 48 | Handler( const Handler & ); // not used 49 | Handler & operator=( const Handler & ); // not used 50 | 51 | ~Handler(); 52 | 53 | #ifdef __CYGWIN__ 54 | // cygwin is not win32 55 | #elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) 56 | WSADATA M_WSAData; 57 | #endif 58 | bool M_valid; 59 | }; 60 | 61 | } 62 | } 63 | 64 | #endif // RCSS_NET_HANDLER_HPP 65 | -------------------------------------------------------------------------------- /src/serializeronlinecoachstdv8.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | serializeronlinecoachstdv8.h 5 | Class for serializing data to std v8 online coaches 6 | ------------------- 7 | begin : 27-MAY-2002 8 | copyright : (C) 2002 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifndef SERIALIZERONLINECOACHSTDV8_H 23 | #define SERIALIZERONLINECOACHSTDV8_H 24 | 25 | #include "serializeronlinecoachstdv7.h" 26 | 27 | namespace rcss { 28 | 29 | class SerializerOnlineCoachStdv8 30 | : public SerializerOnlineCoachStdv7 { 31 | protected: 32 | SerializerOnlineCoachStdv8( const SerializerCommon::Ptr common, 33 | const SerializerCoach::Ptr coach ); 34 | 35 | public: 36 | virtual 37 | ~SerializerOnlineCoachStdv8() override; 38 | 39 | static 40 | const Ptr create(); 41 | 42 | virtual 43 | void serializePlayerClangVer( std::ostream & strm, 44 | const std::string & name, 45 | const unsigned int min, 46 | const unsigned int max ) const override; 47 | }; 48 | 49 | } 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /rcss/clang/clangunsuppmsg.cpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | clangunsuppmsg.cc 5 | Class for CLang unsupported messages 6 | ------------------- 7 | begin : 28-MAY-2002 8 | copyright : (C) 2002 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | 26 | #include "clangunsuppmsg.h" 27 | 28 | #include 29 | #include 30 | 31 | namespace rcss { 32 | namespace clang { 33 | 34 | UnsuppMsg::UnsuppMsg() 35 | : Msg() 36 | { 37 | 38 | } 39 | 40 | UnsuppMsg::~UnsuppMsg() 41 | { 42 | 43 | } 44 | 45 | std::shared_ptr< Msg > 46 | UnsuppMsg::deepCopy() const 47 | { 48 | std::shared_ptr< Msg > rval( new UnsuppMsg( *this ) ); 49 | return rval; 50 | } 51 | 52 | std::ostream & 53 | UnsuppMsg::print( std::ostream & out ) const 54 | { 55 | out << "(unsupported_clang)"; 56 | return out; 57 | } 58 | 59 | std::ostream & 60 | UnsuppMsg::printPretty( std::ostream & out, 61 | const std::string & line_header ) const 62 | { 63 | return out << line_header << "Unsupported Clang" << std::endl; 64 | } 65 | 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /rcss/net/osocketstream.hpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | osocketstream.hpp - An ostream for sockets 5 | ------------------- 6 | begin : 08-JAN-2003 7 | copyright : (C) 2003 by The RoboCup Soccer Server 8 | Maintenance Group. 9 | email : sserver-admin@lists.sourceforge.net 10 | ***************************************************************************/ 11 | 12 | /*************************************************************************** 13 | * * 14 | * This program is free software; you can redistribute it and/or modify * 15 | * it under the terms of the GNU LGPL as published by the Free Software * 16 | * Foundation; either version 2 of the License, or (at your option) any * 17 | * later version. * 18 | * * 19 | ***************************************************************************/ 20 | 21 | #ifndef RCSS_NET_OSOCKETSTREAM_HPP 22 | #define RCSS_NET_OSOCKETSTREAM_HPP 23 | 24 | #include 25 | 26 | namespace rcss { 27 | namespace net { 28 | 29 | class OSocketStream 30 | : public SocketStreamBuf, 31 | public std::ostream { 32 | public: 33 | 34 | OSocketStream( Socket & socket, 35 | const Addr & dest, 36 | int buffer_size = 8192 ) 37 | : SocketStreamBuf( socket, dest, NO_CONN, buffer_size ), 38 | std::ostream( this ) 39 | { } 40 | 41 | OSocketStream( Socket & socket, 42 | int buffer_size = 8192 ) 43 | : SocketStreamBuf( socket, NO_CONN, buffer_size ), 44 | std::ostream( this ) 45 | { } 46 | 47 | private: 48 | // not for use 49 | OSocketStream( const OSocketStream & ); 50 | OSocketStream & operator=( const OSocketStream & ); 51 | }; 52 | 53 | } 54 | } 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /src/stdtimer.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | stdtimer.h 5 | The stadard timer used by the simualtor 6 | ------------------- 7 | begin : AUG-2002 8 | copyright : (C) 2002 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifndef STDTIMER_H 23 | #define STDTIMER_H 24 | 25 | #include "timer.h" 26 | 27 | /** This is a subclass of the timer class. The run method specifes the 28 | standard timer. This timer is controlled by the different server 29 | configuration parameters that specify when the different messages 30 | will arrive. It is a singleton class, which means it can only be 31 | initialized once. To initialize the class, use the static instance 32 | method with as argument the timeable object. To use this class at 33 | a later time use the instance method with no argument.
34 | StandardTimer::instance( Std );
35 | StnadardTimer::instance().run(). */ 36 | class StandardTimer 37 | : public Timer { 38 | private: 39 | 40 | StandardTimer( const StandardTimer& t ) = delete; 41 | public: 42 | 43 | explicit 44 | StandardTimer( Timeable &timeable ); 45 | 46 | void run() override; 47 | 48 | }; 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /rcss/clang/clangfreeformmsg.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | clangfreeformmsg.h 5 | Class for CLang Freeform messages 6 | ------------------- 7 | begin : 28-MAY-2002 8 | copyright : (C) 2002 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifndef RCSS_CLANGFREEFORMMSG_H 23 | #define RCSS_CLANGFREEFORMMSG_H 24 | 25 | #include 26 | 27 | #include 28 | 29 | namespace rcss { 30 | namespace clang { 31 | 32 | class FreeformMsg 33 | : public Msg { 34 | private: 35 | FreeformMsg(); 36 | 37 | public: 38 | 39 | FreeformMsg( const std::string & str ); 40 | 41 | virtual 42 | ~FreeformMsg() override; 43 | 44 | virtual 45 | std::shared_ptr< Msg > deepCopy() const override; 46 | 47 | virtual 48 | std::ostream & print( std::ostream & out ) const override; 49 | 50 | virtual 51 | std::ostream & printPretty( std::ostream & out, 52 | const std::string & line_header ) const override; 53 | 54 | virtual 55 | Types getType() const 56 | { 57 | return FREEFORM; 58 | } 59 | 60 | private: 61 | std::string M_str; 62 | 63 | }; 64 | 65 | } 66 | } 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /rcss/net/isocketstream.hpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | isocketstream.hpp - An istream for sockets 5 | ------------------- 6 | begin : 08-JAN-2003 7 | copyright : (C) 2003 by The RoboCup Soccer Server 8 | Maintenance Group. 9 | email : sserver-admin@lists.sourceforge.net 10 | ***************************************************************************/ 11 | 12 | /*************************************************************************** 13 | * * 14 | * This program is free software; you can redistribute it and/or modify * 15 | * it under the terms of the GNU LGPL as published by the Free Software * 16 | * Foundation; either version 2 of the License, or (at your option) any * 17 | * later version. * 18 | * * 19 | ***************************************************************************/ 20 | 21 | #ifndef RCSS_NET_ISOCKETSTREAM_HPP 22 | #define RCSS_NET_ISOCKETSTREAM_HPP 23 | 24 | #include 25 | 26 | namespace rcss { 27 | namespace net { 28 | 29 | class ISocketStream 30 | : public SocketStreamBuf, 31 | public std::istream { 32 | public: 33 | ISocketStream( Socket & socket, 34 | const Addr & dest, 35 | ConnType conn = CONN_ON_READ, 36 | int buffer_size = 8192 ) 37 | : SocketStreamBuf( socket, dest, conn, buffer_size ), 38 | std::istream( this ) 39 | { } 40 | 41 | ISocketStream( Socket & socket, 42 | ConnType conn = NO_CONN, 43 | int buffer_size = 8192 ) 44 | : SocketStreamBuf( socket, conn, buffer_size ), 45 | std::istream( this ) 46 | { } 47 | 48 | private: 49 | // not for use 50 | ISocketStream(const ISocketStream & ); 51 | ISocketStream & operator=( const ISocketStream & ); 52 | }; 53 | 54 | } 55 | } 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /rcss/clang/clangdelmsg.cpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | clangdelmsg.cc 5 | Class for CLang Delete messages 6 | ------------------- 7 | begin : 28-MAY-2002 8 | copyright : (C) 2002 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | 26 | #include "clangdelmsg.h" 27 | 28 | #include "rule.h" 29 | 30 | namespace rcss { 31 | namespace clang { 32 | 33 | DelMsg::DelMsg() 34 | : Msg() 35 | { 36 | 37 | } 38 | 39 | DelMsg::DelMsg( const RuleIDList & list ) 40 | : Msg(), 41 | M_rids( list ) 42 | { 43 | 44 | } 45 | 46 | DelMsg::~DelMsg() 47 | { 48 | 49 | } 50 | 51 | std::shared_ptr< Msg > 52 | DelMsg::deepCopy() const 53 | { 54 | std::shared_ptr< Msg > rval( new DelMsg( *this ) ); 55 | return rval; 56 | } 57 | 58 | std::ostream & 59 | DelMsg::print( std::ostream & out ) const 60 | { 61 | out << "(delete " << M_rids << ")"; 62 | return out; 63 | } 64 | 65 | std::ostream & 66 | DelMsg::printPretty( std::ostream & out, 67 | const std::string & line_header ) const 68 | { 69 | out << line_header << "Delete" << std::endl; 70 | return M_rids.printPretty( out, line_header + " -" ); 71 | } 72 | 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/timer.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | timer.h 5 | The timer class is an abstract base class for timing 6 | ------------------- 7 | begin : AUG-2002 8 | copyright : (C) 2002 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifndef RCSSSERVER_TIMER_H 23 | #define RCSSSERVER_TIMER_H 24 | 25 | class Timeable; 26 | 27 | /** The timer class is an abstract class that has a reference to a timeable 28 | class. Specific timers can be derived from this class which has to implement 29 | the 'run' method. In this 'run' method the timeable methods from the 30 | timeable instance are called. */ 31 | class Timer { 32 | private: 33 | Timer() = delete; 34 | Timer( const Timer & ) = delete; 35 | Timer & operator=( const Timer & ) = delete; 36 | 37 | public: 38 | 39 | virtual 40 | ~Timer() 41 | { } 42 | 43 | virtual 44 | void run() = 0; 45 | 46 | protected: 47 | 48 | explicit 49 | Timer( Timeable & timeable ) 50 | : M_timeable ( timeable ) 51 | { } 52 | 53 | Timeable & getTimeableRef() 54 | { 55 | return M_timeable; 56 | } 57 | 58 | private: 59 | Timeable & M_timeable; /**< reference to the timeable object */ 60 | }; 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /rcss/net/handler.cpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | handler.cpp - handles network startup 5 | ------------------- 6 | begin : 14-AUG-2003 7 | copyright : (C) 2003 by The RoboCup Soccer Server 8 | Maintenance Group. 9 | email : sserver-admin@lists.sourceforge.net 10 | ***************************************************************************/ 11 | 12 | /*************************************************************************** 13 | * * 14 | * This program is free software; you can redistribute it and/or modify * 15 | * it under the terms of the GNU LGPL as published by the Free Software * 16 | * Foundation; either version 2 of the License, or (at your option) any * 17 | * later version. * 18 | * * 19 | ***************************************************************************/ 20 | 21 | #ifndef HAVE_CONFIG_H 22 | #include 23 | #endif 24 | 25 | #include "handler.hpp" 26 | 27 | #ifdef __CYGWIN__ 28 | // cygwin is not win32 29 | #elif defined(_WIN32) || defined(__WIN32__) || defined (WIN32) 30 | #define RCSS_WIN 31 | #endif 32 | 33 | namespace rcss { 34 | namespace net { 35 | 36 | Handler & 37 | Handler::instance() 38 | { 39 | static Handler rval; 40 | return rval; 41 | } 42 | 43 | Handler::Handler() 44 | : M_valid( true ) 45 | { 46 | #ifdef RCSS_WIN 47 | WORD wVersionRequested; 48 | int err; 49 | 50 | wVersionRequested = MAKEWORD( 2, 2 ); 51 | err = WSAStartup( wVersionRequested, &M_WSAData ); 52 | if ( err != 0 ) 53 | { 54 | m_valid = false; 55 | return; 56 | } 57 | if ( LOBYTE( M_WSAData.wVersion ) != 2 58 | || HIBYTE( M_WSAData.wVersion ) != 2 ) 59 | { 60 | WSACleanup(); 61 | M_valid = false; 62 | return; 63 | } 64 | #endif 65 | } 66 | 67 | Handler::~Handler() 68 | { 69 | #ifdef RCSS_WIN 70 | WSACleanup(); 71 | #endif 72 | } 73 | 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /rcss/net/udpsocket.cpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | udpsocket.cpp - A simple udp socket class 5 | ------------------- 6 | begin : 08-JAN-2003 7 | copyright : (C) 2003 by The RoboCup Soccer Server 8 | Maintenance Group. 9 | email : sserver-admin@lists.sourceforge.net 10 | ***************************************************************************/ 11 | 12 | /*************************************************************************** 13 | * * 14 | * This program is free software; you can redistribute it and/or modify * 15 | * it under the terms of the GNU LGPL as published by the Free Software * 16 | * Foundation; either version 2 of the License, or (at your option) any * 17 | * later version. * 18 | * * 19 | ***************************************************************************/ 20 | 21 | #ifdef HAVE_CONFIG_H 22 | #include 23 | #endif 24 | 25 | #include "udpsocket.hpp" 26 | 27 | #include 28 | #ifdef HAVE_SYS_SOCKET_H 29 | #include 30 | #endif 31 | #include 32 | #ifdef HAVE_NETINET_IN_H 33 | #include 34 | #endif 35 | 36 | #ifdef HAVE_WINSOCK2_H 37 | #include 38 | #endif 39 | 40 | #include 41 | 42 | namespace rcss { 43 | namespace net { 44 | 45 | UDPSocket::UDPSocket() 46 | { 47 | open(); 48 | } 49 | 50 | UDPSocket::UDPSocket( SocketDesc & s ) 51 | : Socket( s ) 52 | { 53 | 54 | } 55 | 56 | UDPSocket::UDPSocket( const Addr & addr ) 57 | { 58 | open(); 59 | bind( addr ); 60 | } 61 | 62 | UDPSocket::UDPSocket( const Addr & addr, 63 | const Addr & dest ) 64 | { 65 | open(); 66 | bind( addr ); 67 | connect( dest ); 68 | } 69 | 70 | bool 71 | UDPSocket::doOpen( SocketDesc & fd ) 72 | { 73 | close(); 74 | fd = ::socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP ); 75 | return fd >= 0; 76 | } 77 | 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /rcss/clang/clangfreeformmsg.cpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | clangfreeformmsg.h 5 | Class for CLang Freeform messages 6 | ------------------- 7 | begin : 28-MAY-2002 8 | copyright : (C) 2002 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | 26 | #include "clangfreeformmsg.h" 27 | 28 | namespace rcss { 29 | namespace clang { 30 | 31 | FreeformMsg::FreeformMsg() 32 | : Msg() 33 | { 34 | 35 | } 36 | 37 | FreeformMsg::FreeformMsg( const std::string & str ) 38 | : Msg(), 39 | M_str( str ) 40 | { 41 | 42 | } 43 | 44 | FreeformMsg::~FreeformMsg() 45 | { 46 | 47 | } 48 | 49 | std::shared_ptr< Msg > 50 | FreeformMsg::deepCopy() const 51 | { 52 | std::shared_ptr< Msg > rval( new FreeformMsg( *this ) ); 53 | return rval; 54 | } 55 | 56 | std::ostream & 57 | FreeformMsg::print( std::ostream & out ) const 58 | { 59 | out << "(freeform \"" << M_str << "\")"; 60 | return out; 61 | } 62 | 63 | std::ostream & 64 | FreeformMsg::printPretty( std::ostream & out, 65 | const std::string & line_header ) const 66 | { 67 | return out << line_header << "Freeform" << std::endl 68 | << line_header << " " << "\"" << M_str << "\"" << std::endl; 69 | } 70 | 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/player_command_tok.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | pcomlexer.h 5 | Lexer for PlayerCommands 6 | ---------------------------- 7 | begin : 27-JUN-2002 8 | copyright : (C) 2002 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifndef RCSS_PCOMLEXER_H 23 | #define RCSS_PCOMLEXER_H 24 | 25 | #include "pcombuilder.h" 26 | 27 | 28 | #undef yyFlexLexer 29 | #define yyFlexLexer RCSSPComFlexLexer 30 | //#include 31 | #include 32 | 33 | class RCSSPComLexer 34 | : public RCSSPComFlexLexer { 35 | public: 36 | 37 | union Holder { 38 | enum { STR_MAX = 8192 }; 39 | 40 | int m_int; 41 | double m_double; 42 | char m_str[ STR_MAX ]; 43 | bool m_bool; 44 | rcss::pcom::VIEW_WIDTH m_view_w; 45 | rcss::pcom::VIEW_QUALITY m_view_q; 46 | rcss::pcom::TEAM m_team; 47 | rcss::pcom::EAR_MODE m_ear; 48 | }; 49 | 50 | 51 | virtual 52 | int yylex(); // defined in player_command_tok.cc 53 | 54 | inline 55 | int lex( Holder & holder ) 56 | { 57 | M_lexed_val = &holder; 58 | return yylex(); 59 | } 60 | 61 | private: 62 | Holder * M_lexed_val; 63 | }; 64 | 65 | namespace rcss { 66 | namespace pcom { 67 | typedef RCSSPComLexer Lexer; 68 | } 69 | } 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /missingflex: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | 4 | 5 | if test "$#" -lt "1"; then 6 | echo "" 7 | echo "Error: $0 can only be called with at least one command line argument" 8 | echo "" 9 | echo "Usage: $0 [OPTIONS] FILE" 10 | echo "" 11 | echo "Where FILE is a flex source file" 12 | echo "" 13 | echo "all options except -o are ignored. Use -oOUTFILE to specify the output" 14 | echo "file" 15 | echo "" 16 | exit 1 17 | fi 18 | 19 | OUTPUT="" 20 | 21 | for PARM in $*; do 22 | CHECK_FOR_OUTPUT_PARM=`echo "$PARM" | sed s/[^-o].*$//`; 23 | if test "$CHECK_FOR_OUTPUT_PARM" = "-o"; then 24 | OUTPUT=`echo "$PARM" | sed s/^-o//` 25 | fi 26 | LAST=$PARM 27 | done 28 | 29 | if ! test -e $LAST; then 30 | echo "" 31 | echo "ERROR: Could not find $1" 32 | echo "" 33 | exit 1 34 | fi 35 | 36 | 37 | EXT=`echo "$LAST" | sed s/^[^.]*//` 38 | BASE=`echo "$LAST" | sed s/$EXT//` 39 | 40 | if test "$EXT" != ".l" -a "$EXT" != ".ll"; then 41 | echo "" 42 | echo "ERROR: $LAST should end in \`.l' or \`.ll'" 43 | echo "" 44 | exit 1 45 | fi 46 | 47 | if test "$EXT" = ".l"; then 48 | NEW_EXT=".c" 49 | else 50 | NEW_EXT=".cc" 51 | fi 52 | 53 | if test "$OUTPUT" = ""; then 54 | OUTPUT="$BASE$NEW_EXT" 55 | fi 56 | 57 | POSSIBLE="$BASE$NEW_EXT" 58 | 59 | 60 | 61 | if test -e "$OUTPUT"; then 62 | touch "$OUTPUT" 63 | echo "" 64 | echo "WARNING: \`flex' is missing on your system. You should only need it if" 65 | echo " you modified a \`.l' or \`.ll' file. You may need the \`Flex'" 66 | echo " package in order for those modifications to take effect. You " 67 | echo " can get \`Flex' from any GNU archive site." 68 | echo "" 69 | elif test -e "$POSSIBLE"; then 70 | cp "$POSSIBLE" "$OUTPUT" 71 | echo "" 72 | echo "WARNING: \`flex' is missing on your system. You should only need it if" 73 | echo " you modified a \`.l' or \`.ll' file. You may need the \`Flex'" 74 | echo " package in order for those modifications to take effect. You " 75 | echo " can get \`Flex' from any GNU archive site." 76 | echo "" 77 | else 78 | echo "" 79 | echo "ERROR: \`flex' is missing on your system and the flex generated" 80 | echo " source could not be found. You can get \`Flex' from any " 81 | echo " GNU archive site." 82 | echo "" 83 | fi 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /rcss/clang/clangdelmsg.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | clangdelmsg.h 5 | Class for CLang Delete messages 6 | ------------------- 7 | begin : 28-MAY-2002 8 | copyright : (C) 2002 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifndef RCSS_CLANGDELMSG_H 23 | #define RCSS_CLANGDELMSG_H 24 | 25 | #include 26 | #include 27 | 28 | namespace rcss { 29 | namespace clang { 30 | 31 | class DelMsg 32 | : public Msg { 33 | public: 34 | 35 | DelMsg(); 36 | private: 37 | DelMsg( const RuleIDList & list ); 38 | public: 39 | 40 | virtual 41 | ~DelMsg() override; 42 | 43 | virtual 44 | std::shared_ptr< Msg > deepCopy() const override; 45 | 46 | virtual 47 | std::ostream & print( std::ostream & out ) const override; 48 | 49 | virtual 50 | std::ostream & printPretty( std::ostream & out, 51 | const std::string & line_header ) const override; 52 | 53 | const RuleIDList & getList() const 54 | { 55 | return M_rids; 56 | } 57 | 58 | void set( const RuleIDList & rids ) 59 | { 60 | M_rids = rids; 61 | } 62 | 63 | virtual 64 | Types getType() const 65 | { 66 | return DEL; 67 | } 68 | 69 | private: 70 | RuleIDList M_rids; 71 | }; 72 | 73 | } 74 | } 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /rcss/clang/clangrulemsg.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | clangrulemsg.h 5 | Class for CLang Rule messages 6 | ------------------- 7 | begin : 28-MAY-2002 8 | copyright : (C) 2002 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifndef RCSS_CLANGRULEMSG_H 23 | #define RCSS_CLANGRULEMSG_H 24 | 25 | #include 26 | 27 | #include 28 | 29 | namespace rcss { 30 | namespace clang { 31 | 32 | class ActivateRules; 33 | 34 | class RuleMsg 35 | : public Msg { 36 | public: 37 | typedef std::list< ActivateRules > Storage; 38 | 39 | RuleMsg(); 40 | private: 41 | RuleMsg( const Storage & list ); 42 | public: 43 | virtual 44 | ~RuleMsg() override; 45 | 46 | virtual 47 | std::shared_ptr< Msg > deepCopy() const override; 48 | 49 | virtual 50 | std::ostream & print( std::ostream & out ) const override; 51 | 52 | virtual 53 | std::ostream & printPretty( std::ostream & out, 54 | const std::string & line_header ) const override; 55 | 56 | const Storage & getList() const 57 | { 58 | return M_active; 59 | } 60 | 61 | Storage & getList() 62 | { 63 | return M_active; 64 | } 65 | 66 | virtual 67 | Types getType() const 68 | { 69 | return RULE; 70 | } 71 | 72 | private: 73 | Storage M_active; 74 | 75 | }; 76 | 77 | } 78 | } 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /rcss/clang/clangdefmsg.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | clangdefmsg.h 5 | Class for CLang Define messages 6 | ------------------- 7 | begin : 28-MAY-2002 8 | copyright : (C) 2002 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifndef RCSS_CLANGDEFMSG_H 23 | #define RCSS_CLANGDEFMSG_H 24 | 25 | #include 26 | #include 27 | 28 | namespace rcss { 29 | namespace clang { 30 | 31 | class DefineMsg 32 | : public Msg { 33 | public: 34 | typedef std::list< std::shared_ptr< Def > > Storage; 35 | 36 | DefineMsg(); 37 | private: 38 | DefineMsg( const Storage & defs ); 39 | public: 40 | 41 | virtual 42 | ~DefineMsg() override; 43 | 44 | virtual 45 | std::shared_ptr< Msg > deepCopy() const override; 46 | 47 | virtual 48 | std::ostream & print( std::ostream & out ) const override; 49 | 50 | virtual 51 | std::ostream & printPretty( std::ostream & out, 52 | const std::string & line_header ) const override; 53 | 54 | const Storage & getDefs() const 55 | { 56 | return M_defs; 57 | } 58 | 59 | Storage & getDefs() 60 | { 61 | return M_defs; 62 | } 63 | 64 | virtual 65 | Types getType() const 66 | { 67 | return DEFINE; 68 | } 69 | 70 | private: 71 | Storage M_defs; 72 | 73 | }; 74 | 75 | } 76 | } 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /rcss/clang/clanginfomsg.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | clanginfomsg.h 5 | Class for CLang Info messages 6 | ------------------- 7 | begin : 28-MAY-2002 8 | copyright : (C) 2002 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifndef RCSS_CLANGINFOMSG_H 23 | #define RCSS_CLANGINFOMSG_H 24 | 25 | #include 26 | #include 27 | 28 | namespace rcss { 29 | namespace clang { 30 | 31 | class InfoMsg 32 | : public Msg { 33 | public: 34 | typedef std::list< std::shared_ptr< Token > > Storage; 35 | 36 | InfoMsg(); 37 | private: 38 | InfoMsg( const Storage & tokens ); 39 | public: 40 | 41 | virtual 42 | ~InfoMsg() override; 43 | 44 | virtual 45 | std::shared_ptr< Msg > deepCopy() const override; 46 | 47 | virtual 48 | std::ostream & print( std::ostream & out ) const override; 49 | 50 | virtual 51 | std::ostream & printPretty( std::ostream & out, 52 | const std::string & line_header ) const override; 53 | 54 | const Storage & getTokens() const 55 | { 56 | return M_tokens; 57 | } 58 | 59 | Storage & getTokens() 60 | { 61 | return M_tokens; 62 | } 63 | 64 | virtual 65 | Types getType() const 66 | { 67 | return INFO; 68 | } 69 | 70 | private: 71 | Storage M_tokens; 72 | 73 | }; 74 | 75 | } 76 | } 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /rcss/clang/clangadvicemsg.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | clangadvicemsg.h 5 | Class for CLang Advice messages 6 | ------------------- 7 | begin : 28-MAY-2002 8 | copyright : (C) 2002 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifndef RCSS_CLANGADVICEMSG_H 23 | #define RCSS_CLANGADVICEMSG_H 24 | 25 | #include 26 | #include 27 | 28 | namespace rcss { 29 | namespace clang { 30 | 31 | class AdviceMsg 32 | : public Msg { 33 | public: 34 | typedef std::list< std::shared_ptr< Token > > Storage; 35 | 36 | AdviceMsg(); 37 | private: 38 | AdviceMsg( const Storage & tokens ); 39 | public: 40 | 41 | virtual 42 | ~AdviceMsg() override; 43 | 44 | virtual 45 | std::shared_ptr< Msg > deepCopy() const override; 46 | 47 | virtual 48 | std::ostream & print( std::ostream & out ) const override; 49 | 50 | virtual 51 | std::ostream & printPretty( std::ostream & out, 52 | const std::string & line_header ) const override; 53 | 54 | const Storage & getTokens() const 55 | { 56 | return M_tokens; 57 | } 58 | Storage & getTokens() 59 | { 60 | return M_tokens; 61 | } 62 | 63 | virtual 64 | Types getType() const 65 | { 66 | return ADVICE; 67 | } 68 | 69 | private: 70 | Storage M_tokens; 71 | }; 72 | 73 | } 74 | } 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /src/serializerplayerstdv5.cpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | serializerplayerstdv5.cpp 5 | Class for serializing data to std v5 players 6 | ------------------- 7 | begin : 2023-01-27 8 | copyright : (C) 2023 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | ***************************************************************************/ 11 | 12 | /*************************************************************************** 13 | * * 14 | * This program is free software; you can redistribute it and/or modify * 15 | * it under the terms of the GNU LGPL as published by the Free Software * 16 | * Foundation; either version 3 of the License, or (at your option) any * 17 | * later version. * 18 | * * 19 | ***************************************************************************/ 20 | 21 | #ifdef HAVE_CONFIG_H 22 | #include 23 | #endif 24 | 25 | #include "serializerplayerstdv5.h" 26 | 27 | #include "player.h" 28 | 29 | namespace rcss { 30 | 31 | SerializerPlayerStdv5::SerializerPlayerStdv5( const SerializerCommon::Ptr common ) 32 | : SerializerPlayerStdv1( common ) 33 | { 34 | 35 | } 36 | 37 | SerializerPlayerStdv5::~SerializerPlayerStdv5() 38 | { 39 | 40 | } 41 | 42 | 43 | void 44 | SerializerPlayerStdv5::serializeBodyCounts( std::ostream & strm, 45 | const Player & self ) const 46 | { 47 | SerializerPlayerStdv1::serializeBodyCounts( strm, self ); 48 | 49 | strm << " (turn_neck " << self.turnNeckCount() << ')'; 50 | } 51 | 52 | const 53 | SerializerPlayer::Ptr 54 | SerializerPlayerStdv5::create() 55 | { 56 | SerializerCommon::Creator cre; 57 | if ( ! SerializerCommon::factory().getCreator( cre, 5 ) ) 58 | { 59 | return SerializerPlayer::Ptr(); 60 | } 61 | 62 | SerializerPlayer::Ptr ptr( new SerializerPlayerStdv5( cre() ) ); 63 | return ptr; 64 | } 65 | 66 | namespace { 67 | RegHolder v5 = SerializerPlayer::factory().autoReg( &SerializerPlayerStdv5::create, 5 ); 68 | RegHolder v6 = SerializerPlayer::factory().autoReg( &SerializerPlayerStdv5::create, 6 ); 69 | 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /src/serializeronlinecoachstdv13.cpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | serializeronlinecoachstdv13.cpp 5 | Class for serializing data to std v13 online coaches 6 | ------------------- 7 | begin : 2008-11-03 8 | copyright : (C) 2008 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | 26 | #include "serializeronlinecoachstdv13.h" 27 | 28 | namespace rcss { 29 | 30 | SerializerOnlineCoachStdv13::SerializerOnlineCoachStdv13( const SerializerCommon::Ptr common, 31 | const SerializerCoach::Ptr coach ) 32 | : SerializerOnlineCoachStdv8( common, coach ) 33 | { 34 | 35 | } 36 | 37 | SerializerOnlineCoachStdv13::~SerializerOnlineCoachStdv13() 38 | { 39 | 40 | } 41 | 42 | const 43 | SerializerOnlineCoach::Ptr 44 | SerializerOnlineCoachStdv13::create() 45 | { 46 | SerializerCommon::Creator cre_common; 47 | if ( ! SerializerCommon::factory().getCreator( cre_common, 13 ) ) 48 | { 49 | return SerializerOnlineCoach::Ptr(); 50 | } 51 | 52 | SerializerCoach::Creator cre_coach; 53 | if ( ! SerializerCoach::factory().getCreator( cre_coach, 13 ) ) 54 | { 55 | return SerializerOnlineCoach::Ptr(); 56 | } 57 | 58 | SerializerOnlineCoach::Ptr ptr( new SerializerOnlineCoachStdv13( cre_common(), cre_coach() ) ); 59 | return ptr; 60 | } 61 | 62 | namespace { 63 | RegHolder v13 = SerializerOnlineCoach::factory().autoReg( &SerializerOnlineCoachStdv13::create, 13 ); 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/serializeronlinecoachstdv7.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | serializeronlinecoachstdv7.h 5 | Class for serializing data to std v7 online coaches 6 | ------------------- 7 | begin : 27-MAY-2002 8 | copyright : (C) 2002 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifndef SERIALIZERONLINECOACHSTDV7_H 23 | #define SERIALIZERONLINECOACHSTDV7_H 24 | 25 | #include "serializeronlinecoachstdv6.h" 26 | 27 | namespace rcss { 28 | 29 | class SerializerOnlineCoachStdv7 30 | : public SerializerOnlineCoachStdv6 { 31 | protected: 32 | SerializerOnlineCoachStdv7( const SerializerCommon::Ptr common, 33 | const SerializerCoach::Ptr coach ); 34 | 35 | public: 36 | virtual 37 | ~SerializerOnlineCoachStdv7() override; 38 | 39 | static 40 | const 41 | Ptr create(); 42 | 43 | virtual 44 | void serializeRefereeAudio( std::ostream & strm, 45 | const int time, 46 | const std::string & name, 47 | const char * msg ) const override; 48 | 49 | virtual 50 | void serializePlayerAudio( std::ostream & strm, 51 | const int time, 52 | const std::string & name, 53 | const char * msg ) const override; 54 | 55 | virtual 56 | void serializeChangedPlayer( std::ostream &, 57 | const int unum, 58 | const int type = -1 ) const override; 59 | }; 60 | 61 | } 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /src/timeable.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | timeale.h 5 | The timeable class is an abstract base class used by a timer 6 | ------------------- 7 | begin : AUG-2002 8 | copyright : (C) 2002 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifndef TIMEABLE_H 23 | #define TIMEABLE_H 24 | 25 | /** The timeable class is an abstract class which specifies the virtual methods 26 | that should be implemented by the subclass. */ 27 | 28 | class Timeable { 29 | public: 30 | virtual 31 | ~Timeable() 32 | { } 33 | 34 | void recvFromClients() { doRecvFromClients(); } 35 | void newSimulatorStep() { doNewSimulatorStep(); } 36 | void sendSenseBody() { doSendSenseBody(); } 37 | void sendVisuals() { doSendVisuals(); } 38 | void sendSynchVisuals() { doSendSynchVisuals(); } 39 | void sendCoachMessages() { doSendCoachMessages(); } 40 | bool sendThink() { return doSendThink(); } 41 | void quit() { doQuit(); } 42 | bool alive() { return isAlive(); } 43 | 44 | protected: 45 | 46 | // virtual methods that should be defined in subclass 47 | virtual void doRecvFromClients() = 0; 48 | virtual void doNewSimulatorStep() = 0; 49 | virtual void doSendSenseBody() = 0; 50 | virtual void doSendVisuals() = 0; 51 | virtual void doSendSynchVisuals() = 0; 52 | virtual void doSendCoachMessages() = 0; 53 | virtual bool doSendThink() = 0; 54 | virtual void doQuit() = 0; 55 | virtual bool isAlive() = 0; 56 | }; 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /rcss/clang/clangrulemsg.cpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | clangrulemsg.cc 5 | Class for CLang Rule messages 6 | ------------------- 7 | begin : 28-MAY-2002 8 | copyright : (C) 2002 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | 26 | #include "clangrulemsg.h" 27 | 28 | #include "rule.h" 29 | 30 | namespace rcss { 31 | namespace clang { 32 | 33 | RuleMsg::RuleMsg() 34 | : Msg() 35 | { 36 | 37 | } 38 | 39 | RuleMsg::RuleMsg( const Storage & list ) 40 | : Msg(), 41 | M_active( list ) 42 | { 43 | 44 | } 45 | 46 | RuleMsg::~RuleMsg() 47 | { 48 | 49 | } 50 | 51 | std::shared_ptr< Msg > 52 | RuleMsg::deepCopy() const 53 | { 54 | std::shared_ptr< Msg > rval( new RuleMsg( *this ) ); 55 | return rval; 56 | } 57 | 58 | std::ostream & 59 | RuleMsg::print( std::ostream & out ) const 60 | { 61 | out << "(rule "; 62 | for ( Storage::const_reference i : M_active ) 63 | { 64 | out << i; 65 | } 66 | out << ")"; 67 | return out; 68 | } 69 | 70 | std::ostream & 71 | RuleMsg::printPretty( std::ostream & out, 72 | const std::string & line_header ) const 73 | { 74 | out << line_header << "Activation List:\n"; 75 | bool first = true; 76 | for ( Storage::const_reference i : M_active ) 77 | { 78 | if ( first ) 79 | { 80 | first = false; 81 | } 82 | else 83 | { 84 | out << line_header << " Then:\n"; 85 | } 86 | i.printPretty( out, line_header + " -" ); 87 | } 88 | return out; 89 | } 90 | 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /src/serializerplayerstdv14.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | serializerplayerstdv14.h 5 | Class for serializing data to std v14 players 6 | ------------------- 7 | begin : 2009-10-26 8 | copyright : (C) 2009 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifndef SERIALIZERPLAYERSTDV14_H 23 | #define SERIALIZERPLAYERSTDV14_H 24 | 25 | #include "serializerplayerstdv13.h" 26 | 27 | namespace rcss { 28 | 29 | class SerializerPlayerStdv14 30 | : public SerializerPlayerStdv13 { 31 | protected: 32 | SerializerPlayerStdv14( const SerializerCommon::Ptr common ); 33 | 34 | public: 35 | virtual 36 | ~SerializerPlayerStdv14() override; 37 | 38 | static 39 | const 40 | SerializerPlayer::Ptr create(); 41 | 42 | 43 | virtual 44 | void serializeFoul( std::ostream &, 45 | const Player & ) const override; 46 | 47 | virtual 48 | void serializeFSPlayerBegin( std::ostream &, 49 | const char, 50 | const int, 51 | const bool, 52 | const int, 53 | const double &, 54 | const double &, 55 | const double &, 56 | const double &, 57 | const double &, 58 | const double & ) const override; 59 | virtual 60 | void serializeFSPlayerState( std::ostream &, 61 | const Player & ) const override; 62 | }; 63 | 64 | } 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /rcss/net/tcpsocket.cpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | tcpsocket.cpp - A simple tcp socket class 5 | ------------------- 6 | begin : 08-JAN-2003 7 | copyright : (C) 2003 by The RoboCup Soccer Server 8 | Maintenance Group. 9 | email : sserver-admin@lists.sourceforge.net 10 | ***************************************************************************/ 11 | 12 | /*************************************************************************** 13 | * * 14 | * This program is free software; you can redistribute it and/or modify * 15 | * it under the terms of the GNU LGPL as published by the Free Software * 16 | * Foundation; either version 2 of the License, or (at your option) any * 17 | * later version. * 18 | * * 19 | ***************************************************************************/ 20 | 21 | #ifdef HAVE_CONFIG_H 22 | #include 23 | #endif 24 | 25 | #include "tcpsocket.hpp" 26 | 27 | #include 28 | #ifdef HAVE_SYS_SOCKET_H 29 | #include 30 | #endif 31 | #include 32 | #ifdef HAVE_NETINET_IN_H 33 | #include 34 | #endif 35 | 36 | #ifdef HAVE_WINSOCK2_H 37 | #include 38 | #endif 39 | 40 | #include 41 | 42 | namespace rcss { 43 | namespace net { 44 | 45 | TCPSocket::TCPSocket() 46 | { 47 | open(); 48 | } 49 | 50 | TCPSocket::TCPSocket( SocketDesc & s ) 51 | : Socket( s ) 52 | { 53 | 54 | } 55 | 56 | TCPSocket::TCPSocket( const Addr & addr ) 57 | { 58 | open(); 59 | bind( addr ); 60 | } 61 | 62 | TCPSocket::TCPSocket( const Addr & addr, 63 | const Addr & dest ) 64 | { 65 | open(); 66 | bind( addr ); 67 | connect( dest ); 68 | } 69 | 70 | bool 71 | TCPSocket::accept( TCPSocket & sock ) 72 | { 73 | SocketDesc fd = ::accept( getFD(), nullptr, 0 ); 74 | if ( fd == INVALIDSOCKET ) 75 | { 76 | return false; 77 | } 78 | sock = TCPSocket( fd ); 79 | return true; 80 | } 81 | 82 | bool 83 | TCPSocket::listen( int backlog ) 84 | { 85 | return ::listen( getFD(), backlog ) == 0; 86 | } 87 | 88 | 89 | bool 90 | TCPSocket::doOpen( SocketDesc & fd ) 91 | { 92 | close(); 93 | fd = ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP ); 94 | return fd >= 0; 95 | } 96 | 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /src/xpmholder.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | xpmholder.h 5 | manages an xpm and it's construction 6 | ------------------- 7 | begin : 21-MAY-2002 8 | copyright : (C) 2001 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifndef XPMHOLDER_H 23 | #define XPMHOLDER_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | class XPMHolder { 30 | private: 31 | std::vector< std::string > M_data; 32 | int M_width; 33 | int M_height; 34 | int M_colors; 35 | 36 | XPMHolder() = delete; // not used 37 | XPMHolder( const XPMHolder & ) = delete; // not used 38 | const XPMHolder & operator=( const XPMHolder & ) = delete; // not used 39 | public: 40 | 41 | explicit 42 | XPMHolder( const char * str ); 43 | 44 | ~XPMHolder() 45 | { 46 | clear(); 47 | } 48 | 49 | void clear(); 50 | 51 | bool valid() const 52 | { 53 | return ! M_data.empty(); 54 | } 55 | 56 | int width() const 57 | { 58 | return M_width; 59 | } 60 | 61 | int height() const 62 | { 63 | return M_height; 64 | } 65 | 66 | int colors() const 67 | { 68 | return M_colors; 69 | } 70 | 71 | const std::vector< std::string > & data() const 72 | { 73 | return M_data; 74 | } 75 | 76 | std::ostream & print( std::ostream & o ) const; 77 | 78 | std::ostream & printEscaped( std::ostream & o ) const; 79 | 80 | }; 81 | 82 | inline 83 | std::ostream & 84 | operator<<( std::ostream & o, 85 | const XPMHolder & holder ) 86 | { 87 | return holder.print( o ); 88 | } 89 | 90 | #endif 91 | -------------------------------------------------------------------------------- /src/serializercoachstdv14.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | serializercoachstdv14.h 5 | Class for serializing data to std v14 offline coaches 6 | ------------------- 7 | begin : 2009-10-26 8 | copyright : (C) 2009 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifndef SERIALIZERCOACHSTDV14_H 23 | #define SERIALIZERCOACHSTDV14_H 24 | 25 | #include "serializercoachstdv13.h" 26 | 27 | namespace rcss { 28 | 29 | class SerializerCoachStdv14 30 | : public SerializerCoachStdv13 { 31 | protected: 32 | SerializerCoachStdv14( const SerializerCommon::Ptr common ); 33 | 34 | public: 35 | virtual 36 | ~SerializerCoachStdv14() override; 37 | 38 | static 39 | const 40 | SerializerCoach::Ptr create(); 41 | 42 | virtual 43 | void serializeVisualPlayer( std::ostream & strm, 44 | const Player & player, 45 | const std::string & name, 46 | const PVector & pos, 47 | const PVector & vel, 48 | const int body, 49 | const int neck ) const override; 50 | 51 | virtual 52 | void serializeVisualPlayer( std::ostream & strm, 53 | const Player & player, 54 | const std::string & name, 55 | const PVector & pos, 56 | const PVector & vel, 57 | const int body, 58 | const int neck, 59 | const int point_dir ) const override; 60 | }; 61 | 62 | } 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /src/serializercoachstdv13.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | serializercoachstdv13.h 5 | Class for serializing data to std v13 offline coaches 6 | ------------------- 7 | begin : 2008-10-28 8 | copyright : (C) 2008 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifndef SERIALIZERCOACHSTDV13_H 23 | #define SERIALIZERCOACHSTDV13_H 24 | 25 | #include "serializercoachstdv8.h" 26 | 27 | namespace rcss { 28 | 29 | class SerializerCoachStdv13 30 | : public SerializerCoachStdv8 { 31 | protected: 32 | SerializerCoachStdv13( const SerializerCommon::Ptr common ); 33 | 34 | 35 | public: 36 | virtual 37 | ~SerializerCoachStdv13() override; 38 | 39 | static 40 | const 41 | SerializerCoach::Ptr create(); 42 | 43 | virtual 44 | void serializeVisualPlayer( std::ostream & strm, 45 | const Player & player, 46 | const std::string & name, 47 | const PVector & pos, 48 | const PVector & vel, 49 | const int body, 50 | const int neck ) const override; 51 | 52 | virtual 53 | void serializeVisualPlayer( std::ostream & strm, 54 | const Player & player, 55 | const std::string & name, 56 | const PVector & pos, 57 | const PVector & vel, 58 | const int body, 59 | const int neck, 60 | const int point_dir ) const override; 61 | }; 62 | 63 | } 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /m4/ax_prog_flex.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # https://www.gnu.org/software/autoconf-archive/ax_prog_flex.html 3 | # =========================================================================== 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_PROG_FLEX(ACTION-IF-TRUE,ACTION-IF-FALSE) 8 | # 9 | # DESCRIPTION 10 | # 11 | # Check whether flex is the scanner generator. Run ACTION-IF-TRUE if 12 | # successful, ACTION-IF-FALSE otherwise 13 | # 14 | # LICENSE 15 | # 16 | # Copyright (c) 2009 Francesco Salvestrini 17 | # Copyright (c) 2010 Diego Elio Petteno` 18 | # 19 | # This program is free software; you can redistribute it and/or modify it 20 | # under the terms of the GNU General Public License as published by the 21 | # Free Software Foundation; either version 2 of the License, or (at your 22 | # option) any later version. 23 | # 24 | # This program is distributed in the hope that it will be useful, but 25 | # WITHOUT ANY WARRANTY; without even the implied warranty of 26 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 27 | # Public License for more details. 28 | # 29 | # You should have received a copy of the GNU General Public License along 30 | # with this program. If not, see . 31 | # 32 | # As a special exception, the respective Autoconf Macro's copyright owner 33 | # gives unlimited permission to copy, distribute and modify the configure 34 | # scripts that are the output of Autoconf when processing the Macro. You 35 | # need not follow the terms of the GNU General Public License when using 36 | # or distributing such scripts, even though portions of the text of the 37 | # Macro appear in them. The GNU General Public License (GPL) does govern 38 | # all other use of the material that constitutes the Autoconf Macro. 39 | # 40 | # This special exception to the GPL applies to versions of the Autoconf 41 | # Macro released by the Autoconf Archive. When you make and distribute a 42 | # modified version of the Autoconf Macro, you may extend this special 43 | # exception to the GPL to apply to your modified version as well. 44 | 45 | #serial 13 46 | 47 | AC_DEFUN([AX_PROG_FLEX], [ 48 | AC_REQUIRE([AM_PROG_LEX]) 49 | AC_REQUIRE([AC_PROG_EGREP]) 50 | 51 | AC_CACHE_CHECK([if flex is the lexer generator],[ax_cv_prog_flex],[ 52 | AS_IF([$LEX --version 2>/dev/null | $EGREP -qw '^g?flex'], 53 | [ax_cv_prog_flex=yes], [ax_cv_prog_flex=no]) 54 | ]) 55 | AS_IF([test "$ax_cv_prog_flex" = "yes"], 56 | m4_ifnblank([$1], [[$1]]), 57 | m4_ifnblank([$2], [[$2]]) 58 | ) 59 | ]) 60 | -------------------------------------------------------------------------------- /src/weather.cpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | weather.h 5 | Class for weather effects control 6 | ------------------- 7 | begin : 2009-11-18 8 | copyright : (C) 2009 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | 26 | #include "weather.h" 27 | 28 | #include "random.h" 29 | #include "serverparam.h" 30 | 31 | #include 32 | 33 | /* 34 | *=================================================================== 35 | *Part: Weather 36 | *=================================================================== 37 | */ 38 | 39 | Weather::Weather() 40 | : M_wind_vector( 0.0, 0.0 ), 41 | M_wind_rand( 0.0 ) 42 | { 43 | 44 | } 45 | 46 | 47 | Weather::~Weather() 48 | { 49 | 50 | } 51 | 52 | 53 | void 54 | Weather::init() 55 | { 56 | if ( ServerParam::instance().windNone() ) 57 | { 58 | M_wind_vector = PVector( 0.0, 0.0 ); 59 | M_wind_rand = 0.0; 60 | } 61 | else if ( ServerParam::instance().windRandom() ) 62 | { 63 | M_wind_vector = PVector::fromPolar( drand( 0, 100 ), drand( -M_PI, +M_PI ) ); 64 | M_wind_rand = drand( 0.0, 0.5 ); 65 | } 66 | else 67 | { 68 | M_wind_vector = PVector::fromPolar( ServerParam::instance().windForce(), 69 | Deg2Rad( ServerParam::instance().windDir() ) ); 70 | M_wind_rand = ServerParam::instance().windRand(); 71 | } 72 | 73 | #if 1 74 | std::printf( "wind factor: rand: %f, vector: (%f, %f)\n", 75 | M_wind_rand, M_wind_vector.x, M_wind_vector.y ); 76 | #endif 77 | 78 | } 79 | 80 | 81 | void 82 | Weather::halfTime() 83 | { 84 | M_wind_vector *= -1.0; 85 | } 86 | -------------------------------------------------------------------------------- /rcss/clang/arithop.cpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | arithop.cpp 5 | Flyweight classes representing comparison operators 6 | ------------------- 7 | begin : 22-MAR-2002 8 | copyright : (C) 2002 by The RoboCup Soccer Server 9 | Maintainance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | 26 | #include "arithop.h" 27 | 28 | namespace rcss { 29 | namespace util { 30 | 31 | const char * ArithOp::STRINGS[] = { "+", "-", "*", "/" }; 32 | 33 | ArithOp::ArithOp( const arith_t & arith ) 34 | : M_arith( arith ) 35 | { 36 | 37 | } 38 | 39 | const char * 40 | ArithOp::getStr() const 41 | { 42 | return STRINGS[ M_arith ]; 43 | } 44 | 45 | const ArithOp & 46 | ArithOp::instance( const arith_t & arith ) 47 | { 48 | // The entire collection of ArithOps is created on the first 49 | // call to ArithOp::instance. Because the array is a static 50 | // varaible in this function, we can legally return references 51 | // to its elements. One of the advatages of doing this is 52 | // that the ArithOps will be destroyed automatically. 53 | static ArithOp instances[] = { ArithOp( PLUS ), 54 | ArithOp( MINUS ), 55 | ArithOp( MULT ), 56 | ArithOp( DIV ) }; 57 | return instances[ arith ]; 58 | } 59 | 60 | const ArithOp & 61 | ArithOp::plus() 62 | { 63 | return instance( PLUS ); 64 | } 65 | 66 | const ArithOp & 67 | ArithOp::minus() 68 | { 69 | return instance( MINUS ); 70 | } 71 | 72 | const ArithOp & 73 | ArithOp::mult() 74 | { 75 | return instance( MULT ); 76 | } 77 | 78 | const ArithOp & 79 | ArithOp::div() 80 | { 81 | return instance( DIV ); 82 | } 83 | 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/serializeronlinecoachstdv6.cpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | serializeronlinecoachstdv6.cc 5 | Class for serializing data to std v6 online coaches 6 | ------------------- 7 | begin : 27-MAY-2002 8 | copyright : (C) 2002 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | 26 | #include "serializeronlinecoachstdv6.h" 27 | 28 | namespace rcss { 29 | 30 | SerializerOnlineCoachStdv6::SerializerOnlineCoachStdv6( const SerializerCommon::Ptr common, 31 | const SerializerCoach::Ptr coach ) 32 | : SerializerOnlineCoachStdv1( common, coach ) 33 | { 34 | 35 | } 36 | 37 | SerializerOnlineCoachStdv6::~SerializerOnlineCoachStdv6() 38 | { 39 | 40 | } 41 | 42 | void 43 | SerializerOnlineCoachStdv6::serializeInit( std::ostream& strm, 44 | const int side ) const 45 | { 46 | strm << "(init " 47 | << ( side == LEFT ? 'l' : 'r' ) 48 | << " ok)"; 49 | } 50 | 51 | const 52 | SerializerOnlineCoach::Ptr 53 | SerializerOnlineCoachStdv6::create() 54 | { 55 | SerializerCommon::Creator cre_common; 56 | if ( ! SerializerCommon::factory().getCreator( cre_common, 6 ) ) 57 | { 58 | return SerializerOnlineCoach::Ptr(); 59 | } 60 | 61 | SerializerCoach::Creator cre_coach; 62 | if ( ! SerializerCoach::factory().getCreator( cre_coach, 6 ) ) 63 | { 64 | return SerializerOnlineCoach::Ptr(); 65 | } 66 | 67 | SerializerOnlineCoach::Ptr ptr( new SerializerOnlineCoachStdv6( cre_common(), cre_coach() ) ); 68 | return ptr; 69 | } 70 | 71 | namespace { 72 | RegHolder v6 = SerializerOnlineCoach::factory().autoReg( &SerializerOnlineCoachStdv6::create, 6 ); 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /rcss/net/addr.hpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | addr.hpp - A network address class 5 | ------------------- 6 | begin : 07-JAN-2003 7 | copyright : (C) 2003 by The RoboCup Soccer Server 8 | Maintenance Group. 9 | email : sserver-admin@lists.sourceforge.net 10 | ***************************************************************************/ 11 | 12 | /*************************************************************************** 13 | * * 14 | * This program is free software; you can redistribute it and/or modify * 15 | * it under the terms of the GNU LGPL as published by the Free Software * 16 | * Foundation; either version 2 of the License, or (at your option) any * 17 | * later version. * 18 | * * 19 | ***************************************************************************/ 20 | 21 | #ifndef RCSS_NET_ADDR_HPP 22 | #define RCSS_NET_ADDR_HPP 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | struct sockaddr_in; 29 | 30 | namespace rcss { 31 | namespace net { 32 | 33 | class Addr { 34 | private: 35 | class Impl; 36 | 37 | std::shared_ptr< Impl > M_impl; 38 | public: 39 | typedef std::uint16_t PortType; 40 | typedef std::uint32_t HostType; 41 | typedef struct sockaddr_in AddrType; 42 | 43 | enum Error { S_ADDR_OK, S_SERV_NOT_FOUND, S_HOST_NOT_FOUND }; 44 | 45 | static const HostType BROADCAST; 46 | 47 | static const HostType ANY; 48 | 49 | Addr( PortType port = 0, 50 | HostType host = Addr::ANY ); 51 | 52 | Addr( const AddrType & addr ); 53 | 54 | ~Addr(); 55 | 56 | bool setPort( PortType port = 0 ); 57 | 58 | bool setPort( const std::string & port, 59 | const std::string & proto = "" ); 60 | 61 | bool setHost( HostType host = Addr::ANY ); 62 | 63 | bool setHost( const std::string & host ); 64 | 65 | const 66 | AddrType & getAddr() const; 67 | 68 | PortType getPort() const; 69 | 70 | HostType getHost() const; 71 | 72 | std::string getHostStr() const; 73 | 74 | std::string getPortStr( const std::string & proto = "" ) const; 75 | 76 | }; 77 | 78 | 79 | bool 80 | operator==( const Addr & a, 81 | const Addr & b ); 82 | 83 | bool 84 | operator!=( const Addr & a, 85 | const Addr & b ); 86 | 87 | std::ostream & 88 | operator<<( std::ostream & o, 89 | const Addr & addr ); 90 | 91 | } 92 | } 93 | 94 | #endif 95 | -------------------------------------------------------------------------------- /rcss/net/iosocketstream.hpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | iosocketstream.hpp - An iostream for sockets 5 | ------------------- 6 | begin : 08-JAN-2003 7 | copyright : (C) 2003 by The RoboCup Soccer Server 8 | Maintenance Group. 9 | email : sserver-admin@lists.sourceforge.net 10 | ***************************************************************************/ 11 | 12 | /*************************************************************************** 13 | * * 14 | * This program is free software; you can redistribute it and/or modify * 15 | * it under the terms of the GNU LGPL as published by the Free Software * 16 | * Foundation; either version 2 of the License, or (at your option) any * 17 | * later version. * 18 | * * 19 | ***************************************************************************/ 20 | 21 | #ifndef RCSS_NET_IOSOCKETSTREAM_HPP 22 | #define RCSS_NET_IOSOCKETSTREAM_HPP 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | namespace rcss { 29 | namespace net { 30 | 31 | class IOSocketStream 32 | : public SocketStreamBuf, 33 | public std::iostream { 34 | // The IOSocketStream can be used in threads, however if a read 35 | // blocks waiting for input, then the sending at the same time 36 | // will also block. If you want to do this then you will need to 37 | // either protect the stream with a mutex or create a 38 | // ISocketStream for reading and a OSocketStream for 39 | // writing. You can pass the same socket to both to have the 40 | // reading and writing performed by the same socket. 41 | public: 42 | 43 | IOSocketStream( Socket & socket, 44 | const Addr & dest, 45 | ConnType conn = CONN_ON_READ, 46 | int buffer_size = 8192 ) 47 | : SocketStreamBuf( socket, dest, conn, buffer_size ), 48 | std::iostream( this ) 49 | { } 50 | 51 | IOSocketStream( Socket & socket, 52 | ConnType conn = NO_CONN, 53 | int buffer_size = 8192 ) 54 | : SocketStreamBuf( socket, conn, buffer_size ), 55 | std::iostream( this ) 56 | { } 57 | 58 | private: 59 | // not for use 60 | IOSocketStream( const IOSocketStream & ); 61 | IOSocketStream & operator=( const IOSocketStream & ); 62 | }; 63 | 64 | } 65 | } 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /src/xmlreader.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: c++ -*- */ 2 | 3 | /* 4 | *Copyright: 5 | 6 | Copyright (C) 1996-2000 Electrotechnical Laboratory. 7 | Itsuki Noda, Yasuo Kuniyoshi and Hitoshi Matsubara. 8 | Copyright (C) 2000, 2001 RoboCup Soccer Server Maintainance Group. 9 | Patrick Riley, Tom Howard, Daniel Polani, Itsuki Noda, 10 | Mikhail Prokopenko, Jan Wendler 11 | Copyright (C) 2002- RoboCup Soccer Simulator Maintainance Group. 12 | 13 | This file is a part of SoccerServer. 14 | 15 | This code is free software; you can redistribute it and/or 16 | modify it under the terms of the GNU Lesser General Public 17 | License as published by the Free Software Foundation; either 18 | version 3 of the License, or (at your option) any later version. 19 | 20 | This library is distributed in the hope that it will be useful, 21 | but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 23 | Lesser General Public License for more details. 24 | 25 | You should have received a copy of the GNU Lesser General Public 26 | License along with this library; if not, write to the Free Software 27 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 28 | 29 | *EndCopyright: 30 | */ 31 | 32 | 33 | #ifndef XMLREADER_H 34 | #define XMLREADER_H 35 | 36 | #ifdef HAVE_CONFIG_H 37 | #include 38 | #endif 39 | 40 | #ifdef HAVE_LIBEXPAT 41 | 42 | #include 43 | #include 44 | 45 | #include 46 | 47 | class XmlReader { 48 | public: 49 | XmlReader(); 50 | virtual ~XmlReader(); 51 | 52 | friend void 53 | _XML_READER_start ( void * data, const char * el, const char ** attr ); 54 | friend void 55 | _XML_READER_end ( void * data, const char * el ); 56 | 57 | virtual 58 | std::ostream & print( std::ostream & o ) const = 0; 59 | 60 | protected: 61 | std::string path; 62 | 63 | XML_Parser parser; 64 | long line; 65 | 66 | bool readXml( const std::string & path_name ); 67 | 68 | virtual 69 | void start( const char * el, 70 | const char ** attr ) = 0; 71 | virtual 72 | void end( const char * el ) = 0; 73 | 74 | bool createFile( const std::string & path ); 75 | 76 | bool extract( const std::string & attr, 77 | const std::string & val, 78 | double & dest, 79 | double start = 0.0, 80 | double end = 100.0 ); 81 | bool extract( const std::string & attr, 82 | const std::string & val, 83 | std::string & dest ); 84 | bool extract ( const std::string & attr, 85 | const std::string & val, 86 | char & dest ); 87 | 88 | }; 89 | 90 | #endif // HAVE_LIBEXPAT 91 | 92 | #endif // _XML_READER_H_ 93 | -------------------------------------------------------------------------------- /src/serializercommonstdv8.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | serializercommonstdv8.h 5 | Class for serializing data to std v8 clients 6 | ------------------- 7 | begin : 24-JAN-2003 8 | copyright : (C) 2003 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifndef SERIALIZERCOMMONSTDV8_H 23 | #define SERIALIZERCOMMONSTDV8_H 24 | 25 | #include "serializercommonstdv7.h" 26 | 27 | namespace rcss { 28 | 29 | 30 | class SerializerCommonStdv8 31 | : public SerializerCommonStdv7 { 32 | protected: 33 | SerializerCommonStdv8(); 34 | 35 | public: 36 | virtual 37 | ~SerializerCommonStdv8() override; 38 | 39 | static 40 | const 41 | Ptr create(); 42 | 43 | virtual 44 | void serializeServerParamBegin( std::ostream & strm ) const override; 45 | 46 | virtual 47 | void serializePlayerParamBegin( std::ostream & strm ) const override; 48 | 49 | virtual 50 | void serializePlayerTypeBegin( std::ostream & strm, 51 | const int id ) const override; 52 | 53 | virtual 54 | void serializeParam( std::ostream & strm, 55 | const std::string & name, 56 | const int param ) const override; 57 | 58 | virtual 59 | void serializeParam( std::ostream & strm, 60 | const std::string & name, 61 | const bool param ) const override; 62 | 63 | virtual 64 | void serializeParam( std::ostream & strm, 65 | const std::string & name, 66 | const double & param ) const override; 67 | 68 | virtual 69 | void serializeParam( std::ostream & strm, 70 | const std::string & name, 71 | const std::string & param ) const override; 72 | 73 | }; 74 | 75 | } 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /src/pcomparser.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | pcomparser.h 5 | Parser for Player Commands 6 | ------------------- 7 | begin : 14-AUG-2002 8 | copyright : (C) 2002 by The RoboCup Soccer Server 9 | Maintainance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifndef PCOMPARSER_H 23 | #define PCOMPARSER_H 24 | 25 | #include "player_command_tok.h" 26 | 27 | #include 28 | 29 | #include 30 | 31 | namespace rcss { 32 | namespace pcom { 33 | 34 | class Builder; 35 | 36 | class Parser 37 | : public rcss::Parser { 38 | public: 39 | typedef rcss::pcom::Lexer Lexer; 40 | 41 | class Param; 42 | typedef int (*ParserFunc)( Param & ); 43 | 44 | class Param { 45 | private: 46 | Lexer M_lexer; 47 | Parser & M_parser; 48 | 49 | protected: 50 | Builder & M_builder; 51 | public: 52 | Param( Parser & parser, 53 | Builder & builder ) 54 | : M_parser( parser ), 55 | M_builder( builder ) 56 | { } 57 | 58 | Parser & getParser() 59 | { 60 | return M_parser; 61 | } 62 | 63 | Lexer & getLexer() 64 | { 65 | return M_lexer; 66 | } 67 | 68 | Builder & getBuilder() 69 | { 70 | return M_builder; 71 | } 72 | }; 73 | 74 | private: 75 | Param M_param; 76 | ParserFunc M_parser; 77 | 78 | virtual 79 | bool doParse( std::istream & strm ) 80 | { 81 | M_param.getLexer().switch_streams( &strm, &std::cerr ); 82 | return M_parser( M_param ) == 0; 83 | } 84 | 85 | public: 86 | Parser( Builder & builder ); 87 | 88 | // convenience method 89 | int parse( const char * msg ); 90 | 91 | }; 92 | 93 | } 94 | } 95 | 96 | extern int RCSS_PCOM_parse( rcss::pcom::Parser::Param & param ); 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /src/field.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | /* 3 | *Header: 4 | *File: field.h (for C++) 5 | *Author: Noda Itsuki 6 | *Date: 1996/02/16 7 | *EndHeader: 8 | */ 9 | 10 | /* 11 | *Copyright: 12 | 13 | Copyright (C) 1996-2000 Electrotechnical Laboratory. 14 | Itsuki Noda, Yasuo Kuniyoshi and Hitoshi Matsubara. 15 | Copyright (C) 2000,2001 RoboCup Soccer Server Maintainance Group. 16 | Patrick Riley, Tom Howard, Daniel Polani, Itsuki Noda, 17 | Mikhail Prokopenko, Jan Wendler 18 | Copyright (C) 2002- RoboCup Soccer Simulator Maintainance Group. 19 | 20 | This file is a part of SoccerServer. 21 | 22 | This code is free software; you can redistribute it and/or 23 | modify it under the terms of the GNU Lesser General Public 24 | License as published by the Free Software Foundation; either 25 | version 3 of the License, or (at your option) any later version. 26 | 27 | This library is distributed in the hope that it will be useful, 28 | but WITHOUT ANY WARRANTY; without even the implied warranty of 29 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 30 | Lesser General Public License for more details. 31 | 32 | You should have received a copy of the GNU Lesser General Public 33 | License along with this library; if not, write to the Free Software 34 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 35 | 36 | *EndCopyright: 37 | */ 38 | 39 | 40 | #ifndef RCSSSERVER_FIELD_H 41 | #define RCSSSERVER_FIELD_H 42 | 43 | #include "timeable.h" 44 | 45 | #include "object.h" 46 | #include "weather.h" 47 | 48 | #include 49 | #include 50 | 51 | #include 52 | #include 53 | #include 54 | #include 55 | #include 56 | 57 | class HeteroPlayer; 58 | class XPMHolder; 59 | 60 | class Monitor; 61 | class Player; 62 | class Coach; 63 | class OnlineCoach; 64 | class Team; 65 | 66 | class Referee; 67 | class ResultSaver; 68 | 69 | struct timeval; 70 | 71 | namespace rcss { 72 | class Listener; 73 | namespace clang { 74 | class Msg; 75 | } 76 | } 77 | 78 | class Field { 79 | private: 80 | const Field & operator=( const Field & ); 81 | 82 | std::vector< const PObject * > M_goals; 83 | std::vector< PObject * > M_landmarks; 84 | public: 85 | const PObject line_l; 86 | const PObject line_r; 87 | const PObject line_t; 88 | const PObject line_b; 89 | 90 | Field(); 91 | ~Field(); 92 | 93 | const 94 | std::vector< const PObject * > & goals() const 95 | { 96 | return M_goals; 97 | } 98 | 99 | const 100 | std::vector< PObject * > & landmarks() const 101 | { 102 | return M_landmarks; 103 | } 104 | 105 | void addLandmark( PObject * new_obj ); 106 | }; 107 | 108 | #endif 109 | -------------------------------------------------------------------------------- /rcss/clang/clangparser.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | clangparser.h 5 | Parser for the Coach Lang 6 | ------------------- 7 | begin : 16-FEB-2002 8 | copyright : (C) 2002 by The RoboCup Soccer Server 9 | Maintainance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifndef RCSS_CLANGPARSER_H 23 | #define RCSS_CLANGPARSER_H 24 | 25 | #include 26 | #include 27 | 28 | #include 29 | 30 | namespace rcss { 31 | namespace clang { 32 | 33 | class Builder; 34 | 35 | class Parser 36 | : public rcss::Parser { 37 | public: 38 | typedef rcss::clang::Lexer Lexer; 39 | 40 | class Param; 41 | typedef int (*ParserFunc)( Param & ); 42 | 43 | class Param { 44 | private: 45 | Lexer M_lexer; 46 | Parser & M_parser; 47 | 48 | protected: 49 | Builder & M_builder; 50 | public: 51 | Param( Parser & parser, 52 | Builder& builder ) 53 | : M_parser( parser ), 54 | M_builder( builder ) 55 | { } 56 | 57 | Parser & getParser() 58 | { 59 | return M_parser; 60 | } 61 | 62 | Lexer & getLexer() 63 | { 64 | return M_lexer; 65 | } 66 | 67 | Builder & getBuilder() 68 | { 69 | return M_builder; 70 | } 71 | }; 72 | 73 | private: 74 | Param M_param; 75 | ParserFunc M_parser; 76 | 77 | virtual 78 | bool doParse( std::istream & strm ) override 79 | { 80 | M_param.getLexer().switch_streams( &strm, &std::cerr ); 81 | return M_parser( M_param ) == 0; 82 | } 83 | 84 | public: 85 | Parser( Builder & builder ); 86 | 87 | // convenience method 88 | int parse( const char * msg ); 89 | }; 90 | 91 | } 92 | } 93 | 94 | extern int RCSS_CLANG_parse( rcss::clang::Parser::Param & param ); 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /src/field.cpp: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++ -*- 2 | *Header: 3 | *File: field.C 4 | *Author: Noda Itsuki 5 | *Date: 1996/02/14 6 | *EndHeader: 7 | */ 8 | 9 | /* 10 | *Copyright: 11 | 12 | Copyright (C) 1996-2000 Electrotechnical Laboratory. 13 | Itsuki Noda, Yasuo Kuniyoshi and Hitoshi Matsubara. 14 | Copyright (C) 2000,2001 RoboCup Soccer Server Maintainance Group. 15 | Patrick Riley, Tom Howard, Daniel Polani, Itsuki Noda, 16 | Mikhail Prokopenko, Jan Wendler 17 | Copyright (C) 2002- RoboCup Soccer Simulator Maintainance Group. 18 | 19 | This file is a part of SoccerServer. 20 | 21 | This code is free software; you can redistribute it and/or 22 | modify it under the terms of the GNU Lesser General Public 23 | License as published by the Free Software Foundation; either 24 | version 3 of the License, or (at your option) any later version. 25 | 26 | This library is distributed in the hope that it will be useful, 27 | but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | Lesser General Public License for more details. 30 | 31 | You should have received a copy of the GNU Lesser General Public 32 | License along with this library; if not, write to the Free Software 33 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 34 | 35 | 36 | *EndCopyright: 37 | */ 38 | 39 | #ifdef HAVE_CONFIG_H 40 | #include 41 | #endif 42 | 43 | #include "field.h" 44 | 45 | #include "serverparam.h" 46 | 47 | /* 48 | *=================================================================== 49 | *Part: Field 50 | *=================================================================== 51 | */ 52 | Field::Field() 53 | : line_l( LINE_L_NAME, LINE_L_NAME_SHORT, "(Line)", "(L)", 54 | PVector( - ServerParam::PITCH_LENGTH / 2.0, 0.0 ) ), 55 | line_r( LINE_R_NAME, LINE_R_NAME_SHORT, "(Line)", "(L)", 56 | PVector( + ServerParam::PITCH_LENGTH / 2.0, 0.0 ) ), 57 | line_t( LINE_T_NAME, LINE_T_NAME_SHORT, "(Line)", "(L)", 58 | PVector( - ServerParam::PITCH_WIDTH / 2.0, 0.0 ) ), 59 | line_b( LINE_B_NAME, LINE_B_NAME_SHORT, "(Line)", "(L)", 60 | PVector( + ServerParam::PITCH_WIDTH / 2.0, 0.0 ) ) 61 | 62 | { 63 | 64 | } 65 | 66 | Field::~Field() 67 | { 68 | M_goals.clear(); 69 | 70 | for ( std::vector< PObject * >::iterator i = M_landmarks.begin(); 71 | i != M_landmarks.end(); 72 | ++i ) 73 | { 74 | delete *i; 75 | *i = static_cast< PObject * >( 0 ); 76 | } 77 | M_landmarks.clear(); 78 | } 79 | 80 | void 81 | Field::addLandmark( PObject * new_obj ) 82 | { 83 | if ( new_obj ) 84 | { 85 | if ( new_obj->closeName() == O_TYPE_GOAL_NAME ) 86 | { 87 | M_goals.push_back( new_obj ); 88 | } 89 | M_landmarks.push_back( new_obj ); 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /src/serializerplayerstdv18.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | serializerplayerstdv18.h 5 | Class for serializing data to std v18 players 6 | ------------------- 7 | begin : 2022-10-08 8 | copyright : (C) 2022 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | ***************************************************************************/ 11 | 12 | /*************************************************************************** 13 | * * 14 | * This program is free software; you can redistribute it and/or modify * 15 | * it under the terms of the GNU LGPL as published by the Free Software * 16 | * Foundation; either version 3 of the License, or (at your option) any * 17 | * later version. * 18 | * * 19 | ***************************************************************************/ 20 | 21 | #ifndef SERIALIZERPLAYERSTDV18_H 22 | #define SERIALIZERPLAYERSTDV18_H 23 | 24 | #include "serializerplayerstdv14.h" 25 | 26 | namespace rcss { 27 | 28 | class SerializerPlayerStdv18 29 | : public SerializerPlayerStdv14 { 30 | protected: 31 | SerializerPlayerStdv18( const SerializerCommon::Ptr common ); 32 | 33 | public: 34 | virtual 35 | ~SerializerPlayerStdv18() override; 36 | 37 | static 38 | const 39 | SerializerPlayer::Ptr create(); 40 | 41 | virtual 42 | void serializeBodyCounts( std::ostream &, 43 | const Player & ) const override; 44 | 45 | virtual 46 | void serializeFSCounts( std::ostream & strm, 47 | const Player & self ) const override; 48 | // virtual 49 | // void serializeFSCounts( std::ostream & strm, 50 | // const int count_kick, 51 | // const int count_dash, 52 | // const int count_turn, 53 | // const int count_catch, 54 | // const int count_move, 55 | // const int count_turn_neck, 56 | // const int count_change_view, 57 | // const int count_say, 58 | // const int count_change_focus) const override; 59 | 60 | virtual 61 | void serializeFocusPoint( std::ostream & strm, 62 | const Player & self ) const override; 63 | 64 | virtual 65 | void serializeFSPlayerFocus( std::ostream & strm, 66 | const Player & p ) const override; 67 | 68 | }; 69 | 70 | } 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /src/leg.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | 4 | /*************************************************************************** 5 | leg.h 6 | ------------------- 7 | begin : 23-OCT-2023 8 | copyright : (C) 2023 by The RoboCup Soccer Simulator 9 | Maintenance Group. 10 | ***************************************************************************/ 11 | 12 | /*************************************************************************** 13 | * * 14 | * This program is free software; you can redistribute it and/or modify * 15 | * it under the terms of the GNU LGPL as published by the Free Software * 16 | * Foundation; either version 3 of the License, or (at your option) any * 17 | * later version. * 18 | * * 19 | ***************************************************************************/ 20 | 21 | #ifndef RCSSSERVER_LEG_H 22 | #define RCSSSERVER_LEG_H 23 | 24 | #include "object.h" 25 | 26 | class Player; 27 | 28 | /*! 29 | \todo inherits an abstract actuator class 30 | */ 31 | class Leg { 32 | public: 33 | enum CommandType { 34 | MOVE, 35 | DASH, 36 | TURN, 37 | KICK, 38 | TACKLE, 39 | NONE 40 | }; 41 | 42 | private: 43 | const Player & M_player; 44 | 45 | CommandType M_command_type; 46 | 47 | double M_kick_power; 48 | double M_kick_dir; 49 | 50 | double M_dash_power; 51 | double M_dash_dir; 52 | 53 | Leg() = delete; 54 | Leg( const Leg & ) = delete; 55 | const Leg & operator=( const Leg & ) = delete; 56 | 57 | public: 58 | explicit 59 | Leg( const Player & player ); 60 | 61 | void resetCommand(); 62 | 63 | void move(); 64 | 65 | void kick( const double power, 66 | const double dir ); 67 | 68 | void turn(); 69 | 70 | void dash( const double power, 71 | const double dir ); 72 | 73 | void tackle(); 74 | 75 | 76 | bool commandDone() const 77 | { 78 | return M_command_type != NONE; 79 | } 80 | 81 | CommandType commandType() const 82 | { 83 | return M_command_type; 84 | } 85 | 86 | double kickPower() const 87 | { 88 | return M_kick_power; 89 | } 90 | 91 | double kickDir() const 92 | { 93 | return M_kick_dir; 94 | } 95 | 96 | double dashPower() const 97 | { 98 | return M_dash_power; 99 | } 100 | 101 | double dashDir() const 102 | { 103 | return M_dash_dir; 104 | } 105 | 106 | PVector calcDashAccel( const double consumed_stamina ) const; 107 | }; 108 | 109 | #endif 110 | -------------------------------------------------------------------------------- /src/serializeronlinecoachstdv1.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | serializeronlinecoachstdv1.h 5 | Class for serializing data to std v1 online coaches 6 | ------------------- 7 | begin : 27-MAY-2002 8 | copyright : (C) 2002 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifndef SERIALIZERONLINECOACHSTDV1_H 23 | #define SERIALIZERONLINECOACHSTDV1_H 24 | 25 | #include "serializer.h" 26 | 27 | namespace rcss { 28 | 29 | class SerializerOnlineCoachStdv1 30 | : public SerializerOnlineCoach { 31 | protected: 32 | SerializerOnlineCoachStdv1( const SerializerCommon::Ptr common, 33 | const SerializerCoach::Ptr coach ); 34 | 35 | public: 36 | virtual 37 | ~SerializerOnlineCoachStdv1() override; 38 | 39 | static 40 | const Ptr create(); 41 | 42 | virtual 43 | void serializeRefereeAudio( std::ostream & strm, 44 | const int time, 45 | const std::string & name, 46 | const char * msg ) const override; 47 | 48 | virtual 49 | void serializePlayerAudio( std::ostream & strm, 50 | const int time, 51 | const std::string & name, 52 | const char * msg ) const override; 53 | 54 | virtual 55 | void serializePlayerClangVer( std::ostream & strm, 56 | const std::string & name, 57 | const unsigned int min, 58 | const unsigned int max ) const override; 59 | 60 | virtual 61 | void serializeInit( std::ostream &, 62 | const int side = 0 ) const override; 63 | 64 | virtual 65 | void serializeChangedPlayer( std::ostream &, 66 | const int unum, 67 | const int type = -1 ) const override; 68 | 69 | }; 70 | 71 | } 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /m4/ax_prog_bison.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # https://www.gnu.org/software/autoconf-archive/ax_prog_bison.html 3 | # =========================================================================== 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_PROG_BISON(ACTION-IF-TRUE,ACTION-IF-FALSE) 8 | # 9 | # DESCRIPTION 10 | # 11 | # Check whether bison is the parser generator. Run ACTION-IF-TRUE if 12 | # successful, ACTION-IF-FALSE otherwise 13 | # 14 | # LICENSE 15 | # 16 | # Copyright (c) 2009 Francesco Salvestrini 17 | # Copyright (c) 2010 Diego Elio Petteno` 18 | # 19 | # This program is free software; you can redistribute it and/or modify it 20 | # under the terms of the GNU General Public License as published by the 21 | # Free Software Foundation; either version 2 of the License, or (at your 22 | # option) any later version. 23 | # 24 | # This program is distributed in the hope that it will be useful, but 25 | # WITHOUT ANY WARRANTY; without even the implied warranty of 26 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 27 | # Public License for more details. 28 | # 29 | # You should have received a copy of the GNU General Public License along 30 | # with this program. If not, see . 31 | # 32 | # As a special exception, the respective Autoconf Macro's copyright owner 33 | # gives unlimited permission to copy, distribute and modify the configure 34 | # scripts that are the output of Autoconf when processing the Macro. You 35 | # need not follow the terms of the GNU General Public License when using 36 | # or distributing such scripts, even though portions of the text of the 37 | # Macro appear in them. The GNU General Public License (GPL) does govern 38 | # all other use of the material that constitutes the Autoconf Macro. 39 | # 40 | # This special exception to the GPL applies to versions of the Autoconf 41 | # Macro released by the Autoconf Archive. When you make and distribute a 42 | # modified version of the Autoconf Macro, you may extend this special 43 | # exception to the GPL to apply to your modified version as well. 44 | 45 | #serial 10 46 | 47 | AC_DEFUN([AX_PROG_BISON], [ 48 | AC_REQUIRE([AC_PROG_YACC]) 49 | AC_REQUIRE([AC_PROG_EGREP]) 50 | 51 | AC_CACHE_CHECK([if bison is the parser generator],[ax_cv_prog_bison],[ 52 | AS_IF([$YACC --version 2>/dev/null | $EGREP -q '^bison '], 53 | [ax_cv_prog_bison=yes], [ax_cv_prog_bison=no]) 54 | ]) 55 | AS_IF([test "$ax_cv_prog_bison" = "yes"], [ 56 | dnl replace the yacc-compatible compiler with the real bison, as 57 | dnl otherwise autoconf limits us to the POSIX yacc. 58 | dnl We also change the generated filename to the old one, so that 59 | dnl automake's ylwrap can deal with it. 60 | YACC="${YACC% -y} -o y.tab.c" 61 | ] m4_ifnblank([$1], [[$1]]), 62 | m4_ifnblank([$2], [[$2]]) 63 | ) 64 | ]) 65 | -------------------------------------------------------------------------------- /rcss/clang/clangdefmsg.cpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | clangdefmsg.cpp 5 | Class for CLang Define messages 6 | ------------------- 7 | begin : 28-MAY-2002 8 | copyright : (C) 2002 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | 26 | #include "clangdefmsg.h" 27 | 28 | namespace rcss { 29 | namespace clang { 30 | 31 | DefineMsg::DefineMsg() 32 | : Msg() 33 | { 34 | 35 | } 36 | 37 | DefineMsg::DefineMsg( const Storage & defs ) 38 | : Msg(), 39 | M_defs( defs ) 40 | { 41 | 42 | } 43 | 44 | DefineMsg::~DefineMsg() 45 | { 46 | M_defs.clear(); 47 | } 48 | 49 | std::shared_ptr< Msg > 50 | DefineMsg::deepCopy() const 51 | { 52 | Storage new_defs; 53 | for ( Storage::const_reference def : M_defs ) 54 | { 55 | new_defs.push_back( def->deepCopy() ); 56 | } 57 | 58 | std::shared_ptr< Msg > ptr( new DefineMsg( new_defs ) ); 59 | return ptr; 60 | } 61 | 62 | std::ostream & 63 | DefineMsg::print( std::ostream & out ) const 64 | { 65 | out << "(define"; 66 | for ( Storage::const_reference def : getDefs() ) 67 | { 68 | if ( ! def ) 69 | { 70 | out << " (null)"; 71 | } 72 | else 73 | { 74 | out << " " << *def; 75 | } 76 | } 77 | out << ")"; 78 | return out; 79 | } 80 | 81 | std::ostream & 82 | DefineMsg::printPretty( std::ostream & out, 83 | const std::string & line_header ) const 84 | { 85 | out << line_header << "Define" << std::endl; 86 | for ( Storage::const_reference def : getDefs() ) 87 | { 88 | if ( ! def ) 89 | { 90 | out << line_header << " - (null)\n"; 91 | } 92 | else 93 | { 94 | def->printPretty( out, line_header + " - " ); 95 | } 96 | } 97 | return out; 98 | } 99 | 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /rcss/clang/clanginfomsg.cpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | clanginfomsg.cc 5 | Class for CLang Info messages 6 | ------------------- 7 | begin : 28-MAY-2002 8 | copyright : (C) 2002 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | 26 | #include "clanginfomsg.h" 27 | 28 | namespace rcss { 29 | namespace clang { 30 | 31 | InfoMsg::InfoMsg() 32 | : Msg() 33 | { 34 | 35 | } 36 | 37 | InfoMsg::InfoMsg( const Storage & tokens ) 38 | : Msg(), 39 | M_tokens( tokens ) 40 | { 41 | 42 | } 43 | 44 | InfoMsg::~InfoMsg() 45 | { 46 | M_tokens.clear(); 47 | } 48 | 49 | std::shared_ptr< Msg > 50 | InfoMsg::deepCopy() const 51 | { 52 | Storage new_tokens; 53 | for ( Storage::const_reference token : M_tokens ) 54 | { 55 | new_tokens.push_back( token->deepCopy() ); 56 | } 57 | 58 | std::shared_ptr< Msg > ptr( new InfoMsg( new_tokens ) ); 59 | return ptr; 60 | } 61 | 62 | std::ostream & 63 | InfoMsg::print( std::ostream & out ) const 64 | { 65 | out << "(info"; 66 | for ( Storage::const_reference token : getTokens() ) 67 | { 68 | if ( ! token ) 69 | { 70 | out << " (null)"; 71 | } 72 | else 73 | { 74 | out << " " << *token; 75 | } 76 | } 77 | out << ")"; 78 | return out; 79 | } 80 | 81 | std::ostream & 82 | InfoMsg::printPretty( std::ostream & out, 83 | const std::string & line_header ) const 84 | { 85 | out << line_header << "Info" << std::endl; 86 | for ( Storage::const_reference token : getTokens() ) 87 | { 88 | if ( ! token ) 89 | { 90 | out << line_header << " - (null)\n"; 91 | } 92 | else 93 | { 94 | token->printPretty( out, line_header + " - " ); 95 | } 96 | } 97 | return out; 98 | } 99 | 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /src/serializercommonjson.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file serializercommonjson.h 5 | \brief Class for serializing data by JSON format 6 | \author Hidehisa Akiyama 7 | */ 8 | 9 | /* 10 | *Copyright: 11 | 12 | Copyright (C) The RoboCup Soccer Server Maintenance Committee. 13 | Hidehisa AKIYAMA 14 | 15 | This code is free software; you can redistribute it and/or 16 | modify it under the terms of the GNU Lesser General Public 17 | License as published by the Free Software Foundation; either 18 | version 3 of the License, or (at your option) any later version. 19 | 20 | This library is distributed in the hope that it will be useful, 21 | but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 23 | Lesser General Public License for more details. 24 | 25 | You should have received a copy of the GNU Lesser General Public 26 | License along with this library; if not, write to the Free Software 27 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 28 | 29 | *EndCopyright: 30 | */ 31 | 32 | ///////////////////////////////////////////////////////////////////// 33 | 34 | #ifndef SERIALIZER_COMMON_JSON_H 35 | #define SERIALIZER_COMMON_JSON_H 36 | 37 | #include "serializer.h" 38 | 39 | namespace rcss { 40 | 41 | class SerializerCommonJSON 42 | : public SerializerCommon { 43 | protected: 44 | SerializerCommonJSON(); 45 | 46 | public: 47 | virtual 48 | ~SerializerCommonJSON() override; 49 | 50 | static const Ptr create(); 51 | 52 | virtual 53 | void serializeServerParamBegin( std::ostream & strm ) const override; 54 | 55 | virtual 56 | void serializeServerParamEnd( std::ostream & strm ) const override; 57 | 58 | virtual 59 | void serializePlayerParamBegin( std::ostream & strm ) const override; 60 | 61 | virtual 62 | void serializePlayerParamEnd( std::ostream & strm ) const override; 63 | 64 | virtual 65 | void serializePlayerTypeBegin( std::ostream & strm, 66 | const int id ) const override; 67 | virtual 68 | void serializePlayerTypeEnd( std::ostream & strm ) const override; 69 | 70 | 71 | virtual 72 | void serializeParam( std::ostream & strm, 73 | const std::string & name, 74 | const int param ) const override; 75 | 76 | virtual 77 | void serializeParam( std::ostream & strm, 78 | const std::string & name, 79 | const bool param ) const override; 80 | 81 | virtual 82 | void serializeParam( std::ostream & strm, 83 | const std::string & name, 84 | const double & param ) const override; 85 | 86 | virtual 87 | void serializeParam( std::ostream & strm, 88 | const std::string & name, 89 | const std::string & param ) const override; 90 | 91 | }; 92 | 93 | } 94 | 95 | #endif 96 | -------------------------------------------------------------------------------- /src/stdoutsaver.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | stdoutsaver.h 5 | Class for saving results to the standard output stream 6 | ------------------- 7 | begin : 2008-10-27 8 | copyright : (C) 2008 by The RoboCup Soccer Simulator 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifndef RCSS_STDOUTSAVER_H 23 | #define RCSS_STDOUTSAVER_H 24 | 25 | #include "resultsaver.hpp" 26 | 27 | #include 28 | 29 | class STDOutSaver 30 | : public ResultSaver { 31 | public: 32 | 33 | static const std::string NAME; 34 | 35 | private: 36 | STDOutSaver(); 37 | 38 | public: 39 | virtual 40 | ~STDOutSaver() override; 41 | 42 | static 43 | Ptr create(); 44 | 45 | private: 46 | virtual 47 | bool doEnabled() const override; 48 | 49 | virtual 50 | void doSaveStart() override; 51 | 52 | virtual 53 | void doSaveTime( const std::time_t time ) override; 54 | 55 | virtual 56 | void doSaveTeamName( team_id id, 57 | const std::string & name ) override; 58 | 59 | virtual 60 | void doSaveCoachName( team_id id, 61 | const std::string & name ) override; 62 | 63 | virtual 64 | void doSaveScore( team_id id, 65 | unsigned int score ) override; 66 | 67 | virtual 68 | void doSavePenTaken( team_id id, 69 | unsigned int taken ) override; 70 | 71 | virtual 72 | void doSavePenScored( team_id id, 73 | unsigned int scored ) override; 74 | 75 | virtual 76 | void doSaveCoinTossWinner( team_id id ) override; 77 | 78 | virtual 79 | bool doSaveComplete() override; 80 | 81 | virtual 82 | const char * doGetName() const override; 83 | 84 | 85 | std::time_t M_time; 86 | std::string M_team_name[ 2 ]; 87 | std::string M_coach_name[ 2 ]; 88 | unsigned int M_score[ 2 ]; 89 | unsigned int M_pen_taken[ 2 ]; 90 | unsigned int M_pen_scored[ 2 ]; 91 | bool M_left_coin; 92 | bool M_right_coin; 93 | }; 94 | 95 | #endif 96 | -------------------------------------------------------------------------------- /src/serializercommonstdv1.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | serializercommonstdv1.h 5 | Class for serializing data to std v1 clients 6 | ------------------- 7 | begin : 27-JAN-2003 8 | copyright : (C) 2003 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifndef SERIALIZERCOMMONSTDV1_H 23 | #define SERIALIZERCOMMONSTDV1_H 24 | 25 | #include "serializer.h" 26 | 27 | namespace rcss { 28 | 29 | 30 | class SerializerCommonStdv1 31 | : public SerializerCommon { 32 | protected: 33 | SerializerCommonStdv1(); 34 | 35 | public: 36 | virtual 37 | ~SerializerCommonStdv1() override; 38 | 39 | static 40 | const 41 | Ptr create(); 42 | 43 | virtual 44 | void serializeServerParamBegin( std::ostream & strm ) const override; 45 | 46 | virtual 47 | void serializeServerParamEnd( std::ostream & strm ) const override; 48 | 49 | virtual 50 | void serializePlayerParamBegin( std::ostream & strm ) const override; 51 | 52 | virtual 53 | void serializePlayerParamEnd( std::ostream & strm ) const override; 54 | 55 | virtual 56 | void serializePlayerTypeBegin( std::ostream & strm, 57 | const int id ) const override; 58 | 59 | virtual 60 | void serializePlayerTypeEnd( std::ostream & strm ) const override; 61 | 62 | virtual 63 | void serializeParam( std::ostream & strm, 64 | const int param ) const override; 65 | 66 | virtual 67 | void serializeParam( std::ostream & strm, 68 | const unsigned int param ) const override; 69 | 70 | virtual 71 | void serializeParam( std::ostream & strm, 72 | const bool param ) const override; 73 | 74 | virtual 75 | void serializeParam( std::ostream & strm, 76 | const double & param ) const override; 77 | 78 | virtual 79 | void serializeParam( std::ostream & strm, 80 | const std::string & param ) const override; 81 | }; 82 | 83 | } 84 | 85 | #endif 86 | -------------------------------------------------------------------------------- /src/serializercommonstdv7.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | serializercommonstdv7.h 5 | Class for serializing data to std v7 clients 6 | ------------------- 7 | begin : 24-JAN-2003 8 | copyright : (C) 2003 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifndef SERIALIZERCOMMONSTDV7_H 23 | #define SERIALIZERCOMMONSTDV7_H 24 | 25 | #include "serializercommonstdv1.h" 26 | 27 | namespace rcss { 28 | 29 | 30 | class SerializerCommonStdv7 31 | : public SerializerCommonStdv1 { 32 | protected: 33 | SerializerCommonStdv7(); 34 | 35 | public: 36 | virtual 37 | ~SerializerCommonStdv7() override; 38 | 39 | static 40 | const 41 | Ptr create(); 42 | 43 | virtual 44 | void serializeServerParamBegin( std::ostream & strm ) const override; 45 | 46 | virtual 47 | void serializeServerParamEnd( std::ostream & strm ) const override; 48 | 49 | virtual 50 | void serializePlayerParamBegin( std::ostream & strm ) const override; 51 | 52 | virtual 53 | void serializePlayerParamEnd( std::ostream & strm ) const override; 54 | 55 | virtual 56 | void serializePlayerTypeBegin( std::ostream & strm, 57 | const int id ) const override; 58 | 59 | virtual 60 | void serializePlayerTypeEnd( std::ostream & strm ) const override; 61 | 62 | virtual 63 | void serializeParam( std::ostream & strm, 64 | const int param ) const override; 65 | 66 | virtual 67 | void serializeParam( std::ostream & strm, 68 | const unsigned int param ) const override; 69 | 70 | virtual 71 | void serializeParam( std::ostream & strm, 72 | const bool param ) const override; 73 | 74 | virtual 75 | void serializeParam( std::ostream & strm, 76 | const double & param ) const override; 77 | 78 | virtual 79 | void serializeParam( std::ostream & strm, 80 | const std::string & param ) const override; 81 | }; 82 | 83 | } 84 | 85 | #endif 86 | -------------------------------------------------------------------------------- /src/observer.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | observer.h 5 | Base for observer classes 6 | ------------------- 7 | begin : 2002-10-07 8 | copyright : (C) 2002 by The RoboCup Soccer Simulator 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | 23 | #ifndef RCSSOBSERVER_H 24 | #define RCSSOBSERVER_H 25 | 26 | //#include "rcssexceptions.h" 27 | #include 28 | #include 29 | 30 | namespace rcss { 31 | 32 | /*! 33 | //=================================================================== 34 | // 35 | // CLASS: Observer 36 | // 37 | // DESC: Base observer. 38 | // 39 | //=================================================================== 40 | */ 41 | 42 | template < class S > 43 | class BaseObserver { 44 | public: 45 | typedef S Sender; 46 | private: 47 | std::shared_ptr< Sender > M_sender; 48 | 49 | public: 50 | BaseObserver() 51 | { } 52 | 53 | BaseObserver( std::shared_ptr< Sender > sender ) 54 | : M_sender( sender ) 55 | { } 56 | 57 | virtual 58 | ~BaseObserver() 59 | { } 60 | 61 | void setSender( std::shared_ptr< Sender > sender ) 62 | { 63 | M_sender = sender; 64 | } 65 | 66 | Sender & sender() 67 | { 68 | if ( ! M_sender ) 69 | { 70 | // throw util::NullErr( __FILE__, __LINE__, 71 | // "Sender is null" ); 72 | throw std::logic_error( "Sender is null" ); 73 | } 74 | return *M_sender; 75 | } 76 | 77 | const Sender & sender() const 78 | { 79 | if ( ! M_sender ) 80 | { 81 | // throw util::NullErr( __FILE__, __LINE__, 82 | // "Sender is null" ); 83 | throw std::logic_error( "Sender is null" ); 84 | } 85 | return *M_sender; 86 | } 87 | 88 | private: 89 | 90 | BaseObserver( const BaseObserver & ) = delete; // not used; 91 | BaseObserver & operator=( const BaseObserver & ) = delete; // not used; 92 | }; 93 | 94 | } 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /src/serializeronlinecoachstdv14.cpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | serializeronlinecoachstdv14.cpp 5 | Class for serializing data to std v14 online coaches 6 | ------------------- 7 | begin : 2008-11-03 8 | copyright : (C) 2008 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | 26 | #include "serializeronlinecoachstdv14.h" 27 | 28 | namespace rcss { 29 | 30 | SerializerOnlineCoachStdv14::SerializerOnlineCoachStdv14( const SerializerCommon::Ptr common, 31 | const SerializerCoach::Ptr coach ) 32 | : SerializerOnlineCoachStdv13( common, coach ) 33 | { 34 | 35 | } 36 | 37 | SerializerOnlineCoachStdv14::~SerializerOnlineCoachStdv14() 38 | { 39 | 40 | } 41 | 42 | const 43 | SerializerOnlineCoach::Ptr 44 | SerializerOnlineCoachStdv14::create() 45 | { 46 | SerializerCommon::Creator cre_common; 47 | if ( ! SerializerCommon::factory().getCreator( cre_common, 14 ) ) 48 | { 49 | return SerializerOnlineCoach::Ptr(); 50 | } 51 | 52 | SerializerCoach::Creator cre_coach; 53 | if ( ! SerializerCoach::factory().getCreator( cre_coach, 14 ) ) 54 | { 55 | return SerializerOnlineCoach::Ptr(); 56 | } 57 | 58 | SerializerOnlineCoach::Ptr ptr( new SerializerOnlineCoachStdv14( cre_common(), cre_coach() ) ); 59 | return ptr; 60 | } 61 | 62 | namespace { 63 | RegHolder v14 = SerializerOnlineCoach::factory().autoReg( &SerializerOnlineCoachStdv14::create, 14 ); 64 | RegHolder v15 = SerializerOnlineCoach::factory().autoReg( &SerializerOnlineCoachStdv14::create, 15 ); 65 | RegHolder v16 = SerializerOnlineCoach::factory().autoReg( &SerializerOnlineCoachStdv14::create, 16 ); 66 | RegHolder v17 = SerializerOnlineCoach::factory().autoReg( &SerializerOnlineCoachStdv14::create, 17 ); 67 | RegHolder v18 = SerializerOnlineCoach::factory().autoReg( &SerializerOnlineCoachStdv14::create, 18 ); 68 | RegHolder v19 = SerializerOnlineCoach::factory().autoReg( &SerializerOnlineCoachStdv14::create, 19 ); 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /rcss/clang/clangmsg.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | clangmsg.h 5 | Abstract base class for CLang messages 6 | ------------------- 7 | begin : 27-MAY-2002 8 | copyright : (C) 2002 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifndef RCSS_CLANGMSG_H 23 | #define RCSS_CLANGMSG_H 24 | 25 | #include 26 | #include 27 | 28 | namespace rcss { 29 | namespace clang { 30 | 31 | /********* Msg *******************/ 32 | class MetaMsg; 33 | class FreeformMsg; 34 | class InfoMsg; 35 | class AdviceMsg; 36 | class DefineMsg; 37 | class UnsuppMsg; 38 | class RuleMsg; 39 | class DelMsg; 40 | 41 | class Msg { 42 | 43 | public: 44 | 45 | enum Types { META, FREEFORM, INFO, ADVICE, DEFINE, DEL, RULE, UNSUP }; 46 | 47 | protected: 48 | Msg(); 49 | Msg( const int & time_recv ); 50 | 51 | public: 52 | virtual 53 | ~Msg(); 54 | 55 | virtual 56 | Types getType() const = 0; 57 | 58 | virtual 59 | std::shared_ptr< Msg > deepCopy() const = 0; 60 | 61 | virtual 62 | std::ostream & print( std::ostream & out ) const = 0; 63 | 64 | virtual 65 | std::ostream & printPretty( std::ostream & out, 66 | const std::string & line_header ) const = 0; 67 | 68 | void setVer( const unsigned int min, 69 | const unsigned int max ); 70 | 71 | unsigned int getMinVer() const; 72 | unsigned int getMaxVer() const; 73 | bool isSupported( const unsigned int min, 74 | const unsigned int max ) const; 75 | int getTimeRecv() const; 76 | void setTimeRecv( const int time_recv ); 77 | int getTimeSend() const; 78 | void setTimeSend( const int time_send ); 79 | int getSide() const; 80 | void setSide( const int side ); 81 | 82 | private: 83 | int M_time_recv; 84 | unsigned int M_min_ver; 85 | unsigned int M_max_ver; 86 | 87 | int M_time_send; 88 | int M_side; 89 | }; 90 | 91 | } 92 | } 93 | 94 | 95 | std::ostream & 96 | operator<<( std::ostream & os, 97 | const rcss::clang::Msg & m ); 98 | 99 | #endif 100 | -------------------------------------------------------------------------------- /rcss/net/socketstreambuf.hpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | socketstreambuf.hpp - A socket stream buffer 5 | ------------------- 6 | begin : 08-JAN-2003 7 | copyright : (C) 2003 by The RoboCup Soccer Server 8 | Maintenance Group. 9 | email : sserver-admin@lists.sourceforge.net 10 | ***************************************************************************/ 11 | 12 | /*************************************************************************** 13 | * * 14 | * This program is free software; you can redistribute it and/or modify * 15 | * it under the terms of the GNU LGPL as published by the Free Software * 16 | * Foundation; either version 2 of the License, or (at your option) any * 17 | * later version. * 18 | * * 19 | ***************************************************************************/ 20 | 21 | 22 | #ifndef RCSS_NET_SOCKETSTREAMBUF_HPP 23 | #define RCSS_NET_SOCKETSTREAMBUF_HPP 24 | 25 | #include 26 | 27 | //g++ 2.95.6 doesn't have the streambuf header, so iostream is used instead 28 | //#include 29 | #include 30 | 31 | namespace rcss { 32 | namespace net { 33 | 34 | class Socket; 35 | 36 | class SocketStreamBuf 37 | : public std::streambuf { 38 | public: 39 | // typedef int int_type; 40 | typedef char char_type; 41 | 42 | enum ConnType { CONN_ON_READ, NO_CONN }; 43 | 44 | private: 45 | 46 | Socket & M_socket; 47 | Addr M_end_point; 48 | std::streamsize M_bufsize; 49 | char_type * M_inbuf; 50 | char_type * M_outbuf; 51 | int M_remained; 52 | char_type M_remained_char; 53 | ConnType M_connect; 54 | 55 | // not used 56 | SocketStreamBuf( const SocketStreamBuf & ); 57 | // not used 58 | SocketStreamBuf & operator=( const SocketStreamBuf & ); 59 | 60 | public: 61 | SocketStreamBuf( Socket & socket, 62 | const Addr & dest, 63 | ConnType conn = CONN_ON_READ, 64 | std::streamsize bufsize = 8192 ); 65 | 66 | SocketStreamBuf( Socket & socket, 67 | ConnType conn = NO_CONN, 68 | std::streamsize bufsize = 8192 ); 69 | 70 | virtual 71 | ~SocketStreamBuf(); 72 | 73 | void setEndPoint( const Addr & addr ) 74 | { 75 | M_end_point = addr; 76 | } 77 | 78 | void setConnectType( ConnType conn ) 79 | { 80 | M_connect = conn; 81 | } 82 | 83 | private: 84 | 85 | bool writeData(); 86 | 87 | protected: 88 | 89 | virtual 90 | int_type overflow( int_type c = traits_type::eof() ); 91 | 92 | virtual 93 | int sync(); 94 | 95 | virtual 96 | int_type underflow(); 97 | 98 | }; 99 | 100 | } 101 | } 102 | 103 | #endif 104 | -------------------------------------------------------------------------------- /rcss/clang/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | bison_target(coach_lang_parser 3 | coach_lang_parser.ypp 4 | ${CMAKE_CURRENT_BINARY_DIR}/coach_lang_parser.cpp 5 | DEFINES_FILE ${CMAKE_CURRENT_BINARY_DIR}/coach_lang_parser.hpp 6 | ) 7 | flex_target(coach_lang_tokenizer 8 | coach_lang_tok.lpp 9 | ${CMAKE_CURRENT_BINARY_DIR}/raw_coach_lang_tok.cpp 10 | ) 11 | add_flex_bison_dependency(coach_lang_tokenizer coach_lang_parser) 12 | add_custom_command( 13 | OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/coach_lang_tok.cpp" 14 | COMMAND ${CMAKE_COMMAND} 15 | ARGS 16 | "-DGENERATED_FILE_PATH=\"${CMAKE_CURRENT_BINARY_DIR}/raw_coach_lang_tok.cpp\"" 17 | "-DCORRECT_HEADER_NAME=coach_lang_tok.h" 18 | "-DOUTPUT_FILE_PATH=\"${CMAKE_CURRENT_BINARY_DIR}/coach_lang_tok.cpp\"" 19 | "-P" "${CMAKE_CURRENT_SOURCE_DIR}/fix_lexer_file.cmake" 20 | MAIN_DEPENDENCY "${CMAKE_CURRENT_BINARY_DIR}/raw_coach_lang_tok.cpp" 21 | ) 22 | 23 | add_library(RCSSCLangParser SHARED 24 | clangbuilder.cpp 25 | clangmsgbuilder.cpp 26 | clangparser.cpp 27 | clangmsg.cpp 28 | clangmetamsg.cpp 29 | clangfreeformmsg.cpp 30 | clangunsuppmsg.cpp 31 | clangrulemsg.cpp 32 | clangdelmsg.cpp 33 | clanginfomsg.cpp 34 | clangadvicemsg.cpp 35 | clangdefmsg.cpp 36 | clangaction.cpp 37 | clangutil.cpp 38 | coach_lang_comp.cpp 39 | arithop.cpp 40 | cond.cpp 41 | compop.cpp 42 | region.cpp 43 | rule.cpp 44 | ${CMAKE_CURRENT_BINARY_DIR}/coach_lang_parser.cpp 45 | ${CMAKE_CURRENT_BINARY_DIR}/coach_lang_tok.cpp 46 | ) 47 | 48 | add_library(RCSS::CLangParser ALIAS RCSSCLangParser) 49 | 50 | 51 | target_link_libraries(RCSSCLangParser 52 | PUBLIC 53 | Boost::boost 54 | ) 55 | 56 | target_compile_definitions(RCSSCLangParser 57 | PUBLIC 58 | HAVE_CONFIG_H 59 | ) 60 | 61 | target_include_directories(RCSSCLangParser 62 | PUBLIC 63 | ${PROJECT_SOURCE_DIR} 64 | ${PROJECT_BINARY_DIR} 65 | ) 66 | 67 | target_compile_options(RCSSCLangParser 68 | PRIVATE 69 | -W -Wall 70 | ) 71 | 72 | set_target_properties(RCSSCLangParser 73 | PROPERTIES 74 | SOVERSION 18 75 | VERSION 18.0.0 76 | LIBRARY_OUTPUT_NAME "rcssclangparser" 77 | ) 78 | 79 | 80 | set_property(TARGET RCSSCLangParser PROPERTY 81 | PUBLIC_HEADER 82 | clangparser.h 83 | coach_lang_tok.h 84 | clangbuilder.h 85 | clangmsgbuilder.h 86 | clangmsg.h 87 | clangmetamsg.h 88 | clangfreeformmsg.h 89 | clangunsuppmsg.h 90 | clangrulemsg.h 91 | clangdelmsg.h 92 | clanginfomsg.h 93 | clangadvicemsg.h 94 | clangdefmsg.h 95 | clangaction.h 96 | clangutil.h 97 | coach_lang_comp.h 98 | ${CMAKE_CURRENT_BINARY_DIR}/coach_lang_parser.hpp 99 | arithop.h 100 | compop.h 101 | cond.h 102 | region.h 103 | rule.h 104 | ) 105 | 106 | install(TARGETS RCSSCLangParser 107 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 108 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 109 | COMPONENT Libraries 110 | PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE 111 | PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rcss/clang 112 | ) 113 | -------------------------------------------------------------------------------- /rcss/clang/clangadvicemsg.cpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | clangadvicemsg.cc 5 | Class for CLang Advice messages 6 | ------------------- 7 | begin : 28-MAY-2002 8 | copyright : (C) 2002 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | 26 | #include "clangadvicemsg.h" 27 | 28 | namespace rcss { 29 | namespace clang { 30 | 31 | AdviceMsg::AdviceMsg() 32 | : Msg() 33 | { 34 | 35 | } 36 | 37 | AdviceMsg::AdviceMsg( const Storage & tokens ) 38 | : Msg(), 39 | M_tokens( tokens ) 40 | { 41 | 42 | } 43 | 44 | AdviceMsg::~AdviceMsg() 45 | { 46 | M_tokens.clear(); 47 | } 48 | 49 | std::shared_ptr< Msg > 50 | AdviceMsg::deepCopy() const 51 | { 52 | Storage new_tokens; 53 | for( Storage::const_reference i : M_tokens ) 54 | { 55 | new_tokens.push_back( i->deepCopy() ); 56 | } 57 | 58 | std::shared_ptr< Msg > rval( new AdviceMsg( new_tokens ) ); 59 | return rval; 60 | } 61 | 62 | // void 63 | // AdviceMsg::accept( Visitor& v ) 64 | // { v.startVisit( this ); } 65 | 66 | // void 67 | // AdviceMsg::accept( ConstVisitor& v ) const 68 | // { v.startVisit( this ); } 69 | 70 | std::ostream & 71 | AdviceMsg::print( std::ostream & out ) const 72 | { 73 | out << "(advice"; 74 | for ( Storage::const_reference token : getTokens() ) 75 | { 76 | if ( ! token ) 77 | { 78 | out << " (null)"; 79 | } 80 | else 81 | { 82 | out << " " << *token; 83 | } 84 | } 85 | out << ")"; 86 | return out; 87 | } 88 | 89 | std::ostream & 90 | AdviceMsg::printPretty( std::ostream & out, 91 | const std::string & line_header ) const 92 | { 93 | out << line_header << "Advice" << std::endl; 94 | for ( Storage::const_reference token : getTokens() ) 95 | { 96 | if ( ! token ) 97 | { 98 | out << line_header << " - (null)\n"; 99 | } 100 | else 101 | { 102 | token->printPretty( out, line_header + " - " ); 103 | } 104 | } 105 | return out; 106 | } 107 | 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /src/remoteclient.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | remoteclient.h - A class for remote client 5 | ------------------- 6 | begin : 22-NOV-2001 7 | copyright : (C) 2001 by The RoboCup Soccer Server 8 | Maintainance Group. 9 | email : sserver-admin@lists.sourceforge.net 10 | ***************************************************************************/ 11 | 12 | /*************************************************************************** 13 | * * 14 | * This program is free software; you can redistribute it and/or modify * 15 | * it under the terms of the GNU LGPL as published by the Free Software * 16 | * Foundation; either version 3 of the License, or (at your option) any * 17 | * later version. * 18 | * * 19 | ***************************************************************************/ 20 | 21 | 22 | #ifndef RCSS_REMOTECLIENT_H 23 | #define RCSS_REMOTECLIENT_H 24 | 25 | #include "compress.h" 26 | 27 | #include 28 | 29 | namespace rcss { 30 | namespace net { 31 | class SocketStreamBuf; 32 | } 33 | namespace gz { 34 | class gzstreambuf; 35 | } 36 | } 37 | 38 | 39 | class RemoteClient { 40 | 41 | private: 42 | rcss::net::UDPSocket M_socket; 43 | rcss::net::SocketStreamBuf * M_socket_buf; 44 | rcss::gz::gzstreambuf * M_gz_buf; 45 | std::ostream * M_transport; 46 | int M_comp_level; 47 | 48 | #ifdef HAVE_LIBZ 49 | //Compressor M_comp; 50 | Decompressor M_decomp; 51 | #endif 52 | 53 | bool M_enforce_dedicated_port; 54 | 55 | public: 56 | RemoteClient(); 57 | 58 | virtual 59 | ~RemoteClient(); 60 | 61 | bool setEnforceDedicatedPort( const bool enf = true ) 62 | { 63 | return M_enforce_dedicated_port = enf; 64 | } 65 | 66 | int send( const char * msg, 67 | const size_t & len ); 68 | 69 | int recv(); 70 | 71 | void undedicatedRecv( char * msg, 72 | const size_t & len ); 73 | 74 | protected: 75 | void processMsg( char * msg, 76 | const size_t & len ); 77 | 78 | virtual 79 | void parseMsg( char * msg, 80 | const size_t & len ) = 0; 81 | 82 | public: 83 | int compressionLevel() const 84 | { 85 | return M_comp_level; 86 | } 87 | 88 | int setCompressionLevel( const int level ); 89 | 90 | std::ostream & getTransport(); 91 | 92 | protected: 93 | void close(); 94 | 95 | public: 96 | bool connected() const 97 | { 98 | return M_socket.isConnected(); 99 | } 100 | 101 | bool connect( const rcss::net::Addr & dest ); 102 | 103 | int open(); 104 | 105 | rcss::net::Addr getDest() const 106 | { 107 | return M_socket.getDest(); 108 | } 109 | 110 | }; 111 | 112 | #endif 113 | -------------------------------------------------------------------------------- /rcss/conf/streamstatushandler.hpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | streamstatushandler.hpp 5 | Interface for writing parser notifactions to streams 6 | ------------------- 7 | begin : 14-MAY-2003 8 | copyright : (C) 2003 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 2 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifndef STREAMSTATUSHANDLER_HPP 23 | #define STREAMSTATUSHANDLER_HPP 24 | 25 | #include "statushandler.hpp" 26 | #include 27 | 28 | namespace rcss { 29 | namespace conf { 30 | 31 | class StreamStatusHandler 32 | : public StatusHandler { 33 | public: 34 | 35 | StreamStatusHandler(); 36 | 37 | StreamStatusHandler( std::ostream & errstrm ); 38 | 39 | virtual 40 | ~StreamStatusHandler(); 41 | 42 | virtual 43 | void parseError( const std::string & curr, 44 | const std::string & err, 45 | const std::string & name, 46 | int lineno ); 47 | 48 | virtual 49 | void buildError( const std::string & module, 50 | const std::string & param, 51 | const std::string & err, 52 | const std::string & name, 53 | int lineno ); 54 | 55 | virtual 56 | void buildWarning( const std::string & module, 57 | const std::string & param, 58 | const std::string & warn, 59 | const std::string & name, 60 | int lineno ); 61 | 62 | virtual 63 | void creatingConfFile( const std::string & conf_name ); 64 | 65 | virtual 66 | void createdConfFile( const std::string & conf_name ); 67 | 68 | virtual 69 | void confCreationFailed( const std::string & conf_name, 70 | int error ); 71 | 72 | virtual 73 | void includeFailed( const std::string & filename, 74 | const std::string & error, 75 | const std::string & name, 76 | int lineno ); 77 | 78 | virtual 79 | void loadFailed( const std::string & libname, 80 | const std::string & error, 81 | const std::vector< std::filesystem::path > & avail, 82 | const std::string & name, 83 | int lineno ); 84 | private: 85 | std::ostream & M_errstrm; 86 | 87 | }; 88 | 89 | } 90 | } 91 | 92 | #endif 93 | -------------------------------------------------------------------------------- /src/serializeronlinecoachstdv8.cpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | serializeronlinecoachstdv8.cc 5 | Class for serializing data to std v8 online coaches 6 | ------------------- 7 | begin : 27-MAY-2002 8 | copyright : (C) 2002 by The RoboCup Soccer Server 9 | Maintenance Group. 10 | email : sserver-admin@lists.sourceforge.net 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU LGPL as published by the Free Software * 17 | * Foundation; either version 3 of the License, or (at your option) any * 18 | * later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | 26 | #include "serializeronlinecoachstdv8.h" 27 | 28 | namespace rcss { 29 | 30 | SerializerOnlineCoachStdv8::SerializerOnlineCoachStdv8( const SerializerCommon::Ptr common, 31 | const SerializerCoach::Ptr coach ) 32 | : SerializerOnlineCoachStdv7( common, coach ) 33 | { 34 | 35 | } 36 | 37 | SerializerOnlineCoachStdv8::~SerializerOnlineCoachStdv8() 38 | { 39 | 40 | } 41 | 42 | void 43 | SerializerOnlineCoachStdv8::serializePlayerClangVer( std::ostream& strm, 44 | const std::string & name, 45 | const unsigned int min, 46 | const unsigned int max ) const 47 | { 48 | strm << "(clang (ver " << name << ' ' << min << ' ' << max << "))"; 49 | } 50 | 51 | 52 | const 53 | SerializerOnlineCoach::Ptr 54 | SerializerOnlineCoachStdv8::create() 55 | { 56 | SerializerCommon::Creator cre_common; 57 | if ( ! SerializerCommon::factory().getCreator( cre_common, 8 ) ) 58 | { 59 | return SerializerOnlineCoach::Ptr(); 60 | } 61 | 62 | SerializerCoach::Creator cre_coach; 63 | if ( ! SerializerCoach::factory().getCreator( cre_coach, 8 ) ) 64 | { 65 | return SerializerOnlineCoach::Ptr(); 66 | } 67 | 68 | SerializerOnlineCoach::Ptr ptr( new SerializerOnlineCoachStdv8( cre_common(), cre_coach() ) ); 69 | return ptr; 70 | } 71 | 72 | 73 | namespace { 74 | RegHolder v8 = SerializerOnlineCoach::factory().autoReg( &SerializerOnlineCoachStdv8::create, 8 ); 75 | RegHolder v9 = SerializerOnlineCoach::factory().autoReg( &SerializerOnlineCoachStdv8::create, 9 ); 76 | RegHolder v10 = SerializerOnlineCoach::factory().autoReg( &SerializerOnlineCoachStdv8::create, 10 ); 77 | RegHolder v11 = SerializerOnlineCoach::factory().autoReg( &SerializerOnlineCoachStdv8::create, 11 ); 78 | RegHolder v12 = SerializerOnlineCoach::factory().autoReg( &SerializerOnlineCoachStdv8::create, 12 ); 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /src/main.cpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*************************************************************************** 4 | main.cpp 5 | Main for rcssserver 6 | ------------------- 7 | begin : 1996 8 | copyright : (C) 1996-2000 Electrotechnical Laboratory. 9 | Itsuki Noda, Yasuo Kuniyoshi and Hitoshi Matsubara. 10 | (C) 2001- by The RoboCup Soccer Server 11 | Maintenance Group. 12 | email : sserver-admin@lists.sourceforge.net 13 | ***************************************************************************/ 14 | 15 | /*************************************************************************** 16 | * * 17 | * This program is free software; you can redistribute it and/or modify * 18 | * it under the terms of the GNU LGPL as published by the Free Software * 19 | * Foundation; either version 3 of the License, or (at your option) any * 20 | * later version. * 21 | * * 22 | ***************************************************************************/ 23 | 24 | #ifdef HAVE_CONFIG_H 25 | #include 26 | #endif 27 | 28 | #include "stadium.h" 29 | #include "serverparam.h" 30 | #include "version.h" 31 | 32 | #include "stdtimer.h" 33 | #include "synctimer.h" 34 | 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | namespace { 44 | 45 | Stadium Std; 46 | 47 | void 48 | sigHandle( int ) 49 | { 50 | Std.finalize( "Server Killed. Exiting..." ); 51 | } 52 | 53 | } 54 | 55 | int 56 | main( int argc, char *argv[] ) 57 | { 58 | std::locale::global( std::locale::classic() ); 59 | 60 | std::cout << PACKAGE << "-" << VERSION << "\n\n" 61 | << Copyright << std::endl; 62 | 63 | if ( ! ServerParam::init( argc, argv ) ) 64 | { 65 | return 1; 66 | } 67 | 68 | struct sigaction sig_action; 69 | sig_action.sa_handler = &sigHandle; 70 | sig_action.sa_flags = 0; 71 | if ( sigaction( SIGINT, &sig_action, nullptr ) != 0 72 | || sigaction( SIGTERM, &sig_action, nullptr ) != 0 73 | || sigaction( SIGHUP, &sig_action, nullptr ) != 0 ) 74 | { 75 | std::cerr << __FILE__ << ": " << __LINE__ 76 | << ": could not set signal handler: " 77 | << strerror( errno ) << std::endl; 78 | ServerParam::instance().clear(); 79 | return 1; 80 | } 81 | 82 | if ( ! Std.init() ) 83 | { 84 | ServerParam::instance().clear(); 85 | return 1; 86 | } 87 | 88 | std::shared_ptr< Timer > timer; 89 | if ( ServerParam::instance().synchMode() ) 90 | { 91 | timer = std::shared_ptr< Timer >( new SyncTimer( Std ) ); 92 | } 93 | else 94 | { 95 | timer = std::shared_ptr< Timer >( new StandardTimer( Std ) ); 96 | } 97 | 98 | std::cout << "\nHit CTRL-C to exit\n"; 99 | 100 | timer->run(); 101 | 102 | ServerParam::instance().clear(); 103 | 104 | return 0; 105 | } 106 | --------------------------------------------------------------------------------