00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef _konkrete_Widget_h
00010 #define _konkrete_Widget_h
00011
00012 #include <konkret/konkret.h>
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 typedef struct _WidgetRef
00024 {
00025 KBase __base;
00026
00027 const KString Id;
00028 }
00029 WidgetRef;
00030
00031 static const unsigned char __WidgetRef_sig[] =
00032 {
00033 0x09,0x4b,0x43,0x5f,0x57,0x69,0x64,0x67,0x65,0x74,0x00,0x01,0x4c,0x02,0x49,
00034 0x64,0x00,
00035 };
00036
00037 KINLINE void WidgetRef_Init(
00038 WidgetRef* self,
00039 const CMPIBroker* cb,
00040 const char* ns)
00041 {
00042 const unsigned char* sig = __WidgetRef_sig;
00043 KBase_Init(&self->__base, cb, sizeof(*self), sig, ns);
00044 }
00045
00046 KINLINE CMPIStatus WidgetRef_InitFromInstance(
00047 WidgetRef* self,
00048 const CMPIBroker* cb,
00049 const CMPIInstance* x)
00050 {
00051 WidgetRef_Init(self, cb, NULL);
00052 return KBase_FromInstance(&self->__base, x);
00053 }
00054
00055 KINLINE CMPIStatus WidgetRef_InitFromObjectPath(
00056 WidgetRef* self,
00057 const CMPIBroker* cb,
00058 const CMPIObjectPath* x)
00059 {
00060 WidgetRef_Init(self, cb, NULL);
00061 return KBase_FromObjectPath(&self->__base, x);
00062 }
00063
00064 KINLINE void WidgetRef_Print(
00065 const WidgetRef* self,
00066 FILE* os)
00067 {
00068 KBase_Print(os, &self->__base, 'r');
00069 }
00070
00071 KINLINE CMPIInstance* WidgetRef_ToInstance(
00072 const WidgetRef* self,
00073 CMPIStatus* status)
00074 {
00075 return KBase_ToInstance(&self->__base, status);
00076 }
00077
00078 KINLINE CMPIObjectPath* WidgetRef_ToObjectPath(
00079 const WidgetRef* self,
00080 CMPIStatus* status)
00081 {
00082 return KBase_ToObjectPath(&self->__base, status);
00083 }
00084
00085 KINLINE const char* WidgetRef_NameSpace(
00086 WidgetRef* self)
00087 {
00088 if (self && self->__base.magic == KMAGIC)
00089 return self->__base.ns ? KChars(self->__base.ns) : NULL;
00090 return NULL;
00091 }
00092
00093 KINLINE void WidgetRef_SetString_Id(
00094 WidgetRef* self,
00095 CMPIString* x)
00096 {
00097 if (self && self->__base.magic == KMAGIC)
00098 {
00099 KString* field = (KString*)&self->Id;
00100 KString_SetString(field, x);
00101 }
00102 }
00103
00104 KINLINE void WidgetRef_Set_Id(
00105 WidgetRef* self,
00106 const char* s)
00107 {
00108 if (self && self->__base.magic == KMAGIC)
00109 {
00110 KString* field = (KString*)&self->Id;
00111 KString_Set(field, self->__base.cb, s);
00112 }
00113 }
00114
00115 KINLINE void WidgetRef_Null_Id(
00116 WidgetRef* self)
00117 {
00118 if (self && self->__base.magic == KMAGIC)
00119 {
00120 KString* field = (KString*)&self->Id;
00121 KString_Null(field);
00122 }
00123 }
00124
00125 KINLINE void WidgetRef_Clr_Id(
00126 WidgetRef* self)
00127 {
00128 if (self && self->__base.magic == KMAGIC)
00129 {
00130 KString* field = (KString*)&self->Id;
00131 KString_Clr(field);
00132 }
00133 }
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144 typedef struct _Widget
00145 {
00146 KBase __base;
00147
00148 const KString Id;
00149 const KString Color;
00150 const KUint32 Size;
00151 }
00152 Widget;
00153
00154 static const unsigned char __Widget_sig[] =
00155 {
00156 0x09,0x4b,0x43,0x5f,0x57,0x69,0x64,0x67,0x65,0x74,0x00,0x03,0x4c,0x02,0x49,
00157 0x64,0x00,0x0c,0x05,0x43,0x6f,0x6c,0x6f,0x72,0x00,0x05,0x04,0x53,0x69,0x7a,
00158 0x65,0x00,
00159 };
00160
00161 KINLINE void Widget_Init(
00162 Widget* self,
00163 const CMPIBroker* cb,
00164 const char* ns)
00165 {
00166 const unsigned char* sig = __Widget_sig;
00167 KBase_Init(&self->__base, cb, sizeof(*self), sig, ns);
00168 }
00169
00170 KINLINE CMPIStatus Widget_InitFromInstance(
00171 Widget* self,
00172 const CMPIBroker* cb,
00173 const CMPIInstance* x)
00174 {
00175 Widget_Init(self, cb, NULL);
00176 return KBase_FromInstance(&self->__base, x);
00177 }
00178
00179 KINLINE CMPIStatus Widget_InitFromObjectPath(
00180 Widget* self,
00181 const CMPIBroker* cb,
00182 const CMPIObjectPath* x)
00183 {
00184 Widget_Init(self, cb, NULL);
00185 return KBase_FromObjectPath(&self->__base, x);
00186 }
00187
00188 KINLINE void Widget_Print(
00189 const Widget* self,
00190 FILE* os)
00191 {
00192 KBase_Print(os, &self->__base, 'i');
00193 }
00194
00195 KINLINE CMPIInstance* Widget_ToInstance(
00196 const Widget* self,
00197 CMPIStatus* status)
00198 {
00199 return KBase_ToInstance(&self->__base, status);
00200 }
00201
00202 KINLINE CMPIObjectPath* Widget_ToObjectPath(
00203 const Widget* self,
00204 CMPIStatus* status)
00205 {
00206 return KBase_ToObjectPath(&self->__base, status);
00207 }
00208
00209 KINLINE const char* Widget_NameSpace(
00210 Widget* self)
00211 {
00212 if (self && self->__base.magic == KMAGIC)
00213 return self->__base.ns ? KChars(self->__base.ns) : NULL;
00214 return NULL;
00215 }
00216
00217 KINLINE void Widget_SetString_Id(
00218 Widget* self,
00219 CMPIString* x)
00220 {
00221 if (self && self->__base.magic == KMAGIC)
00222 {
00223 KString* field = (KString*)&self->Id;
00224 KString_SetString(field, x);
00225 }
00226 }
00227
00228 KINLINE void Widget_Set_Id(
00229 Widget* self,
00230 const char* s)
00231 {
00232 if (self && self->__base.magic == KMAGIC)
00233 {
00234 KString* field = (KString*)&self->Id;
00235 KString_Set(field, self->__base.cb, s);
00236 }
00237 }
00238
00239 KINLINE void Widget_Null_Id(
00240 Widget* self)
00241 {
00242 if (self && self->__base.magic == KMAGIC)
00243 {
00244 KString* field = (KString*)&self->Id;
00245 KString_Null(field);
00246 }
00247 }
00248
00249 KINLINE void Widget_Clr_Id(
00250 Widget* self)
00251 {
00252 if (self && self->__base.magic == KMAGIC)
00253 {
00254 KString* field = (KString*)&self->Id;
00255 KString_Clr(field);
00256 }
00257 }
00258
00259 KINLINE void Widget_SetString_Color(
00260 Widget* self,
00261 CMPIString* x)
00262 {
00263 if (self && self->__base.magic == KMAGIC)
00264 {
00265 KString* field = (KString*)&self->Color;
00266 KString_SetString(field, x);
00267 }
00268 }
00269
00270 KINLINE void Widget_Set_Color(
00271 Widget* self,
00272 const char* s)
00273 {
00274 if (self && self->__base.magic == KMAGIC)
00275 {
00276 KString* field = (KString*)&self->Color;
00277 KString_Set(field, self->__base.cb, s);
00278 }
00279 }
00280
00281 KINLINE void Widget_Null_Color(
00282 Widget* self)
00283 {
00284 if (self && self->__base.magic == KMAGIC)
00285 {
00286 KString* field = (KString*)&self->Color;
00287 KString_Null(field);
00288 }
00289 }
00290
00291 KINLINE void Widget_Clr_Color(
00292 Widget* self)
00293 {
00294 if (self && self->__base.magic == KMAGIC)
00295 {
00296 KString* field = (KString*)&self->Color;
00297 KString_Clr(field);
00298 }
00299 }
00300
00301 KINLINE void Widget_Set_Size(
00302 Widget* self,
00303 CMPIUint32 x)
00304 {
00305 if (self && self->__base.magic == KMAGIC)
00306 {
00307 KUint32* field = (KUint32*)&self->Size;
00308 KUint32_Set(field, x);
00309 }
00310 }
00311
00312 KINLINE void Widget_Null_Size(
00313 Widget* self)
00314 {
00315 if (self && self->__base.magic == KMAGIC)
00316 {
00317 KUint32* field = (KUint32*)&self->Size;
00318 KUint32_Null(field);
00319 }
00320 }
00321
00322 KINLINE void Widget_Clr_Size(
00323 Widget* self)
00324 {
00325 if (self && self->__base.magic == KMAGIC)
00326 {
00327 KUint32* field = (KUint32*)&self->Size;
00328 KUint32_Clr(field);
00329 }
00330 }
00331
00332
00333 typedef struct _Widget_Add_Args
00334 {
00335 KBase __base;
00336
00337 KUint32 X;
00338
00339 KUint32 Y;
00340 }
00341 Widget_Add_Args;
00342
00343 static const unsigned char __Widget_Add_Args_sig[] =
00344 {
00345 0x03,0x41,0x64,0x64,0x00,0x02,0x25,0x01,0x58,0x00,0x25,0x01,0x59,0x00,
00346 };
00347
00348 KINLINE void Widget_Add_Args_Init(
00349 Widget_Add_Args* self,
00350 const CMPIBroker* cb)
00351 {
00352 const unsigned char* sig = __Widget_Add_Args_sig;
00353 KBase_Init(&self->__base, cb, sizeof(*self), sig, NULL);
00354 }
00355
00356 KINLINE CMPIStatus Widget_Add_Args_InitFromArgs(
00357 Widget_Add_Args* self,
00358 const CMPIBroker* cb,
00359 const CMPIArgs* x,
00360 CMPIBoolean in,
00361 CMPIBoolean out)
00362 {
00363 Widget_Add_Args_Init(self, cb);
00364 return KBase_FromArgs(&self->__base, x, in, out);
00365 }
00366
00367 KINLINE CMPIArgs* Widget_Add_Args_ToArgs(
00368 const Widget_Add_Args* self,
00369 CMPIBoolean in,
00370 CMPIBoolean out,
00371 CMPIStatus* status)
00372 {
00373 return KBase_ToArgs(&self->__base, in, out, status);
00374 }
00375
00376 KINLINE CMPIStatus Widget_Add_Args_SetArgs(
00377 const Widget_Add_Args* self,
00378 CMPIBoolean in,
00379 CMPIBoolean out,
00380 CMPIArgs* ca)
00381 {
00382 return KBase_SetToArgs(&self->__base, in, out, ca);
00383 }
00384
00385 KINLINE void Widget_Add_Args_Print(
00386 const Widget_Add_Args* self,
00387 FILE* os)
00388 {
00389 KBase_Print(os, &self->__base, 'a');
00390 }
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400 extern KUint32 Widget_Add(
00401 const CMPIBroker* cb,
00402 CMPIMethodMI* mi,
00403 const CMPIContext* context,
00404 const KUint32* X,
00405 const KUint32* Y,
00406 CMPIStatus* status);
00407
00408 KINLINE CMPIStatus Widget_InvokeMethod(
00409 const CMPIBroker* cb,
00410 CMPIMethodMI* mi,
00411 const CMPIContext* cc,
00412 const CMPIResult* cr,
00413 const CMPIObjectPath* cop,
00414 const char* meth,
00415 const CMPIArgs* in,
00416 CMPIArgs* out)
00417 {
00418 WidgetRef self;
00419
00420 KReturnIf(WidgetRef_InitFromObjectPath(&self, cb, cop));
00421
00422 if (strcasecmp(meth, "Add") == 0)
00423 {
00424 CMPIStatus st = KSTATUS_INIT;
00425 Widget_Add_Args args;
00426 KUint32 r;
00427
00428 KReturnIf(Widget_Add_Args_InitFromArgs(
00429 &args, cb, in, 1, 0));
00430
00431 r = Widget_Add(
00432 cb,
00433 mi,
00434 cc,
00435 &args.X,
00436 &args.Y,
00437 &st);
00438
00439 if (!KOkay(st))
00440 return st;
00441
00442 if (!r.exists)
00443 KReturn(ERR_FAILED);
00444
00445 KReturnIf(Widget_Add_Args_SetArgs(
00446 &args, 0, 1, out));
00447 KReturnUint32Data(cr, &r);
00448 CMReturnDone(cr);
00449
00450 KReturn(OK);
00451 }
00452
00453 KReturn(ERR_METHOD_NOT_FOUND);
00454 }
00455
00456 #endif