29 #ifndef Pt_Soap_ServiceDeclaration_h
30 #define Pt_Soap_ServiceDeclaration_h
32 #include <Pt/Soap/Api.h>
33 #include <Pt/NonCopyable.h>
34 #include <Pt/String.h>
66 explicit Type(TypeId typeId)
76 virtual bool isSimple()
const = 0;
78 virtual const Parameter* getParameter(std::size_t n)
const = 0;
80 virtual const Parameter* getParameter(
const std::string& name)
const = 0;
82 virtual const char* name()
const = 0;
84 virtual std::size_t size()
const = 0;
91 class SimpleType :
public Type
94 explicit SimpleType(TypeId typeId)
102 virtual bool isSimple()
const
107 virtual const Parameter* getParameter(std::size_t)
const
110 virtual const Parameter* getParameter(
const std::string&)
const
113 std::size_t size()
const
120 class ComplexType :
public Type
123 explicit ComplexType(TypeId typeId,
const std::string& name)
129 virtual ~ComplexType()
132 virtual bool isSimple()
const
137 virtual const char* name()
const
139 return _name.c_str();
156 Parameter(
const std::string& name,
const Type& t)
166 const Type* type()
const
169 const std::string& name()
const
172 void set(
const std::string& name,
const Type& t)
178 int minOccurs()
const
183 int maxOccurs()
const
188 void setOccurrence(
int min,
int max)
202 class PT_SOAP_API BooleanType :
public SimpleType
207 virtual ~BooleanType();
209 virtual const char* name()
const
216 class PT_SOAP_API IntegerType :
public SimpleType
221 virtual ~IntegerType();
223 virtual const char* name()
const
230 class PT_SOAP_API FloatType :
public SimpleType
235 virtual ~FloatType();
237 virtual const char* name()
const
244 class PT_SOAP_API StringType :
public SimpleType
249 virtual ~StringType();
251 virtual const char* name()
const
258 class PT_SOAP_API Base64Type :
public SimpleType
263 virtual ~Base64Type();
265 virtual const char* name()
const
267 return "base64Binary";
272 class PT_SOAP_API StructType :
public ComplexType
275 StructType(
const std::string& name);
277 virtual ~StructType();
279 void addParameter(
const std::string& name,
const Type& param,
280 int minOccurence = 1,
int maxOccurence = 1);
282 virtual const Parameter* getParameter(std::size_t n)
const;
284 virtual const Parameter* getParameter(
const std::string& name)
const;
286 virtual std::size_t size()
const
288 return _paramList.size();
292 typedef std::vector<Parameter> ParameterList;
293 ParameterList _paramList;
297 class PT_SOAP_API ArrayType :
public ComplexType
300 ArrayType(
const std::string& name);
302 ArrayType(
const std::string& name,
const Type& elem,
const std::string& elemName);
304 virtual ~ArrayType();
306 void setElement(
const std::string& elemName,
const Type& elem);
308 virtual const Parameter* getParameter(std::size_t n)
const;
310 virtual const Parameter* getParameter(
const std::string& name)
const;
312 virtual std::size_t size()
const
322 class PT_SOAP_API DictElementType :
public ComplexType
325 DictElementType(
const std::string& name);
327 virtual ~DictElementType();
329 void setKey(
const std::string& name,
const Type& param);
331 void setValue(
const std::string& name,
const Type& param);
333 virtual const Parameter* getParameter(std::size_t n)
const;
335 virtual const Parameter* getParameter(
const std::string& name)
const;
337 virtual std::size_t size()
const
348 class PT_SOAP_API DictType :
public ComplexType
351 DictType(
const std::string& typeName,
const std::string& elemTypeName);
355 void setElement(
const std::string& elemName,
356 const std::string& keyname,
const Type& keyType,
357 const std::string& valueName,
const Type& valueType);
359 virtual const Parameter* getParameter(std::size_t n)
const;
361 virtual const Parameter* getParameter(
const std::string& name)
const;
363 virtual std::size_t size()
const
369 DictElementType _elemType;
374 PT_SOAP_API
const BooleanType& boolType();
377 PT_SOAP_API
const IntegerType& intType();
380 PT_SOAP_API
const FloatType& floatType();
383 PT_SOAP_API
const StringType& stringType();
386 PT_SOAP_API
const Base64Type& base64Type();
389 class PT_SOAP_API Operation :
private NonCopyable
392 typedef std::vector<Parameter> ParameterList;
396 virtual ~Operation();
399 {
return _inputName; }
402 {
return _outputName; }
404 void addInput(
const std::string& name,
const Type& param);
406 const Parameter* getInput(
const std::string& name)
const;
408 const Parameter* getInput(std::size_t n)
const;
410 void setOutput(
const std::string& name,
const Type& param);
412 const Parameter* getOutput()
const;
414 const ParameterList& parameters()
const
420 ParameterList _params;
427 class PT_SOAP_API ServiceDeclaration
430 ServiceDeclaration(
const std::string& name);
432 virtual ~ServiceDeclaration();
434 const std::string& name()
const
437 const std::string& targetNamespace()
const
438 {
return _targetNamespace; }
440 void setTargetNamespace(
const std::string& ns)
441 { _targetNamespace = ns; }
443 void addOperation(Operation& op);
445 const Operation* getOperation(
const Pt::String& name)
const;
447 void toWsdl(std::ostream& os)
const;
451 static const BooleanType& boolType();
454 static const IntegerType& intType();
457 static const FloatType& floatType();
460 static const StringType& stringType();
463 static void createComplexTypeList(std::map<std::string,const Type*>& complexTypes,
const Type* type);
467 std::string _targetNamespace;
468 typedef std::vector<Operation*> OperationList;
469 OperationList _operations;
477 template <
typename T>
478 class BasicParameter :
public Type
487 class BasicParameter<int> :
public IntegerType
495 template <
typename T>
496 class BasicParameter< std::vector<T> > :
public ArrayType
505 BasicParameter<T> _elem;
509 template <
typename R,
typename A1,
typename A2>
510 class BasicProcedureDefinition :
public Operation
513 BasicProcedureDefinition()
517 BasicParameter<R> _rDef;
518 BasicParameter<A1> _a1Def;
519 BasicParameter<A2> _a2Def;
526 #endif // Pt_Soap_ServiceDefinition_h
XML schema type for WSDLs.
Definition: ServiceDeclaration.h:49
Protects derived classes from being copied.
Definition: NonCopyable.h:54
Unicode capable basic_string.
Definition: String.h:42