// // BROOKS CHASSIS CLASS // Software Library for Linux // // // Purpose: class for Brooks0254 MFC control chassis // Date: Apri 25, 2011 // Author: Hovanes Egiyan // // // #ifndef _Brooks0254Chassis_ #define _Brooks0254Chassis_ #include #include #include #include #include #include #include "Brooks0254Module.hh" #include "Brooks0254BasePar.hh" #include "Brooks0254Card.hh" using namespace std; //! Brooks0254Chassis class to contain information about the //! whole Brooks0254 module state. It contains an STL vector with //! addresses of all cards belonging to this chassis. Each object is //! supposed to be constructed in a new thread and its Sync() method //! should be called periodilcally to synchronize the parameters in //! the object of this class and the corresponding hardware module. //! This class inherits from Brooks0254Module class, therefore it //! contains the pointer to the serial port object. The port objects //! are created in the constructor of this class. class Brooks0254Chassis : virtual public Brooks0254Module { protected: //! Communication status flag bool bcCommStatus; //! Pointers to MFC card objects vector bcCard; //! Pointers to the global parameters for this chassis map bcPar; //! Method to check is the serial communication is OK bool CommIsOK(); public: static int bcDummyInt; //! Maximum number of cards in Brook0254 chassis. static const unsigned bcCardMax; //! Main constructor for port # portID, with an Brooks0254 address //! addr and device filename devName Brooks0254Chassis( unsigned portID, unsigned addr, string devName ); //! Copy constructor Brooks0254Chassis( Brooks0254Chassis& chassis ); //! Destructor ~Brooks0254Chassis(); //! Copy operator Brooks0254Chassis& operator=( Brooks0254Chassis& chassis ); //! Method to synchronize the information in the Brooks0254 hardware //! and the in the corresponding object in this class. void Sync( bool dir = 0 ); //! Set Batch delivery mode. No continuous readback is available int SetBatchMode( int mode ) ; //! Method to return the communication status inline bool GetCommStatus() { MtxLock scopeLock( bmMutex ); return bcCommStatus; } //! Method to return address of the STL vector containing the addresses of the //! objects cooresponding to the cards in this chassis. inline vector GetCardVector() { MtxLock scopeLock( bmMutex ); return bcCard; } //! Method to return the pointer to the object corresponding to the //! card number carNum in this chassis. inline Brooks0254Card* GetCard( int cardNum ) { MtxLock scopeLock( bmMutex ); return bcCard[cardNum]; } //! Return pointer to the parameter with parameter type parID Brooks0254BasePar* GetPar( Brooks0254ParID& parID ) ; }; #endif