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 CIMParameterRep::~CIMParameterRep()
99 {
100 }
101
|
102 chip 1.36 void CIMParameterRep::setName(const CIMName& name)
|
103 mike 1.9 {
|
104 chip 1.36 // ensure name is not null
|
105 kumpf 1.41 if (name.isNull())
|
106 chip 1.36 {
107 throw UninitializedObjectException();
108 }
|
109 marek 1.44 if (_ownerCount != 0 && _name != name)
110 {
111 MessageLoaderParms parms(
112 "Common.CIMParameterRep.CONTAINED_PARAMETER_NAMECHANGEDEXCEPTION",
113 "Attempted to change the name of a parameter"
114 " already in a container.");
115 throw Exception(parms);
116 }
117 _name = name;
118 // Set the CIM name tag.
119 _nameTag = generateCIMNameTag(_name);
|
120 mike 1.9 }
121
|
122 kumpf 1.26 void CIMParameterRep::removeQualifier(Uint32 index)
|
123 kumpf 1.23 {
|
124 kumpf 1.26 if (index >= _qualifiers.getCount())
|
125 kumpf 1.24 throw IndexOutOfBoundsException();
|
126 kumpf 1.23
|
127 kumpf 1.26 _qualifiers.removeQualifier (index);
|
128 kumpf 1.23 }
129
|
130 mike 1.9 void CIMParameterRep::resolve(
131 DeclContext* declContext,
|
132 kumpf 1.21 const CIMNamespaceName& nameSpace)
|
133 mike 1.9 {
134 // Validate the qualifiers of the method (according to
135 // superClass's method with the same name). This method
136 // will throw an exception if the validation fails.
137
138 CIMQualifierList dummy;
139
140 _qualifiers.resolve(
|
141 kumpf 1.40 declContext,
142 nameSpace,
143 CIMScope::PARAMETER,
144 false,
145 dummy,
146 true);
|
147 mike 1.9 }
148
149 Boolean CIMParameterRep::identical(const CIMParameterRep* x) const
150 {
|
151 kumpf 1.42 // If the pointers are the same, the objects must be identical
152 if (this == x)
153 {
154 return true;
155 }
156
|
157 kumpf 1.28 if (!_name.equal (x->_name))
|
158 kumpf 1.40 return false;
|
159 mike 1.9
160 if (_type != x->_type)
|
161 kumpf 1.40 return false;
|
162 mike 1.9
|
163 kumpf 1.28 if (!_referenceClassName.equal (x->_referenceClassName))
|
164 kumpf 1.40 return false;
|
165 mike 1.9
166 if (!_qualifiers.identical(x->_qualifiers))
|
167 kumpf 1.40 return false;
|
168 mike 1.9
169 return true;
170 }
171
172 PEGASUS_NAMESPACE_END
|