1 martin 1.17 //%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 martin 1.17 // 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 karl 1.5 //
|
28 martin 1.17 //////////////////////////////////////////////////////////////////////////
|
29 schuur 1.1 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
|
32 schuur 1.3 #include "CMPI_Version.h"
|
33 schuur 1.2
|
34 schuur 1.1 #include "CMPI_SelectCond.h"
35 #include "CMPI_Ftabs.h"
36 #include "CMPI_Value.h"
37 #include "CMPI_String.h"
|
38 ms.aruran 1.15 #include <Pegasus/Common/Tracer.h>
|
39 schuur 1.1
40 PEGASUS_USING_STD;
41 PEGASUS_NAMESPACE_BEGIN
42
|
43 venkat.puvvada 1.14 extern "C"
44 {
|
45 schuur 1.1
|
46 venkat.puvvada 1.14 CMPIStatus scndRelease(CMPISelectCond* eSc)
47 {
|
48 ms.aruran 1.15 PEG_METHOD_ENTER(
49 TRC_CMPIPROVIDERINTERFACE,
50 "CMPI_SelectCond:scndRelease()");
51 CMPI_SelectCond *sc = (CMPI_SelectCond*)eSc->hdl;
|
52 venkat.puvvada 1.14 if (sc)
53 {
54 CMPI_SelectCondData *data = (CMPI_SelectCondData *)sc->priv;
55 if (data)
56 {
|
57 venkat.puvvada 1.13 delete data;
58 }
59 delete sc;
60 reinterpret_cast<CMPI_Object*>(eSc)->unlinkAndDelete();
|
61 ms.aruran 1.15 PEG_METHOD_EXIT();
|
62 venkat.puvvada 1.13 CMReturn(CMPI_RC_OK);
|
63 venkat.puvvada 1.14 }
64 else
65 {
|
66 ms.aruran 1.15 PEG_METHOD_EXIT();
|
67 venkat.puvvada 1.13 CMReturn(CMPI_RC_ERR_INVALID_HANDLE);
|
68 venkat.puvvada 1.14 }
69 }
|
70 schuur 1.4
|
71 venkat.puvvada 1.14 CMPISelectCond* scndClone(const CMPISelectCond* eSc, CMPIStatus* rc)
72 {
73 CMSetStatus(rc,CMPI_RC_ERR_NOT_SUPPORTED);
74 return NULL;
75 }
76
77 CMPICount scndGetCountAndType(
78 const CMPISelectCond* eSc,
79 int* type,
80 CMPIStatus* rc)
81 {
|
82 ms.aruran 1.15 PEG_METHOD_ENTER(
83 TRC_CMPIPROVIDERINTERFACE,
84 "CMPI_SelectCond:scndGetCountAndType()");
|
85 venkat.puvvada 1.14 CMPI_SelectCond *sc=(CMPI_SelectCond*)eSc->hdl;
86 if (!sc)
87 {
|
88 ms.aruran 1.15 PEG_TRACE_CSTRING(
89 TRC_CMPIPROVIDERINTERFACE,
|
90 marek 1.16 Tracer::LEVEL1,
|
91 ms.aruran 1.15 "Invalid hanle in \
92 CMPI_SelectCond:scndGetCountAndType");
|
93 venkat.puvvada 1.14 CMSetStatus (rc, CMPI_RC_ERR_INVALID_HANDLE);
|
94 ms.aruran 1.15 PEG_METHOD_EXIT();
|
95 venkat.puvvada 1.14 return 0;
96 }
97 CMPI_SelectCondData *data = (CMPI_SelectCondData *)sc->priv;
98
99 if (data)
100 {
101 if (type!=NULL) *type=data->type;
102 CMSetStatus(rc,CMPI_RC_OK);
|
103 ms.aruran 1.15 PEG_METHOD_EXIT();
|
104 venkat.puvvada 1.14 return data->tableau->size();
105 }
|
106 ms.aruran 1.15 PEG_METHOD_EXIT();
|
107 venkat.puvvada 1.14 return 0;
108 }
109
110 CMPISubCond* scndGetSubCondAt(
111 const CMPISelectCond* eSc,
112 unsigned int index,
113 CMPIStatus* rc)
114 {
|
115 ms.aruran 1.15 PEG_METHOD_ENTER(
116 TRC_CMPIPROVIDERINTERFACE,
117 "CMPI_SelectCond:scndGetSubCondAt()");
|
118 venkat.puvvada 1.14 CMPI_SelectCond *sc=(CMPI_SelectCond*)eSc->hdl;
119 if (!sc)
120 {
|
121 ms.aruran 1.15 PEG_TRACE_CSTRING(
122 TRC_CMPIPROVIDERINTERFACE,
|
123 marek 1.16 Tracer::LEVEL1,
|
124 ms.aruran 1.15 "Invalid hanle in \
125 CMPI_SelectCond:scndGetSubCondAt");
|
126 venkat.puvvada 1.14 CMSetStatus (rc, CMPI_RC_ERR_INVALID_HANDLE);
127 return 0;
128 }
129 CMPI_SelectCondData *data = (CMPI_SelectCondData *)sc->priv;
130 if (data)
131 {
132 if (index<=data->tableau->size())
133 {
134 const CMPI_TableauRow *row=(data->tableau->getData())+index;
135
136 CMPISubCond *sbc=(CMPISubCond*)new CMPI_SubCond(row);
137 CMPI_Object *obj = new CMPI_Object(sbc);
138 CMSetStatus(rc,CMPI_RC_OK);
|
139 ms.aruran 1.15 CMPISubCond* cmpiSubCond =
140 reinterpret_cast<CMPISubCond *>(obj);
141 PEG_METHOD_EXIT();
142 return cmpiSubCond;
|
143 venkat.puvvada 1.14 }
144 }
145 else
146 {
|
147 ms.aruran 1.15 PEG_TRACE_CSTRING(
148 TRC_CMPIPROVIDERINTERFACE,
|
149 marek 1.16 Tracer::LEVEL1,
|
150 ms.aruran 1.15 "Property Not Found in \
151 CMPI_SelectCond:scndGetSubCondAt");
|
152 venkat.puvvada 1.14 CMSetStatus(rc,CMPI_RC_ERR_NO_SUCH_PROPERTY);
153 }
|
154 ms.aruran 1.15 PEG_METHOD_EXIT();
|
155 venkat.puvvada 1.14 return NULL;
156 }
|
157 schuur 1.1
158 }
159
|
160 venkat.puvvada 1.14 static CMPISelectCondFT scnd_FT=
161 {
162 CMPICurrentVersion,
163 scndRelease,
164 scndClone,
165 scndGetCountAndType,
166 scndGetSubCondAt,
167 };
|
168 schuur 1.1
169 CMPISelectCondFT *CMPI_SelectCond_Ftab=&scnd_FT;
170
|
171 venkat.puvvada 1.14 CMPI_SelectCondData::CMPI_SelectCondData(
172 CMPI_Tableau *tblo,
173 int t): tableau(tblo), type(t)
174 {
175 }
|
176 konrad.r 1.7
|
177 konrad.r 1.8 CMPI_SelectCond::CMPI_SelectCond(CMPI_Tableau* tblo, int t)
|
178 venkat.puvvada 1.14 {
179 priv = new CMPI_SelectCondData(tblo, t);
180 ft=CMPI_SelectCond_Ftab;
|
181 schuur 1.1 }
182
183 PEGASUS_NAMESPACE_END
|