X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fftacmp%2Fparse_partn.h;h=36e92d616aa264ce2c37ccbd02c8fcfddaa7fba0;hb=f1754ecea2eab7bd0a302042ac82eb11667b166c;hp=ea9637fb4f72e830949e42d631ab09faf0a98879;hpb=07495effe193ca3f73c3bf0ce417068f9ac9dcdd;p=com%2Fgs-lite.git diff --git a/src/ftacmp/parse_partn.h b/src/ftacmp/parse_partn.h index ea9637f..36e92d6 100644 --- a/src/ftacmp/parse_partn.h +++ b/src/ftacmp/parse_partn.h @@ -1,78 +1,78 @@ -/* ------------------------------------------------ -Copyright 2014 AT&T Intellectual Property - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - ------------------------------------------- */ -#ifndef _PARTN_PARSE_H_INCLUDED__ -#define _PARTN_PARSE_H_INCLUDED__ - -#include -#include"parse_fta.h" -#include"analyze_fta.h" - -/* Interface to FTA Parser */ -void PartnParser_setfileinput(FILE *f); -void PartnParser_setstringinput(char *s); - -class partn_def_t{ -public: - std::string name; - std::string protocol; - std::vector se_list; - std::vector field_list; - - partn_def_t(const char *n, const char *p, se_list_t *sl){ - name=n; - protocol=p; - se_list = sl->se_list; - } - - int verify(table_list *schema, std::string &err_msg); - bool is_compatible(gb_table *gb_tbl); -}; - -class partn_def_list_t{ -public: - std::map partn_map; - - partn_def_list_t(partn_def_t *pd){ - partn_map[pd->name] = pd; - } - partn_def_list_t *append(partn_def_t *pd){ - if(partn_map.count(pd->name)){ - fprintf(stderr,"Warning, duplicate entry named %s in partition definitions, ignored.\n",pd->name.c_str()); - }else{ - partn_map[pd->name] = pd; - } - return this; - } - - partn_def_t *get_partn_def(std::string n){ - if(partn_map.count(n)) - return partn_map[n]; - return NULL; - } - - int verify(table_list *schema, std::string &err_msg){ - int retval=0; - std::map::iterator mspi; - for(mspi=partn_map.begin(); mspi!=partn_map.end();++mspi){ - if((*mspi).second->verify(schema, err_msg)) - retval=1; - } - return retval; - } - - -}; - -#endif +/* ------------------------------------------------ +Copyright 2014 AT&T Intellectual Property + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ------------------------------------------- */ +#ifndef _PARTN_PARSE_H_INCLUDED__ +#define _PARTN_PARSE_H_INCLUDED__ + +#include +#include"parse_fta.h" +#include"analyze_fta.h" + +/* Interface to FTA Parser */ +void PartnParser_setfileinput(FILE *f); +void PartnParser_setstringinput(char *s); + +class partn_def_t{ +public: + std::string name; + std::string protocol; + std::vector se_list; + std::vector field_list; + + partn_def_t(const char *n, const char *p, se_list_t *sl){ + name=n; + protocol=p; + se_list = sl->se_list; + } + + int verify(table_list *schema, std::string &err_msg); + bool is_compatible(gb_table *gb_tbl); +}; + +class partn_def_list_t{ +public: + std::map partn_map; + + partn_def_list_t(partn_def_t *pd){ + partn_map[pd->name] = pd; + } + partn_def_list_t *append(partn_def_t *pd){ + if(partn_map.count(pd->name)){ + fprintf(stderr,"Warning, duplicate entry named %s in partition definitions, ignored.\n",pd->name.c_str()); + }else{ + partn_map[pd->name] = pd; + } + return this; + } + + partn_def_t *get_partn_def(std::string n){ + if(partn_map.count(n)) + return partn_map[n]; + return NULL; + } + + int verify(table_list *schema, std::string &err_msg){ + int retval=0; + std::map::iterator mspi; + for(mspi=partn_map.begin(); mspi!=partn_map.end();++mspi){ + if((*mspi).second->verify(schema, err_msg)) + retval=1; + } + return retval; + } + + +}; + +#endif