00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _SERVICEH
00023 #define _SERVICEH
00024
00025 #include "wsdlparser/WsdlElement.h"
00026
00027 namespace WsdlPull {
00028 class Binding;
00029
00030 class WSDLPULL_EXPORT Service :public WsdlElement {
00031
00032 public:
00033 Service(WsdlParser & w);
00034
00037
00038 void addPort(const std::string& name,const Binding* bn,int serviceExtId);
00039
00040 int getPortExtension(const std::string& name);
00041 const Binding* getPortBinding(const std::string& name);
00043 private:
00044
00045 typedef struct {
00046 std::string name_;
00047 const Binding* binding_;
00048 int serviceExtId_;
00049 }ServicePort;
00050 std::list<ServicePort> ports_;
00051 };
00052
00053
00054 inline
00055 Service::Service(WsdlParser& w)
00056 :WsdlElement(w)
00057 {
00058 }
00059 inline
00060 void
00061 Service::addPort(const std::string& n,const Binding* bn,int serviceExtId)
00062 {
00063 ServicePort sp;
00064 sp.name_=n;
00065 sp.binding_ = bn;
00066 sp.serviceExtId_ = serviceExtId;
00067 }
00068
00069 inline
00070 int
00071 Service::getPortExtension(const std::string & name)
00072 {
00073 for(std::list<ServicePort>::iterator it = ports_.begin();
00074 it != ports_.end();
00075 it++){
00076 if(it->name_ == name)
00077 return it->serviceExtId_;
00078 }
00079 return 0;
00080 }
00081
00082 inline
00083 const Binding*
00084 Service::getPortBinding(const std::string & name)
00085 {
00086 for(std::list<ServicePort>::iterator it = ports_.begin();
00087 it != ports_.end();
00088 it++){
00089 if(it->name_ == name)
00090 return it->binding_;
00091 }
00092 return 0;
00093 }
00094 }
00095 #endif
00096