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

  1 martin 1.49 //%LICENSE////////////////////////////////////////////////////////////////
  2             // 
  3             // 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             // 
 10             // 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             // 
 17             // The above copyright notice and this permission notice shall be included
 18             // in all copies or substantial portions of the Software.
 19             // 
 20             // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 21             // 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 mike   1.11 // 
 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 karl        1.38 void CIMInstance::filter(Boolean includeQualifiers, Boolean includeClassOrigin,
216                                          const CIMPropertyList& propertyList)
217                  {
218 marek       1.44     CheckRep(_rep);
219 karl        1.38     _rep->filter(includeQualifiers, includeClassOrigin, propertyList);
220                  }
221                  
222 mike        1.12 ////////////////////////////////////////////////////////////////////////////////
223                  //
224                  // CIMConstInstance
225                  //
226                  ////////////////////////////////////////////////////////////////////////////////
227                  
228 kumpf       1.14 CIMConstInstance::CIMConstInstance()
229                      : _rep(0)
230                  {
231                  }
232                  
233                  CIMConstInstance::CIMConstInstance(const CIMConstInstance& x)
234                  {
235 thilo.boehm 1.48     _rep = x._rep;
236                      if (_rep)
237                          _rep->Inc();
238 kumpf       1.14 }
239                  
240                  CIMConstInstance::CIMConstInstance(const CIMInstance& x)
241                  {
242 thilo.boehm 1.48     _rep = x._rep;
243                      if (_rep)
244                          _rep->Inc();
245 kumpf       1.14 }
246                  
247 kumpf       1.34 CIMConstInstance::CIMConstInstance(const CIMObject& x)
248 mike        1.12 {
249                      if (!(_rep = dynamic_cast<CIMInstanceRep*>(x._rep)))
250 kumpf       1.42         throw DynamicCastFailedException();
251 thilo.boehm 1.48     _rep->Inc();
252 mike        1.12 }
253                  
254                  CIMConstInstance::CIMConstInstance(const CIMConstObject& x)
255                  {
256                      if (!(_rep = dynamic_cast<CIMInstanceRep*>(x._rep)))
257 kumpf       1.42         throw DynamicCastFailedException();
258 thilo.boehm 1.48     _rep->Inc();
259 kumpf       1.14 }
260                  
261 kumpf       1.28 CIMConstInstance::CIMConstInstance(const CIMName& className)
262 kumpf       1.14 {
263 kumpf       1.42     _rep = new CIMInstanceRep(
264                          CIMObjectPath(String::EMPTY, CIMNamespaceName(), className));
265 kumpf       1.14 }
266                  
267                  CIMConstInstance& CIMConstInstance::operator=(const CIMConstInstance& x)
268                  {
269                      if (x._rep != _rep)
270                      {
271 thilo.boehm 1.48         if (_rep)
272                              _rep->Dec();
273                          _rep = x._rep;
274                          if (_rep)
275                              _rep->Inc();
276 kumpf       1.14     }
277                      return *this;
278                  }
279                  
280                  CIMConstInstance& CIMConstInstance::operator=(const CIMInstance& x)
281                  {
282                      if (x._rep != _rep)
283                      {
284 thilo.boehm 1.48         if (_rep)
285                              _rep->Dec();
286                          _rep = x._rep;
287                          if (_rep)
288                              _rep->Inc();
289 kumpf       1.14     }
290                      return *this;
291                  }
292                  
293                  CIMConstInstance::~CIMConstInstance()
294                  {
295 thilo.boehm 1.48     if (_rep)
296                          _rep->Dec();
297 kumpf       1.14 }
298                  
299 kumpf       1.28 const CIMName& CIMConstInstance::getClassName() const
300 kumpf       1.14 {
301 marek       1.44     CheckRep(_rep);
302 kumpf       1.14     return _rep->getClassName();
303                  }
304                  
305 kumpf       1.22 const CIMObjectPath& CIMConstInstance::getPath() const
306 kumpf       1.14 {
307 marek       1.44     CheckRep(_rep);
308 kumpf       1.14     return _rep->getPath();
309                  }
310                  
311 kumpf       1.28 Uint32 CIMConstInstance::findQualifier(const CIMName& name) const
312 kumpf       1.14 {
313 marek       1.44     CheckRep(_rep);
314 kumpf       1.14     return _rep->findQualifier(name);
315                  }
316                  
317 kumpf       1.33 CIMConstQualifier CIMConstInstance::getQualifier(Uint32 index) const
318 kumpf       1.14 {
319 marek       1.44     CheckRep(_rep);
320 kumpf       1.33     return _rep->getQualifier(index);
321 kumpf       1.14 }
322                  
323                  Uint32 CIMConstInstance::getQualifierCount() const
324                  {
325 marek       1.44     CheckRep(_rep);
326 kumpf       1.14     return _rep->getQualifierCount();
327                  }
328                  
329 kumpf       1.28 Uint32 CIMConstInstance::findProperty(const CIMName& name) const
330 kumpf       1.14 {
331 marek       1.44     CheckRep(_rep);
332 kumpf       1.14     return _rep->findProperty(name);
333                  }
334                  
335 kumpf       1.33 CIMConstProperty CIMConstInstance::getProperty(Uint32 index) const
336 kumpf       1.14 {
337 marek       1.44     CheckRep(_rep);
338 kumpf       1.33     return _rep->getProperty(index);
339 kumpf       1.14 }
340                  
341                  Uint32 CIMConstInstance::getPropertyCount() const
342                  {
343 marek       1.44     CheckRep(_rep);
344 kumpf       1.14     return _rep->getPropertyCount();
345                  }
346                  
347 kumpf       1.29 Boolean CIMConstInstance::isUninitialized() const
348 kumpf       1.14 {
349 kumpf       1.43     return _rep == 0;
350 kumpf       1.14 }
351                  
352                  Boolean CIMConstInstance::identical(const CIMConstInstance& x) const
353                  {
354 marek       1.44     CheckRep(x._rep);
355                      CheckRep(_rep);
356 kumpf       1.14     return _rep->identical(x._rep);
357                  }
358                  
359                  CIMInstance CIMConstInstance::clone() const
360                  {
361                      return CIMInstance((CIMInstanceRep*)(_rep->clone()));
362                  }
363                  
364 kumpf       1.30 CIMObjectPath CIMConstInstance::buildPath(const CIMConstClass& cimClass) const
365 kumpf       1.14 {
366 marek       1.44     CheckRep(_rep);
367 kumpf       1.30     return _rep->buildPath(cimClass);
368 kumpf       1.14 }
369                  
370 mike        1.11 PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2