1 martin 1.38 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.39 //
|
3 martin 1.38 // 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.39 //
|
10 martin 1.38 // 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.39 //
|
17 martin 1.38 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.39 //
|
20 martin 1.38 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.39 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.38 // 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.39 //
|
28 martin 1.38 //////////////////////////////////////////////////////////////////////////
|
29 mike 1.1 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32 #ifndef Pegasus_CIMObjectRep_h
33 #define Pegasus_CIMObjectRep_h
34
35 #include <Pegasus/Common/Config.h>
|
36 kumpf 1.19 #include <Pegasus/Common/Linkage.h>
|
37 mike 1.1 #include <Pegasus/Common/String.h>
|
38 kumpf 1.19 #include <Pegasus/Common/CIMName.h>
|
39 mike 1.1 #include <Pegasus/Common/CIMProperty.h>
40 #include <Pegasus/Common/CIMQualifier.h>
|
41 kumpf 1.8 #include <Pegasus/Common/CIMQualifierList.h>
|
42 mike 1.1 #include <Pegasus/Common/Array.h>
|
43 marek 1.32 #include <Pegasus/Common/OrderedSet.h>
44 #include <Pegasus/Common/CIMPropertyRep.h>
|
45 mike 1.1
46 PEGASUS_NAMESPACE_BEGIN
47
48 /** This class defines the internal representation of the CIMObject class.
49
50 This base class has two implementations: CIMClassRep CIMInstanceRep. The
51 CIMObjectRep pointer member of CIMObject points to one of these.
52
53 This class contains what is common to CIMClass and CIMInstance.
54 */
|
55 kumpf 1.40 class CIMObjectRep
|
56 mike 1.1 {
57 public:
58
|
59 kumpf 1.12 CIMObjectRep(const CIMObjectPath& className);
|
60 mike 1.1
61 virtual ~CIMObjectRep();
62
|
63 kumpf 1.19 const CIMName& getClassName() const
|
64 chip 1.2 {
|
65 kumpf 1.30 return _reference.getClassName();
|
66 chip 1.4 }
67
|
68 kumpf 1.12 const CIMObjectPath& getPath() const
|
69 chip 1.4 {
|
70 kumpf 1.30 return _reference;
|
71 mike 1.1 }
|
72 kumpf 1.15
73 /**
74 Sets the object path for the object
75 @param path CIMObjectPath containing the object path
76 */
77 void setPath (const CIMObjectPath & path);
|
78 mike 1.1
79 void addQualifier(const CIMQualifier& qualifier)
80 {
|
81 kumpf 1.30 _qualifiers.add(qualifier);
|
82 mike 1.1 }
83
|
84 kumpf 1.19 Uint32 findQualifier(const CIMName& name) const
|
85 mike 1.1 {
|
86 kumpf 1.30 return _qualifiers.find(name);
|
87 mike 1.1 }
88
|
89 kumpf 1.20 CIMQualifier getQualifier(Uint32 index)
|
90 mike 1.1 {
|
91 kumpf 1.30 return _qualifiers.getQualifier(index);
|
92 mike 1.1 }
93
|
94 kumpf 1.20 CIMConstQualifier getQualifier(Uint32 index) const
|
95 mike 1.1 {
|
96 kumpf 1.30 return _qualifiers.getQualifier(index);
|
97 mike 1.1 }
98
|
99 kumpf 1.19 Boolean isTrueQualifer(CIMName& name) const
|
100 karl 1.5 {
|
101 kumpf 1.30 return _qualifiers.isTrue(name);
|
102 karl 1.5 }
103
|
104 mike 1.1 Uint32 getQualifierCount() const
105 {
|
106 kumpf 1.30 return _qualifiers.getCount();
|
107 mike 1.1 }
108
|
109 kumpf 1.20 void removeQualifier(Uint32 index)
|
110 mike 1.1 {
|
111 kumpf 1.30 _qualifiers.removeQualifier(index);
|
112 mike 1.1 }
113
114 virtual void addProperty(const CIMProperty& x);
115
|
116 marek 1.32 Uint32 findProperty(const CIMName& name, Uint32 nameTag) const
117 {
118 return _properties.find(name, nameTag);
119 }
120
121 Uint32 findProperty(const CIMName& name) const
122 {
123 return _properties.find(name, generateCIMNameTag(name));
124 }
|
125 mike 1.1
|
126 marek 1.34 CIMProperty getProperty(Uint32 index)
127 {
128 return _properties[index];
129 }
|
130 mike 1.1
|
131 kumpf 1.20 CIMConstProperty getProperty(Uint32 index) const
|
132 mike 1.1 {
|
133 kumpf 1.30 return ((CIMObjectRep*)this)->getProperty(index);
|
134 mike 1.1 }
135
|
136 marek 1.34 void removeProperty(Uint32 index)
137 {
138 _properties.remove(index);
139 }
|
140 mike 1.1
|
141 marek 1.32 Uint32 getPropertyCount() const
142 {
143 return _properties.size();
144 }
|
145 mike 1.1
146 virtual Boolean identical(const CIMObjectRep* x) const;
147
148 virtual CIMObjectRep* clone() const = 0;
149
|
150 thilo.boehm 1.36 void Inc()
151 {
152 _refCounter++;
153 }
154
155 void Dec()
156 {
157 if (_refCounter.decAndTestIfZero())
158 delete this;
159 }
160
|
161 mike 1.1 protected:
162
163 CIMObjectRep(const CIMObjectRep& x);
164
|
165 kumpf 1.12 CIMObjectPath _reference;
|
166 kumpf 1.9 CIMQualifierList _qualifiers;
|
167 marek 1.32 typedef OrderedSet<CIMProperty,
168 CIMPropertyRep,
169 PEGASUS_PROPERTY_ORDEREDSET_HASHSIZE> PropertySet;
170 PropertySet _properties;
|
171 kumpf 1.9
172 private:
173
|
174 kumpf 1.31 CIMObjectRep(); // Unimplemented
175 CIMObjectRep& operator=(const CIMObjectRep& x); // Unimplemented
|
176 mike 1.1
|
177 thilo.boehm 1.36 // reference counter as member to avoid
178 // virtual function resolution overhead
179 AtomicInt _refCounter;
180
|
181 mike 1.1 friend class CIMObject;
|
182 schuur 1.22 friend class BinaryStreamer;
|
183 mike 1.37 friend class CIMBuffer;
|
184 mike 1.1 };
185
186 PEGASUS_NAMESPACE_END
187
188 #endif /* Pegasus_CIMObjectRep_h */
|