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

  1 martin 1.49 //%LICENSE////////////////////////////////////////////////////////////////
  2 martin 1.50 //
  3 martin 1.49 // 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.50 //
 10 martin 1.49 // 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.50 //
 17 martin 1.49 // The above copyright notice and this permission notice shall be included
 18             // in all copies or substantial portions of the Software.
 19 martin 1.50 //
 20 martin 1.49 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 21 martin 1.50 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 22 martin 1.49 // 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.50 //
 28 martin 1.49 //////////////////////////////////////////////////////////////////////////
 29 mike   1.11 //
 30             //%/////////////////////////////////////////////////////////////////////////////
 31             
 32 kumpf  1.14 #include "CIMInstanceRep.h"
 33 mike   1.11 #include "CIMInstance.h"
 34             #include "DeclContext.h"
 35             #include "CIMName.h"
 36             
 37 mike   1.13 PEGASUS_USING_STD;
 38             
 39 mike   1.11 PEGASUS_NAMESPACE_BEGIN
 40             
 41             #define PEGASUS_ARRAY_T CIMInstance
 42             # include "ArrayImpl.h"
 43             #undef PEGASUS_ARRAY_T
 44             
 45 mike   1.12 ////////////////////////////////////////////////////////////////////////////////
 46             //
 47             // CIMInstance
 48             //
 49             ////////////////////////////////////////////////////////////////////////////////
 50             
 51 kumpf  1.14 CIMInstance::CIMInstance()
 52                 : _rep(0)
 53             {
 54             }
 55             
 56             CIMInstance::CIMInstance(const CIMInstance& x)
 57             {
 58 thilo.boehm 1.48     _rep = x._rep;
 59                      if (_rep)
 60                          _rep->Inc();
 61 kumpf       1.14 }
 62                  
 63 kumpf       1.34 CIMInstance::CIMInstance(const CIMObject& x)
 64 mike        1.12 {
 65                      if (!(_rep = dynamic_cast<CIMInstanceRep*>(x._rep)))
 66 kumpf       1.42         throw DynamicCastFailedException();
 67 thilo.boehm 1.48     _rep->Inc();
 68 mike        1.12 }
 69                  
 70 kumpf       1.28 CIMInstance::CIMInstance(const CIMName& className)
 71 kumpf       1.14 {
 72 kumpf       1.42     _rep = new CIMInstanceRep(
 73                          CIMObjectPath(String::EMPTY, CIMNamespaceName(), className));
 74 kumpf       1.14 }
 75                  
 76                  CIMInstance::CIMInstance(CIMInstanceRep* rep)
 77                      : _rep(rep)
 78                  {
 79                  }
 80                  
 81                  CIMInstance& CIMInstance::operator=(const CIMInstance& x)
 82                  {
 83                      if (x._rep != _rep)
 84                      {
 85 thilo.boehm 1.48         if (_rep)
 86                              _rep->Dec();
 87                          _rep = x._rep;
 88                          if (_rep)
 89                              _rep->Inc();
 90 kumpf       1.14     }
 91                      return *this;
 92                  }
 93                  
 94                  CIMInstance::~CIMInstance()
 95                  {
 96 thilo.boehm 1.48     if (_rep)
 97                          _rep->Dec();
 98 kumpf       1.14 }
 99                  
