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_STORE_IC
17 #define ZORBA_STORE_IC
18 
19 #include "store/api/shared_types.h"
20 
21 namespace zorba
22 {
23 
24 namespace store
25 {
26 
27 class IC;
28 
29 
30 /**
31  * Integrity Constraints class. Contains the name of the IC and the
32  * collection name.
33  */
34 class IC : public RCObject
35 {
36 public:
37   enum ICKind
38   {
39     ic_collection,
40     ic_foreignkey
41   };
42 
43 protected:
SYNC_CODE(mutable RCLock theRCLock;)44   SYNC_CODE(mutable RCLock theRCLock;)
45 
46 public:
47   SYNC_CODE(RCLock* getRCLock() const { return &theRCLock; })
48 
49   long* getSharedRefCounter() const { return NULL; }
50 
51 public:
~IC()52   virtual ~IC() {}
53 
54   virtual const Item* getICName() const = 0;
55   virtual ICKind getICKind() const = 0;
56   virtual const Item* getCollectionName() const = 0;
57   virtual const Item* getToCollectionName() const = 0;
58   virtual const Item* getFromCollectionName() const = 0;
59 };
60 
61 
62 class ICChecker
63 {
64 public:
~ICChecker()65   virtual ~ICChecker() {}
66 
67   virtual void check(const Item* collName) = 0;
68 };
69 
70 
71 } // namespace store
72 } // namespace zorba
73 
74 #endif
75 
76 
77 /*
78  * Local variables:
79  * mode: c++
80  * End:
81  */
82 /* vim:set et sw=2 ts=2: */
83