1 /*
2  * Copyright 2006-2008 The FLWOR Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #pragma once
17 #ifndef ZORBA_BINARY_SERIALIZATION_ARCHIVER_CONSTS
18 #define ZORBA_BINARY_SERIALIZATION_ARCHIVER_CONSTS
19 
20 namespace zorba
21 {
22 
23 namespace serialization
24 {
25 
26 #define FIELD_IS_SIMPLE   true
27 #define FIELD_IS_CLASS    true
28 
29 
30 /*******************************************************************************
31 
32   ARCHIVE_FIELD_NORMAL:
33   ---------------------
34   A field of kind NORMAL or PTR acts as the root of a tree of fields representing
35   the serialization of a concrete obj. If the kind is PTR, then the obj was
36   serialized when a pointer to it was encountered. In this case, during
37   deserialization, the archiver will allocate the obj on the heap and fill-in
38   its data members. If the kind is NORMAL, then the obj was serialized when the
39   objitself was encountered (e.g., the object was an embedded data member of
40   another obj, or was residing on the program stack). In this case, during
41   deserialization, the object exists already (in an uninitialized state) and a
42   reference to it is given to the archiver, which will fill-in the obj's data.
43 
44   ARCHIVE_FIELD_PTR:
45   ------------------
46   See comment for ARCHIVE_FIELD_NORMAL.
47 
48   ARCHIVE_FIELD_REFERENCING:
49   --------------------------
50   A field A that references another field B (of kind NORMAL or PTR), where both
51   A and B represent the "same" object.
52 
53   ARCHIVE_FIELD_BASECLASS:
54   ------------------------
55   A field representing a "partial" class object: If an obj O belongs to a
56   concrete class C and C is a subclass of a base class B, then a field of
57   BASECLASS kind is created to represent the serialization of the data members
58   of B. This field is placed as the 1st child of the NORMAL or PTR field that
59   represents the serialization of O, and the children of the BASECALSS field
60   represent the serializations of B's data members. If B itself is a subclass
61   of another class A, then the 1st child of the B BASECLASS field is another
62   BASECLASS field representing class A, etc.
63 
64   ARCHIVE_FIELD_NULL:
65   -------------------
66   A field representing a NULL pointer.
67 
68 ********************************************************************************/
69 enum ArchiveFieldKind
70 {
71   ARCHIVE_FIELD_NORMAL,
72   ARCHIVE_FIELD_PTR,
73   ARCHIVE_FIELD_NULL,
74   ARCHIVE_FIELD_BASECLASS,
75   ARCHIVE_FIELD_REFERENCING
76 };
77 
78 
79 /*******************************************************************************
80 
81 ********************************************************************************/
82 enum ENUM_ALLOW_DELAY
83 {
84   ALLOW_DELAY,
85   DONT_ALLOW_DELAY,
86   SERIALIZE_NOW
87 };
88 
89 
90 /*******************************************************************************
91 
92 ********************************************************************************/
93 enum TypeCode
94 {
95   TYPE_NULL = 0,
96 
97   TYPE_static_context,
98 
99   TYPE_SingletonIterator,
100 
101   TYPE_CtxVarDeclareIterator,
102   TYPE_CtxVarIterator,
103   TYPE_LetVarIterator,
104   TYPE_ForVarIterator,
105   TYPE_FLWORIterator,
106   TYPE_ForLetClause,
107   TYPE_OrderByClause,
108   TYPE_MaterializeClause,
109   TYPE_GroupByClause,
110 
111   TYPE_ChildAxisIterator,
112   TYPE_DescendantSelfAxisIterator,
113   TYPE_DescendantAxisIterator,
114   TYPE_AttributeAxisIterator,
115   TYPE_NodeNameTest,
116 
117   TYPE_SequentialIterator,
118 
119   TYPE_NodeSortIterator,
120   TYPE_NodeDistinctIterator,
121 
122   TYPE_UDFunctionCallIterator,
123   TYPE_ExtFunctionCallIterator,
124 
125   TYPE_HoistIterator,
126   TYPE_UnhoistIterator,
127 
128   TYPE_ElementIterator,
129   TYPE_AttributeIterator,
130   TYPE_EnclosedIterator,
131 
132   TYPE_AndIterator,
133   TYPE_OrIterator,
134   TYPE_CompareIterator,
135   TYPE_TypedValueCompareIterator_1,
136   TYPE_TypedValueCompareIterator_2,
137   TYPE_TypedValueCompareIterator_3,
138   TYPE_TypedValueCompareIterator_4,
139   TYPE_TypedValueCompareIterator_5,
140   TYPE_FnBooleanIterator,
141 
142   TYPE_IfThenElseIterator,
143 
144   TYPE_InstanceOfIterator,
145   TYPE_CastIterator,
146   TYPE_PromoteIterator,
147   TYPE_TreatIterator,
148   TYPE_CastableIterator,
149   TYPE_EitherNodesOrAtomicsIterator,
150 
151   TYPE_AtomicXQType,
152   TYPE_StructuredItemXQType,
153   TYPE_NodeXQType,
154 #ifdef ZORBA_WITH_JSON
155   TYPE_JSONXQType,
156 #endif
157   TYPE_FunctionXQType,
158   TYPE_ItemXQType,
159   TYPE_AnyXQType,
160   TYPE_AnySimpleXQType,
161   TYPE_AnyFunctionXQType,
162   TYPE_UntypedXQType,
163   TYPE_EmptyXQType,
164   TYPE_NoneXQType,
165   TYPE_UserDefinedXQType,
166   TYPE_TypeManagerImpl,
167   TYPE_Schema,
168 
169   TYPE_NumArithIterator_1,
170   TYPE_NumArithIterator_2,
171   TYPE_NumArithIterator_3,
172   TYPE_NumArithIterator_4,
173   TYPE_NumArithIterator_5,
174   TYPE_NumArithIterator_6,
175 
176   TYPE_SpecificNumArithIterator_1,
177   TYPE_SpecificNumArithIterator_2,
178   TYPE_SpecificNumArithIterator_3,
179   TYPE_SpecificNumArithIterator_4,
180   TYPE_SpecificNumArithIterator_5,
181   TYPE_SpecificNumArithIterator_6,
182   TYPE_SpecificNumArithIterator_7,
183   TYPE_SpecificNumArithIterator_8,
184   TYPE_SpecificNumArithIterator_9,
185   TYPE_SpecificNumArithIterator_10,
186   TYPE_SpecificNumArithIterator_11,
187   TYPE_SpecificNumArithIterator_12,
188   TYPE_SpecificNumArithIterator_13,
189   TYPE_SpecificNumArithIterator_14,
190   TYPE_SpecificNumArithIterator_15,
191   TYPE_SpecificNumArithIterator_16,
192   TYPE_SpecificNumArithIterator_17,
193   TYPE_SpecificNumArithIterator_18,
194   TYPE_SpecificNumArithIterator_19,
195   TYPE_SpecificNumArithIterator_20,
196 
197   TYPE_GenericArithIterator_1,
198   TYPE_GenericArithIterator_2,
199   TYPE_GenericArithIterator_3,
200   TYPE_GenericArithIterator_4,
201   TYPE_GenericArithIterator_5,
202   TYPE_GenericArithIterator_6,
203 
204   TYPE_ApplyIterator,
205 
206   TYPE_LoopIterator,
207   TYPE_ExitIterator,
208   TYPE_ExitCatcherIterator,
209   TYPE_FlowCtlIterator,
210 
211   TYPE_CtxVarAssignIterator,
212   TYPE_CtxVarIsSetIterator,
213 
214   TYPE_ForIterator,
215   TYPE_LetIterator,
216   TYPE_TupleSourceIterator,
217   TYPE_CountIterator,
218   TYPE_OuterForIterator,
219   TYPE_TupleStreamIterator,
220   TYPE_WhereIterator,
221   TYPE_WindowVars,
222   TYPE_WindowIterator,
223   TYPE_EndClause,
224   TYPE_StartClause,
225   TYPE_OrderSpec,
226   TYPE_OrderByIterator,
227   TYPE_NonGroupingSpec,
228   TYPE_GroupingSpec,
229   TYPE_GroupByIterator,
230 
231   TYPE_user_function,
232   TYPE_function,
233   TYPE_external_function,
234   TYPE_signature,
235   TYPE_AnnotationInternal,
236   TYPE_AnnotationList,
237 
238   TYPE_TryCatchIterator,
239   TYPE_CatchClause,
240 
241   TYPE_SelfAxisIterator,
242   TYPE_ParentAxisIterator,
243   TYPE_AncestorAxisIterator,
244   TYPE_AncestorReverseAxisIterator,
245   TYPE_AncestorSelfAxisIterator,
246   TYPE_AncestorSelfReverseAxisIterator,
247   TYPE_RSiblingAxisIterator,
248   TYPE_LSiblingAxisIterator,
249   TYPE_LSiblingReverseAxisIterator,
250 
251 #include "runtime/iterator_enum.h"
252 
253   TYPE_DynamicFnCallIterator,
254 
255   TYPE_CountCollectionIterator,
256   TYPE_ZorbaCollectionIteratorHelper_1,
257   TYPE_ZorbaCollectionIteratorHelper_2,
258   TYPE_ZorbaCollectionIteratorHelper_3,
259   TYPE_ZorbaCollectionIteratorHelper_4,
260   TYPE_ZorbaCollectionIteratorHelper_5,
261   TYPE_ZorbaCollectionIteratorHelper_6,
262   TYPE_ZorbaCollectionIteratorHelper_7,
263   TYPE_ZorbaCollectionIteratorHelper_8,
264   TYPE_ZorbaCollectionIteratorHelper_9,
265   TYPE_ZorbaCollectionIteratorHelper_10,
266 
267   TYPE_EmptyIterator,
268 
269   TYPE_TransformIterator,
270   TYPE_CopyClause,
271   TYPE_RenameIterator,
272   TYPE_ReplaceIterator,
273   TYPE_DeleteIterator,
274   TYPE_InsertIterator,
275 
276 #ifdef ZORBA_WITH_JSON
277   TYPE_JSONObjectIterator,
278   TYPE_JSONDirectObjectIterator,
279   TYPE_JSONArrayIterator,
280 #endif
281 
282   TYPE_EvalIterator,
283 
284   TYPE_ProbeIndexPointValueIterator,
285   TYPE_ProbeIndexPointGeneralIterator,
286   TYPE_ProbeIndexRangeValueIterator,
287   TYPE_ProbeIndexRangeGeneralIterator,
288   TYPE_ValueIndexEntryBuilderIterator,
289   TYPE_GeneralIndexEntryBuilderIterator,
290   TYPE_RefreshIndexIterator,
291   TYPE_DeleteIndexIterator,
292   TYPE_CreateIndexIterator,
293   TYPE_CreateInternalIndexIterator,
294 
295   TYPE_PrecedingAxisIterator,
296   TYPE_PrecedingReverseAxisIterator,
297   TYPE_FollowingAxisIterator,
298 
299   TYPE_MaterializeIterator,
300 
301   TYPE_FnMinMaxIterator,
302 
303   TYPE_AtomicValuesEquivalenceIterator,
304 
305   TYPE_OpNumericUnaryIterator,
306   TYPE_OpDoubleUnaryIterator,
307 
308   TYPE_NameCastIterator,
309   TYPE_DocumentIterator,
310   TYPE_CommentIterator,
311   TYPE_PiIterator,
312   TYPE_TextIterator,
313 
314   TYPE_FnDateTimeConstructorIterator,
315   TYPE_FnFormatDateTimeIterator,
316   TYPE_FnAdjustToTimeZoneIterator_2,
317   TYPE_FnAdjustToTimeZoneIterator_1,
318 
319   TYPE_FunctionItem,
320 
321   TYPE_namespace_context,
322 
323   TYPE_var_expr,
324 
325   TYPE_CompilerCB,
326   TYPE_CompilerCB_config,
327 
328   TYPE_FTContainsIterator,
329   TYPE_ftand,
330   TYPE_ftcontent_filter,
331   TYPE_ftcase_option,
332   TYPE_ftdiacritics_option,
333   TYPE_ftdistance_filter,
334   TYPE_ftextension_option,
335   TYPE_ftlanguage_option,
336   TYPE_ftmatch_options,
337   TYPE_ftmild_not,
338   TYPE_ftor,
339   TYPE_ftprimary_with_options,
340   TYPE_ftscope_filter,
341   TYPE_ftselection,
342   TYPE_ftstem_option,
343   TYPE_ftstop_words,
344   TYPE_ftstop_word_option,
345   TYPE_ftthesaurus_id,
346   TYPE_ftthesaurus_option,
347   TYPE_ftunary_not,
348   TYPE_ftweight,
349   TYPE_ftwild_card_option,
350   TYPE_ftwords,
351   TYPE_ftwords_times,
352   TYPE_ftextension_selection,
353   TYPE_ftorder_filter,
354   TYPE_ftrange,
355   TYPE_ftwindow_filter,
356 
357   TYPE_StaticallyKnownCollection,
358   TYPE_IndexDecl,
359   TYPE_ValueIC,
360   TYPE_OrderModifier,
361 
362   TYPE_DecimalFormat,
363 
364   TYPE_BaseUriInfo,
365   TYPE_VarInfo,
366   TYPE_FunctionInfo,
367   TYPE_PrologOption,
368   TYPE_sctx_module,
369 
370   TYPE_QueryLoc,
371 
372   TYPE_PLAN_PROXY,
373 
374   TYPE_XQueryImpl,
375 
376   TYPE_Breakable,
377   TYPE_DebuggerSingletonIterator,
378   TYPE_DebuggerCommons,
379 
380   TYPE_RCObject,
381 
382   TYPE_INT64,
383   TYPE_UINT64,
384   TYPE_INT32,
385   TYPE_UINT32,
386   TYPE_ENUM,
387   TYPE_INT16,
388   TYPE_UINT16,
389   TYPE_CHAR,
390   TYPE_UCHAR,
391 
392   TYPE_FLOAT,
393   TYPE_DOUBLE,
394 
395   TYPE_BOOL,
396 
397   TYPE_STD_STRING,
398   TYPE_ZSTRING,
399 
400   TYPE_COLLATOR,
401 
402   TYPE_UNKNOWN,
403   TYPE_LAST
404 };
405 
406 
407 /*******************************************************************************
408 
409 ********************************************************************************/
410 typedef union
411 {
412   int64_t         int64v;
413   uint64_t        uint64v;
414   int32_t         int32v;
415   uint32_t        uint32v;
416   int16_t         int16v;
417   uint16_t        uint16v;
418   char            charv;
419   unsigned char   ucharv;
420   bool            boolv;
421 } SimpleValue;
422 
423 
424 }
425 }
426 #endif
427 /* vim:set et sw=2 ts=2: */
428