From 1fd49a571338b6c946bb05dcdf59ec1468df5c50 Mon Sep 17 00:00:00 2001 From: SWK <sungwk82@diteam.co.kr> Date: 목, 22 12월 2022 12:31:43 +0900 Subject: [PATCH] ongoing50 #4403 CF AOI Reveiw TACT 지연 개선 1. 일정 시간 유지 신호 처리 시 동기화로 인한 불합리 개선 - 일정 시간 유지 필요 시 스래드풀 작업큐를 이용하여 루프처리 방식으로 변경 - 유지 신호 처리 중 출력 신호 발생 시 작업큐에 등록하여 유지 신호와 결합하여 출력 처리 2. FDC 보고 항목 중 SW 버전 체크 루프 불합리 개선 - 프로그램 시작 시 연동 프로그램 버전 체크 간 실행되지 않는 프로그램이 있는 경우 무한 루프 발생 - 무한 루프로 인한 CPU 점유 상승->루프 중간 Sleep추가 및 코드 간소화 3. 로그 메시지에 시간 ms단위 추가(황만수SM 작업 내역 병합) --- ReviewHistory/include/akSTL/akQueueCircle.h | 151 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 151 insertions(+), 0 deletions(-) diff --git a/ReviewHistory/include/akSTL/akQueueCircle.h b/ReviewHistory/include/akSTL/akQueueCircle.h new file mode 100644 index 0000000..c0fb42a --- /dev/null +++ b/ReviewHistory/include/akSTL/akQueueCircle.h @@ -0,0 +1,151 @@ +#pragma once + + +#include "akSTLLinker.h" + + template <typename T> + class CakQueueCircle + { + public: + CakQueueCircle(); + ~CakQueueCircle(); + + + void clear(); //메모리 삭제는 안됨 + void setMemSize(unsigned int memsize); //memsize가 0일때 메모리 삭제 + + void pushData(T point); + void setData( unsigned int nindex , T point ); + void getData(T* pPointBuffer, unsigned int nBufferLength); + + int size(){return m_nPointNum;}; + + T& operator [](unsigned int nindex); + CakQueueCircle& operator= (CakQueueCircle& traj); + + //static unsigned int s_TrajectorySize; + + + //가능하면 아래의 멤버 변수에 직접 수정은 하지 말것!! + public: + int m_nMemSize; //확보 메모리 사이즈 + int m_nPointIndex; //현재 인덱스 + int m_nPointNum; //현재 입력된 Point 갯수 + T* m_pPoints; //데이터 변수 + public: + unsigned long m_nPushCount; + }; + + + template <typename T> + CakQueueCircle<T>::CakQueueCircle(void) + { + m_pPoints = NULL; + m_nMemSize = 0; + m_nPushCount = 0; + + clear(); + setMemSize(100); + }; + + + template <typename T> + CakQueueCircle<T>::~CakQueueCircle(void) + { + setMemSize(0); + }; + + template <typename T> + void CakQueueCircle<T>::clear() //메모리 삭제는 안됨 + { + m_nMemSize; //확보 메모리 사이즈 + m_nPointIndex = -1; //현재 인덱스 + m_nPointNum = 0; //현재 입력된 Point 갯수 + //m_pPoints; //데이터 변수 + m_nPushCount = 0; + } + + template <typename T> + void CakQueueCircle<T>::setMemSize(unsigned int memsize) //memsize가 0일때 메모리 삭제 + { + //clear + if(m_pPoints != NULL) + { + clear(); + m_nMemSize = 0; + delete [] m_pPoints; + m_pPoints = NULL; + } + + if(memsize > 0) + { + m_nMemSize = memsize; + + m_pPoints = new T [m_nMemSize]; + } + + } + + template <typename T> + void CakQueueCircle<T>::pushData(T point) + { + m_nPointIndex++; + if(m_nPointIndex >= m_nMemSize) + { + m_nPointIndex = 0; + } + + m_nPointNum++; + if(m_nPointNum >= m_nMemSize) + { + m_nPointNum = m_nMemSize; + } + + m_pPoints[m_nPointIndex] = point; + m_nPushCount++; + } + + template <typename T> + void CakQueueCircle<T>::setData( unsigned int nindex , T point ) + { + int pointindex = m_nPointIndex-nindex; + + if(pointindex<0) pointindex = m_nPointNum + pointindex; + + m_pPoints[pointindex] = point; + } + + template <typename T> + T& CakQueueCircle<T>::operator[]( unsigned int nindex ) + { + int pointindex = m_nPointIndex-nindex; + + if(pointindex<0) pointindex = m_nPointNum + pointindex; + + return m_pPoints[pointindex]; + } + + template <typename T> + CakQueueCircle<T>& CakQueueCircle<T>::operator=( CakQueueCircle<T>& queuecircle ) + { + if(m_nMemSize != queuecircle.m_nMemSize) + { + if(m_pPoints) + { + delete [] m_pPoints; + } + + m_pPoints = new T[queuecircle.m_nMemSize]; + } + + + m_nMemSize = queuecircle.m_nMemSize; + m_nPointIndex = queuecircle.m_nPointIndex; + m_nPointNum = queuecircle.m_nPointNum; + + memcpy(m_pPoints, queuecircle.m_pPoints, sizeof(T)*queuecircle.m_nMemSize); + + + + return *this; + } \ No newline at end of file -- Gitblit v1.9.3