diff --git a/Makefile.am b/Makefile.am index 254da72..db132a5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,7 +3,7 @@ VPATH = @srcdir@ AUTOMAKE_OPTIONS = foreign subdir-objects -AM_CXXFLAGS = -I$(top_srcdir) -pthread -std=c++14 -Wall -Wextra -Wnarrowing -pedantic @BAACK_CPPFLAGS@ +AM_CXXFLAGS = -I$(top_srcdir) -pthread -Wall -Wextra -pedantic -Werror=return-type @BAACK_CPPFLAGS@ @@ -22,8 +22,30 @@ endif nobase_include_HEADERS = +if BAACK_WITH_DYNSTACK + +if BAACK_WITH_REMOTECONTROL +lib_LIBRARIES = libBaack.a libDynstack.a libRemotecontrol.a +else +lib_LIBRARIES = libBaack.a libDynstack.a +endif + +else + +if BAACK_WITH_REMOTECONTROL +lib_LIBRARIES = libBaack.a libRemotecontrol.a +else +lib_LIBRARIES = +endif + +endif + + + + ## Dynstack -lib_LIBRARIES = libDynstack.a libRemotecontrol.a libBaack.a +if BAACK_WITH_DYNSTACK +##lib_LIBRARIES += libDynstack.a libDynstack_a_SOURCES = dynstack/export.cpp @@ -32,19 +54,24 @@ libDynstack_a_CPPFLAGS = -Og -g @BAACK_CPPFLAGS@ else libDynstack_a_CPPFLAGS = -O3 -g @BAACK_CPPFLAGS@ endif +endif ## Remotecontrol -libRemotecontrol_a_SOURCES = remote_control/communication/packet.cpp \ - remote_control/communication/message_queue.cpp \ - remote_control/export.cpp \ - remote_control/control/periodic_task.cpp \ - remote_control/control/main_control.cpp \ - remote_control/control/recv_cache.cpp +if BAACK_WITH_REMOTECONTROL +##lib_LIBRARIES += libRemotecontrol.a + +libRemotecontrol_a_SOURCES = remote_control/export.cpp \ + remote_control/communication/packet.cpp \ + remote_control/communication/message_queue.cpp \ + remote_control/control/periodic_task.cpp \ + remote_control/control/main_control.cpp \ + remote_control/control/recv_cache.cpp if BAACK_WITHTEST -libRemotecontrol_a_CPPFLAGS = -O3 -g @BAACK_CPPFLAGS@ +libRemotecontrol_a_CPPFLAGS = -Og -g @BAACK_CPPFLAGS@ else -libRemotecontrol_a_CPPFLAGS = -Og -g @BAACK_CPPFLAGS@ +libRemotecontrol_a_CPPFLAGS = -O3 -g @BAACK_CPPFLAGS@ +endif endif ## Dependency library for Dynstack and Remotecontrol @@ -65,9 +92,9 @@ libBaack_a_SOURCES = lib/data/corsika/event_header.cpp \ basic/basic.cpp if BAACK_WITHTEST -libBaack_a_CPPFLAGS = -O3 -g @BAACK_CPPFLAGS@ +libBaack_a_CPPFLAGS = -Og -g @BAACK_CPPFLAGS@ else -libBaack_a_CPPFLAGS = -Og -g @BAACK_CPPFLAGS@ +libBaack_a_CPPFLAGS = -O3 -g @BAACK_CPPFLAGS@ endif bin_PROGRAMS = diff --git a/Makefile.in b/Makefile.in index 7c136dc..424c999 100644 --- a/Makefile.in +++ b/Makefile.in @@ -165,16 +165,23 @@ am_libBaack_a_OBJECTS = \ libBaack_a_OBJECTS = $(am_libBaack_a_OBJECTS) libDynstack_a_AR = $(AR) $(ARFLAGS) libDynstack_a_LIBADD = -am_libDynstack_a_OBJECTS = dynstack/libDynstack_a-export.$(OBJEXT) +am__libDynstack_a_SOURCES_DIST = dynstack/export.cpp +@BAACK_WITH_DYNSTACK_TRUE@am_libDynstack_a_OBJECTS = dynstack/libDynstack_a-export.$(OBJEXT) libDynstack_a_OBJECTS = $(am_libDynstack_a_OBJECTS) libRemotecontrol_a_AR = $(AR) $(ARFLAGS) libRemotecontrol_a_LIBADD = -am_libRemotecontrol_a_OBJECTS = remote_control/communication/libRemotecontrol_a-packet.$(OBJEXT) \ - remote_control/communication/libRemotecontrol_a-message_queue.$(OBJEXT) \ - remote_control/libRemotecontrol_a-export.$(OBJEXT) \ - remote_control/control/libRemotecontrol_a-periodic_task.$(OBJEXT) \ - remote_control/control/libRemotecontrol_a-main_control.$(OBJEXT) \ - remote_control/control/libRemotecontrol_a-recv_cache.$(OBJEXT) +am__libRemotecontrol_a_SOURCES_DIST = remote_control/export.cpp \ + remote_control/communication/packet.cpp \ + remote_control/communication/message_queue.cpp \ + remote_control/control/periodic_task.cpp \ + remote_control/control/main_control.cpp \ + remote_control/control/recv_cache.cpp +@BAACK_WITH_REMOTECONTROL_TRUE@am_libRemotecontrol_a_OBJECTS = remote_control/libRemotecontrol_a-export.$(OBJEXT) \ +@BAACK_WITH_REMOTECONTROL_TRUE@ remote_control/communication/libRemotecontrol_a-packet.$(OBJEXT) \ +@BAACK_WITH_REMOTECONTROL_TRUE@ remote_control/communication/libRemotecontrol_a-message_queue.$(OBJEXT) \ +@BAACK_WITH_REMOTECONTROL_TRUE@ remote_control/control/libRemotecontrol_a-periodic_task.$(OBJEXT) \ +@BAACK_WITH_REMOTECONTROL_TRUE@ remote_control/control/libRemotecontrol_a-main_control.$(OBJEXT) \ +@BAACK_WITH_REMOTECONTROL_TRUE@ remote_control/control/libRemotecontrol_a-recv_cache.$(OBJEXT) libRemotecontrol_a_OBJECTS = $(am_libRemotecontrol_a_OBJECTS) @BAACK_WITHTEST_TRUE@am__EXEEXT_1 = dynstack_test$(EXEEXT) \ @BAACK_WITHTEST_TRUE@ remotecontrol_test$(EXEEXT) \ @@ -259,8 +266,8 @@ SOURCES = $(libBaack_a_SOURCES) $(libDynstack_a_SOURCES) \ $(libRemotecontrol_a_SOURCES) $(dynstack_benchmark_SOURCES) \ $(dynstack_test_SOURCES) $(library_test_SOURCES) \ $(remotecontrol_test_SOURCES) -DIST_SOURCES = $(libBaack_a_SOURCES) $(libDynstack_a_SOURCES) \ - $(libRemotecontrol_a_SOURCES) \ +DIST_SOURCES = $(libBaack_a_SOURCES) $(am__libDynstack_a_SOURCES_DIST) \ + $(am__libRemotecontrol_a_SOURCES_DIST) \ $(am__dynstack_benchmark_SOURCES_DIST) \ $(am__dynstack_test_SOURCES_DIST) \ $(am__library_test_SOURCES_DIST) \ @@ -407,21 +414,24 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = foreign subdir-objects -AM_CXXFLAGS = -I$(top_srcdir) -pthread -std=c++14 -Wall -Wextra -Wnarrowing -pedantic @BAACK_CPPFLAGS@ +AM_CXXFLAGS = -I$(top_srcdir) -pthread -Wall -Wextra -pedantic -Werror=return-type @BAACK_CPPFLAGS@ nobase_include_HEADERS = -lib_LIBRARIES = libDynstack.a libRemotecontrol.a libBaack.a -libDynstack_a_SOURCES = dynstack/export.cpp -@BAACK_WITHTEST_FALSE@libDynstack_a_CPPFLAGS = -O3 -g @BAACK_CPPFLAGS@ -@BAACK_WITHTEST_TRUE@libDynstack_a_CPPFLAGS = -Og -g @BAACK_CPPFLAGS@ -libRemotecontrol_a_SOURCES = remote_control/communication/packet.cpp \ - remote_control/communication/message_queue.cpp \ - remote_control/export.cpp \ - remote_control/control/periodic_task.cpp \ - remote_control/control/main_control.cpp \ - remote_control/control/recv_cache.cpp - -@BAACK_WITHTEST_FALSE@libRemotecontrol_a_CPPFLAGS = -Og -g @BAACK_CPPFLAGS@ -@BAACK_WITHTEST_TRUE@libRemotecontrol_a_CPPFLAGS = -O3 -g @BAACK_CPPFLAGS@ +@BAACK_WITH_DYNSTACK_FALSE@@BAACK_WITH_REMOTECONTROL_FALSE@lib_LIBRARIES = +@BAACK_WITH_DYNSTACK_FALSE@@BAACK_WITH_REMOTECONTROL_TRUE@lib_LIBRARIES = libBaack.a libRemotecontrol.a +@BAACK_WITH_DYNSTACK_TRUE@@BAACK_WITH_REMOTECONTROL_FALSE@lib_LIBRARIES = libBaack.a libDynstack.a +@BAACK_WITH_DYNSTACK_TRUE@@BAACK_WITH_REMOTECONTROL_TRUE@lib_LIBRARIES = libBaack.a libDynstack.a libRemotecontrol.a +@BAACK_WITH_DYNSTACK_TRUE@libDynstack_a_SOURCES = dynstack/export.cpp +@BAACK_WITHTEST_FALSE@@BAACK_WITH_DYNSTACK_TRUE@libDynstack_a_CPPFLAGS = -O3 -g @BAACK_CPPFLAGS@ +@BAACK_WITHTEST_TRUE@@BAACK_WITH_DYNSTACK_TRUE@libDynstack_a_CPPFLAGS = -Og -g @BAACK_CPPFLAGS@ +@BAACK_WITH_REMOTECONTROL_TRUE@libRemotecontrol_a_SOURCES = remote_control/export.cpp \ +@BAACK_WITH_REMOTECONTROL_TRUE@ remote_control/communication/packet.cpp \ +@BAACK_WITH_REMOTECONTROL_TRUE@ remote_control/communication/message_queue.cpp \ +@BAACK_WITH_REMOTECONTROL_TRUE@ remote_control/control/periodic_task.cpp \ +@BAACK_WITH_REMOTECONTROL_TRUE@ remote_control/control/main_control.cpp \ +@BAACK_WITH_REMOTECONTROL_TRUE@ remote_control/control/recv_cache.cpp + +@BAACK_WITHTEST_FALSE@@BAACK_WITH_REMOTECONTROL_TRUE@libRemotecontrol_a_CPPFLAGS = -O3 -g @BAACK_CPPFLAGS@ +@BAACK_WITHTEST_TRUE@@BAACK_WITH_REMOTECONTROL_TRUE@libRemotecontrol_a_CPPFLAGS = -Og -g @BAACK_CPPFLAGS@ libBaack_a_SOURCES = lib/data/corsika/event_header.cpp \ lib/data/corsika/event_end.cpp \ lib/data/corsika/steering_card.cpp \ @@ -438,8 +448,8 @@ libBaack_a_SOURCES = lib/data/corsika/event_header.cpp \ basic/export.cpp \ basic/basic.cpp -@BAACK_WITHTEST_FALSE@libBaack_a_CPPFLAGS = -Og -g @BAACK_CPPFLAGS@ -@BAACK_WITHTEST_TRUE@libBaack_a_CPPFLAGS = -O3 -g @BAACK_CPPFLAGS@ +@BAACK_WITHTEST_FALSE@libBaack_a_CPPFLAGS = -O3 -g @BAACK_CPPFLAGS@ +@BAACK_WITHTEST_TRUE@libBaack_a_CPPFLAGS = -Og -g @BAACK_CPPFLAGS@ @BAACK_WITHTEST_TRUE@dynstack_test_SOURCES = test/dynstack/storage_test.cpp \ @BAACK_WITHTEST_TRUE@ test/dynstack/advanced_test.cpp \ @BAACK_WITHTEST_TRUE@ test/dynstack/unit_test.cpp \ @@ -623,6 +633,15 @@ libDynstack.a: $(libDynstack_a_OBJECTS) $(libDynstack_a_DEPENDENCIES) $(EXTRA_li $(AM_V_at)-rm -f libDynstack.a $(AM_V_AR)$(libDynstack_a_AR) libDynstack.a $(libDynstack_a_OBJECTS) $(libDynstack_a_LIBADD) $(AM_V_at)$(RANLIB) libDynstack.a +remote_control/$(am__dirstamp): + @$(MKDIR_P) remote_control + @: > remote_control/$(am__dirstamp) +remote_control/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) remote_control/$(DEPDIR) + @: > remote_control/$(DEPDIR)/$(am__dirstamp) +remote_control/libRemotecontrol_a-export.$(OBJEXT): \ + remote_control/$(am__dirstamp) \ + remote_control/$(DEPDIR)/$(am__dirstamp) remote_control/communication/$(am__dirstamp): @$(MKDIR_P) remote_control/communication @: > remote_control/communication/$(am__dirstamp) @@ -635,15 +654,6 @@ remote_control/communication/libRemotecontrol_a-packet.$(OBJEXT): \ remote_control/communication/libRemotecontrol_a-message_queue.$(OBJEXT): \ remote_control/communication/$(am__dirstamp) \ remote_control/communication/$(DEPDIR)/$(am__dirstamp) -remote_control/$(am__dirstamp): - @$(MKDIR_P) remote_control - @: > remote_control/$(am__dirstamp) -remote_control/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) remote_control/$(DEPDIR) - @: > remote_control/$(DEPDIR)/$(am__dirstamp) -remote_control/libRemotecontrol_a-export.$(OBJEXT): \ - remote_control/$(am__dirstamp) \ - remote_control/$(DEPDIR)/$(am__dirstamp) remote_control/control/$(am__dirstamp): @$(MKDIR_P) remote_control/control @: > remote_control/control/$(am__dirstamp) @@ -1126,6 +1136,20 @@ dynstack/libDynstack_a-export.obj: dynstack/export.cpp @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libDynstack_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o dynstack/libDynstack_a-export.obj `if test -f 'dynstack/export.cpp'; then $(CYGPATH_W) 'dynstack/export.cpp'; else $(CYGPATH_W) '$(srcdir)/dynstack/export.cpp'; fi` +remote_control/libRemotecontrol_a-export.o: remote_control/export.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libRemotecontrol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT remote_control/libRemotecontrol_a-export.o -MD -MP -MF remote_control/$(DEPDIR)/libRemotecontrol_a-export.Tpo -c -o remote_control/libRemotecontrol_a-export.o `test -f 'remote_control/export.cpp' || echo '$(srcdir)/'`remote_control/export.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) remote_control/$(DEPDIR)/libRemotecontrol_a-export.Tpo remote_control/$(DEPDIR)/libRemotecontrol_a-export.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='remote_control/export.cpp' object='remote_control/libRemotecontrol_a-export.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libRemotecontrol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o remote_control/libRemotecontrol_a-export.o `test -f 'remote_control/export.cpp' || echo '$(srcdir)/'`remote_control/export.cpp + +remote_control/libRemotecontrol_a-export.obj: remote_control/export.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libRemotecontrol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT remote_control/libRemotecontrol_a-export.obj -MD -MP -MF remote_control/$(DEPDIR)/libRemotecontrol_a-export.Tpo -c -o remote_control/libRemotecontrol_a-export.obj `if test -f 'remote_control/export.cpp'; then $(CYGPATH_W) 'remote_control/export.cpp'; else $(CYGPATH_W) '$(srcdir)/remote_control/export.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) remote_control/$(DEPDIR)/libRemotecontrol_a-export.Tpo remote_control/$(DEPDIR)/libRemotecontrol_a-export.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='remote_control/export.cpp' object='remote_control/libRemotecontrol_a-export.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libRemotecontrol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o remote_control/libRemotecontrol_a-export.obj `if test -f 'remote_control/export.cpp'; then $(CYGPATH_W) 'remote_control/export.cpp'; else $(CYGPATH_W) '$(srcdir)/remote_control/export.cpp'; fi` + remote_control/communication/libRemotecontrol_a-packet.o: remote_control/communication/packet.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libRemotecontrol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT remote_control/communication/libRemotecontrol_a-packet.o -MD -MP -MF remote_control/communication/$(DEPDIR)/libRemotecontrol_a-packet.Tpo -c -o remote_control/communication/libRemotecontrol_a-packet.o `test -f 'remote_control/communication/packet.cpp' || echo '$(srcdir)/'`remote_control/communication/packet.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) remote_control/communication/$(DEPDIR)/libRemotecontrol_a-packet.Tpo remote_control/communication/$(DEPDIR)/libRemotecontrol_a-packet.Po @@ -1154,20 +1178,6 @@ remote_control/communication/libRemotecontrol_a-message_queue.obj: remote_contro @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libRemotecontrol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o remote_control/communication/libRemotecontrol_a-message_queue.obj `if test -f 'remote_control/communication/message_queue.cpp'; then $(CYGPATH_W) 'remote_control/communication/message_queue.cpp'; else $(CYGPATH_W) '$(srcdir)/remote_control/communication/message_queue.cpp'; fi` -remote_control/libRemotecontrol_a-export.o: remote_control/export.cpp -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libRemotecontrol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT remote_control/libRemotecontrol_a-export.o -MD -MP -MF remote_control/$(DEPDIR)/libRemotecontrol_a-export.Tpo -c -o remote_control/libRemotecontrol_a-export.o `test -f 'remote_control/export.cpp' || echo '$(srcdir)/'`remote_control/export.cpp -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) remote_control/$(DEPDIR)/libRemotecontrol_a-export.Tpo remote_control/$(DEPDIR)/libRemotecontrol_a-export.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='remote_control/export.cpp' object='remote_control/libRemotecontrol_a-export.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libRemotecontrol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o remote_control/libRemotecontrol_a-export.o `test -f 'remote_control/export.cpp' || echo '$(srcdir)/'`remote_control/export.cpp - -remote_control/libRemotecontrol_a-export.obj: remote_control/export.cpp -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libRemotecontrol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT remote_control/libRemotecontrol_a-export.obj -MD -MP -MF remote_control/$(DEPDIR)/libRemotecontrol_a-export.Tpo -c -o remote_control/libRemotecontrol_a-export.obj `if test -f 'remote_control/export.cpp'; then $(CYGPATH_W) 'remote_control/export.cpp'; else $(CYGPATH_W) '$(srcdir)/remote_control/export.cpp'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) remote_control/$(DEPDIR)/libRemotecontrol_a-export.Tpo remote_control/$(DEPDIR)/libRemotecontrol_a-export.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='remote_control/export.cpp' object='remote_control/libRemotecontrol_a-export.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libRemotecontrol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o remote_control/libRemotecontrol_a-export.obj `if test -f 'remote_control/export.cpp'; then $(CYGPATH_W) 'remote_control/export.cpp'; else $(CYGPATH_W) '$(srcdir)/remote_control/export.cpp'; fi` - remote_control/control/libRemotecontrol_a-periodic_task.o: remote_control/control/periodic_task.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libRemotecontrol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT remote_control/control/libRemotecontrol_a-periodic_task.o -MD -MP -MF remote_control/control/$(DEPDIR)/libRemotecontrol_a-periodic_task.Tpo -c -o remote_control/control/libRemotecontrol_a-periodic_task.o `test -f 'remote_control/control/periodic_task.cpp' || echo '$(srcdir)/'`remote_control/control/periodic_task.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) remote_control/control/$(DEPDIR)/libRemotecontrol_a-periodic_task.Tpo remote_control/control/$(DEPDIR)/libRemotecontrol_a-periodic_task.Po diff --git a/basic/basic.cpp b/basic/basic.cpp index b0924ed..5879faa 100644 --- a/basic/basic.cpp +++ b/basic/basic.cpp @@ -10,6 +10,9 @@ #include "basic/basic.h" +#include +#include + Basic::Basic() { diff --git a/basic/particle_deduction.h b/basic/particle_deduction.h index 9ae6839..f12e1b0 100644 --- a/basic/particle_deduction.h +++ b/basic/particle_deduction.h @@ -85,5 +85,16 @@ using namespace lib::data; typedef decltype(lib::data::make_particle< DEDUCTED_PARTICLE_COMPOSITION >()) DeductedParticleType; +#if __cplusplus > 199711L template using DeductedParticleTypeCustom = decltype(lib::data::make_particle< DEDUCTED_PARTICLE_COMPOSITION, ParticleDataType::custom, TSize>()); +#else + +template +struct DeductedParticleTypeCustom +{ + typedef decltype(lib::data::make_particle< DEDUCTED_PARTICLE_COMPOSITION, ParticleDataType::custom, TSize>()) type; +}; +#endif + + diff --git a/basic/setup.h b/basic/setup.h new file mode 100644 index 0000000..a33f462 --- /dev/null +++ b/basic/setup.h @@ -0,0 +1,13 @@ +/* setup.h +* this file is part of Dynstack/RemoteControl for CORSIKA +* +* Copyright (C) <2016> +* All rights reserved. +* +* This software may be modified and distributed under the terms +* of the LGPL license. See the LICENSE file for details. +*/ + +#pragma once + + diff --git a/configure b/configure index 791c259..223fcfe 100755 --- a/configure +++ b/configure @@ -630,11 +630,15 @@ LIBOBJS EGREP GREP CXXCPP +BAACK_CPPFLAGS +BAACK_WITH_REMOTECONTROL_FALSE +BAACK_WITH_REMOTECONTROL_TRUE +BAACK_WITH_DYNSTACK_FALSE +BAACK_WITH_DYNSTACK_TRUE BAACK_WITHBENCH_FALSE BAACK_WITHBENCH_TRUE BAACK_WITHTEST_FALSE BAACK_WITHTEST_TRUE -BAACK_CPPFLAGS HAVE_DOXYGEN_FALSE HAVE_DOXYGEN_TRUE DOXYGEN @@ -731,6 +735,8 @@ enable_dependency_tracking with_test with_bench enable_nococo +with_dynstack +with_remotecontrol ' ac_precious_vars='build_alias host_alias @@ -1380,6 +1386,8 @@ Optional Packages: --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-test Compile all Tests --with-bench Compile with benchmark + --with-dynstack Compile dynstack library + --with-remotecontrol Compile remotecontrol library Some influential environment variables: CXX C++ compiler command @@ -4012,16 +4020,18 @@ fi -if test "x$enable_nococo" = "xyes"; then : - - $as_echo "#define _NOCOCO_ 1" >>confdefs.h +# Check whether --with-dynstack was given. +if test "${with_dynstack+set}" = set; then : + withval=$with_dynstack; +fi - $as_echo "#define __DYNDEFAULT__ 1" >>confdefs.h - BAACK_CPPFLAGS=" " +# Check whether --with-remotecontrol was given. +if test "${with_remotecontrol+set}" = set; then : + withval=$with_remotecontrol; +fi -fi if test "x$with_test" = "xyes"; then : @@ -4072,6 +4082,91 @@ fi fi +if test "x$with_dynstack" = "xyes"; then : + + if test x = x; then + BAACK_WITH_DYNSTACK_TRUE= + BAACK_WITH_DYNSTACK_FALSE='#' +else + BAACK_WITH_DYNSTACK_TRUE='#' + BAACK_WITH_DYNSTACK_FALSE= +fi + + +else + + if test x != x; then + BAACK_WITH_DYNSTACK_TRUE= + BAACK_WITH_DYNSTACK_FALSE='#' +else + BAACK_WITH_DYNSTACK_TRUE='#' + BAACK_WITH_DYNSTACK_FALSE= +fi + + +fi + +if test "x$with_remotecontrol" = "xyes"; then : + + if test x = x; then + BAACK_WITH_REMOTECONTROL_TRUE= + BAACK_WITH_REMOTECONTROL_FALSE='#' +else + BAACK_WITH_REMOTECONTROL_TRUE='#' + BAACK_WITH_REMOTECONTROL_FALSE= +fi + + +else + + if test x != x; then + BAACK_WITH_REMOTECONTROL_TRUE= + BAACK_WITH_REMOTECONTROL_FALSE='#' +else + BAACK_WITH_REMOTECONTROL_TRUE='#' + BAACK_WITH_REMOTECONTROL_FALSE= +fi + + +fi + + +if test "x$enable_nococo" = "xyes"; then : + + $as_echo "#define _NOCOCO_ 1" >>confdefs.h + + $as_echo "#define __DYNDEFAULT__ 1" >>confdefs.h + + + BAACK_CPPFLAGS=" " + BAACK_CPPFLAGS="$BAACK_CPPFLAGS -std=c++14" + + + { $as_echo "$as_me:${as_lineno-$LINENO}: Activate Dynstack" >&5 +$as_echo "$as_me: Activate Dynstack" >&6;} + if test x = x; then + BAACK_WITH_DYNSTACK_TRUE= + BAACK_WITH_DYNSTACK_FALSE='#' +else + BAACK_WITH_DYNSTACK_TRUE='#' + BAACK_WITH_DYNSTACK_FALSE= +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: Activate Remotecontrol" >&5 +$as_echo "$as_me: Activate Remotecontrol" >&6;} + if test x = x; then + BAACK_WITH_REMOTECONTROL_TRUE= + BAACK_WITH_REMOTECONTROL_FALSE='#' +else + BAACK_WITH_REMOTECONTROL_TRUE='#' + BAACK_WITH_REMOTECONTROL_FALSE= +fi + + +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_mutex_init in -lpthread" >&5 $as_echo_n "checking for pthread_mutex_init in -lpthread... " >&6; } @@ -4912,6 +5007,30 @@ if test -z "${BAACK_WITHBENCH_TRUE}" && test -z "${BAACK_WITHBENCH_FALSE}"; then as_fn_error $? "conditional \"BAACK_WITHBENCH\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${BAACK_WITH_DYNSTACK_TRUE}" && test -z "${BAACK_WITH_DYNSTACK_FALSE}"; then + as_fn_error $? "conditional \"BAACK_WITH_DYNSTACK\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${BAACK_WITH_DYNSTACK_TRUE}" && test -z "${BAACK_WITH_DYNSTACK_FALSE}"; then + as_fn_error $? "conditional \"BAACK_WITH_DYNSTACK\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${BAACK_WITH_REMOTECONTROL_TRUE}" && test -z "${BAACK_WITH_REMOTECONTROL_FALSE}"; then + as_fn_error $? "conditional \"BAACK_WITH_REMOTECONTROL\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${BAACK_WITH_REMOTECONTROL_TRUE}" && test -z "${BAACK_WITH_REMOTECONTROL_FALSE}"; then + as_fn_error $? "conditional \"BAACK_WITH_REMOTECONTROL\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${BAACK_WITH_DYNSTACK_TRUE}" && test -z "${BAACK_WITH_DYNSTACK_FALSE}"; then + as_fn_error $? "conditional \"BAACK_WITH_DYNSTACK\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${BAACK_WITH_REMOTECONTROL_TRUE}" && test -z "${BAACK_WITH_REMOTECONTROL_FALSE}"; then + as_fn_error $? "conditional \"BAACK_WITH_REMOTECONTROL\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 diff --git a/configure.ac b/configure.ac index 34a39f6..48e7a89 100644 --- a/configure.ac +++ b/configure.ac @@ -35,13 +35,9 @@ AC_ARG_WITH([test], AS_HELP_STRING([--with-test], [Compile all Tests])) AC_ARG_WITH([bench], AS_HELP_STRING([--with-bench], [Compile with benchmark])) AC_ARG_ENABLE([nococo], AS_HELP_STRING([--enable-nococo], [Enable compile without coconut])) +AC_ARG_WITH([dynstack], AS_HELP_STRING([--with-dynstack], [Compile dynstack library])) +AC_ARG_WITH([remotecontrol], AS_HELP_STRING([--with-remotecontrol], [Compile remotecontrol library])) -AS_IF([test "x$enable_nococo" = "xyes"], [ - AC_DEFINE(_NOCOCO_, 1) - AC_DEFINE(__DYNDEFAULT__, 1) - BAACK_CPPFLAGS=" " - AC_SUBST([BAACK_CPPFLAGS]) -]) AS_IF([test "x$with_test" = "xyes"], [ AM_CONDITIONAL([BAACK_WITHTEST], [test x = x]) @@ -56,6 +52,35 @@ AS_IF([test "x$with_bench" = "xyes"], [ ]) +AS_IF([test "x$with_dynstack" = "xyes"], [ + AM_CONDITIONAL([BAACK_WITH_DYNSTACK], [test x = x]) +], [ + AM_CONDITIONAL([BAACK_WITH_DYNSTACK], [test x != x]) +]) + +AS_IF([test "x$with_remotecontrol" = "xyes"], [ + AM_CONDITIONAL([BAACK_WITH_REMOTECONTROL], [test x = x]) +], [ + AM_CONDITIONAL([BAACK_WITH_REMOTECONTROL], [test x != x]) +]) + + +AS_IF([test "x$enable_nococo" = "xyes"], [ + AC_DEFINE(_NOCOCO_, 1) + AC_DEFINE(__DYNDEFAULT__, 1) + + BAACK_CPPFLAGS=" " + BAACK_CPPFLAGS="$BAACK_CPPFLAGS -std=c++14" + AC_SUBST([BAACK_CPPFLAGS]) + + AC_MSG_NOTICE([Activate Dynstack]) + AM_CONDITIONAL([BAACK_WITH_DYNSTACK], [test x = x]) + AC_MSG_NOTICE([Activate Remotecontrol]) + AM_CONDITIONAL([BAACK_WITH_REMOTECONTROL], [test x = x]) +]) + + + AC_CHECK_LIB([pthread], [pthread_mutex_init], [ echo "pthread library is missing but required for dynstack"]) diff --git a/dynstack/export.cpp b/dynstack/export.cpp index 8d77140..26f5739 100644 --- a/dynstack/export.cpp +++ b/dynstack/export.cpp @@ -16,7 +16,7 @@ #include #include #include - +#include #include "dynstack/export.h" @@ -47,11 +47,20 @@ void dynstack_init_(const char* line, const int* size) std::string item; while (std::getline(sstr, item, ' ')) { - list.push_back(item); + if(item == " " || item == "") + { + continue; + } + else + { + list.push_back(item); + } } item = list.front(); list.pop_front(); + + std::cout << item << " with " << list.size() << std::endl; dynstack_steering_card.push_back( std::pair>(item, list) ); diff --git a/dynstack/stack/advanced/if_stack.h b/dynstack/stack/advanced/if_stack.h new file mode 100644 index 0000000..584a052 --- /dev/null +++ b/dynstack/stack/advanced/if_stack.h @@ -0,0 +1,200 @@ +/* if_stack.h +* this file is part of Dynstack/RemoteControl for CORSIKA +* +* Copyright (C) <2016> +* All rights reserved. +* +* This software may be modified and distributed under the terms +* of the LGPL license. See the LICENSE file for details. +*/ + +#pragma once + +#include "dynstack/stack/stack.h" + +#include +#include + + +namespace dynstack +{ + namespace advanced + { + + template + class IfStack : public Stack + { + static_assert(std::is_base_of<_Stack, TStackIf>::value, "TStackIf must be a Stack!"); + static_assert(std::is_base_of<_Stack, TStackElse>::value, "TStackElse must be a Stack!"); + static_assert(std::is_same::value, "TStackIf and TStackElse must store the same type"); + + + private: + + typedef typename TStackIf::m_ReturnType TType; + typedef typename TStackIf::m_StackType TTypeStack; + + TStackIf m_oStack_if; + TStackElse m_oStack_else; + + protected: + + + public: + + + template + IfStack(TArgs... args) + : m_oStack_if( args... ), m_oStack_else( args... ) + { } + + + + IfStack(IfStack && rhs) + : m_oStack_if( std::move(rhs.m_oStack_if) ), m_oStack_else( std::move(rhs.m_oStack_else) ) + { } + + ~IfStack() + { + } + + inline int push_back(const TType& data) + { + const bool decision = TFunc(&data); + + if (decision) + { + return m_oStack_if.push_back(data); + } + + + return m_oStack_else.push_back(data); + } + inline int push_back(TType&& data) + { + const bool decision = TFunc(&data); + + if (decision) + { + return m_oStack_if.push_back(data); + } + + + return m_oStack_else.push_back(data); + + } + + //Copys element to next free space + inline int push_back(std::unique_ptr data, const unsigned int elem) + { + int check = true; + for (unsigned int i = 0; i < elem; i++) + { + const bool decision = TFunc(&data[i]); + if (decision) + { + check = check | m_oStack_if.push_back(data[i]); + } + else + { + check = check | m_oStack_else.push_back(data[i]); + } + + } + return check; + + } + + inline int push_back(const TType* const data, const unsigned int elem) + { + int check = true; + for (unsigned int i = 0; i < elem; i++) + { + const bool decision = TFunc(data + i); + if (decision) + { + check = check | m_oStack_if.push_back(data[i]); + } + else + { + check = check | m_oStack_else.push_back(data[i]); + } + + } + return check; + } + + //Get last element without removing (copy) + inline TType back() + { + if (m_oStack_if.size() > 0) + { + return m_oStack_if.back(); + } + else + { + return m_oStack_else.back(); + } + return TType(); + } + + //Get last element with removing (move) + inline TType pop_back() + { + if (m_oStack_if.size() > 0) + { + return m_oStack_if.pop_back(); + } + else + { + return m_oStack_else.pop_back(); + } + return TType(); + } + + + // Removes last element from stack + // that was readed with back + inline bool pop() + { + if (m_oStack_if.size() > 0) + { + return m_oStack_if.pop(); + } + else + { + return m_oStack_else.pop(); + } + + return false; + } + + inline void clear() + { + m_oStack_if.clear(); + m_oStack_else.clear(); + } + + //Get new empty element to write into (direct access, zero copy) + StackPtr reserve() + { + return StackPtr(); + } + + + + inline unsigned long size() const + { + return m_oStack_if.size() + m_oStack_else.size(); + } + + unsigned long capacity() const + { + return m_oStack_if.capacity() + m_oStack_else.capacity(); + } + + + }; + } +} + diff --git a/dynstack/stack/stack.h b/dynstack/stack/stack.h index 3b33be0..ddeca52 100644 --- a/dynstack/stack/stack.h +++ b/dynstack/stack/stack.h @@ -13,7 +13,6 @@ #include #include -#include "dynstack/stack/stack_ptr.h" /// Main namespace for the dynstack package @@ -33,9 +32,9 @@ namespace dynstack { private: - static_assert(std::is_default_constructible::value, "Stack type needs a default constructor!"); - static_assert(std::is_copy_constructible::value, "Stack type needs a copy constructor!"); - static_assert(std::is_move_constructible::value, "Stack type needs a copy constructor!"); + //static_assert(std::is_default_constructible::value, "Stack type needs a default constructor!"); + //static_assert(std::is_copy_constructible::value, "Stack type needs a copy constructor!"); + //static_assert(std::is_move_constructible::value, "Stack type needs a copy constructor!"); protected: @@ -45,10 +44,10 @@ namespace dynstack Stack(const Stack& rhs) = delete; - inline StackPtr createStackObj(TReturn* const item, void (*del)(TStorage* const) = nullptr) const + /*inline StackPtr createStackObj(TReturn* const item, void (*del)(TStorage* const) = nullptr) const { return StackPtr(item, del); - } + }*/ public: @@ -80,9 +79,9 @@ namespace dynstack virtual void clear() = 0; - //Get new empty element to write into (direct access, zero copy) + /*//Get new empty element to write into (direct access, zero copy) virtual StackPtr reserve() = 0; - +*/ //Returns the number of currently stored elements virtual unsigned long size() const = 0; diff --git a/dynstack/stack/storage/fifo_stack.h b/dynstack/stack/storage/fifo_stack.h index cdea28a..50b54e8 100644 --- a/dynstack/stack/storage/fifo_stack.h +++ b/dynstack/stack/storage/fifo_stack.h @@ -15,7 +15,7 @@ #include #include "dynstack/stack/stack.h" -#include "dynstack/stack/stack_ptr.h" +//#include "dynstack/stack/stack_ptr.h" namespace dynstack { @@ -251,10 +251,6 @@ namespace dynstack * * \return Returns a pointer to new storage area without and precaution */ - inline StackPtr reserve() - { - return StackPtr(); - } inline unsigned long size() const { diff --git a/dynstack/stack/storage/lifo_stack.h b/dynstack/stack/storage/lifo_stack.h index 8bf474b..309e535 100644 --- a/dynstack/stack/storage/lifo_stack.h +++ b/dynstack/stack/storage/lifo_stack.h @@ -13,7 +13,6 @@ #include #include "dynstack/stack/stack.h" -#include "dynstack/stack/stack_ptr.h" namespace dynstack { @@ -165,18 +164,6 @@ namespace dynstack } - //Get new empty element to write into (direct access, zero copy) - inline StackPtr reserve() - { - const unsigned long off = getCurrentOffset(); - if (off < this->m_uiSize - 1) - { - m_tNextFree++; - - return Stack::createStackObj(m_tNextFree - 1); - } - return StackPtr(); - } diff --git a/dynstack/stack/storage/lifo_std_stack.h b/dynstack/stack/storage/lifo_std_stack.h index 9463147..5e0f5ca 100644 --- a/dynstack/stack/storage/lifo_std_stack.h +++ b/dynstack/stack/storage/lifo_std_stack.h @@ -147,12 +147,6 @@ namespace dynstack } - //Get new empty element to write into (direct access, zero copy) - inline StackPtr reserve() - { - return StackPtr(); - } - inline unsigned long size() const diff --git a/dynstack/stack/storage/null_stack.h b/dynstack/stack/storage/null_stack.h index b00dc55..b2a1682 100644 --- a/dynstack/stack/storage/null_stack.h +++ b/dynstack/stack/storage/null_stack.h @@ -100,12 +100,6 @@ namespace dynstack } - //Get new empty element to write into (direct access, zero copy) - StackPtr reserve() - { - return StackPtr(); - } - inline unsigned long size() const diff --git a/dynstack/stack/wrapper/priority_stack.h b/dynstack/stack/wrapper/priority_stack.h new file mode 100644 index 0000000..f9b3a38 --- /dev/null +++ b/dynstack/stack/wrapper/priority_stack.h @@ -0,0 +1,197 @@ +/* priority_stack.h +* this file is part of Dynstack/RemoteControl for CORSIKA +* +* Copyright (C) <2016> +* All rights reserved. +* +* This software may be modified and distributed under the terms +* of the LGPL license. See the LICENSE file for details. +*/ + +#pragma once + +#include "dynstack/stack/stack.h" + +#include +#include + + +namespace dynstack +{ + namespace wrapper + { + + template + class PriorityStack : public Stack + { + static_assert(std::is_base_of<_Stack, TStack>::value, "TStack must be a Stack!"); + + private: + + typedef typename TStack::m_ReturnType TType; + typedef typename TStack::m_StackType TTypeStack; + + TStack m_oStack_if; + TStack m_oStack_else; + + protected: + + + public: + + + template + PriorityStack(TArgs&&... args) + : m_oStack_if(std::forward(args)... ), m_oStack_else(std::forward(args)...) + { } + + + + PriorityStack(PriorityStack && rhs) + : m_oStack_if( std::move(rhs.m_oStack_if) ), m_oStack_else( std::move(rhs.m_oStack_else) ) + { } + + ~PriorityStack() + { + } + + inline int push_back(const TType& data) + { + const bool decision = TFunc(&data); + + if (decision) + { + return m_oStack_if.push_back(data); + } + + + return m_oStack_else.push_back(data); + } + inline int push_back(TType&& data) + { + const bool decision = TFunc(&data); + + if (decision) + { + return m_oStack_if.push_back(data); + } + + + return m_oStack_else.push_back(data); + + } + + //Copys element to next free space + inline int push_back(std::unique_ptr data, const unsigned int elem) + { + int check = true; + for (unsigned int i = 0; i < elem; i++) + { + const bool decision = TFunc(&data[i]); + if (decision) + { + check = check | m_oStack_if.push_back(data[i]); + } + else + { + check = check | m_oStack_else.push_back(data[i]); + } + + } + return check; + + } + + inline int push_back(const TType* const data, const unsigned int elem) + { + int check = true; + for (unsigned int i = 0; i < elem; i++) + { + const bool decision = TFunc(data + i); + if (decision) + { + check = check | m_oStack_if.push_back(data[i]); + } + else + { + check = check | m_oStack_else.push_back(data[i]); + } + + } + return check; + } + + //Get last element without removing (copy) + inline TType back() + { + if (m_oStack_if.size() > 0) + { + return m_oStack_if.back(); + } + else + { + return m_oStack_else.back(); + } + return TType(); + } + + //Get last element with removing (move) + inline TType pop_back() + { + if (m_oStack_if.size() > 0) + { + return m_oStack_if.pop_back(); + } + else + { + return m_oStack_else.pop_back(); + } + return TType(); + } + + + // Removes last element from stack + // that was readed with back + inline bool pop() + { + if (m_oStack_if.size() > 0) + { + return m_oStack_if.pop(); + } + else + { + return m_oStack_else.pop(); + } + + return false; + } + + inline void clear() + { + m_oStack_if.clear(); + m_oStack_else.clear(); + } + + //Get new empty element to write into (direct access, zero copy) + StackPtr reserve() + { + return StackPtr(); + } + + + + inline unsigned long size() const + { + return m_oStack_if.size() + m_oStack_else.size(); + } + + unsigned long capacity() const + { + return m_oStack_if.capacity() + m_oStack_else.capacity(); + } + + + }; + } +} + diff --git a/lib/data/corsika/particle.h b/lib/data/corsika/particle.h index ce0495b..c371595 100644 --- a/lib/data/corsika/particle.h +++ b/lib/data/corsika/particle.h @@ -17,8 +17,12 @@ #include #include +#include + #include "lib/meta/index_sequence.h" + + namespace lib { @@ -690,7 +694,7 @@ namespace lib * \return returns a particle storage */ template - auto make_particle() + auto make_particle()->decltype(ParticleData<0, TArgs...>()) { return ParticleData<0, TArgs...>(); } diff --git a/lib/io/file.cpp b/lib/io/file.cpp index b622e8e..81fdc7a 100644 --- a/lib/io/file.cpp +++ b/lib/io/file.cpp @@ -14,7 +14,7 @@ #include -File::File(std::string p_fileName) +File::File(std::string p_fileName) { m_oFile.open( p_fileName, std::ios::in | std::ios::out | std::ios::binary ); @@ -29,7 +29,7 @@ File::File(std::string p_fileName) } } -File::File() +File::File() : statusOpen(false) { } diff --git a/lib/io/file.h b/lib/io/file.h index 8eca5c0..2c36a69 100644 --- a/lib/io/file.h +++ b/lib/io/file.h @@ -27,7 +27,7 @@ class File private: std::fstream m_oFile; - bool statusOpen = false; + bool statusOpen; public: diff --git a/lib/io/network/server.cpp b/lib/io/network/server.cpp index d98dd96..9468b04 100644 --- a/lib/io/network/server.cpp +++ b/lib/io/network/server.cpp @@ -11,6 +11,13 @@ #include "lib/io/network/server.h" #include +#include +#include + +#if __cplusplus > 199711L +#else +#include +#endif namespace lib { @@ -73,9 +80,11 @@ namespace lib m_functionMutex.unlock(); } } - +#if __cplusplus > 199711L std::this_thread::sleep_for(std::chrono::milliseconds(20)); - +#else + usleep(20000); +#endif this->m_actionMutex.lock(); for (unsigned int i = 0; i < m_action.size(); i++) @@ -85,7 +94,12 @@ namespace lib } this->m_actionMutex.unlock(); + +#if __cplusplus > 199711L std::this_thread::sleep_for(std::chrono::milliseconds(20)); +#else + usleep(20000); +#endif } } diff --git a/lib/meta/index_sequence.h b/lib/meta/index_sequence.h index c6debb0..d6653b7 100644 --- a/lib/meta/index_sequence.h +++ b/lib/meta/index_sequence.h @@ -63,9 +63,16 @@ namespace lib * \warning It is not save to call this with an empty parameter pack * \tparam T Parameter list to create indices from, only the size of T is actually used */ +#if __cplusplus > 199711L template using index_sequence_for = typename implementation::type; - +#else + template + struct index_sequence_for + { + typedef typename implementation::type type; + }; +#endif /// Index list for a spezific number /** @@ -73,8 +80,17 @@ namespace lib * \warning It is not save to call this with TStart<=0 * \tparam TStart Startparameter for the indice list */ +#if __cplusplus > 199711L template using index_sequence_from = typename implementation::type; +#else + template + struct index_sequence_from + { + typedef typename implementation::type type; + }; +#endif + /// Index list for a spezific number /** @@ -85,8 +101,16 @@ namespace lib * \tparam TBegin Startparameter for the indice list * \tparam TEnd Endparamter for the indice list */ +#if __cplusplus > 199711L template using index_sequence_from_to = typename implementation::type; +#else + template + struct index_sequence_from_to + { + typedef typename implementation::type type; + }; +#endif } diff --git a/remote_control/communication/packet.h b/remote_control/communication/packet.h index dd46012..d1db567 100644 --- a/remote_control/communication/packet.h +++ b/remote_control/communication/packet.h @@ -13,6 +13,8 @@ #include #include +#include + namespace remote_control { namespace communication diff --git a/remote_control/export.cpp b/remote_control/export.cpp index fa3ce65..39adeb2 100644 --- a/remote_control/export.cpp +++ b/remote_control/export.cpp @@ -34,15 +34,24 @@ void remotecontrol_init_(const char* line, const int* size) std::list list; std::string item; + while (std::getline(sstr, item, ' ')) { - list.push_back(item); + if(item == " " || item == "") + { + continue; + } + else + { + list.push_back(item); + } } + item = list.front(); list.pop_front(); - remotecontrol_steering_card.emplace(item, list); + remotecontrol_steering_card[item] = list; } diff --git a/test/dynstack/advanced_test.cpp b/test/dynstack/advanced_test.cpp index 9107570..2984921 100644 --- a/test/dynstack/advanced_test.cpp +++ b/test/dynstack/advanced_test.cpp @@ -21,6 +21,7 @@ #include "dynstack/stack/advanced/debug_stack.h" #include "dynstack/stack/advanced/copy_stack.h" #include "dynstack/stack/advanced/dynamic_sorted_stack.h" +#include "dynstack/stack/advanced/if_stack.h" #include "test/dynstack/common_test_function.h" @@ -87,6 +88,31 @@ namespace test return true; } + + + + bool if_decision(const float* const data) + { + if( static_cast(*data) % 2 == 0) + { + return false; + } + return true; + } + + bool If() + { + ::dynstack::advanced::IfStack< + ::dynstack::storage::FIFO_Stack, + ::dynstack::storage::LIFO_Stack, + if_decision > tmp1(12); + + testStack(tmp1, { { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 } }, { { 1, 3, 5, 7, 9, 11, 12, 10, 8, 6, 4, 2 } }); + + return true; + } + + bool Combinations() diff --git a/test/dynstack/advanced_test.h b/test/dynstack/advanced_test.h index f96b469..3d44ca4 100644 --- a/test/dynstack/advanced_test.h +++ b/test/dynstack/advanced_test.h @@ -29,7 +29,9 @@ namespace test bool Copy(); bool DynamicSorted(); - } + + bool If(); + } } } diff --git a/test/dynstack/unit_test.cpp b/test/dynstack/unit_test.cpp index 97ff6c4..b2a4ca4 100644 --- a/test/dynstack/unit_test.cpp +++ b/test/dynstack/unit_test.cpp @@ -44,6 +44,9 @@ namespace test std::cout << "\n\t-Sorted-" << std::endl; test::dynstack::wrapper::Sorted(); + std::cout << "\n\t-Priority-" << std::endl; + test::dynstack::wrapper::Priority(); + std::cout << "\n\t-Combination-" << std::endl; test::dynstack::wrapper::Combinations(); } @@ -58,7 +61,10 @@ namespace test std::cout << "\n\t-Dynamic Sorted-" << std::endl; test::dynstack::advanced::DynamicSorted(); - } + + std::cout << "\n\t-If-" << std::endl; + test::dynstack::advanced::If(); + } } diff --git a/test/dynstack/wrapper_test.cpp b/test/dynstack/wrapper_test.cpp index c9c4d6c..c445e7a 100644 --- a/test/dynstack/wrapper_test.cpp +++ b/test/dynstack/wrapper_test.cpp @@ -17,6 +17,8 @@ #include "dynstack/stack/storage/lifo_stack.h" #include "dynstack/stack/advanced/debug_stack.h" +#include "dynstack/stack/wrapper/priority_stack.h" + #include "lib/data/controlled_value.h" @@ -137,6 +139,20 @@ namespace test } + bool prio(const float* const data) + { + return (static_cast(*data) % 2 == 0)?true : false; + } + bool Priority() + { + ::dynstack::wrapper::PriorityStack<::dynstack::storage::LIFO_Stack, prio> tmp1(12); + + testStack(tmp1, { { 1,2,3,4,5,6,7,8,9,10,11,12 } }, { { 12, 10, 8, 6, 4, 2, 11, 9, 7, 5, 3, 1 } }); + + return true; + } + + bool Combinations() { std::cout << "Combination 1" << std::endl; diff --git a/test/dynstack/wrapper_test.h b/test/dynstack/wrapper_test.h index ce4997f..937489c 100644 --- a/test/dynstack/wrapper_test.h +++ b/test/dynstack/wrapper_test.h @@ -30,7 +30,10 @@ namespace test bool Sorted(); + bool Priority(); + bool Combinations(); + } } } diff --git a/user_code/dynstack_examples/default.h b/user_code/dynstack_examples/default.h index 5d44876..64b74f1 100644 --- a/user_code/dynstack_examples/default.h +++ b/user_code/dynstack_examples/default.h @@ -19,11 +19,13 @@ #include -auto dynstack_setup(std::vector sizes, std::vector< std::list > arguments ) +auto dynstack_setup(std::vector sizes, std::vector< std::list > arguments ) -> decltype(std::unique_ptr< dynstack::storage::LIFO_Stack >()) { if(sizes.size() != 1) { std::cerr << "You need to define the size of a single stack with DYNSTACK N in the input card" << std::endl; + std::cerr << "You provided " << sizes.size() << " Arguments" << std::endl; + exit(-1); } const int stackSize = sizes[0]; diff --git a/user_code/dynstack_examples/icecube1.h b/user_code/dynstack_examples/icecube1.h new file mode 100644 index 0000000..6174821 --- /dev/null +++ b/user_code/dynstack_examples/icecube1.h @@ -0,0 +1,193 @@ +/* default.h +* this file is part of Dynstack/RemoteControl for ||IKA +* +* Copyright (C) <2016> +* All rights reserved. +* +* This software may be modified and distributed under the terms +* of the LGPL license. See the LICENSE file for details. +*/ +#pragma once + +#include "basic/particle_deduction.h" + +#include "basic/basic.h" + +#include "dynstack/stack/storage/fifo_stack.h" +#include "dynstack/stack/storage/lifo_stack.h" +//#include "dynstack/stack/wrapper/priority_stack.h" +#include "dynstack/stack/advanced/if_stack.h" +#include "dynstack/stack/wrapper/filter_stack.h" +#include "dynstack/stack/wrapper/in_callback_stack.h" +#include "dynstack/stack/wrapper/out_callback_stack.h" + + +#include +#include +#include +#include + + + +double energy_interesting; // ENERGY ABOVE WHICH PARTICLES ARE INTERESTING +int n_interesting; // NUMBER OF INTERESTING PARTICLES +int n_interesting_nu; // NUMBER OF INTERESTING NEUTRINOS +bool still_interesting; // FLAG INDICATING IF AN EVENT IS STILL INTERESTING + + +int first = 0; + +//FSTACK (read from stack) +void callback_out(const DeductedParticleType* const p) +{ + if(first < 2){return;} + // IF THE PARTICLE COMING FROM THE STACK IS INTERESTING DECREASE THE + // COUNTER BY 1 + if( !(p->data()[0] == 1 || p->data()[0] == 2 || + p->data()[0] == 3 || p->data()[0] == 5 || + p->data()[0] == 6 || p->data()[0] == 7 || + p->data()[0] == 16 || p->data()[0] == 17 || + p->data()[0] == 18 ) && + p->data()[1]*SBasic().particleRestMass(p->data()[0]) >= energy_interesting ) + + { + n_interesting = n_interesting - 1; + } + + // TSTEND (move from intermediate to final stack) + still_interesting = n_interesting > 0; +} + +int filter(const DeductedParticleType* const p) +{ + if(first < 2){return 0;} + + if(still_interesting) + { + return 0; // Keep particle + } + return -1; +} + +void callback_in(const DeductedParticleType* const p) +{ //To Stack (intermediate) + + first++; + if(first < 2){return;} + + // INCREASE NINTERSTING IF THE CURRENT SECPAR IS INTERESTING + const unsigned int particle_type = p->data()[0]; + if( !( particle_type == 1 || particle_type == 2 || + particle_type == 3 || particle_type == 5 || + particle_type == 6 || particle_type == 7 || + particle_type == 16 || particle_type == 17 || + particle_type == 18 ) && + p->data()[1]*SBasic().particleRestMass(particle_type) >= energy_interesting ) + { + // NEUTRINO PROGENITOR + n_interesting = n_interesting + 1; + } + else if( particle_type >= 66 && particle_type <= 69 && p->data()[1] >= energy_interesting ) + { // NEUTRINO + n_interesting = n_interesting + 1; + n_interesting_nu = n_interesting_nu + 1; + } + + +} + + + +bool sort_function(const DeductedParticleType* const p) +{ // TSTOUT Part + + if( n_interesting_nu > 0) + { + return true; + } + switch((int)p->data()[0]) + { + case 1: // Gamma + case 2: // e+ + case 3: // e- + case 5: // µ+ + case 6: // µ- + case 7: // pi_0 + case 16: // K^o_s + case 17: // \eta + case 18: // \Lambda + { + double pama = SBasic().particleRestMass((int)p->data()[0]); + if( p->data()[1]*pama >= energy_interesting) + { + return true; + } + break; + } + } + return false; +} + + +typedef dynstack::wrapper::FilterStack< + dynstack::wrapper::InputCallbackStack< + dynstack::wrapper::OutputCallbackStack< + dynstack::advanced::IfStack< + dynstack::storage::FIFO_Stack, + dynstack::storage::LIFO_Stack, + sort_function>, + callback_out>, + callback_in>, + filter> stacktype; + + + +auto dynstack_setup(std::vector sizes, std::vector< std::list > arguments ) -> decltype(std::unique_ptr< stacktype >()) +{ + if(sizes.size() != 1) + { + std::cerr << "You need to define the size of a single stack with DYNSTACK N in the input card" << std::endl; + std::cerr << "You provided " << sizes.size() << " Arguments" << std::endl; + + exit(-1); + } + const int stackSize = sizes[0]; + + + if(arguments.size() != 1) + { + std::cerr << "You need to define the energie limit in the input card with DYNSTACK_P" << std::endl; + std::cerr << "You provided " << arguments.size() << " Arguments" << std::endl; + exit(-1); + } + std::stringstream sstr; + sstr << arguments[0].front(); + sstr >> energy_interesting; + + std::cout << "Energiy cut of icecube1: " << energy_interesting << std::endl; + + + + //auto stack = std::make_unique< dynstack::storage::LIFO_Stack >(stackSize); + auto stack = std::unique_ptr< stacktype >(new stacktype(stackSize)); + + std::cout << "(dyn) Create default stack" << std::endl; + + return std::move(stack); +} + +inline void reset() +{ + still_interesting = true; + n_interesting = 0; + n_interesting_nu = 0; + + first = 0; +} + + +inline void close() {} + + + + diff --git a/user_code/dynstack_examples/output.h b/user_code/dynstack_examples/output.h index b0fda22..fe731f1 100644 --- a/user_code/dynstack_examples/output.h +++ b/user_code/dynstack_examples/output.h @@ -55,8 +55,13 @@ void callback_out(const DeductedParticleType* const p) } +typedef dynstack::wrapper::OutputCallbackStack< + dynstack::wrapper::InputCallbackStack< + dynstack::storage::LIFO_Stack, + callback_in>, + callback_out> stacktype; -auto dynstack_setup(std::vector sizes, std::vector< std::list > arguments ) +auto dynstack_setup(std::vector sizes, std::vector< std::list > arguments ) -> decltype(std::unique_ptr< stacktype >()) { if(sizes.size() != 1) { @@ -85,12 +90,6 @@ auto dynstack_setup(std::vector sizes, std::vector< std::list } std::cout << "(Dyn) Showerview file ready!" << std::endl; - - typedef dynstack::wrapper::OutputCallbackStack< - dynstack::wrapper::InputCallbackStack< - dynstack::storage::LIFO_Stack, - callback_in>, - callback_out> stacktype; auto stack = std::unique_ptr< stacktype >(new stacktype(size)); diff --git a/user_code/dynstack_setup.h b/user_code/dynstack_setup.h index eb9ffcf..2db1295 100644 --- a/user_code/dynstack_setup.h +++ b/user_code/dynstack_setup.h @@ -18,6 +18,8 @@ typedef DeductedParticleType Particle; #include "user_code/dynstack_examples/default.h" #elif __DYNOUTPUT__ #include "user_code/dynstack_examples/output.h" +#elif __DYNICECUBE__ +#include "user_code/dynstack_examples/icecube1.h" #elif __DYNCUSTOM__ #include #include diff --git a/user_code/remotecontrol_setup.h b/user_code/remotecontrol_setup.h index b28fcde..c04b279 100644 --- a/user_code/remotecontrol_setup.h +++ b/user_code/remotecontrol_setup.h @@ -35,8 +35,8 @@ - -inline const auto register_periodic_callback() +// With feature level C++14 the decltype becomes uneccessary +inline auto register_periodic_callback() -> const std::array { /** User code here * Create your periodic tasks with lambda or a function pointer and the spacing. @@ -47,13 +47,13 @@ inline const auto register_periodic_callback() + std::array arr = {{ empty }}; - - return std::array({ empty }); + return arr;//std::array({ empty }); } -inline const auto register_server_callback() +inline auto register_server_callback() -> const std::map)>> { typedef std::function)> callback_type; std::map callback; @@ -76,7 +76,7 @@ inline const auto register_server_callback() }; - callback.emplace(0x301, call1 ); + callback[0x301] = call1; return callback;