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

Binding.h

Go to the documentation of this file.
00001 /* 
00002  * wsdlpull - A C++ parser  for WSDL  (Web services description language)
00003  * Copyright (C) 2005-2007 Vivek Krishna
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Library General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2 of the License, or (at your option) any later version.
00009  *
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Library General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Library General Public
00016  * License along with this library; if not, write to the Free
00017  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018  *
00019  *
00020  */
00021 #ifndef _BINDINGH
00022 #define  _BINDINGH
00023 
00024 #include <wsdlparser/WsdlElement.h>
00025 
00026 class PortType;
00027 const int MAX_EXT_ELEM=4;
00028 
00029 //Wsdl Binding element
00030 class Binding:public WsdlElement
00031 {
00032 
00036  public:
00037   typedef std::list<Binding*>::iterator BindingIterator;
00038   typedef std::list<Binding*>::const_iterator cBindingIterator;
00039 
00040   Binding(WsdlParser & w);
00041   ~Binding();
00042   
00050   int getBindingInfo() const;
00055   const PortType *getPortType() const;
00060   int getServiceExtId() const;
00061 
00066   int numOps(void) const;
00067 
00073   const Operation *getOperation(int index) const;
00080   std::string getBindingMethod()const;
00081 
00082 
00089   int getOpBinding(int index, const int*& bindings) const;
00090   int getOutputBinding(int index, const int*& bindings) const;
00091   int getInputBinding(int index, const int*& bindings) const;
00092   int getFaultBinding(int index, const int*& bindings) const;
00094 
00095 
00096 
00101   void setPortType(const PortType * pt);
00102   void setBindingInfo(int id);
00103   void setBindingMethod(const std::string & ns);
00104   void setServiceExtId(int id);
00109   int  addOperation(const Operation * op);
00110   void addOpBinding(int index, int oBn);
00111   void addOutputBinding(int index, int opBn);
00112   void addInputBinding(int index, int ipBn);
00113   void addFaultBinding(int index, int fBn);
00114 
00116 
00117  private:
00118   class OperationBinding
00119     {
00120     public:;
00121       OperationBinding();
00122       const Operation *op;
00123       int opBinding[MAX_EXT_ELEM];
00124       int nObn;                           
00125       //additional extensibility elements,example soap:operation element
00126       int inputBinding[MAX_EXT_ELEM];
00127       int nIpbn;
00128       int outputBinding[MAX_EXT_ELEM];
00129       int nOpbn;
00130       int faultBinding[MAX_EXT_ELEM];
00131       int nFbn;
00132     };
00133 
00134   std::vector<OperationBinding> Ops_;
00135   const PortType *portType_;
00136   std::string binding_;//namespace of the binding protocol(SOAP,HTTP etc)
00137   int bindingInfo;  //binding information for the whole port type 
00138   //this is the id of the element whichgives details about service for this binding
00139   int serviceExtId;                       
00140 };
00141 
00142 inline
00143 Binding::OperationBinding::OperationBinding()
00144   :op(0),
00145      nObn(0),
00146      nIpbn (0),
00147      nOpbn(0),
00148      nFbn(0)
00149 {
00150 }
00151 
00152 inline
00153 int
00154 Binding::getBindingInfo() const
00155 {
00156   return bindingInfo;
00157 }
00158 
00159 inline
00160 const PortType *
00161 Binding::getPortType() const
00162 {
00163   return portType_;
00164 }
00165 
00166 inline
00167 int 
00168 Binding::getServiceExtId() const
00169 {
00170   return serviceExtId;
00171 }
00172 
00173 inline
00174 int
00175 Binding::numOps(void) const
00176 {
00177   return Ops_.size();
00178 }
00179 
00180 inline
00181 const Operation *
00182 Binding::getOperation(int index) const
00183 {
00184   return Ops_[index].op;
00185 }
00186 
00187 inline
00188 int
00189 Binding::getOpBinding(int index, const int*& bindings) const
00190 {
00191   bindings = Ops_[index].opBinding;
00192   return Ops_[index].nObn;
00193 }
00194 
00195 inline
00196 int
00197 Binding::getOutputBinding(int index, const int*& bindings) const
00198 {
00199   bindings = Ops_[index].outputBinding;
00200   return Ops_[index].nOpbn;
00201 }
00202 
00203 inline
00204 int
00205 Binding::getInputBinding(int index, const int*& bindings) const
00206 {
00207   bindings = Ops_[index].inputBinding;
00208   return Ops_[index].nIpbn;
00209 }
00210 
00211 inline
00212 int
00213 Binding::getFaultBinding(int index, const int*& bindings) const
00214 {
00215   bindings = Ops_[index].faultBinding;
00216   return Ops_[index].nFbn;
00217 }
00218 
00219 inline
00220 void 
00221 Binding::setPortType(const PortType * pt)
00222 {
00223   portType_ = pt;
00224 }
00225 
00226 inline
00227 void
00228 Binding:: setBindingInfo(int id)
00229 {
00230   bindingInfo = id;
00231   WsdlElement::addExtElement(id);
00232 }
00233 
00234 inline
00235 void 
00236 Binding::setServiceExtId(int id)
00237 {
00238   serviceExtId = id;
00239 }
00240 
00241 inline
00242 int
00243 Binding::addOperation(const Operation * op)
00244 {
00245   OperationBinding ob;
00246   ob.op=op;
00247   Ops_.push_back(ob);
00248   return Ops_.size()-1;
00249 }
00250 
00251 inline
00252 void
00253 Binding::addOpBinding(int index, int oBn)
00254 {
00255   Ops_[index].opBinding[Ops_[index].nObn++] = oBn;
00256 }
00257 
00258 inline
00259 void
00260 Binding::addOutputBinding(int index, int opBn)
00261 {
00262   Ops_[index].outputBinding[Ops_[index].nOpbn++] = opBn;
00263 }
00264 inline
00265 void
00266 Binding::addInputBinding(int index, int ipBn)
00267 {
00268   Ops_[index].inputBinding[Ops_[index].nIpbn++] = ipBn;
00269 }
00270 
00271 inline
00272 void
00273 Binding::addFaultBinding(int index, int fBn)
00274 {
00275   Ops_[index].faultBinding[Ops_[index].nFbn++] = fBn;
00276 }
00277 
00278 
00279 inline
00280 Binding::Binding(WsdlParser& w)
00281   :WsdlElement(w)
00282 {
00283   portType_ = 0;
00284   Ops_.clear();
00285 }
00286 
00287 inline
00288 Binding::~Binding()
00289 {
00290 };
00291 
00292 inline
00293 void
00294 Binding::setBindingMethod(const std::string & ns)
00295 {
00296   binding_=ns;
00297 }
00298 
00299 inline
00300 std::string
00301 Binding::getBindingMethod()const
00302 {
00303   return binding_;
00304 }
00305 
00306 #endif                                            /*  */

Generated on Sun Oct 16 10:11:52 2005 for wsdlpull by  doxygen 1.3.9.1