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 00064 virtual ~ConduitGroup(); 00065 00066 ConduitGroup(); 00067 ConduitGroup(const char * _groupName, ca_client_context * _ccc, CA_SYNC_GID _groupID, 00068 unsigned int _nMember, unsigned int * _handle); 00069 00070 int get(void) const; 00071 int put(void) const; 00072 00073 ca_client_context * getClientContext(void) const {return ccc;}; 00074 const char * getGroupName(void) const {return groupName.c_str();}; 00075 std::string getGroupNameAsString(void) const {return groupName;}; 00076 CA_SYNC_GID getGroupID(void) const {return groupID;}; 00077 unsigned int getNMember(void) const {return nMember;}; 00078 int * getStatus(void) const {return mStatus;}; 00079 bool * getRule(void) const {return mRule;}; 00080 bool getRule(unsigned int i) const {return mRule[i];}; 00081 unsigned int getGroupHandle(void) const {return groupHandle;}; 00082 ChannelTimeoutPolicy getChannelTimeoutPolicySGPut(void) const {return channelTimeoutPolicySGPut;}; 00083 ChannelTimeoutPolicy getChannelTimeoutPolicySGGet(void) const {return channelTimeoutPolicySGGet;}; 00084 00085 }; 00086 00087 00088 00093 struct change_sg_rule 00094 { 00095 change_sg_rule (const bool & new_rule, const unsigned int & iMember): 00096 new_rule(new_rule),iMember(iMember){} 00097 00098 void operator() (ConduitGroup& g) {g.mRule[iMember] = new_rule;} 00099 00100 private: 00101 bool new_rule; 00102 unsigned int iMember; 00103 }; 00104 00105 00109 struct change_sg_status 00110 { 00111 change_sg_status (const int & new_status, const unsigned int & iMember): 00112 new_status(new_status),iMember(iMember){} 00113 00114 void operator() (ConduitGroup& g) { 00115 g.mStatus[iMember] = new_status; 00116 } 00117 00118 private: 00119 int new_status; 00120 unsigned int iMember; 00121 }; 00122 00127 struct change_timeout_sg_pend_io 00128 { 00129 change_timeout_sg_pend_io (const double & new_timeout_sg_pend_io): 00130 new_timeout_sg_pend_io(new_timeout_sg_pend_io){} 00131 void operator() (ConduitGroup& g) {g.timeout_sg_pend_io = new_timeout_sg_pend_io;} 00132 00133 private: 00134 double new_timeout_sg_pend_io; 00135 }; 00136 00137 00141 struct change_channelTimeoutPolicySGGet 00142 { 00143 change_channelTimeoutPolicySGGet (const ChannelTimeoutPolicy & new_channelTimeoutPolicy): 00144 new_channelTimeoutPolicy(new_channelTimeoutPolicy){} 00145 00146 void operator() (ConduitGroup & g) { 00147 //This does a deep copy! 00148 g.channelTimeoutPolicySGGet = new_channelTimeoutPolicy; 00149 } 00150 private: 00151 ChannelTimeoutPolicy new_channelTimeoutPolicy; 00152 }; 00153 00154 00158 struct change_channelTimeoutPolicySGPut 00159 { 00160 change_channelTimeoutPolicySGPut (const ChannelTimeoutPolicy & new_channelTimeoutPolicy): 00161 new_channelTimeoutPolicy(new_channelTimeoutPolicy){} 00162 00163 void operator() (ConduitGroup & g) { 00164 //This does a deep copy! 00165 g.channelTimeoutPolicySGPut = new_channelTimeoutPolicy; 00166 } 00167 private: 00168 ChannelTimeoutPolicy new_channelTimeoutPolicy; 00169 }; 00170 00171 00172 00173 #endif