eis/inc/zlib/MemCoil.h

120 lines
2.0 KiB
C++

/*********************************************************************
*
* file: MemCoil.h
*
* copyright: Shanghai Baosight Software Co., Ltd.
*
* Version history
* 1.0 2020-02-16 zoufuzhou create
*
*********************************************************************/
#ifndef _H_MEM_COIL_H
#define _H_MEM_COIL_H
#include <zlib/coilDef.h>
#include <zlib/MemTable.hpp>
using namespace baosight;
class CMemCoil
{
public:
CMemCoil();
public:
~CMemCoil(void);
public:
void print(int pos);
TRK_COIL* operator[](int pos);
TRK_COIL* operator()(int ti);
TRK_COIL* isNull();
/**********
*coilid: entry coil id or exit coil id
*mode: ALL:operator all track coil ,CENTER:operator center coil
**********/
TRK_COIL* operator()(const string& coilid,const string& mode = "ALL");
//load coil by pos
int load(int pos,const string& coilid);
//load coil by pos
int load(int pos,PDI* pdi);
//unload coil by pos
int unload(int pos);
//tr on
int trOn(int pos,int ti);
//coil book to center
int book(int pos);
//cancle book
int unbook(int pos);
//tail
int tail(int pos);
//move coil from srcpos to distpos
int move(int from,int to);
//swap srcpos and distpos
int swap(int from,int to);
//move step by step direction: 0:move forward, 1:move back
int stepmove(int from,int to,int direction = 0);
//setdata to quipment
int setdata(int pos);
//match pdo
int match(PDO* pdo);
// Match mode
// bMatchLast:true Match the latest
// bMatchLast:false Match the earliest, the finished extid is empty
int match(PDO* pdo, bool bMatchLast);
public:
TRK_COIL* getCenterCoil(int ti);
int setPDI(PDI* pdi);
PDI* getPDI(const string& entId);
PDO* getPDO(const string& extId);
PDO* getPDO(int i);
GLB_VAR* getGlbVar(void);
private:
// allot TI
int allotTI(void);
private:
TRK_COIL ptr_null;
TRK_COILS* p_trk;
GLB_VAR* p_var;
CMemTable<PDI>* pt_pdi;
CMemTable<PDO>* pt_pdo;
CMemTable<SET>* pt_set;
};
#endif