/* Copyright (c) 20011 Hovanes Egiyan Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _BaseIUVirtBoard_HH_ #define _BaseIUVirtBoard_HH_ extern "C" { #include } ; #include #include #include #include #include #include #include "MtxLock.hh" #include "BaseIUAlarmable.hh" #include "BaseIUMessage.hh" #include "BaseIUCommand.hh" #include "BaseIUVirtPar.hh" #include "BaseIUParADC.hh" #include "BaseIUParStatus.hh" #include "BaseIUDevice.hh" #include "BaseIUModule.hh" using namespace std; typedef void (*ReadReqPtr)(BaseIUDevice&, string); //! BaseIUVirtBoard class to contain information about a CAN-bus remote board //! on a bus. The Sync method of this class will be called to synchronize //! with the hardware. class BaseIUVirtBoard: public BaseIUModule { protected: //! First key is the type, second key is the name of the parameter std::map > bvbPar; //! Initialize parameters for the board virtual void InitParameters() = 0; public: //! Default constructor BaseIUVirtBoard(); //! Main constructor for the board object. The first argument is actually //! expected to be reference to the bus (which is derived from BaseIUModule) //! The second argument is the address of the module, and it is sent separately //! because busses do not carry address (set to 0). BaseIUVirtBoard(const BaseIUModule& module, int address); //! Copy constructor BaseIUVirtBoard(const BaseIUVirtBoard& board); //! Method to synch with the hardware, but a single parameter virtual bool SyncOnePar(BaseIUVirtPar& par, bool dir = 0); //! Destructor virtual ~BaseIUVirtBoard(); //! Assignment operator virtual BaseIUVirtBoard& operator=(const BaseIUVirtBoard& board); //! Get the pointer to the parameter with a given type and name virtual BaseIUVirtPar* GetParameter(string type, string name ); //! Method to synch with the hardware. Should not be used for now virtual bool Sync(bool dir = 0); // Find the given par in the FIFO. If found, return true. If not, return false. virtual bool FindOnePar( BaseIUVirtPar& fakePar ) ; virtual inline int GetAddress() { MtxLock scopeLock(bmMutex); return bmAddress; } virtual inline int SetAddress(const int addr) { MtxLock scopeLock(bmMutex); return (bmAddress = addr); } virtual inline map >& GetParMap() { return bvbPar; } }; #endif // _BaseIUVirtBoard_HH_