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 #ifndef ZORBA_SIMPLE_STORE_STORE_DEFS_H 17 #define ZORBA_SIMPLE_STORE_STORE_DEFS_H 18 19 #include "store_manager_impl.h" 20 21 namespace zorba { 22 23 namespace simplestore { 24 25 26 //#define EMBEDED_TYPE 27 //#define TEXT_ORDPATH 28 29 30 #define GET_STORE() \ 31 (*zorba::simplestore::StoreManagerImpl::getStoreInternal()) 32 33 #define GET_FACTORY() \ 34 (*(reinterpret_cast<BasicItemFactory*>(GET_STORE().getItemFactory()))) 35 36 #define GET_NODE_FACTORY() \ 37 (GET_STORE().getNodeFactory()) 38 39 #define GET_PUL_FACTORY() \ 40 (GET_STORE().getPULFactory()) 41 42 #define BASE_NODE(item) (reinterpret_cast<XmlNode*>((item).getp())) 43 44 #define INTERNAL_NODE(item) (reinterpret_cast<InternalNode*>((item).getp())) 45 46 #define DOC_NODE(item) (reinterpret_cast<DocumentNode*>((item).getp())) 47 48 #define ATTR_NODE(item) (reinterpret_cast<AttributeNode*>((item).getp())) 49 50 #define ELEM_NODE(item) (reinterpret_cast<ElementNode*>((item).getp())) 51 52 #define TEXT_NODE(item) (reinterpret_cast<TextNode*>((item).getp())) 53 54 #define PI_NODE(item) (reinterpret_cast<PiNode*>((item).getp())) 55 56 #define COMMENT_NODE(item) (reinterpret_cast<CommentNode*>((item).getp())) 57 58 59 #ifndef NDEBUG 60 61 #define STORE_TRACE(level, msg) \ 62 { \ 63 if (level <= GET_STORE().getTraceLevel()) \ 64 std::cout << msg << std::endl; \ 65 } 66 67 #define STORE_TRACE1(msg) STORE_TRACE(1, msg); 68 #define STORE_TRACE2(msg) STORE_TRACE(2, msg); 69 #define STORE_TRACE3(msg) STORE_TRACE(3, msg); 70 71 #else 72 73 #define STORE_TRACE(msg) 74 #define STORE_TRACE1(msg) 75 #define STORE_TRACE2(msg) 76 #define STORE_TRACE3(msg) 77 78 #endif 79 80 } 81 } 82 #endif 83 /* vim:set et sw=2 ts=2: */ 84