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

  1 mike  1.10 //%/////////////////////////////////////////////////////////////////////////////
  2            //
  3 kumpf 1.18 // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM,
  4            // The Open Group, Tivoli Systems
  5 mike  1.10 //
  6            // Permission is hereby granted, free of charge, to any person obtaining a copy
  7 kumpf 1.18 // of this software and associated documentation files (the "Software"), to
  8            // deal in the Software without restriction, including without limitation the
  9            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 10 mike  1.10 // sell copies of the Software, and to permit persons to whom the Software is
 11            // furnished to do so, subject to the following conditions:
 12            // 
 13 kumpf 1.18 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 14 mike  1.10 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 15            // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 16 kumpf 1.18 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 17            // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 18            // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 19 mike  1.10 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 20            // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 21            //
 22            //==============================================================================
 23            //
 24            // Author: Mike Brasher (mbrasher@bmc.com)
 25            //
 26 kumpf 1.11 // Modified By: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
 27 kumpf 1.19 //              Carol Ann Krug Graves, Hewlett-Packard Company
 28            //                (carolann_graves@hp.com)
 29 mike  1.10 //
 30            //%/////////////////////////////////////////////////////////////////////////////
 31            
 32 kumpf 1.13 #include "CIMPropertyRep.h"
 33 mike  1.10 #include "CIMProperty.h"
 34            
 35            PEGASUS_NAMESPACE_BEGIN
 36            
 37            #define PEGASUS_ARRAY_T CIMProperty
 38            # include "ArrayImpl.h"
 39            #undef PEGASUS_ARRAY_T
 40            
 41 kumpf 1.11 
 42            ////////////////////////////////////////////////////////////////////////////////
 43            //
 44            // CIMProperty
 45            //
 46            ////////////////////////////////////////////////////////////////////////////////
 47            
 48            CIMProperty::CIMProperty()
 49                : _rep(0)
 50            {
 51            }
 52            
 53            CIMProperty::CIMProperty(const CIMProperty& x)
 54            {
 55                Inc(_rep = x._rep);
 56            }
 57            
 58            CIMProperty::CIMProperty(
 59 kumpf 1.21     const CIMName& name,
 60 kumpf 1.11     const CIMValue& value,
 61                Uint32 arraySize,
 62 kumpf 1.21     const CIMName& referenceClassName,
 63                const CIMName& classOrigin,
 64 kumpf 1.11     Boolean propagated)
 65            {
 66                _rep = new CIMPropertyRep(name, value,
 67                    arraySize, referenceClassName, classOrigin, propagated);
 68            }
 69            
 70 kumpf 1.12 // This constructor allows the CIMClassRep friend class to cast
 71            // away constness.
 72 mike  1.10 CIMProperty::CIMProperty(const CIMConstProperty& x)
 73            {
 74                Inc(_rep = x._rep);
 75            }
 76            
 77 kumpf 1.11 CIMProperty::CIMProperty(CIMPropertyRep* rep)
 78                : _rep(rep)
 79            {
 80            }
 81            
 82            CIMProperty::~CIMProperty()
 83            {
 84                Dec(_rep);
 85            }
 86            
 87            CIMProperty& CIMProperty::operator=(const CIMProperty& x)
 88            {
 89                if (x._rep != _rep)
 90                {
 91                    Dec(_rep);
 92                    Inc(_rep = x._rep);
 93                }
 94                return *this;
 95            }
 96            
 97 kumpf 1.21 const CIMName& CIMProperty::getName() const
 98 kumpf 1.11 {
 99                _checkRep();
100                return _rep->getName();
101            }
102            
103 kumpf 1.21 void CIMProperty::setName(const CIMName& name)
104 kumpf 1.11 {
105                _checkRep();
106                _rep->setName(name);
107            }
108            
109            const CIMValue& CIMProperty::getValue() const
110            {
111                _checkRep();
112                return _rep->getValue();
113            }
114            
115            CIMType CIMProperty::getType() const
116            {
117                _checkRep();
118                return _rep->getValue().getType();
119            }
120            
121            Boolean CIMProperty::isArray() const
122            {
123                _checkRep();
124                return _rep->getValue().isArray();
125 kumpf 1.11 }
126            
127            void CIMProperty::setValue(const CIMValue& value)
128            {
129                _checkRep();
130                _rep->setValue(value);
131            }
132            
133            Uint32 CIMProperty::getArraySize() const
134            {
135                _checkRep();
136                return _rep->getArraySize();
137            }
138            
139 kumpf 1.21 const CIMName& CIMProperty::getReferenceClassName() const
140 kumpf 1.11 {
141                _checkRep();
142                return _rep->getReferenceClassName();
143            }
144            
145 kumpf 1.21 const CIMName& CIMProperty::getClassOrigin() const
146 kumpf 1.11 {
147                _checkRep();
148                return _rep->getClassOrigin();
149            }
150            
151 kumpf 1.21 void CIMProperty::setClassOrigin(const CIMName& classOrigin)
152 kumpf 1.11 {
153                _checkRep();
154                _rep->setClassOrigin(classOrigin);
155            }
156            
157            Boolean CIMProperty::getPropagated() const
158            {
159                _checkRep();
160                return _rep->getPropagated();
161            }
162            
163            void CIMProperty::setPropagated(Boolean propagated)
164            {
165                _checkRep();
166                _rep->setPropagated(propagated);
167            }
168            
169            CIMProperty& CIMProperty::addQualifier(const CIMQualifier& x)
170            {
171                _checkRep();
172                _rep->addQualifier(x);
173 kumpf 1.11     return *this;
174            }
175            
176 kumpf 1.21 Uint32 CIMProperty::findQualifier(const CIMName& name) const
177 kumpf 1.11 {
178                _checkRep();
179                return _rep->findQualifier(name);
180            }
181            
182            CIMQualifier CIMProperty::getQualifier(Uint32 pos)
183            {
184                _checkRep();
185                return _rep->getQualifier(pos);
186            }
187            
188            CIMConstQualifier CIMProperty::getQualifier(Uint32 pos) const
189            {
190                _checkRep();
191                return _rep->getQualifier(pos);
192            }
193            
194            void CIMProperty::removeQualifier(Uint32 pos)
195            {
196                _checkRep();
197                _rep->removeQualifier(pos);
198 kumpf 1.11 }
199                
200            Uint32 CIMProperty::getQualifierCount() const
201            {
202                _checkRep();
203                return _rep->getQualifierCount();
204            }
205            
206 kumpf 1.15 Boolean CIMProperty::isNull() const
207 kumpf 1.11 {
208 kumpf 1.15     return (_rep == 0)? true : false;
209 kumpf 1.11 }
210            
211 mike  1.10 Boolean CIMProperty::identical(const CIMConstProperty& x) const
212            {
213                x._checkRep();
214                _checkRep();
215                return _rep->identical(x._rep);
216 kumpf 1.11 }
217            
218            Boolean CIMProperty::isKey() const
219            {
220                _checkRep();
221                return _rep->isKey();
222            }
223            
224            CIMProperty CIMProperty::clone(Boolean propagateQualifiers) const
225            {
226                return CIMProperty(_rep->clone(propagateQualifiers));
227            }
228            
229            void CIMProperty::_checkRep() const
230            {
231                if (!_rep)
232 kumpf 1.14         ThrowUninitializedHandle();
233 kumpf 1.11 }
234            
235            ////////////////////////////////////////////////////////////////////////////////
236            //
237            // CIMConstProperty
238            //
239            ////////////////////////////////////////////////////////////////////////////////
240            
241            CIMConstProperty::CIMConstProperty()
242                : _rep(0)
243            {
244            }
245            
246            CIMConstProperty::CIMConstProperty(const CIMConstProperty& x)
247            {
248                Inc(_rep = x._rep);
249            }
250            
251            CIMConstProperty::CIMConstProperty(const CIMProperty& x)
252            {
253                Inc(_rep = x._rep);
254 kumpf 1.11 }
255            
256            CIMConstProperty::CIMConstProperty(
257 kumpf 1.21     const CIMName& name,
258 kumpf 1.11     const CIMValue& value,
259                Uint32 arraySize,
260 kumpf 1.21     const CIMName& referenceClassName,
261                const CIMName& classOrigin,
262 kumpf 1.11     Boolean propagated)
263            {
264                _rep = new CIMPropertyRep(name, value,
265                    arraySize, referenceClassName, classOrigin, propagated);
266            }
267            
268            CIMConstProperty::~CIMConstProperty()
269            {
270                Dec(_rep);
271            }
272            
273            CIMConstProperty& CIMConstProperty::operator=(const CIMConstProperty& x)
274            {
275                if (x._rep != _rep)
276                {
277                    Dec(_rep);
278                    Inc(_rep = x._rep);
279                }
280                return *this;
281            }
282            
283 kumpf 1.11 CIMConstProperty& CIMConstProperty::operator=(const CIMProperty& x)
284            {
285                if (x._rep != _rep)
286                {
287                    Dec(_rep);
288                    Inc(_rep = x._rep);
289                }
290                return *this;
291            }
292            
293 kumpf 1.21 const CIMName& CIMConstProperty::getName() const
294 kumpf 1.11 {
295                _checkRep();
296                return _rep->getName();
297            }
298            
299            const CIMValue& CIMConstProperty::getValue() const
300            {
301                _checkRep();
302                return _rep->getValue();
303            }
304            
305            CIMType CIMConstProperty::getType() const
306            {
307                _checkRep();
308                return _rep->getValue().getType();
309            }
310            
311            Boolean CIMConstProperty::isArray() const
312            {
313                _checkRep();
314                return _rep->getValue().isArray();
315 kumpf 1.11 }
316            
317            Uint32 CIMConstProperty::getArraySize() const
318            {
319                _checkRep();
320                return _rep->getArraySize();
321            }
322            
323 kumpf 1.21 const CIMName& CIMConstProperty::getReferenceClassName() const
324 kumpf 1.11 {
325                _checkRep();
326                return _rep->getReferenceClassName();
327            }
328            
329 kumpf 1.21 const CIMName& CIMConstProperty::getClassOrigin() const
330 kumpf 1.11 {
331                _checkRep();
332                return _rep->getClassOrigin();
333            }
334            
335            Boolean CIMConstProperty::getPropagated() const
336            {
337                _checkRep();
338                return _rep->getPropagated();
339            }
340            
341 kumpf 1.21 Uint32 CIMConstProperty::findQualifier(const CIMName& name) const
342 kumpf 1.11 {
343                _checkRep();
344                return _rep->findQualifier(name);
345            }
346            
347            CIMConstQualifier CIMConstProperty::getQualifier(Uint32 pos) const
348            {
349                _checkRep();
350                return _rep->getQualifier(pos);
351            }
352            
353            Uint32 CIMConstProperty::getQualifierCount() const
354            {
355                _checkRep();
356                return _rep->getQualifierCount();
357            }
358            
359 kumpf 1.15 Boolean CIMConstProperty::isNull() const
360 kumpf 1.11 {
361 kumpf 1.15     return (_rep == 0)? true : false;
362 kumpf 1.11 }
363            
364            Boolean CIMConstProperty::identical(const CIMConstProperty& x) const
365            {
366                x._checkRep();
367                _checkRep();
368                return _rep->identical(x._rep);
369            }
370            
371            Boolean CIMConstProperty::isKey() const
372            {
373                _checkRep();
374                return _rep->isKey();
375            }
376            
377            CIMProperty CIMConstProperty::clone(Boolean propagateQualifiers) const
378            {
379                return CIMProperty(_rep->clone(propagateQualifiers));
380            }
381            
382            void CIMConstProperty::_checkRep() const
383 kumpf 1.11 {
384                if (!_rep)
385 kumpf 1.14         ThrowUninitializedHandle();
386 mike  1.10 }
387            
388            PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2