Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

FeeAckInfo.hpp

00001 #ifndef ZTT_DCS_FEE_ACK_INFO_HPP
00002 #define ZTT_DCS_FEE_ACK_INFO_HPP
00003 
00004 #include "FeeInfo.hpp"
00005 #include "ConfigureFeeCom.hpp"
00006 #include "ControlFero.hpp"
00007 #include "ConfigureFero.hpp"
00008 #include <boost/shared_ptr.hpp>
00009 
00010 namespace ztt { namespace dcs {
00011 
00012         
00013 
00017 #define FEE_ACK_NO_LINK "No Link"
00018 
00021 #define FEE_ACK_NO_LINK_SIZE 7
00022 
00023 
00024 /*
00025  * The area -70 to -79 is especially reserved for FeeAckInfos.
00026  * So use these numbers here. For OK use always '0'.
00027  */
00028 
00032 #define FEE_ACK_LINK_OK 0
00033 
00036 #define FEE_ACK_LOST_LINK -71
00037 
00040 #define FEE_ACK_STRANGE_DATA -72
00041 
00044 #define ACK_STRUCTURE "I:1;C"
00045 
00048 #define MAX_SIZE 11000
00049 
00050 class FeeClient;
00057 typedef struct AckStructure{
00061         int errorCode;
00065         char resultData[MAX_SIZE];
00069         AckStructure(){
00070                 errorCode = 0;
00071                 resultData[sprintf(resultData,"initialized")]=0;
00072         }
00076         AckStructure(short code,int& size,char* data){
00077                 errorCode=code;
00078                 memcpy(resultData,data,(size < MAX_SIZE ? size : MAX_SIZE));
00079         }
00083         AckStructure& operator=(const AckStructure& rhs){
00084                 
00085                 if(this ==&rhs) {
00086             return *this;
00087         }
00088                 errorCode = rhs.errorCode;
00089                 memcpy(resultData,rhs.resultData,MAX_SIZE);
00090         
00091                 return *this;
00092         }
00093 }AckStructure;
00094 
00095 
00108 class FeeAckInfo : public FeeInfo {
00109         public:
00123                 FeeAckInfo(char* name, void* noLink, int noLinkSize,
00124                                 DimInfoHandler* pHandler, char* serverName)
00125                                 : FeeInfo(name, noLink, noLinkSize, pHandler),
00126                                 mpServerName(serverName), ackState(FEE_ACK_LOST_LINK),mpConfigureFeeCom(),mpConfigureFero(),mpControlFero(),mpAckService(){};
00130                 virtual ~FeeAckInfo();
00131 
00139                 virtual bool retrieveServiceValue();
00140 
00146                 virtual void initialize();
00147 
00154          const char* getCorrespondingServerName() const;
00155 
00162          bool hasLink();
00163 
00164                 int recErrorCode;
00165                 //dim service points to this variable
00166                 AckStructure sAckStruct;
00167                 //set the corresponding dim service
00168                 void setAckChannel(boost::shared_ptr<DimService> service);
00169                 //fill the ackstructure
00170                 void setAckStructure(AckStructure* ackstruct);
00171                 //void setAckStructure(char* ackstruct);
00177                 void setFedApiChannels(boost::shared_ptr<ConfigureFeeCom> conf,boost::shared_ptr<ControlFero> contfero,
00178                         boost::shared_ptr<ConfigureFero> conffero);
00179                 
00180         private:
00184                 int ackState;
00185 
00190                 boost::shared_ptr<ConfigureFeeCom> mpConfigureFeeCom;
00191                 boost::shared_ptr<ConfigureFero> mpConfigureFero;
00192                 boost::shared_ptr<ControlFero> mpControlFero;
00196                 boost::shared_ptr<DimService> mpAckService;
00200                 const char* mpServerName;
00201 
00202 
00203 }; // end class
00204 
00205 inline const char* FeeAckInfo::getCorrespondingServerName() const {
00206     return mpServerName;
00207 }
00208 
00209 inline bool FeeAckInfo::hasLink() {
00210     return (ackState != FEE_ACK_LOST_LINK) ? true : false;
00211 }
00212 inline void FeeAckInfo::setAckChannel(boost::shared_ptr<DimService> service){
00213         mpAckService = service;
00214 }
00215 
00216 inline void FeeAckInfo::setAckStructure(AckStructure* ackstruct){
00217         sAckStruct = *ackstruct;
00218 }
00219 inline void FeeAckInfo::setFedApiChannels(boost::shared_ptr<ConfigureFeeCom> conf,boost::shared_ptr<ControlFero> contfero,
00220                                                                                   boost::shared_ptr<ConfigureFero> conffero){
00221         mpConfigureFeeCom = conf;
00222         mpControlFero = contfero;
00223         mpConfigureFero = conffero;
00224 }
00225 
00226 } }// end namespace
00227 
00228 #endif
00229 

Generated on Fri Mar 30 02:54:33 2007 for InterComLayer by doxygen 1.3.5