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

  1 mike  1.9 //%/////////////////////////////////////////////////////////////////////////////
  2           //
  3 kumpf 1.15 // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM,
  4            // The Open Group, Tivoli Systems
  5 mike  1.9  //
  6            // Permission is hereby granted, free of charge, to any person obtaining a copy
  7 kumpf 1.15 // 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.9  // 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.15 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 14 mike  1.9  // 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.15 // 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.9  // 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.10 // Modified By: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
 27 mike  1.9  //
 28            //%/////////////////////////////////////////////////////////////////////////////
 29            
 30            #include "CIMParameter.h"
 31 kumpf 1.10 #include "CIMParameterRep.h"
 32 mike  1.9  
 33            PEGASUS_NAMESPACE_BEGIN
 34            
 35            #define PEGASUS_ARRAY_T CIMParameter
 36            # include "ArrayImpl.h"
 37            #undef PEGASUS_ARRAY_T
 38            
 39 kumpf 1.10 ////////////////////////////////////////////////////////////////////////////////
 40            //
 41            // CIMParameter
 42            //
 43            ////////////////////////////////////////////////////////////////////////////////
 44            
 45            CIMParameter::CIMParameter()
 46                : _rep(0)
 47            {
 48            }
 49            
 50            CIMParameter::CIMParameter(const CIMParameter& x)
 51            {
 52                Inc(_rep = x._rep);
 53            }
 54            
 55            CIMParameter::CIMParameter(
 56                const String& name,
 57                CIMType type,
 58                Boolean isArray,
 59                Uint32 arraySize,
 60 kumpf 1.10     const String& referenceClassName)
 61            {
 62                _rep = new CIMParameterRep(
 63                    name, type, isArray, arraySize, referenceClassName);
 64            }
 65            
 66            CIMParameter::CIMParameter(CIMParameterRep* rep)
 67                : _rep(rep)
 68            {
 69            }
 70            
 71            CIMParameter::~CIMParameter()
 72            {
 73                Dec(_rep);
 74            }
 75            
 76            CIMParameter& CIMParameter::operator=(const CIMParameter& x)
 77            {
 78                if (x._rep != _rep)
 79                {
 80                    Dec(_rep);
 81 kumpf 1.10         Inc(_rep = x._rep);
 82                }
 83                return *this;
 84            }
 85            
 86            const String& CIMParameter::getName() const
 87            {
 88                _checkRep();
 89                return _rep->getName();
 90            }
 91            
 92            void CIMParameter::setName(const String& name)
 93            {
 94                _checkRep();
 95                _rep->setName(name);
 96            }
 97            
 98            Boolean CIMParameter::isArray() const
 99            {
100                _checkRep();
101                return _rep->isArray();
102 kumpf 1.10 }
103            
104            Uint32 CIMParameter::getArraySize() const
105            {
106                _checkRep();
107                return _rep->getArraySize();
108            }
109            
110            const String& CIMParameter::getReferenceClassName() const
111            {
112                _checkRep();
113                return _rep->getReferenceClassName();
114            }
115            
116            CIMType CIMParameter::getType() const
117            {
118                _checkRep();
119                return _rep->getType();
120            }
121            
122            void CIMParameter::setType(const CIMType type)
123 kumpf 1.10 {
124                _checkRep();
125                _rep->setType(type);
126            }
127            
128            CIMParameter& CIMParameter::addQualifier(const CIMQualifier& x)
129            {
130                _checkRep();
131                _rep->addQualifier(x);
132                return *this;
133            }
134            
135            Uint32 CIMParameter::findQualifier(const String& name) const
136            {
137                _checkRep();
138                return _rep->findQualifier(name);
139            }
140            
141            CIMQualifier CIMParameter::getQualifier(Uint32 pos)
142            {
143                _checkRep();
144 kumpf 1.10     return _rep->getQualifier(pos);
145            }
146            
147            CIMConstQualifier CIMParameter::getQualifier(Uint32 pos) const
148            {
149                _checkRep();
150                return _rep->getQualifier(pos);
151            }
152            
153            Uint32 CIMParameter::getQualifierCount() const
154            {
155                _checkRep();
156                return _rep->getQualifierCount();
157            }
158            
159            void CIMParameter::resolve(DeclContext* declContext, const String& nameSpace)
160            {
161                _checkRep();
162                _rep->resolve(declContext, nameSpace);
163            }
164            
165 kumpf 1.12 Boolean CIMParameter::isNull() const
166 kumpf 1.10 {
167 kumpf 1.12     return (_rep == 0)? true : false;
168 kumpf 1.10 }
169            
170 mike  1.9  Boolean CIMParameter::identical(const CIMConstParameter& x) const
171            {
172                x._checkRep();
173                _checkRep();
174                return _rep->identical(x._rep);
175 kumpf 1.10 }
176            
177            CIMParameter CIMParameter::clone() const
178            {
179                return CIMParameter(_rep->clone());
180            }
181            
182            void CIMParameter::_checkRep() const
183            {
184                if (!_rep)
185 kumpf 1.11         ThrowUninitializedHandle();
186 kumpf 1.10 }
187            
188            
189            ////////////////////////////////////////////////////////////////////////////////
190            //
191            // CIMConstParameter
192            //
193            ////////////////////////////////////////////////////////////////////////////////
194            
195            CIMConstParameter::CIMConstParameter()
196                : _rep(0)
197            {
198            }
199            
200            CIMConstParameter::CIMConstParameter(const CIMConstParameter& x)
201            {
202                Inc(_rep = x._rep);
203            }
204            
205            CIMConstParameter::CIMConstParameter(const CIMParameter& x)
206            {
207 kumpf 1.10     Inc(_rep = x._rep);
208            }
209            
210            CIMConstParameter::CIMConstParameter(
211                const String& name,
212                CIMType type,
213                Boolean isArray,
214                Uint32 arraySize,
215                const String& referenceClassName)
216            {
217                _rep = new CIMParameterRep(
218                    name, type, isArray, arraySize, referenceClassName);
219            }
220            
221            CIMConstParameter::~CIMConstParameter()
222            {
223                Dec(_rep);
224            }
225            
226            CIMConstParameter& CIMConstParameter::operator=(const CIMConstParameter& x)
227            {
228 kumpf 1.10     if (x._rep != _rep)
229                {
230                    Dec(_rep);
231                    Inc(_rep = x._rep);
232                }
233                return *this;
234            }
235            
236            CIMConstParameter& CIMConstParameter::operator=(const CIMParameter& x)
237            {
238                if (x._rep != _rep)
239                {
240                    Dec(_rep);
241                    Inc(_rep = x._rep);
242                }
243                return *this;
244            }
245            
246            const String& CIMConstParameter::getName() const
247            {
248                _checkRep();
249 kumpf 1.10     return _rep->getName();
250            }
251            
252            Boolean CIMConstParameter::isArray() const
253            {
254                _checkRep();
255                return _rep->isArray();
256            }
257            
258            Uint32 CIMConstParameter::getArraySize() const
259            {
260                _checkRep();
261                return _rep->getArraySize();
262            }
263            
264            const String& CIMConstParameter::getReferenceClassName() const
265            {
266                _checkRep();
267                return _rep->getReferenceClassName();
268            }
269            
270 kumpf 1.10 CIMType CIMConstParameter::getType() const
271            {
272                _checkRep();
273                return _rep->getType();
274            }
275            
276            Uint32 CIMConstParameter::findQualifier(const String& name) const
277            {
278                _checkRep();
279                return _rep->findQualifier(name);
280            }
281            
282            CIMConstQualifier CIMConstParameter::getQualifier(Uint32 pos) const
283            {
284                _checkRep();
285                return _rep->getQualifier(pos);
286            }
287            
288            Uint32 CIMConstParameter::getQualifierCount() const
289            {
290                _checkRep();
291 kumpf 1.10     return _rep->getQualifierCount();
292            }
293            
294 kumpf 1.12 Boolean CIMConstParameter::isNull() const
295 kumpf 1.10 {
296 kumpf 1.12     return (_rep == 0)? true : false;
297 kumpf 1.10 }
298            
299            Boolean CIMConstParameter::identical(const CIMConstParameter& x) const
300            {
301                x._checkRep();
302                _checkRep();
303                return _rep->identical(x._rep);
304            }
305            
306            CIMParameter CIMConstParameter::clone() const
307            {
308                return CIMParameter(_rep->clone());
309            }
310            
311            void CIMConstParameter::_checkRep() const
312            {
313                if (!_rep)
314 kumpf 1.11         ThrowUninitializedHandle();
315 mike  1.9  }
316            
317            PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2