1 karl 1.39 //%2006////////////////////////////////////////////////////////////////////////
|
2 mike 1.9 //
|
3 karl 1.33 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
4 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
5 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
|
6 karl 1.29 // IBM Corp.; EMC Corporation, The Open Group.
|
7 karl 1.33 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
8 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
|
9 karl 1.35 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 karl 1.39 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
12 // EMC Corporation; Symantec Corporation; The Open Group.
|
13 mike 1.9 //
14 // Permission is hereby granted, free of charge, to any person obtaining a copy
|
15 kumpf 1.19 // of this software and associated documentation files (the "Software"), to
16 // deal in the Software without restriction, including without limitation the
17 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
18 mike 1.9 // sell copies of the Software, and to permit persons to whom the Software is
19 // furnished to do so, subject to the following conditions:
|
20 karl 1.39 //
|
21 kumpf 1.19 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
|
22 mike 1.9 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
23 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
24 kumpf 1.19 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
25 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
27 mike 1.9 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30 //==============================================================================
31 //
32 //%/////////////////////////////////////////////////////////////////////////////
33
|
34 sage 1.11 #include <Pegasus/Common/Config.h>
|
35 mike 1.9 #include <cstdio>
36 #include "CIMParameter.h"
|
37 kumpf 1.16 #include "CIMParameterRep.h"
|
38 mike 1.9 #include "CIMName.h"
39 #include "CIMScope.h"
|
40 mike 1.38 #include "StrLit.h"
|
41 mike 1.9
42 PEGASUS_NAMESPACE_BEGIN
43
|
44 chip 1.36 CIMParameterRep::CIMParameterRep(const CIMParameterRep& x) :
45 Sharable(),
46 _name(x._name),
47 _type(x._type),
48 _isArray(x._isArray),
49 _arraySize(x._arraySize),
|
50 marek 1.44 _referenceClassName(x._referenceClassName),
51 _ownerCount(0)
|
52 chip 1.36 {
53 x._qualifiers.cloneTo(_qualifiers);
|
54 marek 1.44 // Set the CIM name tag.
55 _nameTag = generateCIMNameTag(_name);
|
56 chip 1.36 }
57
|
58 mike 1.9 CIMParameterRep::CIMParameterRep(
|
59 chip 1.36 const CIMName& name,
|
60 mike 1.9 CIMType type,
61 Boolean isArray,
62 Uint32 arraySize,
|
63 chip 1.36 const CIMName& referenceClassName)
64 : _name(name), _type(type),
65 _isArray(isArray), _arraySize(arraySize),
|
66 marek 1.44 _referenceClassName(referenceClassName),
67 _ownerCount(0)
68 {
|
69 chip 1.36 // ensure name is not null
|
70 kumpf 1.41 if (name.isNull())
|
71 chip 1.36 {
72 throw UninitializedObjectException();
73 }
|
74 marek 1.44 // Set the CIM name tag.
75 _nameTag = generateCIMNameTag(_name);
|
76 chip 1.36
|
77 kumpf 1.41 if ((_arraySize != 0) && !_isArray)
|
78 chip 1.36 {
79 throw TypeMismatchException();
80 }
|
81 mike 1.9
|
82 kumpf 1.21 if (!referenceClassName.isNull())
|
83 mike 1.9 {
|
84 chip 1.36 if (_type != CIMTYPE_REFERENCE)
85 {
86 throw TypeMismatchException();
87 }
|
88 mike 1.9 }
89 else
90 {
|
91 chip 1.36 if (_type == CIMTYPE_REFERENCE)
92 {
93 throw TypeMismatchException();
94 }
|
95 mike 1.9 }
96 }
97
|
98 chip 1.36 void CIMParameterRep::setName(const CIMName& name)
|
99 mike 1.9 {
|
100 chip 1.36 // ensure name is not null
|
101 kumpf 1.41 if (name.isNull())
|
102 chip 1.36 {
103 throw UninitializedObjectException();
104 }
|
105 marek 1.44 if (_ownerCount != 0 && _name != name)
106 {
107 MessageLoaderParms parms(
108 "Common.CIMParameterRep.CONTAINED_PARAMETER_NAMECHANGEDEXCEPTION",
109 "Attempted to change the name of a parameter"
110 " already in a container.");
111 throw Exception(parms);
112 }
113 _name = name;
114 // Set the CIM name tag.
115 _nameTag = generateCIMNameTag(_name);
|
116 mike 1.9 }
117
118 void CIMParameterRep::resolve(
119 DeclContext* declContext,
|
120 kumpf 1.21 const CIMNamespaceName& nameSpace)
|
121 mike 1.9 {
122 // Validate the qualifiers of the method (according to
123 // superClass's method with the same name). This method
124 // will throw an exception if the validation fails.
125
126 CIMQualifierList dummy;
127
128 _qualifiers.resolve(
|
129 kumpf 1.40 declContext,
130 nameSpace,
131 CIMScope::PARAMETER,
132 false,
133 dummy,
134 true);
|
135 mike 1.9 }
136
137 Boolean CIMParameterRep::identical(const CIMParameterRep* x) const
138 {
|
139 kumpf 1.42 // If the pointers are the same, the objects must be identical
140 if (this == x)
141 {
142 return true;
143 }
144
|
145 kumpf 1.28 if (!_name.equal (x->_name))
|
146 kumpf 1.40 return false;
|
147 mike 1.9
148 if (_type != x->_type)
|
149 kumpf 1.40 return false;
|
150 mike 1.9
|
151 kumpf 1.28 if (!_referenceClassName.equal (x->_referenceClassName))
|
152 kumpf 1.40 return false;
|
153 mike 1.9
154 if (!_qualifiers.identical(x->_qualifiers))
|
155 kumpf 1.40 return false;
|
156 mike 1.9
157 return true;
158 }
159
160 PEGASUS_NAMESPACE_END
|