100 kumpf       1.28 const CIMName& CIMInstance::getClassName() const
101 kumpf       1.14 {
102 marek       1.44     CheckRep(_rep);
103 kumpf       1.14     return _rep->getClassName();
104                  }
105                  
106 kumpf       1.22 const CIMObjectPath& CIMInstance::getPath() const
107 kumpf       1.14 {
108 marek       1.44     CheckRep(_rep);
109 kumpf       1.14     return _rep->getPath();
110 kumpf       1.24 }
111                  
112                  void CIMInstance::setPath (const CIMObjectPath & path)
113                  {
114 marek       1.44     CheckRep(_rep);
115 kumpf       1.24     _rep->setPath (path);
116 kumpf       1.14 }
117                  
118                  CIMInstance& CIMInstance::addQualifier(const CIMQualifier& qualifier)
119                  {
120 marek       1.44     CheckRep(_rep);
121 kumpf       1.14     _rep->addQualifier(qualifier);
122                      return *this;
123                  }
124                  
125 kumpf       1.28 Uint32 CIMInstance::findQualifier(const CIMName& name) const
126 kumpf       1.14 {
127 marek       1.44     CheckRep(_rep);
128 kumpf       1.14     return _rep->findQualifier(name);
129                  }
130                  
131 kumpf       1.33 CIMQualifier CIMInstance::getQualifier(Uint32 index)
132 kumpf       1.14 {
133 marek       1.44     CheckRep(_rep);
134 kumpf       1.33     return _rep->getQualifier(index);
135 kumpf       1.14 }
136                  
137 kumpf       1.33 CIMConstQualifier CIMInstance::getQualifier(Uint32 index) const
138 kumpf       1.14 {
139 marek       1.44     CheckRep(_rep);
140 kumpf       1.33     return _rep->getQualifier(index);
141 kumpf       1.14 }
142                  
143 kumpf       1.36 void CIMInstance::removeQualifier(Uint32 index)
144                  {
145 marek       1.44     CheckRep(_rep);
146 kumpf       1.36     _rep->removeQualifier(index);
147                  }
148                  
149 kumpf       1.14 Uint32 CIMInstance::getQualifierCount() const
150                  {
151 marek       1.44     CheckRep(_rep);
152 kumpf       1.14     return _rep->getQualifierCount();
153                  }
154                  
155                  CIMInstance& CIMInstance::addProperty(const CIMProperty& x)
156                  {
157 marek       1.44     CheckRep(_rep);
158 kumpf       1.14     _rep->addProperty(x);
159                      return *this;
160                  }
161                  
162 kumpf       1.28 Uint32 CIMInstance::findProperty(const CIMName& name) const
163 kumpf       1.14 {
164 marek       1.44     CheckRep(_rep);
165 kumpf       1.14     return _rep->findProperty(name);
166                  }
167                  
168 kumpf       1.34 CIMProperty CIMInstance::getProperty(Uint32 index)
169 kumpf       1.14 {
170 marek       1.44     CheckRep(_rep);
171 kumpf       1.33     return _rep->getProperty(index);
172 kumpf       1.14 }
173                  
174 kumpf       1.34 CIMConstProperty CIMInstance::getProperty(Uint32 index) const
175 kumpf       1.14 {
176 marek       1.44     CheckRep(_rep);
177 kumpf       1.33     return _rep->getProperty(index);
178 kumpf       1.14 }
179                  
180 kumpf       1.34 void CIMInstance::removeProperty(Uint32 index)
181 kumpf       1.14 {
182 marek       1.44     CheckRep(_rep);
183 kumpf       1.33     _rep->removeProperty(index);
184 kumpf       1.14 }
185                  
186                  Uint32 CIMInstance::getPropertyCount() const
187                  {
188 marek       1.44     CheckRep(_rep);
189 kumpf       1.14     return _rep->getPropertyCount();
190                  }
191                  
192 kumpf       1.29 Boolean CIMInstance::isUninitialized() const
193 kumpf       1.14 {
194 kumpf       1.43     return _rep == 0;
195 kumpf       1.14 }
196                  
197 mike        1.11 Boolean CIMInstance::identical(const CIMConstInstance& x) const
198                  {
199 marek       1.44     CheckRep(x._rep);
200                      CheckRep(_rep);
201 mike        1.11     return _rep->identical(x._rep);
202                  }
203                  
204 kumpf       1.14 CIMInstance CIMInstance::clone() const
205                  {
206                      return CIMInstance((CIMInstanceRep*)(_rep->clone()));
207                  }
208                  
209 kumpf       1.30 CIMObjectPath CIMInstance::buildPath(const CIMConstClass& cimClass) const
210 kumpf       1.14 {
211 marek       1.44     CheckRep(_rep);
212 kumpf       1.30     return _rep->buildPath(cimClass);
213 kumpf       1.14 }
214                  
215 anusha.kandepu 1.51 #ifdef PEGASUS_USE_DEPRECATED_INTERFACES
216 karl           1.38 void CIMInstance::filter(Boolean includeQualifiers, Boolean includeClassOrigin,
217                                             const CIMPropertyList& propertyList)
218                     {
219 marek          1.44     CheckRep(_rep);
220 karl           1.38     _rep->filter(includeQualifiers, includeClassOrigin, propertyList);
221                     }
222 anusha.kandepu 1.51 #endif
223                     
224                     void CIMInstance::instanceFilter(
225                         Boolean includeQualifiers,
226                         Boolean includeClassOrigin,
227                         const CIMPropertyList & propertyList)
228                     {
229                         CheckRep(_rep);
230                         _rep->instanceFilter(includeQualifiers, includeClassOrigin, propertyList);
231                     }
232 karl           1.38 
233 mike           1.12 ////////////////////////////////////////////////////////////////////////////////
234                     //
235                     // CIMConstInstance
236                     //
237                     ////////////////////////////////////////////////////////////////////////////////
238                     
239 kumpf          1.14 CIMConstInstance::CIMConstInstance()
240                         : _rep(0)
241                     {
242                     }
243                     
244                     CIMConstInstance::CIMConstInstance(const CIMConstInstance& x)
245                     {
246 thilo.boehm    1.48     _rep = x._rep;
247                         if (_rep)
248                             _rep->Inc();
249 kumpf          1.14 }
250                     
251                     CIMConstInstance::CIMConstInstance(const CIMInstance& x)
252                     {
253 thilo.boehm    1.48     _rep = x._rep;
254                         if (_rep)
255                             _rep->Inc();
256 kumpf          1.14 }
257                     
258 kumpf          1.34 CIMConstInstance::CIMConstInstance(const CIMObject& x)
259 mike           1.12 {
260                         if (!(_rep = dynamic_cast<CIMInstanceRep*>(x._rep)))
261 kumpf          1.42         throw DynamicCastFailedException();
262 thilo.boehm    1.48     _rep->Inc();
263 mike           1.12 }
264                     
265                     CIMConstInstance::CIMConstInstance(const CIMConstObject& x)
266                     {
267                         if (!(_rep = dynamic_cast<CIMInstanceRep*>(x._rep)))
268 kumpf          1.42         throw DynamicCastFailedException();
269 thilo.boehm    1.48     _rep->Inc();
270 kumpf          1.14 }
271                     
272 kumpf          1.28 CIMConstInstance::CIMConstInstance(const CIMName& className)
273 kumpf          1.14 {
274 kumpf          1.42     _rep = new CIMInstanceRep(
275                             CIMObjectPath(String::EMPTY, CIMNamespaceName(), className));
276 kumpf          1.14 }
277                     
278                     CIMConstInstance& CIMConstInstance::operator=(const CIMConstInstance& x)
279                     {
280                         if (x._rep != _rep)
281                         {
282 thilo.boehm    1.48         if (_rep)
283                                 _rep->Dec();
284                             _rep = x._rep;
285                             if (_rep)
286                                 _rep->Inc();
287 kumpf          1.14     }
288                         return *this;
289                     }
290                     
291                     CIMConstInstance& CIMConstInstance::operator=(const CIMInstance& x)
292                     {
293                         if (x._rep != _rep)
294                         {
295 thilo.boehm    1.48         if (_rep)
296                                 _rep->Dec();
297                             _rep = x._rep;
298                             if (_rep)
299                                 _rep->Inc();
300 kumpf          1.14     }
301                         return *this;
302                     }
303                     
304                     CIMConstInstance::~CIMConstInstance()
305                     {
306 thilo.boehm    1.48     if (_rep)
307                             _rep->Dec();
308 kumpf          1.14 }
309                     
310 kumpf          1.28 const CIMName& CIMConstInstance::getClassName() const
311 kumpf          1.14 {
312 marek          1.44     CheckRep(_rep);
313 kumpf          1.14     return _rep->getClassName();
314                     }
315                     
316 kumpf          1.22 const CIMObjectPath& CIMConstInstance::getPath() const
317 kumpf          1.14 {
318 marek          1.44     CheckRep(_rep);
319 kumpf          1.14     return _rep->getPath();
320                     }
321                     
322 kumpf          1.28 Uint32 CIMConstInstance::findQualifier(const CIMName& name) const
323 kumpf          1.14 {
324 marek          1.44     CheckRep(_rep);
325 kumpf          1.14     return _rep->findQualifier(name);
326                     }
327                     
328 kumpf          1.33 CIMConstQualifier CIMConstInstance::getQualifier(Uint32 index) const
329 kumpf          1.14 {
330 marek          1.44     CheckRep(_rep);
331 kumpf          1.33     return _rep->getQualifier(index);
332 kumpf          1.14 }
333                     
334                     Uint32 CIMConstInstance::getQualifierCount() const
335                     {
336 marek          1.44     CheckRep(_rep);
337 kumpf          1.14     return _rep->getQualifierCount();
338                     }
339                     
340 kumpf          1.28 Uint32 CIMConstInstance::findProperty(const CIMName& name) const
341 kumpf          1.14 {
342 marek          1.44     CheckRep(_rep);
343 kumpf          1.14     return _rep->findProperty(name);
344                     }
345                     
346 kumpf          1.33 CIMConstProperty CIMConstInstance::getProperty(Uint32 index) const
347 kumpf          1.14 {
348 marek          1.44     CheckRep(_rep);
349 kumpf          1.33     return _rep->getProperty(index);
350 kumpf          1.14 }
351                     
352                     Uint32 CIMConstInstance::getPropertyCount() const
353                     {
354 marek          1.44     CheckRep(_rep);
355 kumpf          1.14     return _rep->getPropertyCount();
356                     }
357                     
358 kumpf          1.29 Boolean CIMConstInstance::isUninitialized() const
359 kumpf          1.14 {
360 kumpf          1.43     return _rep == 0;
361 kumpf          1.14 }
362                     
363                     Boolean CIMConstInstance::identical(const CIMConstInstance& x) const
364                     {
365 marek          1.44     CheckRep(x._rep);
366                         CheckRep(_rep);
367 kumpf          1.14     return _rep->identical(x._rep);
368                     }
369                     
370                     CIMInstance CIMConstInstance::clone() const
371                     {
372                         return CIMInstance((CIMInstanceRep*)(_rep->clone()));
373                     }
374                     
375 kumpf          1.30 CIMObjectPath CIMConstInstance::buildPath(const CIMConstClass& cimClass) const
376 kumpf          1.14 {
377 marek          1.44     CheckRep(_rep);
378 kumpf          1.30     return _rep->buildPath(cimClass);
379 kumpf          1.14 }
380                     
381 mike           1.11 PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2