1
0
فهرست منبع

Merge branch 'master' of http://local.beijingyongan.com:3000/linux-dev/ya-serv

"合并“
zzj 6 سال پیش
والد
کامیت
c24d91083b
35فایلهای تغییر یافته به همراه391114 افزوده شده و 618 حذف شده
  1. 1 0
      .gitignore
  2. 507 0
      1
  3. 388908 0
      1222.raw
  4. 74 32
      Makefile
  5. 2 2
      Makefile.am
  6. 1290 0
      Makefile.in
  7. BIN
      a.out
  8. 1 0
      a.sh
  9. 46 45
      ant.cpp
  10. 7 11
      ant.h
  11. 4 4
      area.cpp
  12. 8 8
      area.h
  13. 1 0
      async.cpp
  14. 19 19
      autom4te.cache/requests
  15. 21 9
      card.cpp
  16. 1 0
      card.h
  17. 79 18
      card_path.cpp
  18. 1 1
      card_path.h
  19. 12 4
      client.cpp
  20. 31 408
      config.log
  21. 5 5
      config.status
  22. 0 1
      log.h
  23. 10 6
      main.cpp
  24. 2 1
      message.cpp
  25. 15 7
      net-service.cpp
  26. 1 1
      path_tof.txt
  27. 1 1
      point.cpp
  28. 14 6
      select_tool.cpp
  29. 16 10
      select_tool.h
  30. 6 4
      site_area.cpp
  31. 3 3
      site_area.h
  32. BIN
      visit
  33. 13 11
      visit.cpp
  34. 15 0
      write-copy.h
  35. 0 1
      znet.cpp

+ 1 - 0
.gitignore

@@ -1,5 +1,6 @@
 .*
 *.o
+*bak
 /.deps/
 /autom4te.cache/
 Makefile

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 507 - 0
1


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 388908 - 0
1222.raw


+ 74 - 32
Makefile

@@ -49,7 +49,8 @@ NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
 bin_PROGRAMS = yals$(EXEEXT)
-noinst_PROGRAMS = client$(EXEEXT) async$(EXEEXT) test$(EXEEXT)
+noinst_PROGRAMS = client$(EXEEXT) async$(EXEEXT) test$(EXEEXT) \
+	visit$(EXEEXT)
 subdir = .
 DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in $(top_srcdir)/configure COPYING INSTALL \
@@ -81,21 +82,26 @@ test_OBJECTS = $(am_test_OBJECTS)
 test_LDADD = $(LDADD)
 test_LINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(test_LDFLAGS) \
 	$(LDFLAGS) -o $@
+am_visit_OBJECTS = visit-visit.$(OBJEXT)
+visit_OBJECTS = $(am_visit_OBJECTS)
+visit_LDADD = $(LDADD)
+visit_LINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(visit_LDFLAGS) \
+	$(LDFLAGS) -o $@
 am__objects_1 = yals-singleton_test_class1.$(OBJEXT) \
 	yals-wsClient.$(OBJEXT) yals-wsClientMgr.$(OBJEXT) \
 	yals-wsTimerThread.$(OBJEXT) yals-CDBConnect.$(OBJEXT) \
 	yals-CDBConnPool.$(OBJEXT) yals-CDBHelper.$(OBJEXT) \
 	yals-CDBResultSet.$(OBJEXT) yals-jsonBuilder.$(OBJEXT)
-am__objects_2 = $(am__objects_1) yals-IniFile.$(OBJEXT) \
-	yals-sio_client.$(OBJEXT) yals-sio_socket.$(OBJEXT) \
-	yals-sio_client_impl.$(OBJEXT) yals-sio_packet.$(OBJEXT) \
-	yals-select_tool.$(OBJEXT) yals-line_fit.$(OBJEXT) \
-	yals-card_path.$(OBJEXT) yals-loc_point.$(OBJEXT) \
-	yals-ant.$(OBJEXT) yals-card.$(OBJEXT) yals-crc.$(OBJEXT) \
-	yals-loc_tool.$(OBJEXT) yals-message.$(OBJEXT) \
-	yals-net-service.$(OBJEXT) yals-point.$(OBJEXT) \
-	yals-tdoa_sync.$(OBJEXT) yals-worker.$(OBJEXT) \
-	yals-znet.$(OBJEXT)
+am__objects_2 = $(am__objects_1) yals-sio_client.$(OBJEXT) \
+	yals-sio_socket.$(OBJEXT) yals-sio_client_impl.$(OBJEXT) \
+	yals-sio_packet.$(OBJEXT) yals-select_tool.$(OBJEXT) \
+	yals-line_fit.$(OBJEXT) yals-card_path.$(OBJEXT) \
+	yals-loc_point.$(OBJEXT) yals-ant.$(OBJEXT) \
+	yals-card.$(OBJEXT) yals-crc.$(OBJEXT) yals-loc_tool.$(OBJEXT) \
+	yals-message.$(OBJEXT) yals-net-service.$(OBJEXT) \
+	yals-point.$(OBJEXT) yals-tdoa_sync.$(OBJEXT) \
+	yals-worker.$(OBJEXT) yals-znet.$(OBJEXT) \
+	yals-site_area.$(OBJEXT) yals-area.$(OBJEXT)
 am_yals_OBJECTS = $(am__objects_2) yals-main.$(OBJEXT)
 yals_OBJECTS = $(am_yals_OBJECTS)
 yals_LDADD = $(LDADD)
@@ -115,9 +121,9 @@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 CCLD = $(CC)
 LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
 SOURCES = $(async_SOURCES) $(client_SOURCES) $(test_SOURCES) \
-	$(yals_SOURCES)
+	$(visit_SOURCES) $(yals_SOURCES)
 DIST_SOURCES = $(async_SOURCES) $(client_SOURCES) $(test_SOURCES) \
-	$(yals_SOURCES)
+	$(visit_SOURCES) $(yals_SOURCES)
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
@@ -174,7 +180,7 @@ INSTALL_SCRIPT = ${INSTALL}
 INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
 LDFLAGS = 
 LIBOBJS = 
-LIBS = -lev 
+LIBS = -lzlog -lev 
 LTLIBOBJS = 
 MAKEINFO = ${SHELL} /home/lemon/resource/ya-serv/missing --run makeinfo
 MKDIR_P = /bin/mkdir -p
@@ -235,13 +241,13 @@ top_build_prefix =
 top_builddir = .
 top_srcdir = .
 SRC_IN = websocket/singleton_test_class1.cpp  websocket/wsClient.cpp websocket/wsClientMgr.cpp websocket/wsTimerThread.cpp db_api/CDBConnect.cpp db_api/CDBConnPool.cpp db_api/CDBHelper.cpp db_api/CDBResultSet.cpp websocket/jsonBuilder.cpp websocket/jsonBuilder.h websocket/thread_safe_map.h
-AM_SOURCES = $(SRC_IN) IniFile.cpp src/sio_client.cpp src/sio_socket.cpp src/internal/sio_client_impl.cpp src/internal/sio_packet.cpp src/sio_client.h src/sio_message.h src/sio_socket.h src/internal/sio_client_impl.h src/internal/sio_packet.h \
+AM_SOURCES = $(SRC_IN) src/sio_client.cpp src/sio_socket.cpp src/internal/sio_client_impl.cpp src/internal/sio_packet.cpp src/sio_client.h src/sio_message.h src/sio_socket.h src/internal/sio_client_impl.h src/internal/sio_packet.h \
 select_tool.h select_tool.cpp line_fit.h line_fit.cpp card_path.h card_path.cpp loc_point.h loc_point.cpp ant.cpp ant.h card.cpp card.h clock.h \
 crc.cpp crc.h io_buf.h line.h loc_tool.cpp loc_tool.h message.cpp \
 message_file.h message.h net-service.cpp net-service.h point.cpp point.h tdoa_sync.cpp tdoa_sync.h \
-worker.cpp worker.h zio.h zloop.h znet.cpp znet.h zstream.h
+worker.cpp worker.h zio.h zloop.h znet.cpp znet.h zstream.h site_area.cpp  site_area.h area.h area.cpp
 
-AM_CPPFLAGS = -Wall -pthread -m64 -std=c++11 -fPIC -I${prefix}/include
+AM_CPPFLAGS = -Wall -pthread -m64 -std=c++11 -fPIC -I${prefix}/include -I./src -I$(prefix)/mysql/include -I../include/websocketpp -I../include
 AM_LDFLAGS = -Wall -pthread -m64 -std=c++11 -fPIC -L${prefix}/lib  -L$(prefix)/mysql/lib
 yals_SOURCES = ${AM_SOURCES} main.cpp 
 yals_CPPFLAGS = ${AM_CPPFLAGS} 
