From 12d987a0e43a8dc014b734cf94885aff6272a1ab Mon Sep 17 00:00:00 2001
From: wangzhengquan <wangzhengquan85@126.com>
Date: 星期四, 17 九月 2020 15:45:31 +0800
Subject: [PATCH] update

---
 /dev/null |   60 ------------------------------------------------------------
 1 files changed, 0 insertions(+), 60 deletions(-)

diff --git a/basic_pack/README.mk b/basic_pack/README.mk
deleted file mode 100644
index e69de29..0000000
--- a/basic_pack/README.mk
+++ /dev/null
diff --git a/basic_pack/include/IndirectAlg.h b/basic_pack/include/IndirectAlg.h
deleted file mode 100644
index 5d9beba..0000000
--- a/basic_pack/include/IndirectAlg.h
+++ /dev/null
@@ -1,52 +0,0 @@
-#ifndef __USG_INDIRECTALG_H__
-#define __USG_INDIRECTALG_H__
-#include "usg_common.h"
-#include "graph.h"
-struct Record
-{
-    std::string id;
-    time_t timestamp;
-    Point coordinate;
-};
-
-struct Status;
-
-class IndirectAlg {
-
-
-    Figure frame;
-    //閫嗚鎸佺画鏃堕棿锛岃瓒呰繃杩欎釜鏃堕棿鎵嶇畻閫嗚
-    time_t keepTime;
-    // 浠h〃姝g‘琛岃蛋鏂瑰悜鐨勫悜閲�
-    Vector2 direction;
-    // 鐘舵�佺紦瀛�
-    std::map<std::string, Status *> statusMap;
-
-    std::atomic<bool> mterminate;
-    std::thread mthread;
-    void  threadRoutine();
-   
-public:
-    
-    IndirectAlg();
-    IndirectAlg(const std::initializer_list<Edge> & edges, const time_t & _keepTime, const Vector2 & _direction);
-    /**
-     * @points  缁勬垚瑙傛祴鍖哄煙鐨勫郊姝ょ浉閭荤殑鐐�
-     * @_keepTime 淇濇寔鏃堕棿
-     * @_direction 姝g‘琛岃繘鐨勬柟鍚戞柟鍚�
-     */
-    IndirectAlg(const std::initializer_list<Point> & points, const time_t & _keepTime, const Vector2 & _direction);
-
-    ~IndirectAlg();
-
-    void printRecord(int tag, Record &record);
-    /**
-     * 鏄惁閫嗚
-    */
-    bool isRetrograde(Record &record);
-
-
-
-};
-
-#endif
\ No newline at end of file
diff --git a/basic_pack/include/graph.h b/basic_pack/include/graph.h
deleted file mode 100644
index 4d35724..0000000
--- a/basic_pack/include/graph.h
+++ /dev/null
@@ -1,65 +0,0 @@
-#ifndef __USG_GRAPH_H__
-#define __USG_GRAPH_H__
-
-#include "usg_common.h"
-
-struct Point { 
-//public:
-    double x;
-    double y; 
-
-    //Point(const double _x =0, const double _y =0) : x(_x), y(_y) {}
-};
-
-//骞抽潰鍚戦噺
-struct Vector2
-{
-    double x;
-    double y;
-    
-};
-
-
-class Edge {
-public:
-    const Point a, b;
-    /**
-     * 鏄惁鐩镐氦
-    */
-    bool isCorss(const Point& p) const;
-};
- 
-
- 
-
-class Figure {
-    //const string  name;
-    std::vector<Edge> edges;
-
-public:
-    Figure();
-    //Figure(const std::initializer_list<Edge> & _edges);
-    Figure(const std::vector<Edge> & _edges);
-    Figure & operator=(Figure && f);       // move assignment
-    bool contains(const Point& p) const;
-     
-};
-
-
-
-
- // 杩斿洖涓や釜鍚戦噺澶硅鐨刢os鍊�, cos灏忎簬0鍗充袱涓悜閲忕殑澶硅澶т簬90搴�
-static inline double getVector2Angle(const Vector2 & a, const Vector2 & b) {
-    double doc_product =  a.x * b.x + a.y * b.y;
-    double ma = sqrt(a.x * a.x + a.y * a.y);
-    double mb = sqrt(b.x * b.x + b.y * b.y);
-    double cos = doc_product / (ma * mb);
-    return cos;
-}
-
-// 璁$畻a鎸囧悜b鐨勫悜閲�
-static inline Vector2 getVecor2(const Point &a, const Point &b) {
-    return {b.x - a.x, b.y - a.y};
-}
-
-#endif
diff --git a/basic_pack/include/usg_common.h b/basic_pack/include/usg_common.h
deleted file mode 100644
index ec6c404..0000000
--- a/basic_pack/include/usg_common.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Our own header, to be included before all standard system headers.
- */
-
-#ifndef __USG_COMMON_H__
-#define __USG_COMMON_H__
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <unistd.h>
-#include <string.h>
-#include <ctype.h>
-#include <setjmp.h>
-#include <signal.h>
-#include <dirent.h>
-#include <time.h>
-#include <sched.h>
-
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/stat.h>
-#include <sys/sem.h>
-#include <sys/shm.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-#include <errno.h>
-#include <math.h>
-#include <pthread.h>
-#include <semaphore.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-/*
-define int8_t uint8_t int16_t uint16_t int32_t uint32_t int64_t uint64_t
-*/
-#include <stdint.h>
-
-
-
-//c++ header
-
-#include <iostream>
-#include <string>
-#include <cstdlib>
-#include <atomic>
-#include <algorithm>
-#include <iomanip>
-#include <limits>
-#include <map>
-#include <initializer_list>
-#include <vector>
-#include <thread>
-
-
-
-
-/* Our own error-handling functions */
-
-void err_exit(int error, const char *fmt, ...);
-void err_msg(int error, const char *fmt, ...);
-
-static inline int 
-itoa(int num, char *str) 
-{
-	 return sprintf(str, "%d", num); 
-
-}
-
-static inline int 
-ftoa(float num, char *str) 
-{
-	 return sprintf(str, "%f", num); 
-
-}
-#endif
diff --git a/basic_pack/include/usg_typedef.h b/basic_pack/include/usg_typedef.h
deleted file mode 100644
index 7976c59..0000000
--- a/basic_pack/include/usg_typedef.h
+++ /dev/null
@@ -1,52 +0,0 @@
-#ifndef _USG_TYPEDEF_H__
-#define _USG_TYPEDEF_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/// @brief Compare And Swap
-///        If the current value of *a_ptr is a_oldVal, then write a_newVal into *a_ptr
-/// @return true if the comparison is successful and a_newVal was written
-#define CAS(a_ptr, a_oldVal, a_newVal) __sync_bool_compare_and_swap(a_ptr, a_oldVal, a_newVal)
-
-#if ! defined(__FreeBSD__) && ! defined(__OpenBSD__) && \
-                ! defined(__sgi) && ! defined(__APPLE__)
-                /* Some implementations already declare this union */
-
-union semun {                   /* Used in calls to semctl() */
-    int                 val;
-    struct semid_ds *   buf;
-    unsigned short *    array;
-#if defined(__linux__)
-    struct seminfo *    __buf;
-#endif
-};
-
-#endif
-
-
-/* Default file permissions are DEF_MODE & ~DEF_UMASK */
-#define DEF_MODE   S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH
-#define DEF_UMASK  S_IWGRP|S_IWOTH
-/*
- * Default file access permissions for new files.
- */
-#define FILE_MODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)
-
-/*
- * Default permissions for new directories.
- */
-#define DIR_MODE  (FILE_MODE | S_IXUSR | S_IXGRP | S_IXOTH)
-
-
-#define min(a,b)  ((a) < (b) ? (a) : (b))
-#define max(a,b)  ((a) > (b) ? (a) : (b))
-
- 
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif  /* #ifndef  _USG_TYPEDEF_H__ */
diff --git a/basic_pack/test_right_walk2.c b/basic_pack/test_right_walk2.c
deleted file mode 100644
index a6504fc..0000000
--- a/basic_pack/test_right_walk2.c
+++ /dev/null
@@ -1,60 +0,0 @@
-#include <usg_common.h>        /* cos */
-#include <graph.h>
-#include <IndirectAlg.h>
-using namespace std;
-
-int test2() {
-    // IndirectAlg indirectAlg({  {{0.0, 0.0}, {1000.0, 0.0}}, {{1000.0, 0.0}, {1000.0, 1000.0}}, {{1000.0, 1000.0}, {0.0, 1000.0}}, {{0.0, 1000.0}, {0.0, 0.0}} }, 5, {1, 1});
-    /**
-     * 绗竴涓弬鏁癅points  缁勬垚瑙傛祴鍖哄煙鐨勫郊姝ょ浉閭荤殑鐐�
-     * 绗簩涓弬鏁癅_keepTime 淇濇寔鏃堕棿
-     * 绗笁涓弬鏁癅_direction 姝g‘琛岃繘鐨勬柟鍚戞柟鍚�
-     */
-    IndirectAlg indirectAlg((std::initializer_list<Point>){{0.0, 0.0}, {1000.0, 0.0},  {1000.0, 1000.0}, {0.0, 1000.0} }, 5, {1, 1});
-    
-    int i = 0;
-    // time_t start_time;
-    srand((unsigned) time(0));
-
-    double rx, ry;
-    bool isRetrograde;
-    //璧风偣
-    Point start = {0, 0};
-    //浼犲叆鐨勬祦鏁版嵁璁板綍淇℃伅Record 
-    Record record;
-    record.id = 1; //鐩爣ID 
-    record.timestamp = time(0); //鏃堕棿鎴�
-    record.coordinate = start; // 鍧愭爣
-    // time(&start_time);
-    //鍒ゆ柇鏄惁閫嗚
-    while(!(isRetrograde = indirectAlg.isRetrograde(record)) ) {
-        rx = ((double)(rand()%10))/100000;
-        ry = ((double)(rand()%10))/100000;
-
-        //std::cout << timestamp << ":" <<  << "isRetrograde" << isRetrograde;
-       // err_msg(0, "%ld : {%f, %f}  %d\n", record.timestamp, record.coordinate.x, record.coordinate.y, isRetrograde);
-        record.timestamp = time(0);
-        
-        //if (difftime(time(0), start_time) > 1)
-        if (i > 10)
-        {
-            record.coordinate = {record.coordinate.x - rx , record.coordinate.y - ry};
-        } else {
-            record.coordinate = {record.coordinate.x + rx , record.coordinate.y + ry};
-        }
-
-        if (i > 100)
-            break;
-
-        sleep(1);
-        i++;
-    }
-    printf("return %ld : {%f, %f}  %d\n", record.timestamp, record.coordinate.x, record.coordinate.y, isRetrograde);
-    return 0;
-}
-
-
-int main() {
-    test2();
-
-}

--
Gitblit v1.8.0