1 martin 1.3 //%LICENSE////////////////////////////////////////////////////////////////
2 //
3 // Licensed to The Open Group (TOG) under one or more contributor license
4 // agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
5 // this work for additional information regarding copyright ownership.
6 // Each contributor licenses this file to you under the OpenPegasus Open
7 // Source License; you may not use this file except in compliance with the
8 // License.
9 //
10 // Permission is hereby granted, free of charge, to any person obtaining a
11 // copy of this software and associated documentation files (the "Software"),
12 // to deal in the Software without restriction, including without limitation
13 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 // and/or sell copies of the Software, and to permit persons to whom the
15 // Software is furnished to do so, subject to the following conditions:
16 //
17 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
19 //
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 martin 1.3 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
29 kumpf 1.2 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32 #ifndef Pegasus_WsmValue_h
33 #define Pegasus_WsmValue_h
34
35 #include <Pegasus/Common/String.h>
36 #include <Pegasus/Common/ArrayInternal.h>
37 #include <Pegasus/WsmServer/Linkage.h>
38
39 PEGASUS_NAMESPACE_BEGIN
40
41 class WsmEndpointReference;
42 class WsmInstance;
43
44 enum WsmType
45 {
46 WSMTYPE_REFERENCE,
47 WSMTYPE_OBJECT,
48 WSMTYPE_INSTANCE,
49 WSMTYPE_OTHER
50 kumpf 1.2 };
51
52
53 class PEGASUS_WSMSERVER_LINKAGE WsmValue
54 {
55 public:
56
57 WsmValue();
58 WsmValue(const WsmEndpointReference& ref);
59 WsmValue(const Array<WsmEndpointReference>& ref);
60 WsmValue(const WsmInstance& inst);
61 WsmValue(const Array<WsmInstance>& inst);
62 WsmValue(const String& str);
63 WsmValue(const Array<String>& str);
64 WsmValue(const WsmValue& val);
65
66 ~WsmValue()
67 {
68 _release();
69 }
70
71 kumpf 1.2 WsmValue& operator=(const WsmValue& val);
72
73 Boolean isArray() const { return _isArray; }
74 Boolean isNull() const { return _isNull; }
75 void setNull();
76 WsmType getType() const { return _type; }
77 Uint32 getArraySize();
78
79 void toArray();
80 void add(const WsmValue& val);
81
82 void get(WsmEndpointReference& ref) const;
83 void get(Array<WsmEndpointReference>& ref) const;
84 void get(WsmInstance& inst) const;
85 void get(Array<WsmInstance>& inst) const;
86 void get(String& str) const;
87 void get(Array<String>& str) const;
88
89 void set(const WsmEndpointReference& ref);
90 void set(const Array<WsmEndpointReference>& ref);
91 void set(const WsmInstance& inst);
92 kumpf 1.2 void set(const Array<WsmInstance>& inst);
93 void set(const String& str);
94 void set(const Array<String>& str);
95
96 private:
97
98 void _release();
99
100 WsmType _type;
101 Boolean _isArray;
102 Boolean _isNull;
103
104 union WsmValueRep
105 {
106 WsmEndpointReference* ref;
107 Array<WsmEndpointReference>* refa;
108 WsmInstance* inst;
109 Array<WsmInstance>* insta;
110 Array<String>* stra;
111 String* str;
112 } _rep;
113 kumpf 1.2 };
114
115 PEGASUS_NAMESPACE_END
116
117 #endif /* Pegasus_WsmValue_h */
|