1 karl 1.14 //%2006////////////////////////////////////////////////////////////////////////
|
2 mike 1.2 //
|
3 karl 1.11 // 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.8 // IBM Corp.; EMC Corporation, The Open Group.
|
7 karl 1.11 // 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.12 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 karl 1.14 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
12 // EMC Corporation; Symantec Corporation; The Open Group.
|
13 mike 1.2 //
14 // Permission is hereby granted, free of charge, to any person obtaining a copy
|
15 kumpf 1.4 // 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.2 // 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.14 //
|
21 kumpf 1.4 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
|
22 mike 1.2 // 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.4 // 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.2 // 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 #include "CIMPropertyList.h"
35
36 PEGASUS_NAMESPACE_BEGIN
37
|
38 kumpf 1.3 class CIMPropertyListRep
|
39 mike 1.2 {
|
40 kumpf 1.3 public:
|
41 kumpf 1.6 Array<CIMName> propertyNames;
|
42 kumpf 1.3 Boolean isNull;
43 };
|
44 mike 1.2
|
45 kumpf 1.3
|
46 a.arora 1.10 CIMPropertyList::CIMPropertyList()
|
47 kumpf 1.3 {
|
48 a.arora 1.10 _rep = new CIMPropertyListRep();
49 _rep->isNull = true;
|
50 mike 1.2 }
51
|
52 a.arora 1.10 CIMPropertyList::CIMPropertyList(const CIMPropertyList& x)
|
53 mike 1.2 {
|
54 a.arora 1.10 _rep = new CIMPropertyListRep();
|
55 kumpf 1.3 _rep->propertyNames = x._rep->propertyNames;
56 _rep->isNull = x._rep->isNull;
57 }
|
58 mike 1.2
|
59 a.arora 1.10 CIMPropertyList::CIMPropertyList(const Array<CIMName>& propertyNames)
|
60 kumpf 1.3 {
|
61 a.arora 1.10 _rep = new CIMPropertyListRep();
|
62 chip 1.13
63 // ATTN: the following code is inefficient and problematic. besides
64 // adding overhead to check for null property names, it has the
65 // disadvantage of returning an error if only 1 of n properties are null
66 // without informing the caller of which one. this is mainly a problem
67 // with this object's interface. it should be more like CIMQualifierList,
68 // which has a add() method that would validate one at a time.
69
70 // ensure names are not null
71 for(Uint32 i = 0, n = propertyNames.size(); i < n; i++)
72 {
73 if(propertyNames[i].isNull())
74 {
75 throw UninitializedObjectException();
76 }
77 }
78
|
79 kumpf 1.3 _rep->propertyNames = propertyNames;
80 _rep->isNull = false;
|
81 mike 1.2 }
82
|
83 kumpf 1.3 CIMPropertyList::~CIMPropertyList()
|
84 mike 1.2 {
|
85 a.arora 1.10 delete _rep;
|
86 mike 1.2 }
87
|
88 kumpf 1.6 void CIMPropertyList::set(const Array<CIMName>& propertyNames)
|
89 mike 1.2 {
|
90 chip 1.13 // ATTN: the following code is inefficient and problematic. besides
91 // adding overhead to check for null property names, it has the
92 // disadvantage of returning an error if only 1 of n properties are null
93 // without informing the caller of which one. this is mainly a problem
94 // with this object's interface. it should be more like CIMQualifierList,
95 // which has a add() method that would validate one at a time.
96
97 // ensure names are not null
98 for(Uint32 i = 0, n = propertyNames.size(); i < n; i++)
99 {
100 if(propertyNames[i].isNull())
101 {
102 throw UninitializedObjectException();
103 }
104 }
105
|
106 kumpf 1.3 _rep->propertyNames = propertyNames;
107 _rep->isNull = false;
|
108 mike 1.2 }
109
110 CIMPropertyList& CIMPropertyList::operator=(const CIMPropertyList& x)
111 {
112 if (&x != this)
113 {
|
114 kumpf 1.15 _rep->propertyNames = x._rep->propertyNames;
115 _rep->isNull = x._rep->isNull;
|
116 mike 1.2 }
117
118 return *this;
119 }
120
121 void CIMPropertyList::clear()
122 {
|
123 kumpf 1.3 _rep->propertyNames.clear();
124 _rep->isNull = true;
125 }
126
127 Boolean CIMPropertyList::isNull() const
128 {
129 return _rep->isNull;
130 }
131
|
132 kumpf 1.5 Uint32 CIMPropertyList::size() const
|
133 kumpf 1.3 {
134 return _rep->propertyNames.size();
135 }
136
|
137 kumpf 1.7 const CIMName& CIMPropertyList::operator[](Uint32 index) const
|
138 kumpf 1.3 {
|
139 kumpf 1.7 return _rep->propertyNames[index];
|
140 kumpf 1.3 }
141
|
142 kumpf 1.6 Array<CIMName> CIMPropertyList::getPropertyNameArray() const
|
143 kumpf 1.3 {
144 return _rep->propertyNames;
|
145 mike 1.2 }
146
147 PEGASUS_NAMESPACE_END
|