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

  1 martin 1.51 //%LICENSE////////////////////////////////////////////////////////////////
  2 martin 1.52 //
  3 martin 1.51 // 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.52 //
 10 martin 1.51 // 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.52 //
 17 martin 1.51 // The above copyright notice and this permission notice shall be included
 18             // in all copies or substantial portions of the Software.
 19 martin 1.52 //
 20 martin 1.51 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 21 martin 1.52 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 22 martin 1.51 // 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.52 //
 28 martin 1.51 //////////////////////////////////////////////////////////////////////////
 29 mike   1.10 //
 30             //%/////////////////////////////////////////////////////////////////////////////
 31             
 32             #include "CIMQualifier.h"
 33 kumpf  1.19 #include "CIMQualifierRep.h"
 34 mike   1.10 #include "CIMName.h"
 35 kumpf  1.32 #include "InternalException.h"
 36 mike   1.40 #include "StrLit.h"
 37 mike   1.10 
 38             PEGASUS_NAMESPACE_BEGIN
 39 karl   1.13 PEGASUS_USING_STD;
 40 kumpf  1.19 
 41 mike   1.10 ////////////////////////////////////////////////////////////////////////////////
 42             //
 43             // CIMQualifierRep
 44             //
 45             ////////////////////////////////////////////////////////////////////////////////
 46             
 47 chip   1.38 CIMQualifierRep::CIMQualifierRep(const CIMQualifierRep& x) :
 48                 _name(x._name),
 49                 _value(x._value),
 50                 _flavor(x._flavor),
 51 marek  1.46     _propagated(x._propagated),
 52 marek  1.49     _nameTag(x._nameTag),
 53 thilo.boehm 1.50     _refCounter(1),
 54 marek       1.46     _ownerCount(0)
 55 chip        1.38 {
 56                  }
 57                  
 58 mike        1.10 CIMQualifierRep::CIMQualifierRep(
 59 chip        1.38     const CIMName& name,
 60                      const CIMValue& value,
 61 kumpf       1.30     const CIMFlavor & flavor,
 62 mike        1.10     Boolean propagated)
 63 chip        1.38     :
 64                      _name(name),
 65                      _value(value),
 66 mike        1.10     _flavor(flavor),
 67 marek       1.46     _propagated(propagated),
 68 thilo.boehm 1.50     _refCounter(1),
 69 marek       1.46     _ownerCount(0)
 70 mike        1.10 {
 71 chip        1.38     // ensure name is not null
 72 kumpf       1.43     if (name.isNull())
 73 chip        1.38     {
 74                          throw UninitializedObjectException();
 75                      }
 76 marek       1.46     // Set the CIM name tag.
 77                      _nameTag = generateCIMNameTag(_name);
 78 mike        1.10 }
 79                  
 80 chip        1.38 void CIMQualifierRep::setName(const CIMName& name)
 81 mike        1.10 {
 82 chip        1.38     // ensure name is not null
 83 kumpf       1.43     if (name.isNull())
 84 chip        1.38     {
 85                          throw UninitializedObjectException();
 86                      }
 87                  
 88 marek       1.46     if (_ownerCount != 0 && _name != name)
 89                      {
 90                          MessageLoaderParms parms(
 91                              "Common.CIMQualifierRep.CONTAINED_QUALIFIER_NAMECHANGEDEXCEPTION",
 92                              "Attempted to change the name of a qualifier"
 93                                  " already in a container.");
 94                          throw Exception(parms);
 95                      }
 96                  
 97 chip        1.38     _name = name;
 98 marek       1.46 
 99                      // Set the CIM name tag.
100                      _nameTag = generateCIMNameTag(_name);
101 mike        1.10 }
102                  
103 marek       1.54 void CIMQualifierRep::resolveFlavor(const CIMFlavor & inheritedFlavor)
104 kumpf       1.30 {
105                      // ATTN: KS P3 Needs more tests and expansion so we treate first different
106                      // from inheritance
107 karl        1.17 
108 kumpf       1.30     // if the turnoff flags set, reset the flavor bits
109 chip        1.38     if (inheritedFlavor.hasFlavor (CIMFlavor::RESTRICTED))
110 kumpf       1.30     {
111 kumpf       1.31         _flavor.removeFlavor (CIMFlavor::TOSUBCLASS);
112                          _flavor.removeFlavor (CIMFlavor::TOINSTANCE);
113 kumpf       1.30     }
114 chip        1.38     if (inheritedFlavor.hasFlavor (CIMFlavor::DISABLEOVERRIDE))
115 kumpf       1.30     {
116                          _flavor.removeFlavor (CIMFlavor::ENABLEOVERRIDE);
117                      }
118                  
119                      _flavor.addFlavor (inheritedFlavor);
120                  }
121 karl        1.17 
122 mike        1.10 Boolean CIMQualifierRep::identical(const CIMQualifierRep* x) const
123                  {
124                      return
125 kumpf       1.42         this == x ||
126 marek       1.53         (_name.equal(x->_name) &&
127                           _value == x->_value &&
128                           (_flavor.equal(x->_flavor)) &&
129                           _propagated == x->_propagated);
130 mike        1.10 }
131                  
132                  PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2