00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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
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