(file) Return to Parameter.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

  1 mike  1.1 //BEGIN_LICENSE
  2           //
  3           // Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM
  4           //
  5           // Permission is hereby granted, free of charge, to any person obtaining a
  6           // copy of this software and associated documentation files (the "Software"),
  7           // to deal in the Software without restriction, including without limitation
  8           // the rights to use, copy, modify, merge, publish, distribute, sublicense,
  9           // and/or sell copies of the Software, and to permit persons to whom the
 10           // Software is furnished to do so, subject to the following conditions:
 11           //
 12           // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 13           // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 14           // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 15           // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 16           // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 17           // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 18           // DEALINGS IN THE SOFTWARE.
 19           //
 20           //END_LICENSE
 21           //BEGIN_HISTORY
 22 mike  1.1 //
 23           // Author:
 24           //
 25 mike  1.2 // $Log: Parameter.h,v $
 26           // Revision 1.1.1.1  2001/01/14 19:53:02  mike
 27           // Pegasus import
 28           //
 29 mike  1.1 //
 30           //END_HISTORY
 31           
 32           #ifndef Pegasus_Parameter_h
 33           #define Pegasus_Parameter_h
 34           
 35           #include <Pegasus/Common/Config.h>
 36           #include <Pegasus/Common/ParameterRep.h>
 37           
 38           PEGASUS_NAMESPACE_BEGIN
 39           
 40           ////////////////////////////////////////////////////////////////////////////////
 41           //
 42           // Parameter
 43           //
 44           ////////////////////////////////////////////////////////////////////////////////
 45           
 46           class ConstParameter;
 47           
 48           class PEGASUS_COMMON_LINKAGE Parameter
 49           {
 50 mike  1.1 public:
 51           
 52               Parameter() : _rep(0)
 53               {
 54           
 55               }
 56           
 57               Parameter(const Parameter& x)
 58               {
 59           	Inc(_rep = x._rep);
 60               }
 61           
 62               Parameter& operator=(const Parameter& x)
 63               {
 64           	if (x._rep != _rep)
 65           	{
 66           	    Dec(_rep);
 67           	    Inc(_rep = x._rep);
 68           	}
 69           	return *this;
 70               }
 71 mike  1.1 
 72               // Throws IllegalName if name argument not legal CIM identifier.
 73           
 74               Parameter(
 75           	const String& name, 
 76           	Type type,
 77           	Boolean isArray = false,
 78           	Uint32 arraySize = 0,
 79           	const String& referenceClassName = String::EMPTY)
 80               {
 81           	_rep = new ParameterRep(
 82           	    name, type, isArray, arraySize, referenceClassName);
 83               }
 84           
 85               ~Parameter()
 86               {
 87           	Dec(_rep);
 88               }
 89           
 90               const String& getName() const 
 91               { 
 92 mike  1.1 	_checkRep();
 93           	return _rep->getName(); 
 94               }
 95           
 96               // Throws IllegalName if name argument not legal CIM identifier.
 97           
 98               void setName(const String& name)
 99               {
100           	_checkRep();
101           	_rep->setName(name);
102               }
103           
104               Boolean isArray() const
105               {
106           	_checkRep();
107           	return _rep->isArray();
108               }
109           
110               Uint32 getAraySize() const
111               {
112           	_checkRep();
113 mike  1.1 	return _rep->getAraySize();
114               }
115           
116               const String& getReferenceClassName() const 
117               {
118           	_checkRep();
119           	return _rep->getReferenceClassName(); 
120               }
121           
122               Type getType() const 
123               { 
124           	_checkRep();
125           	return _rep->getType();
126               }
127           
128               void setType(Type type);
129           
130               // Throws AlreadyExists.
131           
132               Parameter& addQualifier(const Qualifier& x)
133               {
134 mike  1.1 	_checkRep();
135           	_rep->addQualifier(x);
136           	return *this;
137               }
138           
139               Uint32 findQualifier(const String& name)
140               {
141           	_checkRep();
142           	return _rep->findQualifier(name);
143               }
144           
145               Uint32 findQualifier(const String& name) const
146               {
147           	_checkRep();
148           	return _rep->findQualifier(name);
149               }
150           
151               Qualifier getQualifier(Uint32 pos)
152               {
153           	_checkRep();
154           	return _rep->getQualifier(pos);
155 mike  1.1     }
156           
157               ConstQualifier getQualifier(Uint32 pos) const
158               {
159           	_checkRep();
160           	return _rep->getQualifier(pos);
161               }
162           
163               Uint32 getQualifierCount() const
164               {
165           	_checkRep();
166           	return _rep->getQualifierCount();
167               }
168           
169               void resolve(DeclContext* declContext, const String& nameSpace)
170               {
171           	_checkRep();
172           	_rep->resolve(declContext, nameSpace);
173               }
174           
175               operator int() const { return _rep != 0; }
176 mike  1.1 
177               void toXml(Array<Sint8>& out) const
178               {
179           	_checkRep();
180           	_rep->toXml(out);
181               }
182           
183               void print() const
184               {
185           	_checkRep();
186           	_rep->print();
187               }
188           
189               Boolean identical(const ConstParameter& x) const;
190           
191               Parameter clone() const
192               {
193           	return Parameter(_rep->clone());
194               }
195           
196           private:
197 mike  1.1 
198               Parameter(ParameterRep* rep) : _rep(rep)
199               {
200               }
201           
202               void _checkRep() const
203               {
204           	if (!_rep)
205           	    throw UnitializedHandle();
206               }
207           
208               ParameterRep* _rep;
209               friend class ConstParameter;
210           };
211           
212           ////////////////////////////////////////////////////////////////////////////////
213           //
214           // ConstParameter
215           //
216           ////////////////////////////////////////////////////////////////////////////////
217           
218 mike  1.1 class PEGASUS_COMMON_LINKAGE ConstParameter
219           {
220           public:
221           
222               ConstParameter() : _rep(0)
223               {
224           
225               }
226           
227               ConstParameter(const ConstParameter& x)
228               {
229           	Inc(_rep = x._rep);
230               }
231           
232               ConstParameter(const Parameter& x)
233               {
234           	Inc(_rep = x._rep);
235               }
236           
237               ConstParameter& operator=(const ConstParameter& x)
238               {
239 mike  1.1 	if (x._rep != _rep)
240           	{
241           	    Dec(_rep);
242           	    Inc(_rep = x._rep);
243           	}
244           	return *this;
245               }
246           
247               ConstParameter& operator=(const Parameter& x)
248               {
249           	if (x._rep != _rep)
250           	{
251           	    Dec(_rep);
252           	    Inc(_rep = x._rep);
253           	}
254           	return *this;
255               }
256           
257               // Throws IllegalName if name argument not legal CIM identifier.
258           
259               ConstParameter(
260 mike  1.1 	const String& name, 
261           	Type type,
262           	Boolean isArray = false,
263           	Uint32 arraySize = 0,
264           	const String& referenceClassName = String::EMPTY)
265               {
266           	_rep = new ParameterRep(
267           	    name, type, isArray, arraySize, referenceClassName);
268               }
269           
270               ~ConstParameter()
271               {
272           	Dec(_rep);
273               }
274           
275               const String& getName() const 
276               { 
277           	_checkRep();
278           	return _rep->getName(); 
279               }
280           
281 mike  1.1     Boolean isArray() const
282               {
283           	_checkRep();
284           	return _rep->isArray();
285               }
286           
287               Uint32 getAraySize() const
288               {
289           	_checkRep();
290           	return _rep->getAraySize();
291               }
292           
293               const String& getReferenceClassName() const 
294               {
295           	_checkRep();
296           	return _rep->getReferenceClassName(); 
297               }
298           
299               Type getType() const 
300               { 
301           	_checkRep();
302 mike  1.1 	return _rep->getType();
303               }
304           
305               Uint32 findQualifier(const String& name) const
306               {
307           	_checkRep();
308           	return _rep->findQualifier(name);
309               }
310           
311               ConstQualifier getQualifier(Uint32 pos) const
312               {
313           	_checkRep();
314           	return _rep->getQualifier(pos);
315               }
316           
317               Uint32 getQualifierCount() const
318               {
319           	_checkRep();
320           	return _rep->getQualifierCount();
321               }
322           
323 mike  1.1     operator int() const { return _rep != 0; }
324           
325               void toXml(Array<Sint8>& out) const
326               {
327           	_checkRep();
328           	_rep->toXml(out);
329               }
330           
331               void print() const
332               {
333           	_checkRep();
334           	_rep->print();
335               }
336           
337               Boolean identical(const ConstParameter& x) const
338               {
339           	x._checkRep();
340           	_checkRep();
341           	return _rep->identical(x._rep);
342               }
343           
344 mike  1.2     Parameter clone() const
345 mike  1.1     {
346 mike  1.2 	return Parameter(_rep->clone());
347 mike  1.1     }
348           
349           private:
350           
351               void _checkRep() const
352               {
353           	if (!_rep)
354           	    throw UnitializedHandle();
355               }
356           
357               ParameterRep* _rep;
358               friend class Parameter;
359           };
360           
361           PEGASUS_NAMESPACE_END
362           
363           #endif /* Pegasus_Parameter_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2