wsdlpull  1.23
Service.h
Go to the documentation of this file.
1 /*
2  * wsdlpull - A C++ parser for WSDL (Web services description language)
3  * Copyright (C) 2005-2007 Vivek Krishna
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the Free
17  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  *
19  *
20  */
21 
22 #ifndef _SERVICEH
23 #define _SERVICEH
24 
25 #include "wsdlparser/WsdlElement.h"
27 
28 namespace WsdlPull {
29 class Binding;
30 
32 public:
33  typedef struct {
34  std::string name_;
35  const Binding* binding_;
37  }ServicePort;
38  typedef std::list<ServicePort>::const_iterator cServicePortIterator;
39 
40 public:
41  Service(WsdlParser & w);
42 
45 
46  void addPort(const std::string& name,const Binding* bn,int serviceExtId);
47 
48  int getPortExtension(const std::string& name)const;
49  const Binding* getPortBinding(const std::string& name)const;
50  void getPortBindings(cServicePortIterator &from, cServicePortIterator &to)const;
51  std::list<std::string> getPorts()const;
53 private:
54 
55  std::list<ServicePort> ports_;
56 };
57 
58 
59 inline
61  :WsdlElement(w)
62 {
63 }
64 inline
65 void
66 Service::addPort(const std::string& n,const Binding* bn,int serviceExtId)
67 {
68  ServicePort sp;
69  sp.name_=n;
70  sp.binding_ = bn;
71  sp.serviceExtId_ = serviceExtId;
72  ports_.push_back(sp);
73 }
74 
75 inline
76 int
77 Service::getPortExtension(const std::string & name)const
78 {
79  for(std::list<ServicePort>::const_iterator it = ports_.begin();
80  it != ports_.end();
81  it++){
82  if(it->name_ == name)
83  return it->serviceExtId_;
84  }
85  return 0;
86 }
87 
88 inline
89 const Binding*
90 Service::getPortBinding(const std::string & name)const
91 {
92  for(std::list<ServicePort>::const_iterator it = ports_.begin();
93  it != ports_.end();
94  it++){
95  if(it->name_ == name)
96  return it->binding_;
97  }
98  return 0;
99 }
100 
101 inline
102 void
104  cServicePortIterator &to)const
105 {
106  if (ports_.size()> 0)
107  {
108  from = ports_.begin();
109  to = ports_.end();
110  }
111 }
112 
113 inline
114 std::list<std::string>
116 {
117  std::list<std::string> names;
118  for(std::list<ServicePort>::const_iterator it = ports_.begin();
119  it != ports_.end();
120  it++){
121  names.push_back(it->name_);
122  }
123  return names;
124 }
125 }
126 #endif
127 
std::list< std::string > getPorts() const
Definition: Service.h:115
void getPortBindings(cServicePortIterator &from, cServicePortIterator &to) const
Definition: Service.h:103
const Binding * getPortBinding(const std::string &name) const
Definition: Service.h:90
#define WSDLPULL_EXPORT
const Binding * binding_
Definition: Service.h:35
int getPortExtension(const std::string &name) const
Definition: Service.h:77
void addPort(const std::string &name, const Binding *bn, int serviceExtId)
Definition: Service.h:66
Service(WsdlParser &w)
Definition: Service.h:60
std::list< ServicePort >::const_iterator cServicePortIterator
Definition: Service.h:38