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_CONTEXT_STATICALLY_KNOWN_COLLECTION_H 18 #define ZORBA_CONTEXT_STATICALLY_KNOWN_COLLECTION_H 19 20 #include "common/shared_types.h" 21 22 #include "context/static_context_consts.h" 23 #include "annotations/annotations.h" 24 25 #include "types/typeconstants.h" 26 27 #include "zorbaserialization/class_serializer.h" 28 29 namespace zorba 30 { 31 32 class StaticallyKnownCollection : public SimpleRCObject 33 { 34 private: 35 store::Item_t theName; 36 AnnotationList_t theAnnotations; 37 xqtref_t theNodeType; 38 xqtref_t theCollectionType; 39 40 // redundant information 41 // cache the Zorba known annotations to allow for efficient 42 // checks at runtime 43 StaticContextConsts::declaration_property_t theUpdateProperty; 44 StaticContextConsts::declaration_property_t theOrderProperty; 45 StaticContextConsts::node_modifier_t theNodeModifier; 46 47 public: 48 SERIALIZABLE_CLASS(StaticallyKnownCollection); 49 50 SERIALIZABLE_CLASS_CONSTRUCTOR2(StaticallyKnownCollection, SimpleRCObject); 51 52 void serialize(::zorba::serialization::Archiver& ar); 53 54 public: 55 StaticallyKnownCollection( 56 store::Item_t& aName, 57 const AnnotationList_t& aAnnotationList, 58 xqtref_t& aNodeType, 59 xqtref_t& aCollectionType, 60 StaticContextConsts::declaration_property_t aUpdateProperty, 61 StaticContextConsts::declaration_property_t aOrderProperty, 62 StaticContextConsts::node_modifier_t aNodeModifier 63 ); 64 65 ~StaticallyKnownCollection(); 66 getName()67 const store::Item* getName() const { return theName.getp(); } 68 69 AnnotationList* getAnnotations()70 getAnnotations() const { return theAnnotations.getp(); }; 71 getUpdateProperty()72 StaticContextConsts::declaration_property_t getUpdateProperty() const 73 { 74 return theUpdateProperty; 75 } 76 getOrderProperty()77 StaticContextConsts::declaration_property_t getOrderProperty() const 78 { 79 return theOrderProperty; 80 } 81 getNodeModifier()82 StaticContextConsts::node_modifier_t getNodeModifier() const 83 { 84 return theNodeModifier; 85 } 86 getNodeType()87 const XQType* getNodeType() const 88 { 89 return theNodeType.getp(); 90 } 91 getCollectionType()92 const XQType* getCollectionType() const 93 { 94 return theCollectionType.getp(); 95 } 96 }; 97 98 99 typedef rchandle<StaticallyKnownCollection> StaticallyKownCollection_t; 100 101 } 102 103 #endif 104 105 106 /* 107 * Local variables: 108 * mode: c++ 109 * End: 110 */ 111 /* vim:set et sw=2 ts=2: */ 112