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
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