1 /* ------------------------------------------------
2 Copyright 2014 AT&T Intellectual Property
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
7 http://www.apache.org/licenses/LICENSE-2.0
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14 ------------------------------------------- */
15 #ifndef _PARTN_PARSE_H_INCLUDED__
16 #define _PARTN_PARSE_H_INCLUDED__
20 #include"analyze_fta.h"
22 /* Interface to FTA Parser */
23 void PartnParser_setfileinput(FILE *f);
24 void PartnParser_setstringinput(char *s);
30 std::vector<scalarexp_t *> se_list;
31 std::vector<std::string> field_list;
33 partn_def_t(const char *n, const char *p, se_list_t *sl){
36 se_list = sl->se_list;
39 int verify(table_list *schema, std::string &err_msg);
40 bool is_compatible(gb_table *gb_tbl);
43 class partn_def_list_t{
45 std::map<std::string, partn_def_t *> partn_map;
47 partn_def_list_t(partn_def_t *pd){
48 partn_map[pd->name] = pd;
50 partn_def_list_t *append(partn_def_t *pd){
51 if(partn_map.count(pd->name)){
52 fprintf(stderr,"Warning, duplicate entry named %s in partition definitions, ignored.\n",pd->name.c_str());
54 partn_map[pd->name] = pd;
59 partn_def_t *get_partn_def(std::string n){
60 if(partn_map.count(n))
65 int verify(table_list *schema, std::string &err_msg){
67 std::map<std::string, partn_def_t *>::iterator mspi;
68 for(mspi=partn_map.begin(); mspi!=partn_map.end();++mspi){
69 if((*mspi).second->verify(schema, err_msg))