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

  1 mike  1.10 //%/////////////////////////////////////////////////////////////////////////////
  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.10 //
 23            // Author: Mike Brasher (mbrasher@bmc.com)
 24            //
 25 kumpf 1.11 // Modified By: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
 26 mike  1.10 //
 27            //%/////////////////////////////////////////////////////////////////////////////
 28            
 29            #include "CIMProperty.h"
 30            
 31            PEGASUS_NAMESPACE_BEGIN
 32            
 33            #define PEGASUS_ARRAY_T CIMProperty
 34            # include "ArrayImpl.h"
 35            #undef PEGASUS_ARRAY_T
 36            
 37 kumpf 1.11 
 38            ////////////////////////////////////////////////////////////////////////////////
 39            //
 40            // CIMProperty
 41            //
 42            ////////////////////////////////////////////////////////////////////////////////
 43            
 44            CIMProperty::CIMProperty()
 45                : _rep(0)
 46            {
 47            }
 48            
 49            CIMProperty::CIMProperty(const CIMProperty& x)
 50            {
 51                Inc(_rep = x._rep);
 52            }
 53            
 54            CIMProperty::CIMProperty(
 55                const String& name,
 56                const CIMValue& value,
 57                Uint32 arraySize,
 58 kumpf 1.11     const String& referenceClassName,
 59                const String& classOrigin,
 60                Boolean propagated)
 61            {
 62                _rep = new CIMPropertyRep(name, value,
 63                    arraySize, referenceClassName, classOrigin, propagated);
 64            }
 65            
 66 kumpf 1.12 // This constructor allows the CIMClassRep friend class to cast
 67            // away constness.
 68 mike  1.10 CIMProperty::CIMProperty(const CIMConstProperty& x)
 69            {
 70                Inc(_rep = x._rep);
 71            }
 72            
 73 kumpf 1.11 CIMProperty::CIMProperty(CIMPropertyRep* rep)
 74                : _rep(rep)
 75            {
 76            }
 77            
 78            CIMProperty::~CIMProperty()
 79            {
 80                Dec(_rep);
 81            }
 82            
 83            CIMProperty& CIMProperty::operator=(const CIMProperty& x)
 84            {
 85                if (x._rep != _rep)
 86                {
 87                    Dec(_rep);
 88                    Inc(_rep = x._rep);
 89                }
 90                return *this;
 91            }
 92            
 93            const String& CIMProperty::getName() const
 94 kumpf 1.11 {
 95                _checkRep();
 96                return _rep->getName();
 97            }
 98            
 99            void CIMProperty::setName(const String& name)
