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 // Author: Mike Brasher (mbrasher@bmc.com)
33 //
|
34 kumpf 1.3 // Modified By: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
|
35 mike 1.2 //
36 //%/////////////////////////////////////////////////////////////////////////////
37
38 #include "CIMPropertyList.h"
39
40 PEGASUS_NAMESPACE_BEGIN
41
|
42 kumpf 1.3 class CIMPropertyListRep
|
43 mike 1.2 {
|
44 kumpf 1.3 public:
|
45 kumpf 1.6 Array<CIMName> propertyNames;
|
46 kumpf 1.3 Boolean isNull;
47 };
|
48 mike 1.2
|
49 kumpf 1.3
|
50 a.arora 1.10 CIMPropertyList::CIMPropertyList()
|
51 kumpf 1.3 {
|
52 a.arora 1.10 _rep = new CIMPropertyListRep();
53 _rep->isNull = true;
|
54 mike 1.2 }
55
|
56 a.arora 1.10 CIMPropertyList::CIMPropertyList(const CIMPropertyList& x)
|
57 mike 1.2 {
|
58 a.arora 1.10 _rep = new CIMPropertyListRep();
|
59 kumpf 1.3 _rep->propertyNames = x._rep->propertyNames;
60 _rep->isNull = x._rep->isNull;
61 }
|
62 mike 1.2
|
63 a.arora 1.10 CIMPropertyList::CIMPropertyList(const Array<CIMName>& propertyNames)
|
64 kumpf 1.3 {
|
65 a.arora 1.10 _rep = new CIMPropertyListRep();
|
66 chip 1.13
67 // ATTN: the following code is inefficient and problematic. besides
68 // adding overhead to check for null property names, it has the
69 // disadvantage of returning an error if only 1 of n properties are null
70 // without informing the caller of which one. this is mainly a problem
71 // with this object's interface. it should be more like CIMQualifierList,
72 // which has a add() method that would validate one at a time.
73
74 // ensure names are not null
75 for(Uint32 i = 0, n = propertyNames.size(); i < n; i++)
76 {
77 if(propertyNames[i].isNull())
78 {
79 throw UninitializedObjectException();
80 }
81 }
82
|
83 kumpf 1.3 _rep->propertyNames = propertyNames;
84 _rep->isNull = false;
|
85 mike 1.2 }
86
|
87 kumpf 1.3 CIMPropertyList::~CIMPropertyList()
|
88 mike 1.2 {
|
89 a.arora 1.10 delete _rep;
|
90 mike 1.2 }
91
|
92 kumpf 1.6 void CIMPropertyList::set(const Array<CIMName>& propertyNames)
|
93 mike 1.2 {
|
94 chip 1.13 // ATTN: the following code is inefficient and problematic. besides
95 // adding overhead to check for null property names, it has the
96 // disadvantage of returning an error if only 1 of n properties are null
97 // without informing the caller of which one. this is mainly a problem
98 // with this object's interface. it should be more like CIMQualifierList,
99 // which has a add() method that would validate one at a time.
100
101 // ensure names are not null
102 for(Uint32 i = 0, n = propertyNames.size(); i < n; i++)
103 {
104 if(propertyNames[i].isNull())
105 {
106 throw UninitializedObjectException();
107 }
108 }
109
|
110 kumpf 1.3 _rep->propertyNames = propertyNames;
111 _rep->isNull = false;
|
112 mike 1.2 }
113
114 CIMPropertyList& CIMPropertyList::operator=(const CIMPropertyList& x)
115 {
116 if (&x != this)
117 {
|
118 kumpf 1.3 _rep->propertyNames = x._rep->propertyNames;
119 _rep->isNull = x._rep->isNull;
|
120 mike 1.2 }
121
122 return *this;
123 }
124
125 void CIMPropertyList::clear()
126 {
|
127 kumpf 1.3 _rep->propertyNames.clear();
128 _rep->isNull = true;
129 }
130
131 Boolean CIMPropertyList::isNull() const
132 {
133 return _rep->isNull;
134 }
135
|
136 kumpf 1.5 Uint32 CIMPropertyList::size() const
|
137 kumpf 1.3 {
138 return _rep->propertyNames.size();
139 }
140
|
141 kumpf 1.7 const CIMName& CIMPropertyList::operator[](Uint32 index) const
|
142 kumpf 1.3 {
|
143 kumpf 1.7 return _rep->propertyNames[index];
|
144 kumpf 1.3 }
145
|
146 kumpf 1.6 Array<CIMName> CIMPropertyList::getPropertyNameArray() const
|
147 kumpf 1.3 {
148 return _rep->propertyNames;
|
149 mike 1.2 }
150
151 PEGASUS_NAMESPACE_END
|