X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fftacmp%2Fparse_schema.cc;h=4d2f38f11ca9b58dba3e01e104b1628e7e909592;hb=f1754ecea2eab7bd0a302042ac82eb11667b166c;hp=a9bc60cf0dbcc9895c25dcdb5f475a1965f88d87;hpb=e981e864b812c938d3df8b555b6bb98bb89273e7;p=com%2Fgs-lite.git diff --git a/src/ftacmp/parse_schema.cc b/src/ftacmp/parse_schema.cc index a9bc60c..4d2f38f 100644 --- a/src/ftacmp/parse_schema.cc +++ b/src/ftacmp/parse_schema.cc @@ -259,11 +259,29 @@ int table_list::get_table_ref(string t){ // and verify that all field unpacking functions // are listed in the schema. int table_list::unroll_tables(string &err){ + int f, tref, p, t, ret=0, retval=0; + // First, verify there are no repeat field names in any // of the tables. + set found_names; + set dup_names; + for(t=0;tget_tbl_name()) != found_names.end()){ + dup_names.insert(tbl_list[t]->get_tbl_name()); + }else{ + found_names.insert(tbl_list[t]->get_tbl_name()); + } + } + if(dup_names.size()>0){ + fprintf(stderr, "Error, the schema has duplicate names:"); + for(auto dit=dup_names.begin();dit!=dup_names.end(); ++dit) + fprintf(stderr, " %s",(*dit).c_str()); + fprintf(stderr, "\n"); + retval = 1; + } - int f, tref, p, t, ret, retval; +// extrack unpack functions for(t=0;tget_schema_type() == UNPACK_FCNS_SCHEMA){ for(f=0;fufcn_list.size();f++){ @@ -282,7 +300,7 @@ int table_list::unroll_tables(string &err){ // every field has an access function if(tbl_list[t]->get_schema_type() == PROTOCOL_SCHEMA){ - retval = tbl_list[t]->verify_access_fcns(err); + ret = tbl_list[t]->verify_access_fcns(err); if(ret) retval = ret; } @@ -405,6 +423,11 @@ int table_list::unroll_tables(string &err){ err.append(").\n"); } } +// and insert schema_ids + set s_schema_ids = tbl_list[root]->get_all_schema_ids(); + for(auto sit=s_schema_ids.begin(); sit!=s_schema_ids.end(); ++sit){ + tbl_list[s]->add_to_all_schema_ids((*sit)); + } // s has one less predecessor. n_pred[s]--; @@ -473,8 +496,11 @@ string table_def::to_string(){ case OPERATOR_VIEW_SCHEMA: retval += "OPERATOR_VIEW "; break; + case WATCHLIST_SCHEMA: + retval += "WATCHLIST "; + break; default: - retval = "ERROR UNKNOWN TABLE TYPE "; + retval = "ERROR UNKNOWN TABLE TYPE ("+std::to_string(schema_type)+")"; break; }