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

  1 martin 1.37 //%LICENSE////////////////////////////////////////////////////////////////
  2 martin 1.38 //
  3 martin 1.37 // Licensed to The Open Group (TOG) under one or more contributor license
  4             // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
  5             // this work for additional information regarding copyright ownership.
  6             // Each contributor licenses this file to you under the OpenPegasus Open
  7             // Source License; you may not use this file except in compliance with the
  8             // License.
  9 martin 1.38 //
 10 martin 1.37 // Permission is hereby granted, free of charge, to any person obtaining a
 11             // copy of this software and associated documentation files (the "Software"),
 12             // to deal in the Software without restriction, including without limitation
 13             // the rights to use, copy, modify, merge, publish, distribute, sublicense,
 14             // and/or sell copies of the Software, and to permit persons to whom the
 15             // Software is furnished to do so, subject to the following conditions:
 16 martin 1.38 //
 17 martin 1.37 // The above copyright notice and this permission notice shall be included
 18             // in all copies or substantial portions of the Software.
 19 martin 1.38 //
 20 martin 1.37 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 21 martin 1.38 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 22 martin 1.37 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 23             // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 24             // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 25             // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 26             // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 27 martin 1.38 //
 28 martin 1.37 //////////////////////////////////////////////////////////////////////////
 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 thilo.boehm 1.36     _rep = x._rep;
 56                      if (_rep)
 57                          _rep->Inc();
 58 kumpf       1.11 }
 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 thilo.boehm 1.36     if (_rep)
 80                          _rep->Dec();
 81 kumpf       1.11 }
 82                  
 83                  CIMProperty& CIMProperty::operator=(const CIMProperty& x)
 84                  {
 85 thilo.boehm 1.36 
 86 kumpf       1.11     if (x._rep != _rep)
 87                      {
 88 thilo.boehm 1.36        if (_rep)
 89                             _rep->Dec();
 90                         _rep = x._rep;
 91                         if (_rep)
 92                             _rep->Inc();
 93 kumpf       1.11     }
 94                      return *this;
 95                  }
 96                  
 97 kumpf       1.21 const CIMName& CIMProperty::getName() const
 98 kumpf       1.11 {
 99 marek       1.34     CheckRep(_rep);
100 kumpf       1.11     return _rep->getName();
101                  }
102                  
103 kumpf       1.21 void CIMProperty::setName(const CIMName& name)
104 kumpf       1.11 {
105 marek       1.34     CheckRep(_rep);
106 kumpf       1.11     _rep->setName(name);
107                  }
108                  
109                  const CIMValue& CIMProperty::getValue() const
110                  {
111 marek       1.34     CheckRep(_rep);
112 kumpf       1.11     return _rep->getValue();
113                  }
114                  
115                  CIMType CIMProperty::getType() const
116                  {
117 marek       1.34     CheckRep(_rep);
118 kumpf       1.11     return _rep->getValue().getType();
119                  }
120                  
121                  Boolean CIMProperty::isArray() const
122                  {
123 marek       1.34     CheckRep(_rep);
124 kumpf       1.11     return _rep->getValue().isArray();
125                  }
126                  
127                  void CIMProperty::setValue(const CIMValue& value)
128                  {
129 marek       1.34     CheckRep(_rep);
130 kumpf       1.11     _rep->setValue(value);
131                  }
132                  
133                  Uint32 CIMProperty::getArraySize() const
134                  {
135 marek       1.34     CheckRep(_rep);
136 kumpf       1.11     return _rep->getArraySize();
137                  }
138                  
139 kumpf       1.21 const CIMName& CIMProperty::getReferenceClassName() const
140 kumpf       1.11 {
141 marek       1.34     CheckRep(_rep);
142 kumpf       1.11     return _rep->getReferenceClassName();
143                  }
144                  
145 kumpf       1.21 const CIMName& CIMProperty::getClassOrigin() const
146 kumpf       1.11 {
147 marek       1.34     CheckRep(_rep);
148 kumpf       1.11     return _rep->getClassOrigin();
149                  }
150                  
151 kumpf       1.21 void CIMProperty::setClassOrigin(const CIMName& classOrigin)
152 kumpf       1.11 {
153 marek       1.34     CheckRep(_rep);
154 kumpf       1.11     _rep->setClassOrigin(classOrigin);
155                  }
156                  
157                  Boolean CIMProperty::getPropagated() const
158                  {
159 marek       1.34     CheckRep(_rep);
160 kumpf       1.11     return _rep->getPropagated();
161                  }
162                  
163                  void CIMProperty::setPropagated(Boolean propagated)
164                  {
165 marek       1.34     CheckRep(_rep);
166 kumpf       1.11     _rep->setPropagated(propagated);
167                  }
168                  
169                  CIMProperty& CIMProperty::addQualifier(const CIMQualifier& x)
170                  {
171 marek       1.34     CheckRep(_rep);
172 kumpf       1.11     _rep->addQualifier(x);
173                      return *this;
174                  }
175                  
176 kumpf       1.21 Uint32 CIMProperty::findQualifier(const CIMName& name) const
177 kumpf       1.11 {
178 marek       1.34     CheckRep(_rep);
179 kumpf       1.11     return _rep->findQualifier(name);
180                  }
181                  
182 kumpf       1.27 CIMQualifier CIMProperty::getQualifier(Uint32 index)
183 kumpf       1.11 {
184 marek       1.34     CheckRep(_rep);
185 kumpf       1.27     return _rep->getQualifier(index);
186 kumpf       1.11 }
187                  
188 kumpf       1.27 CIMConstQualifier CIMProperty::getQualifier(Uint32 index) const
189 kumpf       1.11 {
190 marek       1.34     CheckRep(_rep);
191 kumpf       1.27     return _rep->getQualifier(index);
192 kumpf       1.11 }
193                  
194 kumpf       1.27 void CIMProperty::removeQualifier(Uint32 index)
195 kumpf       1.11 {
196 marek       1.34     CheckRep(_rep);
197 kumpf       1.27     _rep->removeQualifier(index);
198 kumpf       1.11 }
199 kumpf       1.33 
200 kumpf       1.11 Uint32 CIMProperty::getQualifierCount() const
201                  {
202 marek       1.34     CheckRep(_rep);
203 kumpf       1.11     return _rep->getQualifierCount();
204                  }
205                  
206 kumpf       1.23 Boolean CIMProperty::isUninitialized() const
207 kumpf       1.11 {
208 kumpf       1.33     return _rep == 0;
209 kumpf       1.11 }
210                  
211 mike        1.10 Boolean CIMProperty::identical(const CIMConstProperty& x) const
212                  {
213 marek       1.34     CheckRep(x._rep);
214                      CheckRep(_rep);
215 mike        1.10     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                  
224                  ////////////////////////////////////////////////////////////////////////////////
225                  //
226                  // CIMConstProperty
227                  //
228                  ////////////////////////////////////////////////////////////////////////////////
229                  
230                  CIMConstProperty::CIMConstProperty()
231                      : _rep(0)
232                  {
233                  }
234                  
235                  CIMConstProperty::CIMConstProperty(const CIMConstProperty& x)
236                  {
237 thilo.boehm 1.36     _rep = x._rep;
238                      if (_rep)
239                          _rep->Inc();
240 kumpf       1.11 }
241                  
242                  CIMConstProperty::CIMConstProperty(const CIMProperty& x)
243                  {
244 thilo.boehm 1.36     _rep = x._rep;
245                      if (_rep)
246                          _rep->Inc();
247 kumpf       1.11 }
248                  
249                  CIMConstProperty::CIMConstProperty(
250 kumpf       1.21     const CIMName& name,
251 kumpf       1.11     const CIMValue& value,
252                      Uint32 arraySize,
253 kumpf       1.21     const CIMName& referenceClassName,
254                      const CIMName& classOrigin,
255 kumpf       1.11     Boolean propagated)
256                  {
257                      _rep = new CIMPropertyRep(name, value,
258                          arraySize, referenceClassName, classOrigin, propagated);
259                  }
260                  
261                  CIMConstProperty::~CIMConstProperty()
262                  {
263 thilo.boehm 1.36     if (_rep)
264                          _rep->Dec();
265 kumpf       1.11 }
266                  
267                  CIMConstProperty& CIMConstProperty::operator=(const CIMConstProperty& x)
268                  {
269                      if (x._rep != _rep)
270                      {
271 thilo.boehm 1.36         if (_rep)
272                              _rep->Dec();
273                          _rep = x._rep;
274                          if (_rep)
275                              _rep->Inc();
276 kumpf       1.11     }
277                      return *this;
278                  }
279                  
280                  CIMConstProperty& CIMConstProperty::operator=(const CIMProperty& x)
281                  {
282                      if (x._rep != _rep)
283                      {
284 thilo.boehm 1.36         if (_rep)
285                              _rep->Dec();
286                          _rep = x._rep;
287                          if (_rep)
288                              _rep->Inc();
289 kumpf       1.11     }
290                      return *this;
291                  }
292                  
293 kumpf       1.21 const CIMName& CIMConstProperty::getName() const
294 kumpf       1.11 {
295 marek       1.34     CheckRep(_rep);
296 kumpf       1.11     return _rep->getName();
297                  }
298                  
299                  const CIMValue& CIMConstProperty::getValue() const
300                  {
301 marek       1.34     CheckRep(_rep);
302 kumpf       1.11     return _rep->getValue();
303                  }
304                  
305                  CIMType CIMConstProperty::getType() const
306                  {
307 marek       1.34     CheckRep(_rep);
308 kumpf       1.11     return _rep->getValue().getType();
309                  }
310                  
311                  Boolean CIMConstProperty::isArray() const
312                  {
313 marek       1.34     CheckRep(_rep);
314 kumpf       1.11     return _rep->getValue().isArray();
315                  }
316                  
317                  Uint32 CIMConstProperty::getArraySize() const
318                  {
319 marek       1.34     CheckRep(_rep);
320 kumpf       1.11     return _rep->getArraySize();
321                  }
322                  
323 kumpf       1.21 const CIMName& CIMConstProperty::getReferenceClassName() const
324 kumpf       1.11 {
325 marek       1.34     CheckRep(_rep);
326 kumpf       1.11     return _rep->getReferenceClassName();
327                  }
328                  
329 kumpf       1.21 const CIMName& CIMConstProperty::getClassOrigin() const
330 kumpf       1.11 {
331 marek       1.34     CheckRep(_rep);
332 kumpf       1.11     return _rep->getClassOrigin();
333                  }
334                  
335                  Boolean CIMConstProperty::getPropagated() const
336                  {
337 marek       1.34     CheckRep(_rep);
338 kumpf       1.11     return _rep->getPropagated();
339                  }
340                  
341 kumpf       1.21 Uint32 CIMConstProperty::findQualifier(const CIMName& name) const
342 kumpf       1.11 {
343 marek       1.34     CheckRep(_rep);
344 kumpf       1.11     return _rep->findQualifier(name);
345                  }
346                  
347 kumpf       1.27 CIMConstQualifier CIMConstProperty::getQualifier(Uint32 index) const
348 kumpf       1.11 {
349 marek       1.34     CheckRep(_rep);
350 kumpf       1.27     return _rep->getQualifier(index);
351 kumpf       1.11 }
352                  
353                  Uint32 CIMConstProperty::getQualifierCount() const
354                  {
355 marek       1.34     CheckRep(_rep);
356 kumpf       1.11     return _rep->getQualifierCount();
357                  }
358                  
359 kumpf       1.23 Boolean CIMConstProperty::isUninitialized() const
360 kumpf       1.11 {
361 kumpf       1.33     return _rep == 0;
362 kumpf       1.11 }
363                  
364                  Boolean CIMConstProperty::identical(const CIMConstProperty& x) const
365                  {
366 marek       1.34     CheckRep(x._rep);
367                      CheckRep(_rep);
368 kumpf       1.11     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 mike        1.10 PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2