1 mike 1.15 //%/////////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (c) 2000, 2001 The Open group, BMC Software, Tivoli Systems, IBM
4 //
5 // Permission is hereby granted, free of charge, to any person obtaining a copy
6 // of this software and associated documentation files (the "Software"), to
7 // deal in the Software without restriction, including without limitation the
8 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9 // sell copies of the Software, and to permit persons to whom the Software is
10 // furnished to do so, subject to the following conditions:
11 //
12 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
13 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
14 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
15 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
16 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
17 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
18 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
19 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 //
21 //==============================================================================
22 mike 1.15 //
23 // Author: Mike Brasher (mbrasher@bmc.com)
24 //
25 // Modified By:
26 //
27 //%/////////////////////////////////////////////////////////////////////////////
28
29 #ifndef Pegasus_MethodRep_h
30 #define Pegasus_MethodRep_h
31
32 #include <Pegasus/Common/Config.h>
33 #include <Pegasus/Common/Exception.h>
34 #include <Pegasus/Common/String.h>
35 #include <Pegasus/Common/CIMQualifier.h>
36 #include <Pegasus/Common/CIMQualifierList.h>
37 #include <Pegasus/Common/CIMParameter.h>
38 #include <Pegasus/Common/Sharable.h>
39 #include <Pegasus/Common/Pair.h>
40
41 PEGASUS_NAMESPACE_BEGIN
42
43 mike 1.15 class CIMMethod;
44 class CIMConstMethod;
45 class DeclContext;
46
47 class PEGASUS_COMMON_LINKAGE CIMMethodRep : public Sharable
48 {
49 public:
50
51 CIMMethodRep(
52 const String& name,
53 CIMType type,
54 const String& classOrigin,
55 Boolean propagated);
56
57 ~CIMMethodRep();
58
59 virtual const String& getName() const
60 {
61 return _name;
62 }
63
64 mike 1.15 void setName(const String& name);
65
66 CIMType getType() const
67 {
68 return _type;
69 }
70
71 void setType(CIMType type);
72
73 const String& getClassOrigin() const
74 {
75 return _classOrigin;
76 }
77
78 void setClassOrigin(const String& classOrigin);
79
80 Boolean getPropagated() const
81 {
82 return _propagated;
83 }
84
85 mike 1.15 void setPropagated(Boolean propagated)
86 {
87 _propagated = propagated;
88 }
89
90 void addQualifier(const CIMQualifier& qualifier)
91 {
92 _qualifiers.add(qualifier);
93 }
94 // ATTN: ks 18 May. Why no non-const version here
95 Uint32 findQualifier(const String& name) const
96 {
97 return _qualifiers.find(name);
98 }
99 // ATTN:
100 Boolean existsQualifier(const String& name) const
101 {
102 return (findQualifier(name) != PEG_NOT_FOUND) ? true : false;
103 }
104
105 CIMQualifier getQualifier(Uint32 pos)
106 mike 1.15 {
107 return _qualifiers.getQualifier(pos);
108 }
109
110
111 CIMConstQualifier getQualifier(Uint32 pos) const
112 {
113 return _qualifiers.getQualifier(pos);
114 }
115 //
116 void removeQualifier(Uint32 pos)
117 {
118 _qualifiers.removeQualifier(pos);
119 }
120
121
122 Uint32 getQualifierCount() const
123 {
124 return _qualifiers.getCount();
125 }
126
127 mike 1.15 void addParameter(const CIMParameter& x);
128
129 Uint32 findParameter(const String& name);
130
131 Uint32 findParameter(const String& name) const
132 {
133 return ((CIMMethodRep*)this)->findParameter(name);
134 }
135
136 CIMParameter getParameter(Uint32 pos);
137
138 CIMConstParameter getParameter(Uint32 pos) const
139 {
140 return ((CIMMethodRep*)this)->getParameter(pos);
141 }
142
143 Uint32 getParameterCount() const;
144
145 void resolve(
146 DeclContext* declContext,
147 const String& nameSpace,
148 mike 1.15 const CIMConstMethod& method);
149
150 void resolve(
151 DeclContext* declContext,
152 const String& nameSpace);
153
154 void toXml(Array<Sint8>& out) const;
155
156 virtual void print(PEGASUS_STD(ostream)& os = PEGASUS_STD(cout)) const;
157
158 Boolean identical(const CIMMethodRep* x) const;
159
160 CIMMethodRep* clone() const
161 {
162 return new CIMMethodRep(*this);
163 }
164
165 private:
166
167 CIMMethodRep();
168
169 mike 1.15 CIMMethodRep(const CIMMethodRep& x);
170
171 CIMMethodRep& operator=(const CIMMethodRep& x);
172
173 String _name;
174 CIMType _type;
175 String _classOrigin;
176 Boolean _propagated;
177 CIMQualifierList _qualifiers;
178 Array<CIMParameter> _parameters;
179
180 friend class CIMClassRep;
181 };
182
183 PEGASUS_NAMESPACE_END
184
185 #endif /* Pegasus_MethodRep_h */
|