(file) Return to cxxstubs_t.h CVS log (file) (dir) Up to [OMI] / omi / gen

  1 mike  1.1 /*
  2           **==============================================================================
  3           **
  4           ** Open Management Infrastructure (OMI)
  5           **
  6           ** Copyright (c) Microsoft Corporation
  7           ** 
  8           ** Licensed under the Apache License, Version 2.0 (the "License"); you may not 
  9           ** use this file except in compliance with the License. You may obtain a copy 
 10           ** of the License at 
 11           **
 12           **     http://www.apache.org/licenses/LICENSE-2.0 
 13           **
 14           ** THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 15           ** KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED 
 16           ** WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, 
 17           ** MERCHANTABLITY OR NON-INFRINGEMENT. 
 18           **
 19           ** See the Apache 2 License for the specific language governing permissions 
 20           ** and limitations under the License.
 21           **
 22 mike  1.1 **==============================================================================
 23           */
 24           
 25           //==============================================================================
 26           //
 27           // stubs.h - templates for generating 'stubs.cpp'.
 28           //
 29           //==============================================================================
 30           
 31           #ifndef _migen_cxxstubs_t_h
 32           #define _migen_cxxstubs_t_h
 33           
 34           //==============================================================================
 35           //
 36           // COMMON_PROVIDER_STUBS_CPP
 37           //
 38           //==============================================================================
 39           
 40           #define COMMON_PROVIDER_STUBS_CPP "\
 41           MI_EXTERN_C void MI_CALL <ALIAS>_Load(\n\
 42               <ALIAS>_Self** self,\n\
 43 mike  1.1     MI_Module_Self* selfModule,\n\
 44               MI_Context* context)\n\
 45           {\n\
 46               MI_Result r = MI_RESULT_OK;\n\
 47               Context ctx(context, &r);\n\
 48               <ALIAS>_Class_Provider* prov = new <ALIAS>_Class_Provider((Module*)selfModule);\n\
 49           \n\
 50               prov->Load(ctx);\n\
 51               if (MI_RESULT_OK != r)\n\
 52               {\n\
 53                   delete prov;\n\
 54                   MI_PostResult(context, r);\n\
 55                   return;\n\
 56               }\n\
 57               *self = (<ALIAS>_Self*)prov;\n\
 58               MI_PostResult(context, MI_RESULT_OK);\n\
 59           }\n\
 60           \n\
 61           MI_EXTERN_C void MI_CALL <ALIAS>_Unload(\n\
 62               <ALIAS>_Self* self,\n\
 63               MI_Context* context)\n\
 64 mike  1.1 {\n\
 65               MI_Result r = MI_RESULT_OK;\n\
 66               Context ctx(context, &r);\n\
 67               <ALIAS>_Class_Provider* prov = (<ALIAS>_Class_Provider*)self;\n\
 68           \n\
 69               prov->Unload(ctx);\n\
 70               delete ((<ALIAS>_Class_Provider*)self);\n\
 71               MI_PostResult(context, r);\n\
 72           }\n\
 73           \n"
 74           
 75           //==============================================================================
 76           //
 77           // INSTANCE_PROVIDER_STUBS_CPP
 78           //
 79           //==============================================================================
 80           
 81           #define INSTANCE_PROVIDER_STUBS_CPP COMMON_PROVIDER_STUBS_CPP   "\
 82           MI_EXTERN_C void MI_CALL <ALIAS>_EnumerateInstances(\n\
 83               <ALIAS>_Self* self,\n\
 84               MI_Context* context,\n\
 85 mike  1.1     const MI_Char* nameSpace,\n\
 86               const MI_Char* className,\n\
 87               const MI_PropertySet* propertySet,\n\
 88               MI_Boolean keysOnly,\n\
 89               const MI_Filter* filter)\n\
 90           {\n\
 91               <ALIAS>_Class_Provider* cxxSelf =((<ALIAS>_Class_Provider*)self);\n\
 92               Context  cxxContext(context);\n\
 93           \n\
 94               cxxSelf->EnumerateInstances(\n\
 95                   cxxContext,\n\
 96                   nameSpace,\n\
 97                   __PropertySet(propertySet),\n\
 98                   __bool(keysOnly),\n\
 99                   filter);\n\
100           }\n\
101           \n\
102           MI_EXTERN_C void MI_CALL <ALIAS>_GetInstance(\n\
103               <ALIAS>_Self* self,\n\
104               MI_Context* context,\n\
105               const MI_Char* nameSpace,\n\
106 mike  1.1     const MI_Char* className,\n\
107               const <ALIAS>* instanceName,\n\
108               const MI_PropertySet* propertySet)\n\
109           {\n\
110               <ALIAS>_Class_Provider* cxxSelf =((<ALIAS>_Class_Provider*)self);\n\
111               Context  cxxContext(context);\n\
112               <ALIAS>_Class cxxInstanceName(instanceName, true);\n\
113           \n\
114               cxxSelf->GetInstance(\n\
115                   cxxContext,\n\
116                   nameSpace,\n\
117                   cxxInstanceName,\n\
118                   __PropertySet(propertySet));\n\
119           }\n\
120           \n\
121           MI_EXTERN_C void MI_CALL <ALIAS>_CreateInstance(\n\
122               <ALIAS>_Self* self,\n\
123               MI_Context* context,\n\
124               const MI_Char* nameSpace,\n\
125               const MI_Char* className,\n\
126               const <ALIAS>* newInstance)\n\
127 mike  1.1 {\n\
128               <ALIAS>_Class_Provider* cxxSelf =((<ALIAS>_Class_Provider*)self);\n\
129               Context  cxxContext(context);\n\
130               <ALIAS>_Class cxxNewInstance(newInstance, false);\n\
131           \n\
132               cxxSelf->CreateInstance(cxxContext, nameSpace, cxxNewInstance);\n\
133           }\n\
134           \n\
135           MI_EXTERN_C void MI_CALL <ALIAS>_ModifyInstance(\n\
136               <ALIAS>_Self* self,\n\
137               MI_Context* context,\n\
138               const MI_Char* nameSpace,\n\
139               const MI_Char* className,\n\
140               const <ALIAS>* modifiedInstance,\n\
141               const MI_PropertySet* propertySet)\n\
142           {\n\
143               <ALIAS>_Class_Provider* cxxSelf =((<ALIAS>_Class_Provider*)self);\n\
144               Context  cxxContext(context);\n\
145               <ALIAS>_Class cxxModifiedInstance(modifiedInstance, false);\n\
146           \n\
147               cxxSelf->ModifyInstance(\n\
148 mike  1.1         cxxContext,\n\
149                   nameSpace,\n\
150                   cxxModifiedInstance,\n\
151                   __PropertySet(propertySet));\n\
152           }\n\
153           \n\
154           MI_EXTERN_C void MI_CALL <ALIAS>_DeleteInstance(\n\
155               <ALIAS>_Self* self,\n\
156               MI_Context* context,\n\
157               const MI_Char* nameSpace,\n\
158               const MI_Char* className,\n\
159               const <ALIAS>* instanceName)\n\
160           {\n\
161               <ALIAS>_Class_Provider* cxxSelf =((<ALIAS>_Class_Provider*)self);\n\
162               Context  cxxContext(context);\n\
163               <ALIAS>_Class cxxInstanceName(instanceName, true);\n\
164           \n\
165               cxxSelf->DeleteInstance(cxxContext, nameSpace, cxxInstanceName);\n\
166           }\n\
167           \n"
168           
169 mike  1.1 //==============================================================================
170           //
171           // ASSOCIATION_PROVIDER_STUBS_CPP
172           //
173           //==============================================================================
174           
175           #define ASSOCIATION_PROVIDER_STUBS_CPP INSTANCE_PROVIDER_STUBS_CPP "\
176           MI_EXTERN_C void MI_CALL <ALIAS>_AssociatorInstances(\n\
177               <ALIAS>_Self* self,\n\
178               MI_Context* context,\n\
179               const MI_Char* nameSpace,\n\
180               const MI_Char* className,\n\
181               const MI_Instance* instanceName,\n\
182               const MI_Char* resultClass,\n\
183               const MI_Char* role,\n\
184               const MI_Char* resultRole,\n\
185               const MI_PropertySet* propertySet,\n\
186               MI_Boolean keysOnly,\n\
187               const MI_Filter* filter)\n\
188           {\n\
189               <ALIAS>_Class_Provider* cxxSelf =((<ALIAS>_Class_Provider*)self);\n\
190 mike  1.1     Context  cxxContext(context);\n\
191           \n\
192               cxxSelf->AssociatorInstances(\n\
193                   cxxContext, \n\
194                   nameSpace,\n\
195                   instanceName, \n\
196                   resultClass,\n\
197                   role,\n\
198                   resultRole,\n\
199                   __PropertySet(propertySet),\n\
200                   __bool(keysOnly),\n\
201                   filter);\n\
202           }\n\
203           \n\
204           MI_EXTERN_C void MI_CALL <ALIAS>_ReferenceInstances(\n\
205               <ALIAS>_Self* self,\n\
206               MI_Context* context,\n\
207               const MI_Char* nameSpace,\n\
208               const MI_Char* resultClass,\n\
209               const MI_Instance* instanceName,\n\
210               const MI_Char* role,\n\
211 mike  1.1     const MI_PropertySet* propertySet,\n\
212               MI_Boolean keysOnly,\n\
213               const MI_Filter* filter)\n\
214           {\n\
215               <ALIAS>_Class_Provider* cxxSelf =((<ALIAS>_Class_Provider*)self);\n\
216               Context  cxxContext(context);\n\
217           \n\
218               cxxSelf->ReferenceInstances(\n\
219                   cxxContext,\n\
220                   nameSpace,\n\
221                   instanceName,\n\
222                   role,\n\
223                   __PropertySet(propertySet),\n\
224                   __bool(keysOnly),\n\
225                   filter);\n\
226           }\n\
227           \n"
228           
229           #define ASSOCIATION_PROVIDER_STUBS_CPP_ROLES INSTANCE_PROVIDER_STUBS_CPP "\
230           MI_EXTERN_C void MI_CALL <ALIAS>_AssociatorInstances<ROLE1>(\n\
231               <ALIAS>_Self* self,\n\
232 mike  1.1     MI_Context* context,\n\
233               const MI_Char* nameSpace,\n\
234               const MI_Char* className,\n\
235               const <ALIAS1>* instanceName,\n\
236               const MI_Char* resultClass,\n\
237               const MI_PropertySet* propertySet,\n\
238               MI_Boolean keysOnly,\n\
239               const MI_Filter* filter)\n\
240           {\n\
241               <ALIAS>_Class_Provider* cxxSelf =((<ALIAS>_Class_Provider*)self);\n\
242               <ALIAS1>_Class cxxInstanceName(instanceName, true);\n\
243               Context  cxxContext(context);\n\
244           \n\
245               cxxSelf->AssociatorInstances<ROLE1>(\n\
246                   cxxContext, \n\
247                   nameSpace,\n\
248                   cxxInstanceName,\n\
249                   resultClass,\n\
250                   __PropertySet(propertySet),\n\
251                   __bool(keysOnly),\n\
252                   filter);\n\
253 mike  1.1 }\n\
254           \n\
255           MI_EXTERN_C void MI_CALL <ALIAS>_AssociatorInstances<ROLE2>(\n\
256               <ALIAS>_Self* self,\n\
257               MI_Context* context,\n\
258               const MI_Char* nameSpace,\n\
259               const MI_Char* className,\n\
260               const <ALIAS2>* instanceName,\n\
261               const MI_Char* resultClass,\n\
262               const MI_PropertySet* propertySet,\n\
263               MI_Boolean keysOnly,\n\
264               const MI_Filter* filter)\n\
265           {\n\
266               <ALIAS>_Class_Provider* cxxSelf =((<ALIAS>_Class_Provider*)self);\n\
267               <ALIAS2>_Class cxxInstanceName(instanceName, true);\n\
268               Context  cxxContext(context);\n\
269           \n\
270               cxxSelf->AssociatorInstances<ROLE2>(\n\
271                   cxxContext,\n\
272                   nameSpace,\n\
273                   cxxInstanceName,\n\
274 mike  1.1         resultClass,\n\
275                   __PropertySet(propertySet),\n\
276                   __bool(keysOnly),\n\
277                   filter);\n\
278           }\n\
279           \n\
280           MI_EXTERN_C void MI_CALL <ALIAS>_ReferenceInstances<ROLE1>(\n\
281               <ALIAS>_Self* self,\n\
282               MI_Context* context,\n\
283               const MI_Char* nameSpace,\n\
284               const MI_Char* resultClass,\n\
285               const <ALIAS1>* instanceName,\n\
286               const MI_PropertySet* propertySet,\n\
287               MI_Boolean keysOnly,\n\
288               const MI_Filter* filter)\n\
289           {\n\
290               <ALIAS>_Class_Provider* cxxSelf =((<ALIAS>_Class_Provider*)self);\n\
291               <ALIAS1>_Class cxxInstanceName(instanceName, true);\n\
292               Context  cxxContext(context);\n\
293           \n\
294               cxxSelf->ReferenceInstances<ROLE1>(\n\
295 mike  1.1         cxxContext,\n\
296                   nameSpace,\n\
297                   cxxInstanceName,\n\
298                   __PropertySet(propertySet),\n\
299                   __bool(keysOnly),\n\
300                   filter);\n\
301           }\n\
302           \n\
303           MI_EXTERN_C void MI_CALL <ALIAS>_ReferenceInstances<ROLE2>(\n\
304               <ALIAS>_Self* self,\n\
305               MI_Context* context,\n\
306               const MI_Char* nameSpace,\n\
307               const MI_Char* resultClass,\n\
308               const <ALIAS2>* instanceName,\n\
309               const MI_PropertySet* propertySet,\n\
310               MI_Boolean keysOnly,\n\
311               const MI_Filter* filter)\n\
312           {\n\
313               <ALIAS>_Class_Provider* cxxSelf =((<ALIAS>_Class_Provider*)self);\n\
314               <ALIAS2>_Class cxxInstanceName(instanceName, true);\n\
315               Context  cxxContext(context);\n\
316 mike  1.1 \n\
317               cxxSelf->ReferenceInstances<ROLE2>(\n\
318                   cxxContext,\n\
319                   nameSpace,\n\
320                   cxxInstanceName,\n\
321                   __PropertySet(propertySet),\n\
322                   __bool(keysOnly),\n\
323                   filter);\n\
324           }\n\
325           \n"
326           
327           //==============================================================================
328           //
329           // INDICATION_PROVIDER_STUBS_CPP
330           //
331           //==============================================================================
332           
333           #define INDICATION_PROVIDER_STUBS_CPP COMMON_PROVIDER_STUBS_CPP "\
334           MI_EXTERN_C void MI_CALL <ALIAS>_EnableIndications(\n\
335               <ALIAS>_Self* self,\n\
336               MI_Context* indicationsContext,\n\
337 mike  1.1     const MI_Char* nameSpace,\n\
338               const MI_Char* className)\n\
339           {\n\
340               <ALIAS>_Class_Provider* cxxSelf =((<ALIAS>_Class_Provider*)self);\n\
341           \n\
342               cxxSelf->SetIndicationContext(indicationsContext);\n\
343               cxxSelf->EnableIndications();\n\
344           }\n\
345           \n\
346           MI_EXTERN_C void MI_CALL <ALIAS>_DisableIndications(\n\
347               <ALIAS>_Self* self,\n\
348               MI_Context* indicationsContext,\n\
349               const MI_Char* nameSpace,\n\
350               const MI_Char* className)\n\
351           {\n\
352               <ALIAS>_Class_Provider* cxxSelf =((<ALIAS>_Class_Provider*)self);\n\
353           \n\
354               cxxSelf->DisableIndications();\n\
355               cxxSelf->SetIndicationContext(0);\n\
356           \n\
357               MI_PostResult(indicationsContext, MI_RESULT_OK);\n\
358 mike  1.1 }\n\
359           \n\
360           MI_EXTERN_C void MI_CALL <ALIAS>_Subscribe(\n\
361               <ALIAS>_Self* self,\n\
362               MI_Context* context,\n\
363               const MI_Char* nameSpace,\n\
364               const MI_Char* className,\n\
365               const MI_Filter* filter,\n\
366               const MI_Char* bookmark,\n\
367               MI_Uint64  subscriptionID,\n\
368               void** subscriptionSelf)\n\
369           {\n\
370               <ALIAS>_Class_Provider* cxxSelf =((<ALIAS>_Class_Provider*)self);\n\
371               Context  cxxContext(context);\n\
372           \n\
373               cxxSelf->Subscribe(\n\
374                   cxxContext,\n\
375                   nameSpace,\n\
376                   filter,\n\
377                   bookmark,\n\
378                   subscriptionID,\n\
379 mike  1.1         subscriptionSelf);\n\
380           }\n\
381           \n\
382           MI_EXTERN_C void MI_CALL <ALIAS>_Unsubscribe(\n\
383               <ALIAS>_Self* self,\n\
384               MI_Context* context,\n\
385               const MI_Char* nameSpace,\n\
386               const MI_Char* className,\n\
387               MI_Uint64  subscriptionID,\n\
388               void* subscriptionSelf)\n\
389           {\n\
390               <ALIAS>_Class_Provider* cxxSelf =((<ALIAS>_Class_Provider*)self);\n\
391               Context  cxxContext(context);\n\
392           \n\
393               cxxSelf->Unsubscribe(\n\
394                   cxxContext,\n\
395                   nameSpace,\n\
396                   subscriptionID,\n\
397                   subscriptionSelf);\n\
398           }\n\
399           \n"
400 mike  1.1 
401           //==============================================================================
402           //
403           // EXTRINSIC_METHOD_STUB_CPP
404           //
405           //==============================================================================
406           
407           #define EXTRINSIC_METHOD_STUB_CPP "\
408           MI_EXTERN_C void MI_CALL <ALIAS>_Invoke_<METHOD>(\n\
409               <ALIAS>_Self* self,\n\
410               MI_Context* context,\n\
411               const MI_Char* nameSpace,\n\
412               const MI_Char* className,\n\
413               const MI_Char* methodName,\n\
414               const <ALIAS>* instanceName,\n\
415               const <ALIAS>_<METHOD>* in)\n\
416           {\n\
417               <ALIAS>_Class_Provider* cxxSelf =((<ALIAS>_Class_Provider*)self);\n\
418               <ALIAS>_Class instance(instanceName, false);\n\
419               Context  cxxContext(context);\n\
420               <ALIAS>_<METHOD>_Class param(in, false);\n\
421 mike  1.1 \n\
422               cxxSelf->Invoke_<METHOD>(cxxContext, nameSpace, instance, param);\n\
423           }\n\
424           \n"
425           
426           #endif /* _migen_cxxstubs_t_h */

ViewCVS 0.9.2