wsdlpull 1.23
Loading...
Searching...
No Matches
Binding.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#ifndef _BINDINGH
22#define _BINDINGH
23
26
27namespace WsdlPull {
28class PortType;
29const int MAX_EXT_ELEM=50;
30
31//Wsdl Binding element
33{
34
38 public:
39 typedef std::list<Binding*>::iterator BindingIterator;
40 typedef std::list<Binding*>::const_iterator cBindingIterator;
41
43 ~Binding();
44
52 int getBindingInfo() const;
57 const PortType *getPortType() const;
62 int getServiceExtId() const;
63
68 int numOps(void) const;
69
75 const Operation *getOperation(int index) const;
82 std::string getBindingMethod()const;
83
84
91 int getOpBinding(int index, const int*& bindings) const;
92 int getOutputBinding(int index, const int*& bindings) const;
93 int getInputBinding(int index, const int*& bindings) const;
94 int getFaultBinding(int index, const int*& bindings) const;
96
98
103 void setPortType(const PortType * pt);
104 void setBindingInfo(int id);
105 void setBindingMethod(const std::string & ns);
106 void addServiceExtId(int id);
111 int addOperation(const Operation * op);
112 void addOpBinding(int index, int oBn);
113 void addOutputBinding(int index, int opBn);
114 void addInputBinding(int index, int ipBn);
115 void addFaultBinding(int index, int fBn);
116 int getOperationIndex(const Qname & name) const;
117
119
120 private:
121 class OperationBinding
122 {
123 public:
124 OperationBinding();
125 const Operation *op;
126 int opBinding[MAX_EXT_ELEM];
127 int nObn;
128 //additional extensibility elements,example soap:operation element
129 int inputBinding[MAX_EXT_ELEM];
130 int nIpbn;
131 int outputBinding[MAX_EXT_ELEM];
132 int nOpbn;
133 int faultBinding[MAX_EXT_ELEM];
134 int nFbn;
135 };
136
137 std::vector<OperationBinding> Ops_;
138 const PortType *portType_;
139 std::string binding_;//namespace of the binding protocol(SOAP,HTTP etc)
140 int bindingInfo; //binding information for the whole port type
141 //this is the id of the element whichgives details about service for this binding
142 std::list<int> serviceExtIds_;
143};
144
145inline
146Binding::OperationBinding::OperationBinding()
147 :op(0),
148 nObn(0),
149 nIpbn (0),
150 nOpbn(0),
151 nFbn(0)
152{
153}
154
155inline
156int
158{
159 return bindingInfo;
160}
161
162inline
163const PortType *
165{
166 return portType_;
167}
168
169inline
170int
172{
173 if (serviceExtIds_.size() > 0)
174 return serviceExtIds_.front();
175 else
176 return 0;
177}
178
179inline
180int
182{
183 return Ops_.size();
184}
185
186inline
187const Operation *
188Binding::getOperation(int index) const
189{
190 return Ops_[index].op;
191}
192
193inline
194int
195Binding::getOpBinding(int index, const int*& bindings) const
196{
197 bindings = Ops_[index].opBinding;
198 return Ops_[index].nObn;
199}
200
201inline
202int
203Binding::getOutputBinding(int index, const int*& bindings) const
204{
205 bindings = Ops_[index].outputBinding;
206 return Ops_[index].nOpbn;
207}
208
209inline
210int
211Binding::getInputBinding(int index, const int*& bindings) const
212{
213 bindings = Ops_[index].inputBinding;
214 return Ops_[index].nIpbn;
215}
216
217inline
218int
219Binding::getFaultBinding(int index, const int*& bindings) const
220{
221 bindings = Ops_[index].faultBinding;
222 return Ops_[index].nFbn;
223}
224
225inline
226void
228{
229 portType_ = pt;
230}
231
232inline
233void
235{
236 bindingInfo = id;
238}
239
240inline
241void
243{
244 serviceExtIds_.push_back(id);
245}
246
247inline
248int
250{
251 OperationBinding ob;
252 ob.op=op;
253 Ops_.push_back(ob);
254 return Ops_.size()-1;
255}
256
257inline
258void
259Binding::addOpBinding(int index, int oBn)
260{
261 Ops_[index].opBinding[Ops_[index].nObn++] = oBn;
262}
263
264inline
265void
266Binding::addOutputBinding(int index, int opBn)
267{
268 Ops_[index].outputBinding[Ops_[index].nOpbn++] = opBn;
269}
270inline
271void
272Binding::addInputBinding(int index, int ipBn)
273{
274 Ops_[index].inputBinding[Ops_[index].nIpbn++] = ipBn;
275}
276
277inline
278void
279Binding::addFaultBinding(int index, int fBn)
280{
281 Ops_[index].faultBinding[Ops_[index].nFbn++] = fBn;
282}
283
284
285inline
287 :WsdlElement(w)
288{
289 portType_ = 0;
290 Ops_.clear();
291}
292
293inline
295{
296}
297
298inline
299void
300Binding::setBindingMethod(const std::string & ns)
301{
302 binding_=ns;
303}
304
305inline
306std::string
308{
309 return binding_;
310}
311
312inline int
314{
315 for (int i=0; i < int(Ops_.size()); i++ ) {
316 if (Ops_[i].op->getName() == name.getLocalName() ) return i;
317 }
318 return -1;
319}
320
321
322}
323#endif /* */
Definition Qname.h:31
std::string getLocalName(void) const
Definition Qname.h:76
int getServiceExtId() const
Definition Binding.h:171
int numOps(void) const
Definition Binding.h:181
int getOpBinding(int index, const int *&bindings) const
Definition Binding.h:195
void addOpBinding(int index, int oBn)
Definition Binding.h:259
const PortType * getPortType() const
Definition Binding.h:164
void setPortType(const PortType *pt)
Definition Binding.h:227
void addOutputBinding(int index, int opBn)
Definition Binding.h:266
int getOperationIndex(const Qname &name) const
Definition Binding.h:313
Binding(WsdlParser &w)
Definition Binding.h:286
void addFaultBinding(int index, int fBn)
Definition Binding.h:279
void setBindingMethod(const std::string &ns)
Definition Binding.h:300
void addInputBinding(int index, int ipBn)
Definition Binding.h:272
std::string getBindingMethod() const
Definition Binding.h:307
int getFaultBinding(int index, const int *&bindings) const
Definition Binding.h:219
std::list< Binding * >::const_iterator cBindingIterator
Definition Binding.h:40
void setBindingInfo(int id)
Definition Binding.h:234
void addServiceExtId(int id)
Definition Binding.h:242
const Operation * getOperation(int index) const
Definition Binding.h:188
int getOutputBinding(int index, const int *&bindings) const
Definition Binding.h:203
int getInputBinding(int index, const int *&bindings) const
Definition Binding.h:211
int getBindingInfo() const
Definition Binding.h:157
int addOperation(const Operation *op)
Definition Binding.h:249
std::list< Binding * >::iterator BindingIterator
Definition Binding.h:39
void addExtElement(int ident)
const int MAX_EXT_ELEM
Definition Binding.h:29
#define WSDLPULL_EXPORT