LAPTOP-SNT8I5JK\Boounion
2025-08-22 2a21061d88d5533065dc57cfae0b1f2c1952e06f
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#include "stdafx.h"
#include "CStep.h"
 
 
namespace SERVO {
 
    CStep::CStep()
    {
        m_nID = 0;
        m_pCclink = nullptr;
        InitializeCriticalSection(&m_criticalSection);
    }
 
    CStep::~CStep()
    {
        DeleteCriticalSection(&m_criticalSection);
    }
 
    void CStep::setCcLink(CCCLinkIEControl* pCcLink)
    {
        m_pCclink = pCcLink;
    }
 
    void CStep::setEquipment(CEquipment* pEquipment)
    {
        m_pEquipment = pEquipment;
    }
 
    CEquipment* CStep::getEquipment()
    {
        return m_pEquipment;
    }
 
    void CStep::setID(int id)
    {
        m_nID = id;
    }
 
    int CStep::getID()
    {
        return m_nID;
    }
 
    void CStep::setName(const char* pszName)
    {
        m_strName = pszName;
    }
 
    std::string& CStep::getName()
    {
        return m_strName;
    }
 
    void CStep::getAttributeVector(CAttributeVector& attrubutes)
    {
        unsigned int weight = 1;
        attrubutes.clear();
        attrubutes.addAttribute(new CAttribute("Network", 
            std::to_string(m_station.nNetNo).c_str(), "", weight++));
        attrubutes.addAttribute(new CAttribute("Station",
            std::to_string(m_station.nStNo).c_str(), "", weight++));
 
        auto as = m_attributeVector.getAttributes();
        for (auto item : as) {
            attrubutes.addAttribute(new CAttribute(item->getName().c_str(),
                item->getValue().c_str(), item->getDescription().c_str(), item->getWeight()));
        }
    }
 
    CAttributeVector& CStep::attributeVector()
    {
        return m_attributeVector;
    }
 
    void CStep::init()
    {
 
    }
 
    void CStep::term()
    {
 
    }
 
    void CStep::setProp(const char* pszKey, void* pValue)
    {
        m_mapProp[pszKey] = pValue;
    }
 
    void* CStep::getProp(const char* pszKey)
    {
        auto iter = m_mapProp.find(pszKey);
        if (iter == m_mapProp.end()) return nullptr;
        return iter->second;
    }
 
    void CStep::addAttribute(CAttribute* pAttribute)
    {
        // Ìí¼Óattributeʱ£¬ÒªÇ°É¾³ý´æÔÚµÄͬÃûµÄattribute
        m_attributeVector.addAttribute(pAttribute, TRUE);
    }
 
    void CStep::addAttributeVector(CAttributeVector& attributeVector)
    {
        // Ìí¼Óattributeʱ£¬ÒªÇ°É¾³ý´æÔÚµÄͬÃûµÄattribute
        std::vector<CAttribute*>& srcs = attributeVector.getAttributes();
        auto it = srcs.begin();
        while (it != srcs.end()) {
            BOOL bAdd = m_attributeVector.addAttribute((*it), TRUE);
            if (bAdd) {
                it = srcs.erase(it);
            }
            else {
                ++it;
            }
        }
    }
 
    void CStep::convertString(const char* pszBuffer, int size, std::string& strOut)
    {
        strOut.clear();
        int nLength = 0;
        for (int i = 0; i < size; i++) {
            if (pszBuffer[i] == '\0') break;
            nLength++;
        }
        if (nLength > 0) {
            strOut = std::string(pszBuffer, nLength);
        }
    }
}