conduitGroup.h

Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 #ifndef CONDUITGROUP_H
00009 #define CONDUITGROUP_H
00010 
00011 #include <iostream>
00012 #include <cadef.h>
00013 
00014 #include <hashConduit.h>
00015 #include <statusCodes.h>
00016 
00017 
00027 class ConduitGroup
00028 {
00029     friend struct change_channelTimeoutPolicySGPut;
00030     friend struct change_channelTimeoutPolicySGGet;
00031     friend struct change_timeout_sg_pend_io;
00032     friend struct change_sg_rule;
00033     friend class Connect;
00034         
00035 private:        
00036     static unsigned int  groupHandleNext;
00037     unsigned int         nMember;
00038     ca_client_context *  ccc;
00039                         
00040     double  timeout_sg_pend_io;
00041 
00042     ChannelTimeoutPolicy channelTimeoutPolicySGGet;
00043     ChannelTimeoutPolicy channelTimeoutPolicySGPut;
00044 
00045     union   db_access_val ** dataBuffer;
00046 
00047     friend std::ostream& operator<<(std::ostream& os, const ConduitGroup& e)
00048     {
00049         os<< "handle="  << e.groupHandle<<" name=" << e.groupName<< " nMember=" << e.nMember << std::endl;
00050         return os;
00051     };
00052                 
00053 public:
00054     std::string groupName;
00055     unsigned int  groupHandle;
00056     CA_SYNC_GID   groupID;
00057 
00058     int     * mStatus;
00059     bool    * mRule;
00060 
00061     unsigned int  * mHandle;
00062 
00063     virtual ~ConduitGroup();
00064         
00065     ConduitGroup();
00066     ConduitGroup(const char * _groupName, ca_client_context * _ccc,  CA_SYNC_GID _groupID,
00067                             unsigned int  _nMember,   unsigned int  * _handle);
00068 
00069     int  get(void) const;
00070     int  put(void) const;
00071         
00072     ca_client_context * getClientContext(void) const {return ccc;};
00073     const char *        getGroupName(void) const {return groupName.c_str();};
00074     string              getGroupNameAsString(void) const {return groupName;};
00075     CA_SYNC_GID         getGroupID(void) const {return groupID;};
00076     unsigned int        getNMember(void) const {return nMember;};
00077     int  *              getStatus(void) const {return mStatus;};
00078     bool *              getRule(void) const {return mRule;};
00079     bool                getRule(unsigned int  i) const {return mRule[i];};
00080     unsigned int        getGroupHandle(void) const {return groupHandle;};
00081     ChannelTimeoutPolicy getChannelTimeoutPolicySGPut(void) const {return channelTimeoutPolicySGPut;};
00082     ChannelTimeoutPolicy getChannelTimeoutPolicySGGet(void) const {return channelTimeoutPolicySGGet;};
00083  };
00084 
00085 
00086 
00091 struct change_sg_rule
00092 {
00093         change_sg_rule (const bool & new_rule, const unsigned int  & iMember):
00094                 new_rule(new_rule),iMember(iMember){}
00095 
00096         void operator() (ConduitGroup& g) {g.mRule[iMember] =  new_rule;}
00097 
00098 private:
00099         bool new_rule;
00100         unsigned int  iMember;
00101 };
00102 
00103 
00107 struct change_sg_status
00108 {
00109         change_sg_status (const int  & new_status, const unsigned int  & iMember):
00110                 new_status(new_status),iMember(iMember){}
00111 
00112         void operator() (ConduitGroup& g) {            
00113             g.mStatus[iMember] =  new_status;
00114         }
00115 
00116 private:
00117         int  new_status;
00118         unsigned int  iMember;
00119 };
00120 
00125 struct change_timeout_sg_pend_io
00126 {
00127     change_timeout_sg_pend_io (const double & new_timeout_sg_pend_io):
00128             new_timeout_sg_pend_io(new_timeout_sg_pend_io){}
00129     void operator() (ConduitGroup& g) {g.timeout_sg_pend_io =  new_timeout_sg_pend_io;}
00130         
00131 private:
00132     double new_timeout_sg_pend_io;
00133 };
00134 
00135 
00139 struct change_channelTimeoutPolicySGGet
00140 {
00141     change_channelTimeoutPolicySGGet (const ChannelTimeoutPolicy & new_channelTimeoutPolicy):
00142                 new_channelTimeoutPolicy(new_channelTimeoutPolicy){}
00143 
00144     void operator() (ConduitGroup & g) {
00145         //This does a deep copy!
00146         g.channelTimeoutPolicySGGet =  new_channelTimeoutPolicy;
00147     }
00148 private:
00149     ChannelTimeoutPolicy new_channelTimeoutPolicy;
00150 };
00151 
00152 
00156 struct change_channelTimeoutPolicySGPut
00157 {
00158     change_channelTimeoutPolicySGPut (const ChannelTimeoutPolicy & new_channelTimeoutPolicy):
00159                 new_channelTimeoutPolicy(new_channelTimeoutPolicy){}
00160 
00161     void operator() (ConduitGroup & g) {
00162         //This does a deep copy!
00163         g.channelTimeoutPolicySGPut =  new_channelTimeoutPolicy;
00164     }
00165 private:
00166     ChannelTimeoutPolicy new_channelTimeoutPolicy;
00167 };
00168 
00169 
00170 
00171 #endif

Generated on 3 May 2017 for CAFE by  doxygen 1.6.1