(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.23 Boolean CIMProperty::isUninitialized() 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 kumpf 1.24 CIMProperty CIMProperty::clone() const
219 kumpf 1.11 {
220 kumpf 1.24     return CIMProperty(_rep->clone());
221 kumpf 1.11 }
222            
223            void CIMProperty::_checkRep() const
224            {
225                if (!_rep)
226 kumpf 1.26         throw UninitializedObjectException();
227 kumpf 1.11 }
228            
229            ////////////////////////////////////////////////////////////////////////////////
230            //
231            // CIMConstProperty
232            //
233            ////////////////////////////////////////////////////////////////////////////////
234            
235            CIMConstProperty::CIMConstProperty()
236                : _rep(0)
237            {
238            }
239            
240            CIMConstProperty::CIMConstProperty(const CIMConstProperty& x)
241            {
242                Inc(_rep = x._rep);
243            }
244            
245            CIMConstProperty::CIMConstProperty(const CIMProperty& x)
246            {
247                Inc(_rep = x._rep);
248 kumpf 1.11 }
249            
250            CIMConstProperty::CIMConstProperty(
251 kumpf 1.21     const CIMName& name,
252 kumpf 1.11     const CIMValue& value,
253                Uint32 arraySize,
254 kumpf 1.21     const CIMName& referenceClassName,
255                const CIMName& classOrigin,
256 kumpf 1.11     Boolean propagated)
257            {
258                _rep = new CIMPropertyRep(name, value,
259                    arraySize, referenceClassName, classOrigin, propagated);
260            }
261            
262            CIMConstProperty::~CIMConstProperty()
263            {
264                Dec(_rep);
265            }
266            
267            CIMConstProperty& CIMConstProperty::operator=(const CIMConstProperty& x)
268            {
269                if (x._rep != _rep)
270                {
271                    Dec(_rep);
272                    Inc(_rep = x._rep);
273                }
274                return *this;
275            }
276            
277 kumpf 1.11 CIMConstProperty& CIMConstProperty::operator=(const CIMProperty& x)
278            {
279                if (x._rep != _rep)
280                {
281                    Dec(_rep);
282                    Inc(_rep = x._rep);
283                }
284                return *this;
285            }
286            
287 kumpf 1.21 const CIMName& CIMConstProperty::getName() const
288 kumpf 1.11 {
289                _checkRep();
290                return _rep->getName();
291            }
292            
293            const CIMValue& CIMConstProperty::getValue() const
294            {
295                _checkRep();
296                return _rep->getValue();
297            }
298            
299            CIMType CIMConstProperty::getType() const
300            {
301                _checkRep();
302                return _rep->getValue().getType();
303            }
304            
305            Boolean CIMConstProperty::isArray() const
306            {
307                _checkRep();
308                return _rep->getValue().isArray();
309 kumpf 1.11 }
310            
311            Uint32 CIMConstProperty::getArraySize() const
312            {
313                _checkRep();
314                return _rep->getArraySize();
315            }
316            
317 kumpf 1.21 const CIMName& CIMConstProperty::getReferenceClassName() const
318 kumpf 1.11 {
319                _checkRep();
320                return _rep->getReferenceClassName();
321            }
322            
323 kumpf 1.21 const CIMName& CIMConstProperty::getClassOrigin() const
324 kumpf 1.11 {
325                _checkRep();
326                return _rep->getClassOrigin();
327            }
328            
329            Boolean CIMConstProperty::getPropagated() const
330            {
331                _checkRep();
332                return _rep->getPropagated();
333            }
334            
335 kumpf 1.21 Uint32 CIMConstProperty::findQualifier(const CIMName& name) const
336 kumpf 1.11 {
337                _checkRep();
338                return _rep->findQualifier(name);
339            }
340            
341            CIMConstQualifier CIMConstProperty::getQualifier(Uint32 pos) const
342            {
343                _checkRep();
344                return _rep->getQualifier(pos);
345            }
346            
347            Uint32 CIMConstProperty::getQualifierCount() const
348            {
349                _checkRep();
350                return _rep->getQualifierCount();
351            }
352            
353 kumpf 1.23 Boolean CIMConstProperty::isUninitialized() const
354 kumpf 1.11 {
355 kumpf 1.15     return (_rep == 0)? true : false;
356 kumpf 1.11 }
357            
358            Boolean CIMConstProperty::identical(const CIMConstProperty& x) const
359            {
360                x._checkRep();
361                _checkRep();
362                return _rep->identical(x._rep);
363            }
364            
365 kumpf 1.24 CIMProperty CIMConstProperty::clone() const
366 kumpf 1.11 {
367 kumpf 1.24     return CIMProperty(_rep->clone());
368 kumpf 1.11 }
369            
370            void CIMConstProperty::_checkRep() const
371            {
372                if (!_rep)
373 kumpf 1.26         throw UninitializedObjectException();
374 mike  1.10 }
375            
376            PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2