100            {
101                _checkRep();
102                _rep->setName(name);
103            }
104            
105            const CIMValue& CIMProperty::getValue() const
106            {
107                _checkRep();
108                return _rep->getValue();
109            }
110            
111            CIMType CIMProperty::getType() const
112            {
113                _checkRep();
114                return _rep->getValue().getType();
115 kumpf 1.11 }
116            
117            Boolean CIMProperty::isArray() const
118            {
119                _checkRep();
120                return _rep->getValue().isArray();
121            }
122            
123            void CIMProperty::setValue(const CIMValue& value)
124            {
125                _checkRep();
126                _rep->setValue(value);
127            }
128            
129            Uint32 CIMProperty::getArraySize() const
130            {
131                _checkRep();
132                return _rep->getArraySize();
133            }
134            
135            const String& CIMProperty::getReferenceClassName() const
136 kumpf 1.11 {
137                _checkRep();
138                return _rep->getReferenceClassName();
139            }
140            
141            const String& CIMProperty::getClassOrigin() const
142            {
143                _checkRep();
144                return _rep->getClassOrigin();
145            }
146            
147            void CIMProperty::setClassOrigin(const String& classOrigin)
148            {
149                _checkRep();
150                _rep->setClassOrigin(classOrigin);
151            }
152            
153            Boolean CIMProperty::getPropagated() const
154            {
155                _checkRep();
156                return _rep->getPropagated();
157 kumpf 1.11 }
158            
159            void CIMProperty::setPropagated(Boolean propagated)
160            {
161                _checkRep();
162                _rep->setPropagated(propagated);
163            }
164            
165            CIMProperty& CIMProperty::addQualifier(const CIMQualifier& x)
166            {
167                _checkRep();
168                _rep->addQualifier(x);
169                return *this;
170            }
171            
172            Uint32 CIMProperty::findQualifier(const String& name) const
173            {
174                _checkRep();
175                return _rep->findQualifier(name);
176            }
177            
178 kumpf 1.11 Boolean CIMProperty::existsQualifier(const String& name) const
179            {
180                _checkRep();
181                return _rep->existsQualifier(name);
182            }
183            
184            CIMQualifier CIMProperty::getQualifier(Uint32 pos)
185            {
186                _checkRep();
187                return _rep->getQualifier(pos);
188            }
189            
190            CIMConstQualifier CIMProperty::getQualifier(Uint32 pos) const
191            {
192                _checkRep();
193                return _rep->getQualifier(pos);
194            }
195            
196            void CIMProperty::removeQualifier(Uint32 pos)
197            {
198                _checkRep();
199 kumpf 1.11     _rep->removeQualifier(pos);
200            }
201                
202            Uint32 CIMProperty::getQualifierCount() const
203            {
204                _checkRep();
205                return _rep->getQualifierCount();
206            }
207            
208            void CIMProperty::resolve(
209                DeclContext* declContext,
210                const String& nameSpace,
211                Boolean isInstancePart,
212                const CIMConstProperty& property,
213                Boolean propagateQualifiers)
214            {
215                _checkRep();
216                _rep->resolve(declContext, 
217                    nameSpace, isInstancePart, property, propagateQualifiers);
218            }
219            
220 kumpf 1.11 void CIMProperty::resolve(
221                DeclContext* declContext,
222                const String& nameSpace,
223                Boolean isInstancePart,
224                Boolean propagateQualifiers)
225            {
226                _checkRep();
227                _rep->resolve(
228                    declContext, nameSpace, isInstancePart, propagateQualifiers);
229            }
230            
231            CIMProperty::operator int() const
232            {
233                return (_rep != 0);
234            }
235            
236            void CIMProperty::toXml(Array<Sint8>& out) const
237            {
238                _checkRep();
239                _rep->toXml(out);
240            }
241 kumpf 1.11 
242            void CIMProperty::print(PEGASUS_STD(ostream)& o) const
243            {
244                _checkRep();
245                _rep->print(o);
246            }
247            
248            void CIMProperty::toMof(Array<Sint8>& out) const
249            {
250                _checkRep();
251                _rep->toMof(out);
252            }
253            
254 mike  1.10 Boolean CIMProperty::identical(const CIMConstProperty& x) const
255            {
256                x._checkRep();
257                _checkRep();
258                return _rep->identical(x._rep);
259 kumpf 1.11 }
260            
261            Boolean CIMProperty::isKey() const
262            {
263                _checkRep();
264                return _rep->isKey();
265            }
266            
267            CIMProperty CIMProperty::clone(Boolean propagateQualifiers) const
268            {
269                return CIMProperty(_rep->clone(propagateQualifiers));
270            }
271            
272            void CIMProperty::_checkRep() const
273            {
274                if (!_rep)
275                    ThrowUnitializedHandle();
276            }
277            
278            ////////////////////////////////////////////////////////////////////////////////
279            //
280 kumpf 1.11 // CIMConstProperty
281            //
282            ////////////////////////////////////////////////////////////////////////////////
283            
284            CIMConstProperty::CIMConstProperty()
285                : _rep(0)
286            {
287            }
288            
289            CIMConstProperty::CIMConstProperty(const CIMConstProperty& x)
290            {
291                Inc(_rep = x._rep);
292            }
293            
294            CIMConstProperty::CIMConstProperty(const CIMProperty& x)
295            {
296                Inc(_rep = x._rep);
297            }
298            
299            // Throws IllegalName if name argument not legal CIM identifier.
300            
301 kumpf 1.11 CIMConstProperty::CIMConstProperty(
302                const String& name,
303                const CIMValue& value,
304                Uint32 arraySize,
305                const String& referenceClassName,
306                const String& classOrigin,
307                Boolean propagated)
308            {
309                _rep = new CIMPropertyRep(name, value,
310                    arraySize, referenceClassName, classOrigin, propagated);
311            }
312            
313            CIMConstProperty::~CIMConstProperty()
314            {
315                Dec(_rep);
316            }
317            
318            CIMConstProperty& CIMConstProperty::operator=(const CIMConstProperty& x)
319            {
320                if (x._rep != _rep)
321                {
322 kumpf 1.11         Dec(_rep);
323                    Inc(_rep = x._rep);
324                }
325                return *this;
326            }
327            
328            CIMConstProperty& CIMConstProperty::operator=(const CIMProperty& x)
329            {
330                if (x._rep != _rep)
331                {
332                    Dec(_rep);
333                    Inc(_rep = x._rep);
334                }
335                return *this;
336            }
337            
338            const String& CIMConstProperty::getName() const
339            {
340                _checkRep();
341                return _rep->getName();
342            }
343 kumpf 1.11 
344            const CIMValue& CIMConstProperty::getValue() const
345            {
346                _checkRep();
347                return _rep->getValue();
348            }
349            
350            CIMType CIMConstProperty::getType() const
351            {
352                _checkRep();
353                return _rep->getValue().getType();
354            }
355            
356            Boolean CIMConstProperty::isArray() const
357            {
358                _checkRep();
359                return _rep->getValue().isArray();
360            }
361            
362            Uint32 CIMConstProperty::getArraySize() const
363            {
364 kumpf 1.11     _checkRep();
365                return _rep->getArraySize();
366            }
367            
368            const String& CIMConstProperty::getReferenceClassName() const
369            {
370                _checkRep();
371                return _rep->getReferenceClassName();
372            }
373            
374            const String& CIMConstProperty::getClassOrigin() const
375            {
376                _checkRep();
377                return _rep->getClassOrigin();
378            }
379            
380            Boolean CIMConstProperty::getPropagated() const
381            {
382                _checkRep();
383                return _rep->getPropagated();
384            }
385 kumpf 1.11 
386            Uint32 CIMConstProperty::findQualifier(const String& name) const
387            {
388                _checkRep();
389                return _rep->findQualifier(name);
390            }
391            
392            CIMConstQualifier CIMConstProperty::getQualifier(Uint32 pos) const
393            {
394                _checkRep();
395                return _rep->getQualifier(pos);
396            }
397            
398            Uint32 CIMConstProperty::getQualifierCount() const
399            {
400                _checkRep();
401                return _rep->getQualifierCount();
402            }
403            
404            CIMConstProperty::operator int() const
405            {
406 kumpf 1.11     return (_rep != 0);
407            }
408            
409            void CIMConstProperty::toXml(Array<Sint8>& out) const
410            {
411                _checkRep();
412                _rep->toXml(out);
413            }
414            
415            void CIMConstProperty::print(PEGASUS_STD(ostream)& o) const
416            {
417                _checkRep();
418                _rep->print(o);
419            }
420            
421            void CIMConstProperty::toMof(Array<Sint8>& out) const
422            {
423                _checkRep();
424                _rep->toMof(out);
425            }
426            
427 kumpf 1.11 Boolean CIMConstProperty::identical(const CIMConstProperty& x) const
428            {
429                x._checkRep();
430                _checkRep();
431                return _rep->identical(x._rep);
432            }
433            
434            Boolean CIMConstProperty::isKey() const
435            {
436                _checkRep();
437                return _rep->isKey();
438            }
439            
440            CIMProperty CIMConstProperty::clone(Boolean propagateQualifiers) const
441            {
442                return CIMProperty(_rep->clone(propagateQualifiers));
443            }
444            
445            void CIMConstProperty::_checkRep() const
446            {
447                if (!_rep)
448 kumpf 1.11         ThrowUnitializedHandle();
449 mike  1.10 }
450            
451            PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2