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

  1 karl  1.30 //%2005////////////////////////////////////////////////////////////////////////
  2 mike  1.10 //
  3 karl  1.29 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
  4            // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
  5            // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
  6 karl  1.28 // IBM Corp.; EMC Corporation, The Open Group.
  7 karl  1.29 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
  8            // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
  9 karl  1.30 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 10            // EMC Corporation; VERITAS Software Corporation; The Open Group.
 11 mike  1.10 //
 12            // Permission is hereby granted, free of charge, to any person obtaining a copy
 13 kumpf 1.18 // of this software and associated documentation files (the "Software"), to
 14            // deal in the Software without restriction, including without limitation the
 15            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 16 mike  1.10 // sell copies of the Software, and to permit persons to whom the Software is
 17            // furnished to do so, subject to the following conditions:
 18            // 
 19 kumpf 1.18 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 20 mike  1.10 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 21            // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 22 kumpf 1.18 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 23            // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 24            // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 25 mike  1.10 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 26            // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 27            //
 28            //==============================================================================
 29            //
 30            // Author: Mike Brasher (mbrasher@bmc.com)
 31            //
 32 kumpf 1.11 // Modified By: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
 33 kumpf 1.19 //              Carol Ann Krug Graves, Hewlett-Packard Company
 34            //                (carolann_graves@hp.com)
 35 mike  1.10 //
 36            //%/////////////////////////////////////////////////////////////////////////////
 37            
 38 kumpf 1.13 #include "CIMPropertyRep.h"
 39 mike  1.10 #include "CIMProperty.h"
 40            
 41            PEGASUS_NAMESPACE_BEGIN
 42            
 43            #define PEGASUS_ARRAY_T CIMProperty
 44            # include "ArrayImpl.h"
 45            #undef PEGASUS_ARRAY_T
 46            
 47 kumpf 1.11 
 48            ////////////////////////////////////////////////////////////////////////////////
 49            //
 50            // CIMProperty
 51            //
 52            ////////////////////////////////////////////////////////////////////////////////
 53            
 54            CIMProperty::CIMProperty()
 55                : _rep(0)
 56            {
 57            }
 58            
 59            CIMProperty::CIMProperty(const CIMProperty& x)
 60            {
 61                Inc(_rep = x._rep);
 62            }
 63            
 64            CIMProperty::CIMProperty(
 65 kumpf 1.21     const CIMName& name,
 66 kumpf 1.11     const CIMValue& value,
 67                Uint32 arraySize,
 68 kumpf 1.21     const CIMName& referenceClassName,
 69                const CIMName& classOrigin,
 70 kumpf 1.11     Boolean propagated)
 71            {
 72                _rep = new CIMPropertyRep(name, value,
 73                    arraySize, referenceClassName, classOrigin, propagated);
 74            }
 75            
 76 kumpf 1.12 // This constructor allows the CIMClassRep friend class to cast
 77            // away constness.
 78 mike  1.10 CIMProperty::CIMProperty(const CIMConstProperty& x)
 79            {
 80                Inc(_rep = x._rep);
 81            }
 82            
 83 kumpf 1.11 CIMProperty::CIMProperty(CIMPropertyRep* rep)
 84                : _rep(rep)
 85            {
 86            }
 87            
 88            CIMProperty::~CIMProperty()
 89            {
 90                Dec(_rep);
 91            }
 92            
 93            CIMProperty& CIMProperty::operator=(const CIMProperty& x)
 94            {
 95                if (x._rep != _rep)
 96                {
 97                    Dec(_rep);
 98                    Inc(_rep = x._rep);
 99                }
100                return *this;
101            }
102            
103 kumpf 1.21 const CIMName& CIMProperty::getName() const
104 kumpf 1.11 {
105                _checkRep();
106                return _rep->getName();
107            }
108            
109 kumpf 1.21 void CIMProperty::setName(const CIMName& name)
110 kumpf 1.11 {
111                _checkRep();
112                _rep->setName(name);
113            }
114            
115            const CIMValue& CIMProperty::getValue() const
116            {
117                _checkRep();
118                return _rep->getValue();
119            }
120            
121            CIMType CIMProperty::getType() const
122            {
123                _checkRep();
124                return _rep->getValue().getType();
125            }
126            
127            Boolean CIMProperty::isArray() const
128            {
129                _checkRep();
130                return _rep->getValue().isArray();
131 kumpf 1.11 }
132            
133            void CIMProperty::setValue(const CIMValue& value)
134            {
135                _checkRep();
136                _rep->setValue(value);
137            }
138            
139            Uint32 CIMProperty::getArraySize() const
140            {
141                _checkRep();
142                return _rep->getArraySize();
143            }
144            
145 kumpf 1.21 const CIMName& CIMProperty::getReferenceClassName() const
146 kumpf 1.11 {
147                _checkRep();
148                return _rep->getReferenceClassName();
149            }
150            
151 kumpf 1.21 const CIMName& CIMProperty::getClassOrigin() const
152 kumpf 1.11 {
153                _checkRep();
154                return _rep->getClassOrigin();
155            }
156            
157 kumpf 1.21 void CIMProperty::setClassOrigin(const CIMName& classOrigin)
158 kumpf 1.11 {
159                _checkRep();
160                _rep->setClassOrigin(classOrigin);
161            }
162            
163            Boolean CIMProperty::getPropagated() const
164            {
165                _checkRep();
166                return _rep->getPropagated();
167            }
168            
169            void CIMProperty::setPropagated(Boolean propagated)
170            {
171                _checkRep();
172                _rep->setPropagated(propagated);
173            }
174            
175            CIMProperty& CIMProperty::addQualifier(const CIMQualifier& x)
176            {
177                _checkRep();
178                _rep->addQualifier(x);
179 kumpf 1.11     return *this;
180            }
181            
182 kumpf 1.21 Uint32 CIMProperty::findQualifier(const CIMName& name) const
183 kumpf 1.11 {
184                _checkRep();
185                return _rep->findQualifier(name);
186            }
187            
188 kumpf 1.27 CIMQualifier CIMProperty::getQualifier(Uint32 index)
189 kumpf 1.11 {
190                _checkRep();
191 kumpf 1.27     return _rep->getQualifier(index);
192 kumpf 1.11 }
193            
194 kumpf 1.27 CIMConstQualifier CIMProperty::getQualifier(Uint32 index) const
195 kumpf 1.11 {
196                _checkRep();
197 kumpf 1.27     return _rep->getQualifier(index);
198 kumpf 1.11 }
199            
200 kumpf 1.27 void CIMProperty::removeQualifier(Uint32 index)
201 kumpf 1.11 {
202                _checkRep();
203 kumpf 1.27     _rep->removeQualifier(index);
204 kumpf 1.11 }
205                
206            Uint32 CIMProperty::getQualifierCount() const
207            {
208                _checkRep();
209                return _rep->getQualifierCount();
210            }
211            
212 kumpf 1.23 Boolean CIMProperty::isUninitialized() const
213 kumpf 1.11 {
214 kumpf 1.15     return (_rep == 0)? true : false;
215 kumpf 1.11 }
216            
217 mike  1.10 Boolean CIMProperty::identical(const CIMConstProperty& x) const
218            {
219                x._checkRep();
220                _checkRep();
221                return _rep->identical(x._rep);
222 kumpf 1.11 }
223            
224 kumpf 1.24 CIMProperty CIMProperty::clone() const
225 kumpf 1.11 {
226 kumpf 1.24     return CIMProperty(_rep->clone());
227 kumpf 1.11 }
228            
229            void CIMProperty::_checkRep() const
230            {
231                if (!_rep)
232 kumpf 1.26         throw UninitializedObjectException();
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 kumpf 1.27 CIMConstQualifier CIMConstProperty::getQualifier(Uint32 index) const
348 kumpf 1.11 {
349                _checkRep();
350 kumpf 1.27     return _rep->getQualifier(index);
351 kumpf 1.11 }
352            
353            Uint32 CIMConstProperty::getQualifierCount() const
354            {
355                _checkRep();
356                return _rep->getQualifierCount();
357            }
358            
359 kumpf 1.23 Boolean CIMConstProperty::isUninitialized() 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 kumpf 1.24 CIMProperty CIMConstProperty::clone() const
372 kumpf 1.11 {
373 kumpf 1.24     return CIMProperty(_rep->clone());
374 kumpf 1.11 }
375            
376            void CIMConstProperty::_checkRep() const
377            {
378                if (!_rep)
379 kumpf 1.26         throw UninitializedObjectException();
380 mike  1.10 }
381            
382            PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2