00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _BINDINGH
00022 #define _BINDINGH
00023
00024 #include "wsdlparser/WsdlElement.h"
00025 #include "xmlpull/wsdlpull_export.h"
00026
00027 namespace WsdlPull {
00028 class PortType;
00029 const int MAX_EXT_ELEM=50;
00030
00031
00032 class WSDLPULL_EXPORT Binding:public WsdlElement
00033 {
00034
00035
00036
00037
00038 public:
00039 typedef std::list<Binding*>::iterator BindingIterator;
00040 typedef std::list<Binding*>::const_iterator cBindingIterator;
00041
00042 Binding(WsdlParser & w);
00043 ~Binding();
00044
00045
00046
00047
00048
00049
00050
00051
00052 int getBindingInfo() const;
00053
00054
00055
00056
00057 const PortType *getPortType() const;
00058
00059
00060
00061
00062 int getServiceExtId() const;
00063
00064
00065
00066
00067
00068 int numOps(void) const;
00069
00070
00071
00072
00073
00074
00075 const Operation *getOperation(int index) const;
00076
00077
00078
00079
00080
00081
00082 std::string getBindingMethod()const;
00083
00084
00085
00086
00087
00088
00089
00090
00091 int getOpBinding(int index, const int*& bindings) const;
00092 int getOutputBinding(int index, const int*& bindings) const;
00093 int getInputBinding(int index, const int*& bindings) const;
00094 int getFaultBinding(int index, const int*& bindings) const;
00095
00096
00097
00098
00099
00100
00101
00102
00103 void setPortType(const PortType * pt);
00104 void setBindingInfo(int id);
00105 void setBindingMethod(const std::string & ns);
00106 void addServiceExtId(int id);
00107
00108
00109
00110
00111 int addOperation(const Operation * op);
00112 void addOpBinding(int index, int oBn);
00113 void addOutputBinding(int index, int opBn);
00114 void addInputBinding(int index, int ipBn);
00115 void addFaultBinding(int index, int fBn);
00116 int getOperationIndex(const Qname & name) const;
00117
00118
00119
00120 private:
00121 class OperationBinding
00122 {
00123 public:
00124 OperationBinding();
00125 const Operation *op;
00126 int opBinding[MAX_EXT_ELEM];
00127 int nObn;
00128
00129 int inputBinding[MAX_EXT_ELEM];
00130 int nIpbn;
00131 int outputBinding[MAX_EXT_ELEM];
00132 int nOpbn;
00133 int faultBinding[MAX_EXT_ELEM];
00134 int nFbn;
00135 };
00136
00137 std::vector<OperationBinding> Ops_;
00138 const PortType *portType_;
00139 std::string binding_;
00140 int bindingInfo;
00141
00142 std::list<int> serviceExtIds_;
00143 };
00144
00145 inline
00146 Binding::OperationBinding::OperationBinding()
00147 :op(0),
00148 nObn(0),
00149 nIpbn (0),
00150 nOpbn(0),
00151 nFbn(0)
00152 {
00153 }
00154
00155 inline
00156 int
00157 Binding::getBindingInfo() const
00158 {
00159 return bindingInfo;
00160 }
00161
00162 inline
00163 const PortType *
00164 Binding::getPortType() const
00165 {
00166 return portType_;
00167 }
00168
00169 inline
00170 int
00171 Binding::getServiceExtId() const
00172 {
00173 if (serviceExtIds_.size() > 0)
00174 return serviceExtIds_.front();
00175 else
00176 return 0;
00177 }
00178
00179 inline
00180 int
00181 Binding::numOps(void) const
00182 {
00183 return Ops_.size();
00184 }
00185
00186 inline
00187 const Operation *
00188 Binding::getOperation(int index) const
00189 {
00190 return Ops_[index].op;
00191 }
00192
00193 inline
00194 int
00195 Binding::getOpBinding(int index, const int*& bindings) const
00196 {
00197 bindings = Ops_[index].opBinding;
00198 return Ops_[index].nObn;
00199 }
00200
00201 inline
00202 int
00203 Binding::getOutputBinding(int index, const int*& bindings) const
00204 {
00205 bindings = Ops_[index].outputBinding;
00206 return Ops_[index].nOpbn;
00207 }
00208
00209 inline
00210 int
00211 Binding::getInputBinding(int index, const int*& bindings) const
00212 {
00213 bindings = Ops_[index].inputBinding;
00214 return Ops_[index].nIpbn;
00215 }
00216
00217 inline
00218 int
00219 Binding::getFaultBinding(int index, const int*& bindings) const
00220 {
00221 bindings = Ops_[index].faultBinding;
00222 return Ops_[index].nFbn;
00223 }
00224
00225 inline
00226 void
00227 Binding::setPortType(const PortType * pt)
00228 {
00229 portType_ = pt;
00230 }
00231
00232 inline
00233 void
00234 Binding:: setBindingInfo(int id)
00235 {
00236 bindingInfo = id;
00237 WsdlElement::addExtElement(id);
00238 }
00239
00240 inline
00241 void
00242 Binding::addServiceExtId(int id)
00243 {
00244 serviceExtIds_.push_back(id);
00245 }
00246
00247 inline
00248 int
00249 Binding::addOperation(const Operation * op)
00250 {
00251 OperationBinding ob;
00252 ob.op=op;
00253 Ops_.push_back(ob);
00254 return Ops_.size()-1;
00255 }
00256
00257 inline
00258 void
00259 Binding::addOpBinding(int index, int oBn)
00260 {
00261 Ops_[index].opBinding[Ops_[index].nObn++] = oBn;
00262 }
00263
00264 inline
00265 void
00266 Binding::addOutputBinding(int index, int opBn)
00267 {
00268 Ops_[index].outputBinding[Ops_[index].nOpbn++] = opBn;
00269 }
00270 inline
00271 void
00272 Binding::addInputBinding(int index, int ipBn)
00273 {
00274 Ops_[index].inputBinding[Ops_[index].nIpbn++] = ipBn;
00275 }
00276
00277 inline
00278 void
00279 Binding::addFaultBinding(int index, int fBn)
00280 {
00281 Ops_[index].faultBinding[Ops_[index].nFbn++] = fBn;
00282 }
00283
00284
00285 inline
00286 Binding::Binding(WsdlParser& w)
00287 :WsdlElement(w)
00288 {
00289 portType_ = 0;
00290 Ops_.clear();
00291 }
00292
00293 inline
00294 Binding::~Binding()
00295 {
00296 }
00297
00298 inline
00299 void
00300 Binding::setBindingMethod(const std::string & ns)
00301 {
00302 binding_=ns;
00303 }
00304
00305 inline
00306 std::string
00307 Binding::getBindingMethod()const
00308 {
00309 return binding_;
00310 }
00311
00312 inline int
00313 Binding::getOperationIndex(const Qname & name) const
00314 {
00315 for (int i=0; i < int(Ops_.size()); i++ ) {
00316 if (Ops_[i].op->getName() == name.getLocalName() ) return i;
00317 }
00318 return -1;
00319 }
00320
00321
00322 }
00323 #endif