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

  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           #ifndef _omi_instance_h
 26           #define _omi_instance_h
 27           
 28           #include "config.h"
 29           #include <common.h>
 30           #include "atomic.h"
 31           #include "batch.h"
 32           #include "buf.h"
 33           
 34           BEGIN_EXTERNC
 35           
 36           /*
 37           **==============================================================================
 38           **
 39           ** Instance structure and related functions.
 40           **
 41           **==============================================================================
 42           */
 43 mike  1.1 
 44           /* Immediately precedes heap-allocated Instance structures */
 45           typedef struct _InstanceHeader
 46           {
 47               MI_Uint32 magic;
 48               union
 49               {
 50                   AtomicInt refs;
 51                   MI_Uint64 alignment;
 52               }
 53               u;
 54           }
 55           InstanceHeader;
 56           
 57           typedef struct _Instance /* extends MI_Instance */
 58           {
 59               /* Function table (inherited field) */
 60               MI_InstanceFT* ft;
 61           
 62               /* The class declaration for this instance (inherited field) */
 63               MI_ClassDecl* classDecl;
 64 mike  1.1 
 65               /* The optional server name (inherited field) */
 66               MI_Char* serverName;
 67           
 68               /* The optional namespace (inherited field) */
 69               MI_Char* nameSpace;
 70           
 71               /* Allocator for this instance */
 72               Batch* batch;
 73           
 74               /* Points to this structure if static, other structure if dynamic. */
 75               struct _Instance* self;
 76           
 77               /* If true, instances releases batch upon destruction */
 78               MI_Boolean releaseBatch;
 79           }
 80           Instance;
 81           
 82           MI_Result MI_CALL Instance_Construct(
 83               MI_Instance* self,
 84               const MI_ClassDecl* classDecl,
 85 mike  1.1     Batch* batch);
 86           
 87           MI_Result Instance_New(
 88               MI_Instance** self,
 89               const MI_ClassDecl* classDecl,
 90               Batch* batch);
 91           
 92           MI_Result MI_CALL Instance_NewDynamic(
 93               MI_Instance** self,
 94               const MI_Char* className,
 95               MI_Uint32 metaType, /* MI_FLAG_(CLASS|ASSOCIATION|INDICATION|METHOD) */
 96               Batch* batch);
 97           
 98           /* TODO: Set MI_ClassDecl.schema during generation; eliminate schemaDecl arg */
 99           MI_Result MI_CALL Instance_InitConvert(
100               MI_Instance* self,
101               const MI_ClassDecl* classDecl,
102               const MI_Instance* instance,
103               MI_Boolean keysOnly,
104               MI_Boolean allowKeylessInst,
105               MI_Boolean copy,
106 mike  1.1     Batch* batch);
107           
108           MI_Result MI_CALL Instance_Clone(
109               const MI_Instance* self, 
110               MI_Instance** inst,
111               Batch* batch);
112           
113           MI_Result MI_CALL Instance_SetClassName(
114               MI_Instance* self, 
115               const MI_Char* className);
116           
117           MI_Result MI_CALL Instance_Print(
118               const MI_Instance* self,
119               FILE* os,
120               MI_Uint32 level,
121               MI_Boolean showNulls);
122           
123           /* Return true if instances have exactly the same keys */
124           MI_Boolean Instance_MatchKeys(
125               const MI_Instance* self,
126               const MI_Instance* instance);
127 mike  1.1 
128           /*
129           **==============================================================================
130           **
131           ** MI_Instance function table and functions
132           **
133           **==============================================================================
134           */
135           
136           void __MI_Instance_Ref(MI_Instance* self);
137           
138           void __MI_Instance_Unref(MI_Instance* self);
139           
140           MI_Result MI_CALL __MI_Instance_Clone(
141               const MI_Instance* self, 
142               MI_Instance** inst);
143           
144           MI_Result MI_CALL __MI_Instance_Destruct(
145               MI_Instance* self);
146           
147           MI_Result MI_CALL __MI_Instance_Delete(
148 mike  1.1     MI_Instance* self);
149           
150           MI_Result MI_CALL __MI_Instance_IsA(
151               const MI_Instance* self_,
152               const MI_ClassDecl* classDecl,
153               MI_Boolean* result);
154           
155           MI_Result MI_CALL __MI_Instance_GetClassName(
156               const MI_Instance* self_, 
157               const MI_Char** classname);
158           
159           MI_Result MI_CALL __MI_Instance_SetNameSpace(
160               MI_Instance* self, 
161               const MI_Char* nameSpace);
162           
163           MI_Result MI_CALL __MI_Instance_GetNameSpace(
164               const MI_Instance* self, 
165               const MI_Char** nameSpace);
166           
167           MI_Result MI_CALL __MI_Instance_GetElementCount(
168               const MI_Instance* self,
169 mike  1.1     MI_Uint32* count);
170           
171           MI_Result MI_CALL __MI_Instance_AddElement(
172               MI_Instance* self,
173               const MI_Char* name,
174               const MI_Value* value,
175               MI_Type type,
176               MI_Uint32 flags);
177           
178           MI_Result MI_CALL __MI_Instance_SetElement(
179               MI_Instance* self, 
180               const MI_Char* name, 
181               const MI_Value* value,
182               MI_Type type,
183               MI_Uint32 flags);
184           
185           MI_Result MI_CALL __MI_Instance_SetElementAt(
186               MI_Instance* self, 
187               MI_Uint32 index,
188               const MI_Value* value,
189               MI_Type type,
190 mike  1.1     MI_Uint32 flags);
191           
192           MI_Result MI_CALL __MI_Instance_GetElement(
193               const MI_Instance* self, 
194               const MI_Char* name, 
195               MI_Value* valueOut,
196               MI_Type* typeOut,
197               MI_Uint32* flagsOut,
198               MI_Uint32* indexOut);
199           
200           MI_Result MI_CALL __MI_Instance_GetElementAt(
201               const MI_Instance* self,
202               MI_Uint32 index,
203               const MI_Char** name,
204               MI_Value* value,
205               MI_Type* type,
206               MI_Uint32* flags);
207           
208           MI_Result MI_CALL __MI_Instance_ClearElement(
209               MI_Instance* self_, 
210               const MI_Char* name);
211 mike  1.1 
212           MI_Result MI_CALL __MI_Instance_ClearElementAt(
213               MI_Instance* self, 
214               MI_Uint32 index);
215           
216           MI_Result MI_CALL __MI_Instance_Print(
217               const MI_Instance* self,
218               FILE* os,
219               MI_Uint32 level);
220           
221           extern MI_InstanceFT __mi_instanceFT;
222           
223           END_EXTERNC
224           
225           #endif /* _omi_instance_h */

ViewCVS 0.9.2