@@ -255,6 +261,9 @@ client_LDFLAGS = ${AM_LDFLAGS}  -L. -lzlog
 test_SOURCES = test.cpp base64.cpp
 test_CPPFLAGS = ${AM_CPPFLAGS}
 test_LDFLAGS = ${AM_LDFLAGS}  -L. -lzlog -lrt
+visit_SOURCES = visit.cpp 
+visit_CPPFLAGS = ${AM_CPPFLAGS} -D_TEST_
+visit_LDFLAGS = ${AM_LDFLAGS}  
 EXTRA_DIST = message_file.h
 all: all-am
 
@@ -346,6 +355,9 @@ client$(EXEEXT): $(client_OBJECTS) $(client_DEPENDENCIES) $(EXTRA_client_DEPENDE
 test$(EXEEXT): $(test_OBJECTS) $(test_DEPENDENCIES) $(EXTRA_test_DEPENDENCIES) 
 	@rm -f test$(EXEEXT)
 	$(test_LINK) $(test_OBJECTS) $(test_LDADD) $(LIBS)
+visit$(EXEEXT): $(visit_OBJECTS) $(visit_DEPENDENCIES) $(EXTRA_visit_DEPENDENCIES) 
+	@rm -f visit$(EXEEXT)
+	$(visit_LINK) $(visit_OBJECTS) $(visit_LDADD) $(LIBS)
 yals$(EXEEXT): $(yals_OBJECTS) $(yals_DEPENDENCIES) $(EXTRA_yals_DEPENDENCIES) 
 	@rm -f yals$(EXEEXT)
 	$(yals_LINK) $(yals_OBJECTS) $(yals_LDADD) $(LIBS)
@@ -361,12 +373,13 @@ include ./$(DEPDIR)/client-client.Po
 include ./$(DEPDIR)/client-message_file.Po
 include ./$(DEPDIR)/test-base64.Po
 include ./$(DEPDIR)/test-test.Po
+include ./$(DEPDIR)/visit-visit.Po
 include ./$(DEPDIR)/yals-CDBConnPool.Po
 include ./$(DEPDIR)/yals-CDBConnect.Po
 include ./$(DEPDIR)/yals-CDBHelper.Po
 include ./$(DEPDIR)/yals-CDBResultSet.Po
-include ./$(DEPDIR)/yals-IniFile.Po
 include ./$(DEPDIR)/yals-ant.Po
+include ./$(DEPDIR)/yals-area.Po
 include ./$(DEPDIR)/yals-card.Po
 include ./$(DEPDIR)/yals-card_path.Po
 include ./$(DEPDIR)/yals-crc.Po
@@ -384,6 +397,7 @@ include ./$(DEPDIR)/yals-sio_client.Po
 include ./$(DEPDIR)/yals-sio_client_impl.Po
 include ./$(DEPDIR)/yals-sio_packet.Po
 include ./$(DEPDIR)/yals-sio_socket.Po
+include ./$(DEPDIR)/yals-site_area.Po
 include ./$(DEPDIR)/yals-tdoa_sync.Po
 include ./$(DEPDIR)/yals-worker.Po
 include ./$(DEPDIR)/yals-wsClient.Po
@@ -475,6 +489,20 @@ test-base64.obj: base64.cpp
 #	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \
 #	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o test-base64.obj `if test -f 'base64.cpp'; then $(CYGPATH_W) 'base64.cpp'; else $(CYGPATH_W) '$(srcdir)/base64.cpp'; fi`
 
+visit-visit.o: visit.cpp
+	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(visit_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT visit-visit.o -MD -MP -MF $(DEPDIR)/visit-visit.Tpo -c -o visit-visit.o `test -f 'visit.cpp' || echo '$(srcdir)/'`visit.cpp
+	$(am__mv) $(DEPDIR)/visit-visit.Tpo $(DEPDIR)/visit-visit.Po
+#	source='visit.cpp' object='visit-visit.o' libtool=no \
+#	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \
+#	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(visit_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o visit-visit.o `test -f 'visit.cpp' || echo '$(srcdir)/'`visit.cpp
+
+visit-visit.obj: visit.cpp
+	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(visit_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT visit-visit.obj -MD -MP -MF $(DEPDIR)/visit-visit.Tpo -c -o visit-visit.obj `if test -f 'visit.cpp'; then $(CYGPATH_W) 'visit.cpp'; else $(CYGPATH_W) '$(srcdir)/visit.cpp'; fi`
+	$(am__mv) $(DEPDIR)/visit-visit.Tpo $(DEPDIR)/visit-visit.Po
+#	source='visit.cpp' object='visit-visit.obj' libtool=no \
+#	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \
+#	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(visit_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o visit-visit.obj `if test -f 'visit.cpp'; then $(CYGPATH_W) 'visit.cpp'; else $(CYGPATH_W) '$(srcdir)/visit.cpp'; fi`
+
 yals-singleton_test_class1.o: websocket/singleton_test_class1.cpp
 	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(yals_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT yals-singleton_test_class1.o -MD -MP -MF $(DEPDIR)/yals-singleton_test_class1.Tpo -c -o yals-singleton_test_class1.o `test -f 'websocket/singleton_test_class1.cpp' || echo '$(srcdir)/'`websocket/singleton_test_class1.cpp
 	$(am__mv) $(DEPDIR)/yals-singleton_test_class1.Tpo $(DEPDIR)/yals-singleton_test_class1.Po
@@ -601,20 +629,6 @@ yals-jsonBuilder.obj: websocket/jsonBuilder.cpp
 #	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \
 #	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(yals_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o yals-jsonBuilder.obj `if test -f 'websocket/jsonBuilder.cpp'; then $(CYGPATH_W) 'websocket/jsonBuilder.cpp'; else $(CYGPATH_W) '$(srcdir)/websocket/jsonBuilder.cpp'; fi`
 
-yals-IniFile.o: IniFile.cpp
-	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(yals_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT yals-IniFile.o -MD -MP -MF $(DEPDIR)/yals-IniFile.Tpo -c -o yals-IniFile.o `test -f 'IniFile.cpp' || echo '$(srcdir)/'`IniFile.cpp
-	$(am__mv) $(DEPDIR)/yals-IniFile.Tpo $(DEPDIR)/yals-IniFile.Po
-#	source='IniFile.cpp' object='yals-IniFile.o' libtool=no \
-#	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \
-#	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(yals_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o yals-IniFile.o `test -f 'IniFile.cpp' || echo '$(srcdir)/'`IniFile.cpp
-
-yals-IniFile.obj: IniFile.cpp
-	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(yals_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT yals-IniFile.obj -MD -MP -MF $(DEPDIR)/yals-IniFile.Tpo -c -o yals-IniFile.obj `if test -f 'IniFile.cpp'; then $(CYGPATH_W) 'IniFile.cpp'; else $(CYGPATH_W) '$(srcdir)/IniFile.cpp'; fi`
-	$(am__mv) $(DEPDIR)/yals-IniFile.Tpo $(DEPDIR)/yals-IniFile.Po
-#	source='IniFile.cpp' object='yals-IniFile.obj' libtool=no \
-#	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \
-#	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(yals_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o yals-IniFile.obj `if test -f 'IniFile.cpp'; then $(CYGPATH_W) 'IniFile.cpp'; else $(CYGPATH_W) '$(srcdir)/IniFile.cpp'; fi`
-
 yals-sio_client.o: src/sio_client.cpp
 	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(yals_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT yals-sio_client.o -MD -MP -MF $(DEPDIR)/yals-sio_client.Tpo -c -o yals-sio_client.o `test -f 'src/sio_client.cpp' || echo '$(srcdir)/'`src/sio_client.cpp
 	$(am__mv) $(DEPDIR)/yals-sio_client.Tpo $(DEPDIR)/yals-sio_client.Po
@@ -867,6 +881,34 @@ yals-znet.obj: znet.cpp
 #	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \
 #	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(yals_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o yals-znet.obj `if test -f 'znet.cpp'; then $(CYGPATH_W) 'znet.cpp'; else $(CYGPATH_W) '$(srcdir)/znet.cpp'; fi`
 
+yals-site_area.o: site_area.cpp
+	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(yals_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT yals-site_area.o -MD -MP -MF $(DEPDIR)/yals-site_area.Tpo -c -o yals-site_area.o `test -f 'site_area.cpp' || echo '$(srcdir)/'`site_area.cpp
+	$(am__mv) $(DEPDIR)/yals-site_area.Tpo $(DEPDIR)/yals-site_area.Po
+#	source='site_area.cpp' object='yals-site_area.o' libtool=no \
+#	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \
+#	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(yals_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o yals-site_area.o `test -f 'site_area.cpp' || echo '$(srcdir)/'`site_area.cpp
+
+yals-site_area.obj: site_area.cpp
+	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(yals_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT yals-site_area.obj -MD -MP -MF $(DEPDIR)/yals-site_area.Tpo -c -o yals-site_area.obj `if test -f 'site_area.cpp'; then $(CYGPATH_W) 'site_area.cpp'; else $(CYGPATH_W) '$(srcdir)/site_area.cpp'; fi`
+	$(am__mv) $(DEPDIR)/yals-site_area.Tpo $(DEPDIR)/yals-site_area.Po
+#	source='site_area.cpp' object='yals-site_area.obj' libtool=no \
+#	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \
+#	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(yals_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o yals-site_area.obj `if test -f 'site_area.cpp'; then $(CYGPATH_W) 'site_area.cpp'; else $(CYGPATH_W) '$(srcdir)/site_area.cpp'; fi`
+
+yals-area.o: area.cpp
+	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(yals_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT yals-area.o -MD -MP -MF $(DEPDIR)/yals-area.Tpo -c -o yals-area.o `test -f 'area.cpp' || echo '$(srcdir)/'`area.cpp
+	$(am__mv) $(DEPDIR)/yals-area.Tpo $(DEPDIR)/yals-area.Po
+#	source='area.cpp' object='yals-area.o' libtool=no \
+#	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \
+#	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(yals_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o yals-area.o `test -f 'area.cpp' || echo '$(srcdir)/'`area.cpp
+
+yals-area.obj: area.cpp
+	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(yals_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT yals-area.obj -MD -MP -MF $(DEPDIR)/yals-area.Tpo -c -o yals-area.obj `if test -f 'area.cpp'; then $(CYGPATH_W) 'area.cpp'; else $(CYGPATH_W) '$(srcdir)/area.cpp'; fi`
+	$(am__mv) $(DEPDIR)/yals-area.Tpo $(DEPDIR)/yals-area.Po
+#	source='area.cpp' object='yals-area.obj' libtool=no \
+#	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \
+#	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(yals_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o yals-area.obj `if test -f 'area.cpp'; then $(CYGPATH_W) 'area.cpp'; else $(CYGPATH_W) '$(srcdir)/area.cpp'; fi`
+
 yals-main.o: main.cpp
 	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(yals_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT yals-main.o -MD -MP -MF $(DEPDIR)/yals-main.Tpo -c -o yals-main.o `test -f 'main.cpp' || echo '$(srcdir)/'`main.cpp
 	$(am__mv) $(DEPDIR)/yals-main.Tpo $(DEPDIR)/yals-main.Po

+ 2 - 2
Makefile.am

@@ -9,8 +9,8 @@ crc.cpp crc.h io_buf.h line.h loc_tool.cpp loc_tool.h message.cpp \
 message_file.h message.h net-service.cpp net-service.h point.cpp point.h tdoa_sync.cpp tdoa_sync.h \
 worker.cpp worker.h zio.h zloop.h znet.cpp znet.h zstream.h site_area.cpp  site_area.h area.h area.cpp
 
-AM_CPPFLAGS=-Wall -pthread -m64 -std=c++11 -fPIC -I${prefix}/include -I./src -I/usr/local/mysql/include
-AM_LDFLAGS= -Wall -pthread -m64 -std=c++11 -fPIC -L${prefix}/lib  -L$(prefix)/mysql/lib -L/usr/local/mysql/lib
+AM_CPPFLAGS=-Wall -pthread -m64 -std=c++11 -fPIC -I${prefix}/include -I./src -I$(prefix)/mysql/include -I../include/websocketpp -I../include
+AM_LDFLAGS= -Wall -pthread -m64 -std=c++11 -fPIC -L${prefix}/lib  -L$(prefix)/mysql/lib
 
 yals_SOURCES=${AM_SOURCES} main.cpp 
 yals_CPPFLAGS=${AM_CPPFLAGS} 

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 1290 - 0
Makefile.in



+ 1 - 0
a.sh

@@ -0,0 +1 @@
+g++ ant.cpp point.cpp -std=c++11 -I../include -lzlog -D_TEST

+ 46 - 45
ant.cpp

@@ -4,20 +4,18 @@
 #include <math.h>
 #include "ant.h"
 
+template<> std::shared_ptr<sit_list> 
+single_base<sit_list, int, std::shared_ptr<site>>::m_instance=std::make_shared<sit_list>();
 int site::index()const
 {
 	return m_algo+(m_num_dims<<1);
 }
 
-sit_list*sit_list::instance()
-{
-	static sit_list _impl;
-	_impl.load_from_db();
-	return &_impl;
-}
 site::site(int id)
-    :m_id(id)
-     ,m_path_empty(true)
+	:m_algo(0)
+	,m_num_dims(0)
+    ,m_id(id)
+    ,m_path_empty(true)
 {
 
 }
@@ -26,10 +24,7 @@ const algo_config&site::config()const
 	return g_config[index()];
 }
 
-const site& sit_list::operator[](int id) const
-{
-    return m_list[id];
-} 
+ 
 static int str_split(char*s,char**rc)
 {
 	char**o=rc;
@@ -57,19 +52,26 @@ void sit_list::read_sit_list(const char*fname)
 			continue;
 
 		id=atoi(s[1]);
-		if(id>(int)m_list.size())
-			continue;
 
 		int antid=atoi(s[2])-1;
 		if(antid>=2)
 			continue;
-
-		m_list[id].m_id=id;
-		m_list[id].m_ant[antid].set(atof(s[4]),-atof(s[5]));
+		auto tmp = m_instance->get(id);
+		if(tmp==nullptr)
+		{
+			tmp = std::make_shared<site>();
+			tmp->m_id=id;
+		}
+		tmp->m_ant[antid].set(atof(s[4]),-atof(s[5]));
+		instance()->add(id,tmp);
+		std_info("211111 id=%dsize = %d",id,instance()->m_map.size());
+		//m_list[id].m_id=id;
+		//m_list[id].m_ant[antid].set(atof(s[4]),-atof(s[5]));
 	}
-
-	for(auto&sit:m_list)
+	
+	for(auto&sit_:m_instance->m_map)
 	{
+		auto & sit = *(sit_.second);
 		if(sit.m_id==-1)
 			continue;
 
@@ -96,34 +98,34 @@ void sit_list::read_ant_path(const char*fname)
 			continue;
 
 		id=atoi(s[0]);
-		if(id>(int)m_list.size())
+		auto s_ = m_instance->get(id);
+		if(s_==nullptr)
 			continue;
 
 		pid=atoi(s[1]);
 		if(pid>2)
           continue;
-
         point p1(atof(s[2]),-atof(s[3]));
         point p2(atof(s[5]),-atof(s[6]));
-        
+		auto &sit_ = *s_; 
         if(pid == 0)
         {
             line_v l(p1,p2);
             {
-                point px = l.line::projection(m_list[id]);
-                m_list[id].set(px);
+                point px = l.line::projection(sit_);
+                sit_.set(px);
                 for(int i=0;i<2;i++)
                 {
                     path p;
                     p.m_slope[0] = atof(s[8]);
                     p.m_line[0] = line_v(px,l[i]);
-                    m_list[id].m_ant[i].m_path.push_back(p);
+                    sit_.m_ant[i].m_path.push_back(p);
                 }
             }
         }
         else 
         {
-            ant &a = pid<0?m_list[id].m_ant[0]:m_list[id].m_ant[1];
+            ant &a = pid<0?sit_.m_ant[0]:sit_.m_ant[1];
             if(a.m_path.size()!=0)
             {
                 path &p = a.m_path[0];
@@ -138,13 +140,14 @@ void sit_list::read_ant_path(const char*fname)
                 a.m_path.push_back(p);
             }
             if(abs(pid)==1)
-              m_list[id].set(p1);
+				 sit_.set(p1);
         }
 	}
 	fclose(fp);
 
-	for(auto&s:m_list)
+	for(auto&_s:m_instance->m_map)
 	{
+		auto & s = *(_s.second);
 		if(s.m_id==-1)
 			continue;
         s.swap();
@@ -162,10 +165,7 @@ void sit_list::read_ant_path(const char*fname)
             }
         }
         std_info("%s",s.to_string().c_str());
-        std_info("%f----%f",s.x,s.y);
-        log_info("%s",s.to_string().c_str());
-        log_debug("%s",s.to_string().c_str());
-        log_error("%s",s.to_string().c_str());
+        //std_info("%f----%f",s.x,s.y);
 	}
 }
 
@@ -182,23 +182,24 @@ int loc_message::tool_index()const
 
 algo_config site::g_config[]=
 {
-	{ "tof-1",  1, 2, 100, 1000 },
-	{ "tdoa-1", 2, 2, 100, 1000 },
-	{ "tof-2",  2, 3, 100, 1000 },
-	{ "tdoa-2", 3, 3, 100, 1000 },
-	{ "tof-3",  3, 4, 100, 1000 },
-	{ "tdoa-3", 4, 4, 100, 1000 }
+	{ "tof-1",  1, 2, 0.1, 1 },
+	{ "tdoa-1", 2, 2, 0.1, 1 },
+	{ "tof-2",  2, 3, 0.1, 1 },
+	{ "tdoa-2", 3, 3, 0.1, 1 },
+	{ "tof-3",  3, 4, 0.1, 1 },
+	{ "tdoa-3", 4, 4, 0.1, 1 }
 };
+
 #ifdef _TEST
 int main()
 {
 	log_init("./log.ini");
-    sit_list *sl = sit_list::instance();
-	sl->load("data_reader_antenna.txt","path_tof.txt");
-    (*sl)[219].solving(0,100);
-    (*sl)[219].solving(1,100.5);
-    std_info("---%d",(*sl)[209].m_ant[0].m_path.size());
-    std_info("---%d",(*sl)[209][0].size());
-    std_info("---%s",(*sl)[209][0][0][0].to_string().c_str());
+    //sit_list *sl = sit_list::instance();
+	sit_list::instance()->load("data_reader_antenna.txt","path_tof.txt");
+	sit_list::instance()->get(219)->solving(0,100);
+	sit_list::instance()->get(219)->solving(1,100.5);
+    //std_info("---%d",(*sl)[209].m_ant[0].m_path.size());
+    //std_info("---%d",(*sl)[209][0].size());
+    //std_info("---%s",(*sl)[209][0][0][0].to_string().c_str());
 }
 #endif

+ 7 - 11
ant.h

@@ -11,6 +11,7 @@
 #include "log.h"
 #include "line.h"
 #include "point.h"
+#include "write-copy.h"
 
 struct path
 {
@@ -50,8 +51,8 @@ struct algo_config
 	const char*desc;
 	int min_msg_cnt;
 	int best_msg_cnt;
-	int min_wait_time;
-	int max_wait_time;
+	double min_wait_time;
+	double max_wait_time;
 };
 //
 struct ant :point
@@ -186,7 +187,7 @@ struct site:point
 	std::string to_string()const
 	{
         std::stringstream ss;
-        ss<<"site_id:"<<m_id;
+        ss<<"site_id:"<<m_id<<"x:"<<x<<" y: "<<y;
         for(const auto a:m_ant)
         {  
             ss<<"<";
@@ -235,26 +236,21 @@ struct site:point
 };
 
 
-struct sit_list
+struct sit_list:single_base<sit_list,int,std::shared_ptr<site>>
 {
-	std::array<site,1000> m_list;
-
-	const site& operator[](int id) const;
 	void load(const char*ant_file,const char*path_file)
 	{
 		read_sit_list(ant_file);
 		read_ant_path(path_file);
 	}
 
-	void load_from_db()
+	static void load_from_db()
 	{
-	
+	//	load("data_reader_antenna.txt","path_tof.txt");
 	}
 
 	void read_sit_list(const char*fname);
 	void read_ant_path(const char*fname);
-
-	static sit_list*instance();
 };
 
 struct loc_message

+ 4 - 4
area.cpp

@@ -13,17 +13,17 @@ struct area_impl
 	}
 
 
-	void on_hover(int card_id,std::shared_ptr<area_hover>&c,double speed)
+    void on_hover(int64_t card_id,std::shared_ptr<area_hover>&c,double speed)
 	{
-	
+
 	}
 
-	void on_enter(int card_id,std::shared_ptr<area_hover>&c,double speed)
+    void on_enter(int64_t card_id,std::shared_ptr<area_hover>&c,double speed)
 	{
 	
 	}
 
-	void on_leave(int card_id,std::shared_ptr<area_hover>&c,double speed)
+    void on_leave(int64_t card_id,std::shared_ptr<area_hover>&c,double speed)
 	{
 	
 	

+ 8 - 8
area.h

@@ -16,9 +16,9 @@ struct area
 	{
 	}
 
-	virtual void on_hover(int card_id,std::shared_ptr<area_hover>&c,double speed)=0;
-	virtual void on_enter(int card_id,std::shared_ptr<area_hover>&c,double speed)=0;
-	virtual void on_leave(int card_id,std::shared_ptr<area_hover>&c,double speed)=0;
+    virtual void on_hover(int64_t card_id,std::shared_ptr<area_hover>&c,double speed)=0;
+    virtual void on_enter(int64_t card_id,std::shared_ptr<area_hover>&c,double speed)=0;
+    virtual void on_leave(int64_t card_id,std::shared_ptr<area_hover>&c,double speed)=0;
 
 	int id()const
 	{
@@ -86,25 +86,25 @@ struct area_hover
 struct area_tool
 {
 	std::vector<std::shared_ptr<area_hover>> m_clist;
-	void on_point(int card_id,const point&pt,double speed);
+	void on_point(int64_t card_id,const point&pt,double speed);
 
 	//检测是否超时
-	void on_timer(int card_id)
+    void on_timer(int64_t card_id)
 	{
 	
 	}
 
-	void do_hover_biz(int card_id,std::shared_ptr<area_hover>&a,double speed)
+    void do_hover_biz(int64_t card_id,std::shared_ptr<area_hover>&a,double speed)
 	{
 		a->m_area->on_hover(card_id,a,speed);
 	}
 
-	void do_enter_biz(int card_id,std::shared_ptr<area_hover>&a,double speed)
+    void do_enter_biz(int64_t card_id,std::shared_ptr<area_hover>&a,double speed)
 	{
 		a->m_area->on_enter(card_id,a,speed);
 	}
 
-	void do_leave_biz(int card_id,std::shared_ptr<area_hover>&a,double speed)
+    void do_leave_biz(int64_t card_id,std::shared_ptr<area_hover>&a,double speed)
 	{
 		a->m_area->on_leave(card_id,a,speed);
 	}

+ 1 - 0
async.cpp

@@ -13,6 +13,7 @@
 #define EV_MULTIPLICITY 1
 #define EV_SIGNAL_ENABLE 1
 #define EV_ASYNC_ENABLE 1
+#define EV_USE_FLOOR 1
 #include <ev++.h>
 
 #include <clock.h>

+ 19 - 19
autom4te.cache/requests

@@ -81,58 +81,58 @@
                         'configure.ac'
                       ],
                       {
-                        '_LT_AC_TAGCONFIG' => 1,
                         'AM_PROG_F77_C_O' => 1,
-                        'AC_INIT' => 1,
+                        '_LT_AC_TAGCONFIG' => 1,
                         'm4_pattern_forbid' => 1,
-                        'AC_CANONICAL_TARGET' => 1,
+                        'AC_INIT' => 1,
                         '_AM_COND_IF' => 1,
-                        'AC_CONFIG_LIBOBJ_DIR' => 1,
+                        'AC_CANONICAL_TARGET' => 1,
                         'AC_SUBST' => 1,
-                        'AC_CANONICAL_HOST' => 1,
+                        'AC_CONFIG_LIBOBJ_DIR' => 1,
                         'AC_FC_SRCEXT' => 1,
+                        'AC_CANONICAL_HOST' => 1,
                         'AC_PROG_LIBTOOL' => 1,
                         'AM_PROG_MKDIR_P' => 1,
                         'AM_INIT_AUTOMAKE' => 1,
-                        'AC_CONFIG_SUBDIRS' => 1,
                         'AM_PATH_GUILE' => 1,
+                        'AC_CONFIG_SUBDIRS' => 1,
                         'AM_AUTOMAKE_VERSION' => 1,
                         'LT_CONFIG_LTDL_DIR' => 1,
-                        'AC_REQUIRE_AUX_FILE' => 1,
                         'AC_CONFIG_LINKS' => 1,
-                        'LT_SUPPORTED_TAG' => 1,
+                        'AC_REQUIRE_AUX_FILE' => 1,
                         'm4_sinclude' => 1,
+                        'LT_SUPPORTED_TAG' => 1,
                         'AM_MAINTAINER_MODE' => 1,
                         'AM_NLS' => 1,
                         'AC_FC_PP_DEFINE' => 1,
                         'AM_GNU_GETTEXT_INTL_SUBDIR' => 1,
-                        '_m4_warn' => 1,
                         'AM_MAKEFILE_INCLUDE' => 1,
+                        '_m4_warn' => 1,
                         'AM_PROG_CXX_C_O' => 1,
-                        '_AM_COND_ENDIF' => 1,
                         '_AM_MAKEFILE_INCLUDE' => 1,
+                        '_AM_COND_ENDIF' => 1,
                         'AM_ENABLE_MULTILIB' => 1,
                         'AM_PROG_MOC' => 1,
                         'AM_SILENT_RULES' => 1,
                         'AC_CONFIG_FILES' => 1,
-                        'include' => 1,
                         'LT_INIT' => 1,
-                        'AM_PROG_AR' => 1,
+                        'include' => 1,
                         'AM_GNU_GETTEXT' => 1,
+                        'AM_PROG_AR' => 1,
                         'AC_LIBSOURCE' => 1,
-                        'AC_CANONICAL_BUILD' => 1,
                         'AM_PROG_FC_C_O' => 1,
+                        'AC_CANONICAL_BUILD' => 1,
                         'AC_FC_FREEFORM' => 1,
-                        'AC_FC_PP_SRCEXT' => 1,
                         'AH_OUTPUT' => 1,
-                        '_AM_SUBST_NOTMAKE' => 1,
+                        'AC_FC_PP_SRCEXT' => 1,
                         'AC_CONFIG_AUX_DIR' => 1,
-                        'AM_PROG_CC_C_O' => 1,
-                        'sinclude' => 1,
+                        '_AM_SUBST_NOTMAKE' => 1,
                         'm4_pattern_allow' => 1,
-                        'AM_CONDITIONAL' => 1,
-                        'AC_CANONICAL_SYSTEM' => 1,
+                        'sinclude' => 1,
+                        'AM_PROG_CC_C_O' => 1,
                         'AM_XGETTEXT_OPTION' => 1,
+                        'AC_CANONICAL_SYSTEM' => 1,
+                        'AM_CONDITIONAL' => 1,
                         'AC_CONFIG_HEADERS' => 1,
                         'AC_DEFINE_TRACE_LITERAL' => 1,
                         'AM_POT_TOOLS' => 1,

+ 21 - 9
card.cpp

@@ -31,6 +31,11 @@ struct card_location_base
 	virtual void on_location(const std::vector<point>&vp,const std::vector<loc_message> &lm )
     {
         loc_point pt = m_sel_tool->select_solution(vp,lm);
+		if(pt.m_useless)
+		{
+			std_info("loc_point,x:%.2f,y:%.2f",pt.x,pt.y);
+			log_info("loc_point,x:%.2f,y:%.2f",pt.x,pt.y);
+		}
         m_smo_tool->smooth_strategy();
     }
     void do_status(STA_TYPE st)
@@ -98,16 +103,20 @@ struct one_ct_message_handle
         else if(loop == nullptr)
           return;
    		if(!m_msg_list.empty()&& m_ct!=loc.m_card_ct)
+		{
 			m_msg_list.clear();
+		}
 
-		site s=(*sit_list::instance())[loc.m_site_id];
+		const site &s=*(sit_list::instance()->get(loc.m_site_id));
 		if(m_msg_list.empty())
 		{
 			m_ct=loc.m_card_ct;
 			m_ac=&s.config();
 			m_min_timeout=false;
             //这里构造loc_message 保存数据
-			m_msg_list.push_back(loc_message(s,loc.m_tof,loc.m_time_stamp,loc.m_card_id,loc.m_card_ct,loc.m_card_type,loc.m_ant_id,loc.m_rav,loc.m_acc,loc.m_sync_ct,loc.m_rssi));
+			m_msg_list.push_back(loc_message(s,loc.m_tof,loc.m_time_stamp,loc.m_card_id,
+							loc.m_card_ct,loc.m_card_type,loc.m_ant_id,loc.m_rav,loc.m_acc,
+							loc.m_sync_ct,loc.m_rssi));
 
 			//启动本CT的最小、最大两个定时器
 			m_min_timer.start(m_ac->min_wait_time);
@@ -115,7 +124,9 @@ struct one_ct_message_handle
 			return;
 		}
 
-		m_msg_list.push_back(loc_message(s,loc.m_tof,loc.m_time_stamp,loc.m_card_id,loc.m_card_ct,loc.m_card_type,loc.m_ant_id,loc.m_rav,loc.m_acc,loc.m_sync_ct,loc.m_rssi));
+		m_msg_list.push_back(loc_message(s,loc.m_tof,loc.m_time_stamp,loc.m_card_id,
+						loc.m_card_ct,loc.m_card_type,loc.m_ant_id,loc.m_rav,loc.m_acc,
+						loc.m_sync_ct,loc.m_rssi));
 
 		if(m_min_timeout && (int)m_msg_list.size()>=m_ac->best_msg_cnt)
 		{
@@ -135,13 +146,9 @@ struct one_ct_message_handle
 		reset();
 	}
 };
-//card 类的handle -->on_message..
-//handle message.
 struct card_message_handle
 {
 	card_location_base*m_card;
-	//std::vector<loc_message> m_msg_list;
-    //here handle ct message...one ct one handle operator.
 	std::array<one_ct_message_handle*,16> m_ct_list;
 
 	card_message_handle(card_location_base*card)
@@ -218,6 +225,11 @@ struct card_list_impl:card_list
 
 	void init_card_from_db()
 	{
+		for(int i=0;i<(1<<16);i++)
+		{
+			card_location_base * mp = new car("car1");
+			m_list.push_back(mp);
+		}
 	}
 
 	card_location_base *get(uint64_t card_id)const
@@ -240,8 +252,8 @@ struct card_list_impl:card_list
 			return;
 		}
 
-		log_info("card message:site=%d,ant=%d,card=%d,tof=%lld,rav=%02X,acc=%02X,rssi=%d",
-				loc.m_site_id,loc.m_ant_id,loc.m_card_id,loc.m_tof,loc.m_rav,loc.m_acc,loc.m_rssi);
+		log_info("card message:site=%d,ant=%d,card=%d,tof=%lld,rav=%02X,acc=%02X,rssi=%d,stamp=%llu",
+				loc.m_site_id,loc.m_ant_id,loc.m_card_id,loc.m_tof,loc.m_rav,loc.m_acc,loc.m_rssi,loc.m_time_stamp);
 
 		c->on_message(loop,loc,is_history);
 	}

+ 1 - 0
card.h

@@ -14,6 +14,7 @@ template<typename T> struct zloop;
 struct card_list:single_base<card_list,int64_t,std::shared_ptr<card_location_base>>
 {
 	virtual void on_message(zloop<task*> *loop,const message_locinfo&loc,bool is_history)=0;
+	virtual void init_card_from_db()=0;
 	virtual ~card_list(){}
 };
 

+ 79 - 18
card_path.cpp

@@ -10,6 +10,7 @@
 #include "ant.h"
 
 #include "card_path.h"
+#include "visit.h"
 
 namespace{
 
@@ -198,21 +199,26 @@ void log_path(const std::vector<base_path>&path,const vertex_list&v_list)
 		printf("base_path %.6lf, %03d,(%d,%s),(%d,%s)\n",c,i,path[i][0],v_list[path[i][0]].to_string().c_str(),path[i][1],v_list[path[i][1]].to_string().c_str());
 	}
 }
-
-static std::vector<base_path> init_path(const sit_list&sites,vertex_list&v)
+struct handle_path :visitor<std::shared_ptr<site>>
 {
 	std::vector<base_path> ret;
-	for(uint32_t i=0;i<sites.m_list.size();i++)
+	vertex_list v;
+	handle_path()
 	{
-		auto&s=sites[i];
+		v.add(point(0,0),0,-1);
+	}
+	bool visit(std::shared_ptr<site> sit)
+	{
+		//auto&s=sites[i];
+		const auto &s = *sit;
 
 		if(!s.have_valid_path())
-			continue;
+			return false;
 
 		if(s.path(0).empty()||s.path(1).empty())
-			continue;
+			return false;
         if(s[0].size()<2)
-            continue;
+			return false;
         line_v l000 = s[0][0][0];
         line_v l010 = s[0][1][0];
         if(l000.is_same(l010))
@@ -245,10 +251,60 @@ static std::vector<base_path> init_path(const sit_list&sites,vertex_list&v)
 
 		        ret.push_back(base_path(p0,p1));
 			    ret.back().sid=s.m_id;
-
             }
         }
-    }
+		return true;
+	}
+};
+static std::vector<base_path> init_path(std::vector<base_path> & ret,vertex_list&v)
+{
+//	for(uint32_t i=0;i<sites.m_list.size();i++)
+//	{
+//		auto&s=sites[i];
+//
+//		if(!s.have_valid_path())
+//			continue;
+//
+//		if(s.path(0).empty()||s.path(1).empty())
+//			continue;
+//        if(s[0].size()<2)
+//            continue;
+//        line_v l000 = s[0][0][0];
+//        line_v l010 = s[0][1][0];
+//        if(l000.is_same(l010))
+//        {
+//            printf("same....%d",s.m_id);
+//			int p0=v.add(point::min(s.path(0),s.path(1)),0,s.m_id);
+//			int p1=v.add(point::max(s.path(0),s.path(1)),0,s.m_id);
+//
+//		    ret.push_back(base_path(p0,p1));
+//			ret.back().sid=s.m_id;
+//        }
+//        else
+//        {
+//            point px = l000.line::crossing(l010);
+//            for(int i=0;i<2;i++)
+//            {
+//			    int p0=v.add(point::min(px,s.path(i)),0,s.m_id);
+//			    int p1=v.add(point::max(px,s.path(i)),0,s.m_id);
+//
+//		        ret.push_back(base_path(p0,p1));
+//			    ret.back().sid=s.m_id;
+//            }
+//        }
+//        for(int i=0;i<2;i++)
+//        {
+//            if(!s[0][i][1].empty())
+//            {
+//			    int p0=v.add(point::min(s[0][i][1][0],s[0][i][1][1]),0,s.m_id);
+//			    int p1=v.add(point::max(s[0][i][1][0],s[0][i][1][1]),0,s.m_id);
+//
+//		        ret.push_back(base_path(p0,p1));
+//			    ret.back().sid=s.m_id;
+//
+//            }
+//        }
+//    }
 
 /*
 
@@ -282,7 +338,7 @@ static std::vector<base_path> init_path(const sit_list&sites,vertex_list&v)
     printf("++++++++++++++++++++++++++++++++++++++++++++");
 	ret.erase(std::unique(ret.begin(),ret.end()),ret.end());
 	log_path(ret,v);
-    printf("++++++++++++++++++++++++++++++++++++++++++++");
+    printf("+++++++++++++++++nnnnn+++++++++++++++++++++++++++");
 
 	std::sort(ret.begin(),ret.end(),[&v](const base_path&p1,const base_path&p2){
 		double arg=p1.arg(v)-p2.arg(v);
@@ -383,6 +439,7 @@ static std::vector<base_path> init_path(const sit_list&sites,vertex_list&v)
 		point&p0=v[p[0]];
 		point&p1=v[p[1]];
 
+		//return p0.dist(p1)<0.1 || p0.empty() || p1.empty();
 		return p0.dist(p1)<0.1;
 	}),ret2.end());
 
@@ -429,6 +486,8 @@ static std::vector<base_path> init_path(const sit_list&sites,vertex_list&v)
 	return std::move(ret2);
 }
 
+
+
 #if 0
 struct ghash
 {
@@ -759,16 +818,18 @@ graph g_graph;
 
 }//namespace
 
-void card_path::init(const sit_list&sites)
+void card_path::init()
 {
     //Ensure only ont thread can init path.
 	int expect=0;
 	if(g_init_flag.compare_exchange_strong(expect,1))
 	{
-		vertex_list v_list;
-		v_list.add(point(0,0),0,-1);
-		std::vector<base_path> opath=init_path(sites,v_list);
-		g_graph.init(v_list,opath);
+		handle_path hp;
+		//std::vector<base_path> opath=init_path(sites,v_list);
+		sit_list::instance()->accept(hp);
+		std::vector<base_path> opath=init_path(hp.ret,hp.v);
+		
+		g_graph.init(hp.v,opath);
 
 		++g_init_flag;
 	}
@@ -831,12 +892,12 @@ void test_find_poss_path(const card_path&cp ,const point&from)
 
 int main()
 {
-	std::unique_ptr<sit_list> sites(new sit_list());
-	sites->load("data_reader_antenna.txt","path_tof.txt");
+//	std::unique_ptr<sit_list> sites(new sit_list());
+	sit_list::instance()->load("data_reader_antenna.txt","path_tof.txt");
 
 	card_path cp;
 
-	cp.init(*sites);
+	cp.init();
 #if 0
 	{
 		test_at_path(cp,point(4773.104654,-104.0887));

+ 1 - 1
card_path.h

@@ -12,7 +12,7 @@ struct card_path
     bool is_at_path(const point&pt) const;
 
     static card_path&inst();
-    static void init(const sit_list&sites);
+    static void init();
 };
 
 #endif

+ 12 - 4
client.cpp

@@ -2,12 +2,15 @@
 #include "log.h"
 #include "zio.h"
 #include "message_file.h"
+#include "thread"
+#include "chrono"
 
 int main()
 {
 	int sock=zio::build_stream();
 
 	if(zio::connect(sock,"127.0.0.1",4000))
+	//if(zio::connect(sock,"192.168.8.116",4000))
 	{
 		return -1;
 	}
@@ -18,7 +21,7 @@ int main()
 	int count=0x400+2;
 	char buf[8192];
 	uint64_t time;
-#if 1
+#if 0
 
 	for(int i=0;i<8000;i++)
 	{
@@ -38,16 +41,21 @@ int main()
 #else
 	message_file mf(stdin);
 	count=0;
+	uint64_t time_tmp=0;
 	while(len>0)
 	{
-		while((len=mf.get_line(&time,&buf[count],sizeof(buf)-count)))
+		//while((len=mf.get_line(&time,&buf[count],sizeof(buf)-count)))
 		{
+			std_info("......%lu",time);
 			count+=len;
 			if(count>1024)
 				break;
 		}
-
-		log_info("count=%d",count);
+		len=mf.get_line(&time,&buf[count],sizeof(buf)-count);
+		if(0==time_tmp)	
+		  time_tmp =time;
+		std::this_thread::sleep_for(std::chrono::milliseconds(time-time_tmp));
+		log_info("count=%d,time=%llu buf=%s",len,time,buf);
 		if(count!=zio::writev(sock,buf,count))
 			break;
 

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 31 - 408
config.log


+ 5 - 5
config.status

@@ -651,15 +651,15 @@ S["INSTALL_PROGRAM"]="${INSTALL}"
 S["target_alias"]=""
 S["host_alias"]=""
 S["build_alias"]=""
-S["LIBS"]="-lev "
+S["LIBS"]="-lzlog -lev "
 S["ECHO_T"]=""
 S["ECHO_N"]="-n"
 S["ECHO_C"]=""
 S["DEFS"]="-DPACKAGE_NAME=\\\"yals\\\" -DPACKAGE_TARNAME=\\\"yals\\\" -DPACKAGE_VERSION=\\\"1.0\\\" -DPACKAGE_STRING=\\\"yals\\ 1.0\\\" -DPACKAGE_BUGREPORT=\\\"BUG-REPORT-ADDRESS"\
-"\\\" -DPACKAGE_URL=\\\"\\\" -DPACKAGE=\\\"yals\\\" -DVERSION=\\\"1.0\\\" -DHAVE_LIBEV=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H="\
-"1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_FCNTL_H"\
-"=1 -DHAVE_NETINET_IN_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRING_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_UNISTD_H=1 -DHAVE__BOOL=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC="\
-"1 -DHAVE_STDLIB_H=1 -DHAVE_REALLOC=1 -DHAVE_INET_NTOA=1 -DHAVE_MEMSET=1 -DHAVE_SOCKET=1"
+"\\\" -DPACKAGE_URL=\\\"\\\" -DPACKAGE=\\\"yals\\\" -DVERSION=\\\"1.0\\\" -DHAVE_LIBEV=1 -DHAVE_LIBZLOG=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1"\
+" -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_ARPA_INET_H"\
+"=1 -DHAVE_FCNTL_H=1 -DHAVE_NETINET_IN_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRING_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_UNISTD_H=1 -DHAVE__BOOL=1 -DHAVE_STDLIB_H"\
+"=1 -DHAVE_MALLOC=1 -DHAVE_STDLIB_H=1 -DHAVE_REALLOC=1 -DHAVE_INET_NTOA=1 -DHAVE_MEMSET=1 -DHAVE_SOCKET=1"
 S["mandir"]="${datarootdir}/man"
 S["localedir"]="${datarootdir}/locale"
 S["libdir"]="${exec_prefix}/lib"

+ 0 - 1
log.h

@@ -1 +0,0 @@
-../dist/include/log.h

+ 10 - 6
main.cpp

@@ -1,9 +1,13 @@
 #include <log.h>
 #include <net-service.h>
-#include "IniFile.h"
 #include "db_api/CDBConnPool.h"
 #include "websocket/wsClientMgr.h"
 #include "websocket/wsTimerThread.h"
+
+#include "card.h"
+#include "ant.h"
+#include "card_path.h"
+
 #include <config_file.h>
 
 config_file config;
@@ -72,11 +76,11 @@ int main()
 	log_init("../etc/log.ini");
 	if(config.open("../etc/config.ini"))
 		return -1;
-
-	//init log sql websockt.
-//	Init_Setting is;
-//	is.init();
-
+	
+	log_info("herer..init from db...");
+	sit_list::instance()->load_from_db();
+	card_list::instance()->init_card_from_db();
+	card_path::init();
 	net_service mh;
 
 	int port=config.get("service.port",4000);

+ 2 - 1
message.cpp

@@ -1,6 +1,7 @@
 #include <math.h>
 #include "zstream.h"
 #include "message.h"
+#include "log.h"
 
 void message_locinfo::zero_this()
 {
@@ -17,7 +18,6 @@ void message_locinfo::load(zistream&is,bool tdoa)
 	m_card_type=b;
 	m_batty_status&=0xF;
 
-
 	//角度
 	is>>b;
 	if(m_card_type==1)
@@ -52,6 +52,7 @@ void message_locinfo::load(zistream&is,bool tdoa)
 	uint16_t sp1=0,sp2=0;
 	is>>sp1>>sp2;
 	m_rssi=10*log10(1.*sp1*(1<<17)/pow(sp2-64.,2))-121.74;
+	log_info("timestamp=%llu,type:%d,card_id:%d,ct:%d,status:%d,acc=%d,tof=%llu,ant_id:%d,spq=%d",m_time_stamp,m_card_type,m_card_id,m_card_ct,m_batty_status,m_acc,m_tof,m_ant_id,m_rssi);
 }
 
 void message_tdoasync::zero_this()

+ 15 - 7
net-service.cpp

@@ -10,7 +10,7 @@
 #include <log.h>
 #include <znet.h>
 #include <zstream.h>
-
+#include <sys/time.h>
 #include "worker.h"
 #include "tdoa_sync.h"
 #include "net-service.h"
@@ -31,13 +31,7 @@ net_service::~net_service()
 
 void net_service::on_message(std::shared_ptr<client> clt,const char*data,size_t len)
 {
-	//std::vector<char> v(data,data+len);
 	//clt->send(std::move(v));
-
-	//log_info("recv a message ,len=%d",len);
-	//logn_bin(1,"50ms .test",data,len);
-	//return;
-
 	logn_bin(1,"",data,len);//输出二进制日志
 
 	zistream is(data,len-2);
@@ -49,12 +43,26 @@ void net_service::on_message(std::shared_ptr<client> clt,const char*data,size_t
 			{
 				uint32_t site_id;
 				is>>site_id>>skip(12);
+				struct timeval tv;
+				gettimeofday(&tv,NULL);
+				uint64_t t = tv.tv_sec*1000 + tv.tv_usec/1000;
+				int index=0;
 				while(!is.eof())
 				{
+					uint64_t tstamp = t -1000 + 50 + index* 45;
+					index++;
 					task*t=task::alloc<message_locinfo>();
 					message_locinfo&m=t->body<message_locinfo>();
 					m.load(is,cmd==0x863b);
+					m.m_time_stamp=tstamp;
 					m.m_site_id=site_id;
+					if(m.m_card_id != 1222)
+					{
+					  log_error("----error cardid");
+					  continue;
+					}
+
+					std_info("....%llu",m.m_time_stamp);
 					t->m_cmd_code=cmd;
 					t->m_hash_id=m.m_card_id;
 					m_loc_worker->request(t);

+ 1 - 1
path_tof.txt

@@ -35,7 +35,7 @@
 317, 0, 5674.04, 379, 0, 5800.67, 417, 0, 0,NULL, -1
 318, 0, 4727, 89.7, 0, 6144.3, 523, 0, 0,NULL, -1
 320, 0, 4727, 89.7, 0,  6144.3, 523, 0, 0,NULL, -1
-402, 0, 4746.2, -110.8, 0,4746.2, -39.1, 0, 0,NULL, -1
+402, -1, 4746.2, -110.8, 0,4746.2, -39.1, 0, 0,NULL, -1
 501, 0, 2952, 73, 0, 2952, 181.85, 0, 0,NULL, -1
 504, 0, 2952, 114.6, 0, 2952, 226.85, 0, 0,NULL, -1
 505, 0, 2952, 75, 0,2952, 369.85, 0, 0,NULL, -1

+ 1 - 1
point.cpp

@@ -1,7 +1,7 @@
 #include "point.h"
 
 point::point() 
-	:x(0) ,y(0)
+	:x(0) ,y(0),z(0)
 {
 }
 

+ 14 - 6
select_tool.cpp

@@ -177,6 +177,7 @@ bool select_point_object::select_solution(const std::vector<point> &vp,const sit
 		m_d(0).inc_cl(10);
    }
    point pt = select_solution0(tvp,sit->m_scale);
+   std_info("-----select_solution0:x:%.2f,y:%.2f",pt.x,pt.y);
 	m_d(0).set(pt);
 	if(pt.empty())
 		return false;
@@ -190,6 +191,7 @@ bool select_point_object::select_solution(const std::vector<point> &vp,const sit
 
     //revise_by
     //
+	std_info("revise_by_history:::%llu",m_d(0).m_time);
     bool fg=revise_by_history(pt,sit,m_d(0).m_time);
     if(!card_path::inst().is_at_path(pt))
 	{
@@ -261,10 +263,12 @@ bool select_point_object::select_solution(const std::vector<point> &vp,const sit
 				double tk=(d0-d1)/(t0-t1), tb=d1-tk*t1;		//d1+(d0-d1)/(t0-t1)*(t-t1)
 				for(double ti=tbegin;ti<t0;ti=ti+1)
 				{
+					std_info("add ..seelct");
 					m_fitk.add(ti, tk*ti+tb);
 				}
 			}
 		}
+		m_fitk.add(m_last->m_time/1000.,m_begin->loc_dist(*m_last));
 
 		if(m_d.size()>1)
 		{
@@ -340,12 +344,14 @@ void select_point_object::remove_history()
 					double tk=(d0-d1)/(t0-t1), tb=d1-tk*t1;		//d1+(d0-d1)/(t0-t1)*(t-t1)
 					for(double ti=tbegin;ti<t0;ti=ti+1)
 					{
+						std_info("add remove..");
 						m_fitk.add(ti, tk*ti+tb);
 					}
 				}
 			}
 
 			dist=m_begin->loc_dist(m_d(i)[0]);
+						std_info("add remove..");
 			m_fitk.add(m_d(i).m_time/1000.,dist);
 
 			if(i==len)
@@ -360,13 +366,13 @@ void select_point_object::remove_history()
 }
 void select_point_object::save_k()
 {
+	std_info("save_k()...............");
 	const fit_result*fk=best_fit_raw(0,4);
 	if(!fk)
 	{
 		m_cur_fit.reset();
 		return;
 	}
-
 	m_cur_fit=*fk;
 
 	fit_result&r=m_cur_fit;
@@ -394,7 +400,7 @@ fit_result* select_point_object::best_fit_raw(int num_point,int start,int last)
 	last  =std::min(last,m_fitk.tool_size());
 	if(last==-1)
 		last=m_fitk.tool_size();
-
+	std_info("best_fit_raw :%d:%d",start,last);
 	for(int i=start;i<last;i++)
 	{
 		if(!m_fitk[i].is_valid())
@@ -425,13 +431,14 @@ loc_point select_tool_person_1::select_solution(const std::vector<point> vp,cons
     //select point.
     if(lm[0].tool_index() == 0)  
     {
-        m_spo = new person_point_filter(); 
+		if(m_spo==nullptr)
+			m_spo = new person_point_filter(); 
         lp=m_spo->select_solution_impl(vp,lm);
     }
     else if (lm[0].tool_index() == 2)
     {
         //for now..
-        m_spo = new person_point_filter(); 
+        //m_spo = new person_point_filter(); 
         lp=m_spo->select_solution_impl(vp,lm);
     }
     else
@@ -445,13 +452,14 @@ loc_point select_tool_car_1::select_solution(const std::vector<point> vp,const s
     //select point.
     if(lm[0].tool_index() == 0)  
     {
-        m_spo = new car_point_filter(); 
+		if(m_spo==nullptr)
+			m_spo = new car_point_filter(); 
         lp=m_spo->select_solution_impl(vp,lm);
     }
     else if (lm[0].tool_index() == 2)
     {
         //for now..
-        m_spo = new car_point_filter(); 
+        //m_spo = new car_point_filter(); 
         lp=m_spo->select_solution_impl(vp,lm);
     }
     else

+ 16 - 10
select_tool.h

@@ -140,7 +140,7 @@ struct person_point_filter:select_point_object
         return a;
     }
 
-    virtual bool revise_by_history(point & pt, const site*sit, int64_t m_time)
+    virtual bool revise_by_history(point & pt, const site*sit, int64_t timestamp)
     {
         point dstp = sit->get_dstp(pt);
         if(dstp.empty())
@@ -468,12 +468,13 @@ struct car_point_filter:select_point_object
 		return dist;
 	}
 
-    virtual bool revise_by_history(point & pt, const site*sit, int64_t m_time)
+    virtual bool revise_by_history(point & pt, const site*sit, int64_t timestamp)
     {
-        std_info("revise_____-before:%f,%f",pt.x,pt.y);
+        std_info("revise_____-before:%f,%f,%llu",pt.x,pt.y,timestamp);
         bool flag =false;
 		if(m_line.empty() || !m_line.contain(m_d(0),0.1))
 		{
+			std_info("m_line .empty() ......");
 			m_last_fit_valid = false;
 			m_last_fit_time_sec = 0;
 			m_last_fit_k = 0;
@@ -493,7 +494,7 @@ struct car_point_filter:select_point_object
 
 		// convert pt to distance
 		double dist = convert_pt_to_dist(pt, sit);
-		double m_time_sec = m_time / 1000.;	//second
+		double m_time_sec = timestamp / 1000.;	//second
 		//if(m_time_sec - m_last_fit_nearest_time_sec > 30)m_last_fit_valid = false;
 		if(m_time_sec - m_last_fit_time_sec > 60)m_last_fit_valid = false;
 
@@ -503,6 +504,10 @@ struct car_point_filter:select_point_object
 		// choose data by fit
 		const fit_result*fit=best_fit();
 		bool if_change_fit=false;
+		if(fit !=nullptr)
+		  std_info("fit != nullptr...m_time_sec:%f,fitK.x():%f",m_time_sec,m_fitk.x(0));
+		else 
+		  std_info("fit ==nullptr...");
 		if(fit!=nullptr && fit->ke<=1 && m_time_sec - m_fitk.x(0) <= 15 && fabs(fit->k) < m_pos_differ)
 		{							//printf("change fit time:%f,%f,%f\n",m_time_sec, fit->d.x(0), m_time_sec - fit->d.x(0));
 			
@@ -549,7 +554,7 @@ struct car_point_filter:select_point_object
 			// update acc
 			//m_accumulate_acc=0
 
-			printf("change line, k=%f,ke=%f\n",fit->k,fit->ke);
+			printf("change line------------, k=%f,ke=%f\n",fit->k,fit->ke);
 		}
 
 		// revise
@@ -558,6 +563,7 @@ struct car_point_filter:select_point_object
 							//estimate_dist, dist, m_last_fit_valid, m_time_sec - m_last_fit_time_sec);
 		if(m_last_fit_valid && m_time_sec - m_last_fit_time_sec < 20)
 		{
+			std_info("here ....m_time_sec:%llu,m_last_fit_time_sec:%llu",m_time_sec,m_last_fit_time_sec);
 			if(fabs(m_last_fit_k) > 0.5 && fabs(estimate_dist-dist)>m_fit_differ)
 				dist=estimate_dist;
 			else if(fabs(m_last_fit_k) <= 0.5 && fabs(estimate_dist-dist)>m_fit_differ * 2)
@@ -576,7 +582,7 @@ struct car_point_filter:select_point_object
 
 		// create the list
 		//if(m_accumulate_acc<-10)generate(mpt, sit,false); generate single point
-		if(m_last_fit_valid && m_time/1000. - m_last_fit_time_sec < 20 && fabs(m_last_fit_k) > 0.5)
+		if(m_last_fit_valid && timestamp/1000. - m_last_fit_time_sec < 20 && fabs(m_last_fit_k) > 0.5)
 			generate_list(mpt, sit, true);	//generate the whole list
 		else
 			generate_list(mpt, sit, false);	//generate single point
@@ -1066,22 +1072,22 @@ struct select_tool_manage
 {
    void create_tool(const std::string &s,std::shared_ptr<select_tool> &set,std::shared_ptr<smooth_tool> &smt)
    {
-        if(s.compare(std::string{"person1"}))
+        if(!s.compare(std::string{"person1"}))
         {
             set=std::make_shared<select_tool_person_1>();
             smt=std::make_shared<smooth_tool_person_1>(set);
         }
-        else if(s.compare(std::string{"person2"}))
+        else if(!s.compare(std::string{"person2"}))
         {
             set=std::make_shared<select_tool_person_2>();
             smt=std::make_shared<smooth_tool_person_1>(set);
         }
-        else if(s.compare(std::string{"car1"}))
+        else if(!s.compare(std::string{"car1"}))
         {
             set=std::make_shared<select_tool_car_1>();
             smt=std::make_shared<smooth_tool_car_1>(set);
         }
-        else if(s.compare(std::string{"drivingface1"}))
+        else if(!s.compare(std::string{"drivingface1"}))
         {
             set=std::make_shared<select_tool_drivingface_car_1>();
             smt=std::make_shared<smooth_tool_drivingface_car_1>(set);

+ 6 - 4
site_area.cpp

@@ -1,6 +1,8 @@
 
 #include "site_area.h"
 
+#include "card.h"
+
 //每张卡包含这样一个对象,保存最后一个分站区域
 //1、记录卡进出分站的时间,地点
 //2、用于考勤
@@ -11,7 +13,7 @@ site_area_hover::site_area_hover()
 {
 }
 
-void site_area_hover::on_point(int card_id,int site_id,const point*pt)
+void site_area_hover::on_point(int64_t card_id,int site_id,const point*pt)
 {
 	if(pt!=nullptr)
 	{
@@ -26,7 +28,7 @@ void site_area_hover::on_point(int card_id,int site_id,const point*pt)
 			return;
 
 		//离开现有分站处理,记录现有分站的进出时间和地点
-		leave_site(card_id,site_id);
+        leave_site(card_id,m_site_id);
 
 		//进入分站覆盖区域处理,考勤
 		enter_site(card_id,site_id);
@@ -38,13 +40,13 @@ void site_area_hover::on_point(int card_id,int site_id,const point*pt)
 	}
 }
 
-void site_area_hover::enter_site(int card_id,int enter_site)
+void site_area_hover::enter_site(int64_t card_id,int enter_site)
 {
 
 
 }
 
-void site_area_hover::leave_site(int card_id,int enter_site)
+void site_area_hover::leave_site(int64_t card_id,int enter_site)
 {
 
 

+ 3 - 3
site_area.h

@@ -10,10 +10,10 @@ struct site_area_hover
 	//调用时机:
 	//1、tof一维收到第一个数据点时,以pt=0调用
 	//2、数据点解析完毕之后调用
-	void on_point(int card_id,int site_id,const point*pt);
+    void on_point(int64_t card_id,int site_id,const point*pt);
 private:
-	void enter_site(int card_id,int enter_site);
-	void leave_site(int card_id,int enter_site);
+    void enter_site(int64_t card_id,int enter_site);
+    void leave_site(int64_t card_id,int enter_site);
 
 	int    m_site_id;
 	time_t m_enter_time,m_last_time;


+ 13 - 11
visit.cpp

@@ -17,11 +17,7 @@ struct card_list:single_base<card_list,int,std::shared_ptr<card>>
 		for(std::pair<int,std::shared_ptr<card>> me:m_map)
 		{
 			v.visit(me.second);
-			while(true)
-			{
-				printf("%p--xxxxxx---\n",this);
-				std::this_thread::sleep_for(std::chrono::milliseconds(500));
-			}
+			printf("====\n");
 		}
 	}
 };
@@ -30,7 +26,7 @@ struct visit_log:visitor<std::shared_ptr<card>>
 {
 	bool visit(std::shared_ptr<card> c)
 	{
-		printf("%d\n",c->id);
+		printf("vist :::::::%d\n",c->id);
 		return true;
 	}
 };
@@ -51,12 +47,12 @@ void run()
 int main()
 {
 	std::vector<std::shared_ptr<card_list>> v;
-	std::thread th(run);
+	//std::thread th(run);
 	for(int i=0;i<100;i++)
 	{
 		card_list::instance()->add(i,std::make_shared<card>(i));//每次生成一个对象
 		printf("%d  %p\n",i,card_list::instance().get());
-	//	v.push_back(card_list::instance());
+		v.push_back(card_list::instance());
 	}
 
 	for(int i=0;i<100;i++)
@@ -64,9 +60,15 @@ int main()
 	//	printf("%d  %p\n",i,v[i].get());
 	}
 
-	th.join();
-	//card_list::instance()->accept(vl);
-
+	//th.join();
+	visit_log vl;
+	card_list::instance()->accept(vl);
+//	printf("%p",card_list::instance()->get(5));
+	auto x = card_list::instance()->get(100);
+	if(x!=nullptr)
+	  printf("...........id:%d\n",x->id);
+	else
+	  printf("nullptr...\n");
 	return 0;
 }
 

+ 15 - 0
write-copy.h

@@ -11,6 +11,13 @@
 template<typename T,typename K,typename V> 
 struct write_copy_base:acceptor<V>
 {
+	void accept(visitor<V> &v)
+	{
+		for(std::pair<K,V> me:m_map)
+		{
+			v.visit(me.second);
+		}
+	}
 	std::unordered_map<K,V> m_map;
 	write_copy_base()
 	{
@@ -21,6 +28,14 @@ struct write_copy_base:acceptor<V>
 	{
 		return m_map[k];
 	}
+	V	get(K k)
+	{
+		auto serch = m_map.find(k);
+		if(serch != m_map.end())
+		  return serch->second;
+		else
+		  return nullptr;
+	}
 
 	std::shared_ptr<T> clone()const
 	{

+ 0 - 1
znet.cpp

@@ -18,7 +18,6 @@
 #include <worker.h>
 
 #include "config_file.h"
-
 extern config_file config;
 struct client_ex:client
 {