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

  1 martin 1.50 //%LICENSE////////////////////////////////////////////////////////////////
  2 martin 1.51 //
  3 martin 1.50 // 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.51 //
 10 martin 1.50 // 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.51 //
 17 martin 1.50 // The above copyright notice and this permission notice shall be included
 18             // in all copies or substantial portions of the Software.
 19 martin 1.51 //
 20 martin 1.50 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 21 martin 1.51 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 22 martin 1.50 // 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.51 //
 28 martin 1.50 //////////////////////////////////////////////////////////////////////////
 29 mike   1.9  //
 30             //%/////////////////////////////////////////////////////////////////////////////
 31             
 32 sage   1.11 #include <Pegasus/Common/Config.h>
 33 mike   1.9  #include <cstdio>
 34             #include "CIMParameter.h"
 35 kumpf  1.16 #include "CIMParameterRep.h"
 36 mike   1.9  #include "CIMName.h"
 37             #include "CIMScope.h"
 38 mike   1.38 #include "StrLit.h"
 39 mike   1.9  
 40             PEGASUS_NAMESPACE_BEGIN
 41             
 42 chip   1.36 CIMParameterRep::CIMParameterRep(const CIMParameterRep& x) :
 43                 _name(x._name),
 44                 _type(x._type),
 45                 _isArray(x._isArray),
 46                 _arraySize(x._arraySize),
 47 marek  1.44     _referenceClassName(x._referenceClassName),
 48 thilo.boehm 1.49     _refCounter(1),
 49 kumpf       1.52     _ownerCount(0)
 50 chip        1.36 {
 51                      x._qualifiers.cloneTo(_qualifiers);
 52 marek       1.44     // Set the CIM name tag.
 53                      _nameTag = generateCIMNameTag(_name);
 54 chip        1.36 }
 55                  
 56 mike        1.9  CIMParameterRep::CIMParameterRep(
 57 chip        1.36     const CIMName& name,
 58 mike        1.9      CIMType type,
 59                      Boolean isArray,
 60                      Uint32 arraySize,
 61 chip        1.36     const CIMName& referenceClassName)
 62                      : _name(name), _type(type),
 63                      _isArray(isArray), _arraySize(arraySize),
 64 marek       1.44     _referenceClassName(referenceClassName),
 65 thilo.boehm 1.49     _refCounter(1),
 66 marek       1.44     _ownerCount(0)
 67 kumpf       1.52 {
 68 chip        1.36     // ensure name is not null
 69 kumpf       1.41     if (name.isNull())
 70 chip        1.36     {
 71                          throw UninitializedObjectException();
 72                      }
 73 marek       1.44     // Set the CIM name tag.
 74                      _nameTag = generateCIMNameTag(_name);
 75 chip        1.36 
 76 kumpf       1.41     if ((_arraySize != 0) && !_isArray)
 77 chip        1.36     {
 78                          throw TypeMismatchException();
 79                      }
 80 mike        1.9  
 81 kumpf       1.21     if (!referenceClassName.isNull())
 82 mike        1.9      {
 83 chip        1.36         if (_type != CIMTYPE_REFERENCE)
 84                          {
 85                              throw TypeMismatchException();
 86                          }
 87 mike        1.9      }
 88                      else
 89                      {
 90 chip        1.36         if (_type == CIMTYPE_REFERENCE)
 91                          {
 92                              throw TypeMismatchException();
 93                          }
 94 mike        1.9      }
 95                  }
 96                  
 97 chip        1.36 void CIMParameterRep::setName(const CIMName& name)
 98 mike        1.9  {
 99 chip        1.36     // ensure name is not null
100 kumpf       1.41     if (name.isNull())
101 chip        1.36     {
102                          throw UninitializedObjectException();
103                      }
104 marek       1.44     if (_ownerCount != 0 && _name != name)
105                      {
106                          MessageLoaderParms parms(
107                              "Common.CIMParameterRep.CONTAINED_PARAMETER_NAMECHANGEDEXCEPTION",
108                              "Attempted to change the name of a parameter"
109                                  " already in a container.");
110                          throw Exception(parms);
111                      }
112 kumpf       1.52     _name = name;
113 marek       1.44     // Set the CIM name tag.
114                      _nameTag = generateCIMNameTag(_name);
115 mike        1.9  }
116                  
117                  void CIMParameterRep::resolve(
118                      DeclContext* declContext,
119 kumpf       1.21     const CIMNamespaceName& nameSpace)
120 mike        1.9  {
121                      // Validate the qualifiers of the method (according to
122                      // superClass's method with the same name). This method
123                      // will throw an exception if the validation fails.
124                  
125                      CIMQualifierList dummy;
126                  
127                      _qualifiers.resolve(
128 kumpf       1.40         declContext,
129                          nameSpace,
130                          CIMScope::PARAMETER,
131                          false,
132                          dummy,
133                          true);
134 mike        1.9  }
135                  
136                  Boolean CIMParameterRep::identical(const CIMParameterRep* x) const
137                  {
138 kumpf       1.42     // If the pointers are the same, the objects must be identical
139                      if (this == x)
140                      {
141                          return true;
142                      }
143                  
144 kumpf       1.28     if (!_name.equal (x->_name))
145 kumpf       1.40         return false;
146 mike        1.9  
147                      if (_type != x->_type)
148 kumpf       1.40         return false;
149 mike        1.9  
150 kumpf       1.28     if (!_referenceClassName.equal (x->_referenceClassName))
151 kumpf       1.40         return false;
152 mike        1.9  
153                      if (!_qualifiers.identical(x->_qualifiers))
154 kumpf       1.40         return false;
155 mike        1.9  
156                      return true;
157                  }
158                  
159                  PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2