1 thilo.boehm 1.1.2.1 //%LICENSE////////////////////////////////////////////////////////////////
2 //
3 // 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 //
10 // 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 //
17 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
19 //
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 thilo.boehm 1.1.2.1 // 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 //
28 //////////////////////////////////////////////////////////////////////////
29 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32 #ifndef _SCMOCLASS_H_
33 #define _SCMOCLASS_H_
34
35
36 #include <Pegasus/Common/Config.h>
37 #include <Pegasus/Common/Linkage.h>
38 #include <Pegasus/Common/SCMO.h>
39 #include <Pegasus/Common/CIMClass.h>
40
41 PEGASUS_NAMESPACE_BEGIN
42
43 thilo.boehm 1.1.2.1
44 #define PEGASUS_SCMB_CLASS_MAGIC 0xF00FABCD
45
46 class PEGASUS_COMMON_LINKAGE SCMOClass
47 {
48 public:
49
50 /**
51 * Constructs a SCMOClass out of a CIMClass.
52 * @param theCIMClass The source the SCMOClass is constucted off.
53 * @return
54 */
55 SCMOClass(CIMClass& theCIMClass );
56
57 /**
58 * Copy constructor for the SCMO class, used to implement refcounting.
59 * @param theSCMOClass The class for which to create a copy
60 * @return
61 */
62 SCMOClass(const SCMOClass& theSCMOClass )
63 {
64 thilo.boehm 1.1.2.1 cls.hdr = theSCMOClass.cls.hdr;
65 Ref();
66 }
67
68 /**
69 * Destructor is decrementing the refcount. If refcount is zero, the
70 * singele chunk memory object is deallocated.
71 */
72 ~SCMOClass()
73 {
74 Unref();
75 }
76
77 /**
78 * Gets the key property names as a string array
79 * @return An Array of String objects containing the names of the key
80 * properties.
81 */
82 void getKeyNamesAsString(Array<String>& keyNames) const;
83
84 /**
85 thilo.boehm 1.1.2.1 * Determines whether the object has been initialized.
86 * @return True if the object has not been initialized, false otherwise.
87 */
88 Boolean isUninitialized( ) const {return (cls.base == NULL); };
89
90 private:
91
92 void Ref()
93 {
94 cls.hdr->refCount++;
95 // printf("\ncls.hdr->refCount=%u\n",cls.hdr->refCount.get());
96 };
97
98 void Unref()
99 {
100 if (cls.hdr->refCount.decAndTestIfZero())
101 {
102 // printf("\ncls.hdr->refCount=%u\n",cls.hdr->refCount.get());
103 free(cls.base);
104 cls.base=NULL;
105 }
106 thilo.boehm 1.1.2.1 else
107 {
108 // printf("\ncls.hdr->refCount=%u\n",cls.hdr->refCount.get());
109 }
110
111 };
112
113 /**
114 * Constructs an uninitialized SCMOClass object.
115 */
116 SCMOClass();
117
118 SCMO_RC _getProperyNodeIndex(Uint32& node, const char* name) const;
119 SCMO_RC _getKeyBindingNodeIndex(Uint32& node, const char* name) const;
120
121 void _setClassQualifers(CIMClass& theCIMClass);
122 QualifierNameEnum _setQualifier(
123 Uint64 start,
124 const CIMQualifier& theCIMQualifier);
125
126 void _setClassProperties(CIMClass& theCIMClass);
127 thilo.boehm 1.1.2.1 void _setProperty(Uint64 start,
128 Boolean* isKey,
129 const CIMProperty& theCIMProperty);
130 Boolean _setPropertyQualifiers(
131 Uint64 start,
132 const CIMQualifierList& theQualifierList);
133
134 void _setClassKeyBinding(Uint64 start, const CIMProperty& theCIMProperty);
135 void _insertPropertyIntoOrderedSet(Uint64 start, Uint32 newIndex);
136 void _insertKeyBindingIntoOrderedSet(Uint64 start, Uint32 newIndex);
137 void _clearKeyPropertyMask();
138 void _setPropertyAsKeyInMask(Uint32 i);
139 Boolean _isPropertyKey(Uint32 i);
140
141 void _setValue(Uint64 start, const CIMValue& theCIMValue);
142 QualifierNameEnum _getSCMOQualifierNameEnum(const CIMName& theCIMname);
143 Boolean _isSamePropOrigin(Uint32 node, const char* origin) const;
144
|