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 #include "xmlpull/wsdlpull_export.h"
00026 
00027 namespace WsdlPull {
00028 class PortType;
00029 const int MAX_EXT_ELEM=4;
00030 
00031 //Wsdl Binding element
00032 class WSDLPULL_EXPORT Binding:public WsdlElement
00033 {
00034 
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   
00052   int getBindingInfo() const;
00057   const PortType *getPortType() const;
00062   int getServiceExtId() const;
00063 
00068   int numOps(void) const;
00069 
00075   const Operation *getOperation(int index) const;
00082   std::string getBindingMethod()const;
00083 
00084 
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;
00096 
00097 
00098 
00103   void setPortType(const PortType * pt);
00104   void setBindingInfo(int id);
00105   void setBindingMethod(const std::string & ns);
00106   void setServiceExtId(int id);
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 
00118 
00119  private:
00120   class OperationBinding
00121     {
00122     public:
00123       OperationBinding();
00124       const Operation *op;
00125       int opBinding[MAX_EXT_ELEM];
00126       int nObn;                           
00127       //additional extensibility elements,example soap:operation element
00128       int inputBinding[MAX_EXT_ELEM];
00129       int nIpbn;
00130       int outputBinding[MAX_EXT_ELEM];
00131       int nOpbn;
00132       int faultBinding[MAX_EXT_ELEM];
00133       int nFbn;
00134     };
00135 
00136   std::vector<OperationBinding> Ops_;
00137   const PortType *portType_;
00138   std::string binding_;//namespace of the binding protocol(SOAP,HTTP etc)
00139   int bindingInfo;  //binding information for the whole port type 
00140   //this is the id of the element whichgives details about service for this binding
00141   int serviceExtId;                       
00142 };
00143 
00144 inline
00145 Binding::OperationBinding::OperationBinding()
00146   :op(0),
00147      nObn(0),
00148      nIpbn (0),
00149      nOpbn(0),
00150      nFbn(0)
00151 {
00152 }
00153 
00154 inline
00155 int
00156 Binding::getBindingInfo() const
00157 {
00158   return bindingInfo;
00159 }
00160 
00161 inline
00162 const PortType *
00163 Binding::getPortType() const
00164 {
00165   return portType_;
00166 }
00167 
00168 inline
00169 int 
00170 Binding::getServiceExtId() const
00171 {
00172   return serviceExtId;
00173 }
00174 
00175 inline
00176 int
00177 Binding::numOps(void) const
00178 {
00179   return Ops_.size();
00180 }
00181 
00182 inline
00183 const Operation *
00184 Binding::getOperation(int index) const
00185 {
00186   return Ops_[index].op;
00187 }
00188 
00189 inline
00190 int
00191 Binding::getOpBinding(int index, const int*& bindings) const
00192 {
00193   bindings = Ops_[index].opBinding;
00194   return Ops_[index].nObn;
00195 }
00196 
00197 inline
00198 int
00199 Binding::getOutputBinding(int index, const int*& bindings) const
00200 {
00201   bindings = Ops_[index].outputBinding;
00202   return Ops_[index].nOpbn;
00203 }
00204 
00205 inline
00206 int
00207 Binding::getInputBinding(int index, const int*& bindings) const
00208 {
00209   bindings = Ops_[index].inputBinding;
00210   return Ops_[index].nIpbn;
00211 }
00212 
00213 inline
00214 int
00215 Binding::getFaultBinding(int index, const int*& bindings) const
00216 {
00217   bindings = Ops_[index].faultBinding;
00218   return Ops_[index].nFbn;
00219 }
00220 
00221 inline
00222 void 
00223 Binding::setPortType(const PortType * pt)
00224 {
00225   portType_ = pt;
00226 }
00227 
00228 inline
00229 void
00230 Binding:: setBindingInfo(int id)
00231 {
00232   bindingInfo = id;
00233   WsdlElement::addExtElement(id);
00234 }
00235 
00236 inline
00237 void 
00238 Binding::setServiceExtId(int id)
00239 {
00240   serviceExtId = id;
00241 }
00242 
00243 inline
00244 int
00245 Binding::addOperation(const Operation * op)
00246 {
00247   OperationBinding ob;
00248   ob.op=op;
00249   Ops_.push_back(ob);
00250   return Ops_.size()-1;
00251 }
00252 
00253 inline
00254 void
00255 Binding::addOpBinding(int index, int oBn)
00256 {
00257   Ops_[index].opBinding[Ops_[index].nObn++] = oBn;
00258 }
00259 
00260 inline
00261 void
00262 Binding::addOutputBinding(int index, int opBn)
00263 {
00264   Ops_[index].outputBinding[Ops_[index].nOpbn++] = opBn;
00265 }
00266 inline
00267 void
00268 Binding::addInputBinding(int index, int ipBn)
00269 {
00270   Ops_[index].inputBinding[Ops_[index].nIpbn++] = ipBn;
00271 }
00272 
00273 inline
00274 void
00275 Binding::addFaultBinding(int index, int fBn)
00276 {
00277   Ops_[index].faultBinding[Ops_[index].nFbn++] = fBn;
00278 }
00279 
00280 
00281 inline
00282 Binding::Binding(WsdlParser& w)
00283   :WsdlElement(w)
00284 {
00285   portType_ = 0;
00286   Ops_.clear();
00287 }
00288 
00289 inline
00290 Binding::~Binding()
00291 {
00292 };
00293 
00294 inline
00295 void
00296 Binding::setBindingMethod(const std::string & ns)
00297 {
00298   binding_=ns;
00299 }
00300 
00301 inline
00302 std::string
00303 Binding::getBindingMethod()const
00304 {
00305   return binding_;
00306 }
00307 }
00308 #endif                                            /*  */

Generated on Sun Apr 2 18:12:00 2006 for wsdlpull by  doxygen 1.3.9.1