00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef _konkrete_Gadget_h
00010 #define _konkrete_Gadget_h
00011
00012 #include <konkret/konkret.h>
00013 #include "Widget.h"
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 typedef struct _GadgetRef
00025 {
00026 KBase __base;
00027
00028 const KRef Left;
00029 const KRef Right;
00030 }
00031 GadgetRef;
00032
00033 static const unsigned char __GadgetRef_sig[] =
00034 {
00035 0x09,0x4b,0x43,0x5f,0x47,0x61,0x64,0x67,0x65,0x74,0x00,0x02,0x4e,0x04,0x4c,
00036 0x65,0x66,0x74,0x00,0x4e,0x05,0x52,0x69,0x67,0x68,0x74,0x00,
00037 };
00038
00039 KINLINE void GadgetRef_Init(
00040 GadgetRef* self,
00041 const CMPIBroker* cb,
00042 const char* ns)
00043 {
00044 const unsigned char* sig = __GadgetRef_sig;
00045 KBase_Init(&self->__base, cb, sizeof(*self), sig, ns);
00046 ((KRef*)&self->Left)->__sig = __Widget_sig;
00047 ((KRef*)&self->Right)->__sig = __Widget_sig;
00048 }
00049
00050 KINLINE CMPIStatus GadgetRef_InitFromInstance(
00051 GadgetRef* self,
00052 const CMPIBroker* cb,
00053 const CMPIInstance* x)
00054 {
00055 GadgetRef_Init(self, cb, NULL);
00056 return KBase_FromInstance(&self->__base, x);
00057 }
00058
00059 KINLINE CMPIStatus GadgetRef_InitFromObjectPath(
00060 GadgetRef* self,
00061 const CMPIBroker* cb,
00062 const CMPIObjectPath* x)
00063 {
00064 GadgetRef_Init(self, cb, NULL);
00065 return KBase_FromObjectPath(&self->__base, x);
00066 }
00067
00068 KINLINE void GadgetRef_Print(
00069 const GadgetRef* self,
00070 FILE* os)
00071 {
00072 KBase_Print(os, &self->__base, 'r');
00073 }
00074
00075 KINLINE CMPIInstance* GadgetRef_ToInstance(
00076 const GadgetRef* self,
00077 CMPIStatus* status)
00078 {
00079 return KBase_ToInstance(&self->__base, status);
00080 }
00081
00082 KINLINE CMPIObjectPath* GadgetRef_ToObjectPath(
00083 const GadgetRef* self,
00084 CMPIStatus* status)
00085 {
00086 return KBase_ToObjectPath(&self->__base, status);
00087 }
00088
00089 KINLINE const char* GadgetRef_NameSpace(
00090 GadgetRef* self)
00091 {
00092 if (self && self->__base.magic == KMAGIC)
00093 return self->__base.ns ? KChars(self->__base.ns) : NULL;
00094 return NULL;
00095 }
00096
00097 KINLINE void GadgetRef_SetObjectPath_Left(
00098 GadgetRef* self,
00099 const CMPIObjectPath* x)
00100 {
00101 if (self && self->__base.magic == KMAGIC)
00102 {
00103 KRef* field = (KRef*)&self->Left;
00104 KRef_SetObjectPath(field, x);
00105 }
00106 }
00107
00108 KINLINE CMPIStatus GadgetRef_Set_Left(
00109 GadgetRef* self,
00110 const WidgetRef* x)
00111 {
00112 if (self && self->__base.magic == KMAGIC)
00113 {
00114 KRef* field = (KRef*)&self->Left;
00115 return KRef_Set(field, &x->__base);
00116 }
00117 CMReturn(CMPI_RC_ERR_FAILED);
00118 }
00119
00120 KINLINE void GadgetRef_Null_Left(
00121 GadgetRef* self)
00122 {
00123 if (self && self->__base.magic == KMAGIC)
00124 {
00125 KRef* field = (KRef*)&self->Left;
00126 KRef_Null(field);
00127 }
00128 }
00129
00130 KINLINE void GadgetRef_Clr_Left(
00131 GadgetRef* self)
00132 {
00133 if (self && self->__base.magic == KMAGIC)
00134 {
00135 KRef* field = (KRef*)&self->Left;
00136 KRef_Clr(field);
00137 }
00138 }
00139
00140 KINLINE void GadgetRef_SetObjectPath_Right(
00141 GadgetRef* self,
00142 const CMPIObjectPath* x)
00143 {
00144 if (self && self->__base.magic == KMAGIC)
00145 {
00146 KRef* field = (KRef*)&self->Right;
00147 KRef_SetObjectPath(field, x);
00148 }
00149 }
00150
00151 KINLINE CMPIStatus GadgetRef_Set_Right(
00152 GadgetRef* self,
00153 const WidgetRef* x)
00154 {
00155 if (self && self->__base.magic == KMAGIC)
00156 {
00157 KRef* field = (KRef*)&self->Right;
00158 return KRef_Set(field, &x->__base);
00159 }
00160 CMReturn(CMPI_RC_ERR_FAILED);
00161 }
00162
00163 KINLINE void GadgetRef_Null_Right(
00164 GadgetRef* self)
00165 {
00166 if (self && self->__base.magic == KMAGIC)
00167 {
00168 KRef* field = (KRef*)&self->Right;
00169 KRef_Null(field);
00170 }
00171 }
00172
00173 KINLINE void GadgetRef_Clr_Right(
00174 GadgetRef* self)
00175 {
00176 if (self && self->__base.magic == KMAGIC)
00177 {
00178 KRef* field = (KRef*)&self->Right;
00179 KRef_Clr(field);
00180 }
00181 }
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192 typedef struct _Gadget
00193 {
00194 KBase __base;
00195
00196 const KRef Left;
00197 const KRef Right;
00198 }
00199 Gadget;
00200
00201 static const unsigned char __Gadget_sig[] =
00202 {
00203 0x09,0x4b,0x43,0x5f,0x47,0x61,0x64,0x67,0x65,0x74,0x00,0x02,0x4e,0x04,0x4c,
00204 0x65,0x66,0x74,0x00,0x4e,0x05,0x52,0x69,0x67,0x68,0x74,0x00,
00205 };
00206
00207 KINLINE void Gadget_Init(
00208 Gadget* self,
00209 const CMPIBroker* cb,
00210 const char* ns)
00211 {
00212 const unsigned char* sig = __Gadget_sig;
00213 KBase_Init(&self->__base, cb, sizeof(*self), sig, ns);
00214 ((KRef*)&self->Left)->__sig = __Widget_sig;
00215 ((KRef*)&self->Right)->__sig = __Widget_sig;
00216 }
00217
00218 KINLINE CMPIStatus Gadget_InitFromInstance(
00219 Gadget* self,
00220 const CMPIBroker* cb,
00221 const CMPIInstance* x)
00222 {
00223 Gadget_Init(self, cb, NULL);
00224 return KBase_FromInstance(&self->__base, x);
00225 }
00226
00227 KINLINE CMPIStatus Gadget_InitFromObjectPath(
00228 Gadget* self,
00229 const CMPIBroker* cb,
00230 const CMPIObjectPath* x)
00231 {
00232 Gadget_Init(self, cb, NULL);
00233 return KBase_FromObjectPath(&self->__base, x);
00234 }
00235
00236 KINLINE void Gadget_Print(
00237 const Gadget* self,
00238 FILE* os)
00239 {
00240 KBase_Print(os, &self->__base, 'i');
00241 }
00242
00243 KINLINE CMPIInstance* Gadget_ToInstance(
00244 const Gadget* self,
00245 CMPIStatus* status)
00246 {
00247 return KBase_ToInstance(&self->__base, status);
00248 }
00249
00250 KINLINE CMPIObjectPath* Gadget_ToObjectPath(
00251 const Gadget* self,
00252 CMPIStatus* status)
00253 {
00254 return KBase_ToObjectPath(&self->__base, status);
00255 }
00256
00257 KINLINE const char* Gadget_NameSpace(
00258 Gadget* self)
00259 {
00260 if (self && self->__base.magic == KMAGIC)
00261 return self->__base.ns ? KChars(self->__base.ns) : NULL;
00262 return NULL;
00263 }
00264
00265 KINLINE void Gadget_SetObjectPath_Left(
00266 Gadget* self,
00267 const CMPIObjectPath* x)
00268 {
00269 if (self && self->__base.magic == KMAGIC)
00270 {
00271 KRef* field = (KRef*)&self->Left;
00272 KRef_SetObjectPath(field, x);
00273 }
00274 }
00275
00276 KINLINE CMPIStatus Gadget_Set_Left(
00277 Gadget* self,
00278 const WidgetRef* x)
00279 {
00280 if (self && self->__base.magic == KMAGIC)
00281 {
00282 KRef* field = (KRef*)&self->Left;
00283 return KRef_Set(field, &x->__base);
00284 }
00285 CMReturn(CMPI_RC_ERR_FAILED);
00286 }
00287
00288 KINLINE void Gadget_Null_Left(
00289 Gadget* self)
00290 {
00291 if (self && self->__base.magic == KMAGIC)
00292 {
00293 KRef* field = (KRef*)&self->Left;
00294 KRef_Null(field);
00295 }
00296 }
00297
00298 KINLINE void Gadget_Clr_Left(
00299 Gadget* self)
00300 {
00301 if (self && self->__base.magic == KMAGIC)
00302 {
00303 KRef* field = (KRef*)&self->Left;
00304 KRef_Clr(field);
00305 }
00306 }
00307
00308 KINLINE void Gadget_SetObjectPath_Right(
00309 Gadget* self,
00310 const CMPIObjectPath* x)
00311 {
00312 if (self && self->__base.magic == KMAGIC)
00313 {
00314 KRef* field = (KRef*)&self->Right;
00315 KRef_SetObjectPath(field, x);
00316 }
00317 }
00318
00319 KINLINE CMPIStatus Gadget_Set_Right(
00320 Gadget* self,
00321 const WidgetRef* x)
00322 {
00323 if (self && self->__base.magic == KMAGIC)
00324 {
00325 KRef* field = (KRef*)&self->Right;
00326 return KRef_Set(field, &x->__base);
00327 }
00328 CMReturn(CMPI_RC_ERR_FAILED);
00329 }
00330
00331 KINLINE void Gadget_Null_Right(
00332 Gadget* self)
00333 {
00334 if (self && self->__base.magic == KMAGIC)
00335 {
00336 KRef* field = (KRef*)&self->Right;
00337 KRef_Null(field);
00338 }
00339 }
00340
00341 KINLINE void Gadget_Clr_Right(
00342 Gadget* self)
00343 {
00344 if (self && self->__base.magic == KMAGIC)
00345 {
00346 KRef* field = (KRef*)&self->Right;
00347 KRef_Clr(field);
00348 }
00349 }
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359 KINLINE CMPIStatus Gadget_InvokeMethod(
00360 const CMPIBroker* cb,
00361 CMPIMethodMI* mi,
00362 const CMPIContext* cc,
00363 const CMPIResult* cr,
00364 const CMPIObjectPath* cop,
00365 const char* meth,
00366 const CMPIArgs* in,
00367 CMPIArgs* out)
00368 {
00369 GadgetRef self;
00370
00371 KReturnIf(GadgetRef_InitFromObjectPath(&self, cb, cop));
00372
00373
00374 KReturn(ERR_METHOD_NOT_FOUND);
00375 }
00376
00377 #endif