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

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2