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

Generated on Mon Feb 6 23:02:42 2006 for wsdlpull by  doxygen 1.3.9.1