SDC C-Project CF Review 프로그램
LYW
2021-09-23 c08b701c90c8998b241c82638d5c488e03238214
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#pragma once
#include <vector>
 
#include "CHThreadPools/WorkThreadPools.h"
 
#define MAX_MOTION_DATA_COUNT    100
 
typedef std::vector<double>                VectorDouble;
typedef std::vector<double>::iterator    VectorDoubleIt;
 
enum MotorThreadData {    ThreadDataType_AxisMotionEnd=0, ThreadDataType_GantryMotionEnd, ThreadDataType_ThetaMotionEnd ,
                        ThreadDataType_AxisManualGo, ThreadDataType_JogGo, ThreadDataType_GantryGo, ThreadDataType_AutoGo,ThreadDataType_WsiAutoGo };
 
union UThreadData
{
    int        nValue;
    DWORD    dwValue;
    double    dValue;
};
 
class CMotionData
{
public:
    CMotionData()
    {
        nType    = -1;
        nIndex    = -1;
        memset(uData, 0, sizeof(uData));
 
        vecDoubleX.clear();
        vecDoubleY.clear();
    }
 
    int                nType;
    int                nIndex;
    VectorDouble    vecDoubleX;
    VectorDouble    vecDoubleY;
    UThreadData        uData[MAX_MOTION_DATA_COUNT];
};
 
class CMotionThreadData : public CWorkThreadData
{
public:
    CMotionThreadData(PVOID pPtr) : CWorkThreadData(pPtr)
    {
 
    }
    virtual ~CMotionThreadData()
    {
 
    }
 
    CMotionData motionData;
};
 
interface IMotionThread2Parent
{
    virtual void IMT2P_RunThreadProcess(const CMotionData& motionData) = 0;
};
 
class CMotionThread : public CWorkThreadPools
{
public:
    CMotionThread(IMotionThread2Parent* pMT2P, int nThreadCount=1);
    virtual ~CMotionThread(void);
    BOOL    AddThreadData(const CMotionData& data);
 
protected:
    virtual void WorkThreadProcess(PVOID pParameter);
 
protected:
    IMotionThread2Parent*    m_pMT2P;
};