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

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