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

PortType.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 _PORTTYPEH
00022 #define _PORTTYPEH
00023 
00024 #include <wsdlparser/Operation.h>
00025 #include <wsdlparser/Binding.h>
00026 
00027 //This class implements a port type of WSDL .
00028 class PortType:public WsdlElement
00029 {
00030  public:
00031   typedef std::list<PortType*>::iterator PortTypeIterator;
00032   typedef std::list<PortType*>::const_iterator cPortTypeIterator;
00033 
00034   PortType(WsdlParser& w);
00035   ~PortType();
00038 
00039   int getNumOps(void) const;
00040 
00046   const Operation *getOperation(int index) const;
00047 
00053   const Operation *getOperation(const Qname & name) const;
00054   int  getOperationIndex(const Qname & name) const;
00055   
00061   bool getOperations(Operation::cOpIterator & start ,Operation::cOpIterator & finish)const;
00062 
00070   const Binding* binding(const std::string & nsp)const;
00071   
00073 
00076   void addOp(Operation * op);
00077   void setBinding(Binding* bn);
00079  private:
00080   std::vector<Operation *> ops_;
00081   std::vector<const Binding *> bindings_;
00082 };
00083 
00084 inline
00085 PortType::PortType(WsdlParser& w)
00086   :WsdlElement(w)
00087 {
00088   ops_.clear() ;
00089 }
00090 inline
00091 PortType::~PortType() 
00092 {
00093   for (size_t i = 0; i < ops_.size(); i++)
00094     delete ops_[i];  
00095 
00096 }
00097 
00098 inline
00099 int
00100 PortType::getNumOps(void) const
00101 {
00102   return ops_.size();
00103 }
00104 
00105 inline
00106 const Operation *
00107 PortType::getOperation(int index) const
00108 {
00109   return ops_[index];
00110 }
00111  
00112 inline
00113 int
00114 PortType::getOperationIndex(const Qname & name) const
00115 {
00116   for (size_t i = 0; i < ops_.size(); i++)
00117     {
00118       if (ops_[i]->getName() == name.getLocalName())
00119         return i;
00120     }
00121   return 0;
00122 }
00123 
00124 inline
00125 const Operation *
00126 PortType::getOperation(const Qname & name) const
00127 {
00128   for (size_t i = 0; i < ops_.size(); i++)
00129     {
00130       if (ops_[i]->getName() == name.getLocalName())
00131         return ops_[i];
00132     }
00133   return 0;
00134 }
00135 
00136 inline
00137 bool
00138 PortType::getOperations(Operation::cOpIterator & start ,
00139                         Operation::cOpIterator & finish)const
00140 {
00141   start=ops_.begin();
00142   finish=ops_.end();
00143   return true;
00144 }
00145 
00146 
00147 inline
00148 void 
00149 PortType::addOp(Operation * op)
00150 {
00151   ops_.push_back(op);
00152 }
00153 
00154 inline
00155 void
00156 PortType::setBinding(Binding* bn)
00157 {
00158   bindings_.push_back(bn);
00159 }
00160 
00161 inline
00162 const Binding*
00163 PortType::binding(const std::string & nsp)const
00164 {
00165   for (unsigned int i = 0; i<bindings_.size();i++){
00166     if (bindings_[i]->getBindingMethod() == nsp)
00167       return bindings_[i];
00168   }
00169   return 0;
00170 }
00171 #endif                                            /*  */

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