Commit ca17fe16 authored by Simon Morlat's avatar Simon Morlat

don't serialize recognizer'ids. There are re-constructed at load time.

parent 43333c36
...@@ -93,11 +93,7 @@ void Recognizer::serialize(BinaryOutputStream& fstr, bool topLevel){ ...@@ -93,11 +93,7 @@ void Recognizer::serialize(BinaryOutputStream& fstr, bool topLevel){
if (topLevel || mName.empty()) { if (topLevel || mName.empty()) {
//write the type //write the type
fstr<<type_byte; fstr<<type_byte;
//write the id followed by name if mId>0 fstr<<mName;
fstr<<mId;
if (mId > 0) {
fstr<<mName;
}
//then invoked derived class serialization //then invoked derived class serialization
_serialize(fstr); _serialize(fstr);
}else{ }else{
...@@ -110,12 +106,10 @@ void Recognizer::serialize(BinaryOutputStream& fstr, bool topLevel){ ...@@ -110,12 +106,10 @@ void Recognizer::serialize(BinaryOutputStream& fstr, bool topLevel){
} }
Recognizer::Recognizer(BinaryGrammarBuilder& istr){ Recognizer::Recognizer(BinaryGrammarBuilder& istr){
//read the id // read the recognizer name:
istr >> mId; string name;
//if the id is > 0, read the recognizer name: istr >> name;
if (mId > 0){ if (!name.empty()) setName(name);
istr >> mName;
}
} }
...@@ -774,7 +768,6 @@ int Grammar::load(const std::string &filename){ ...@@ -774,7 +768,6 @@ int Grammar::load(const std::string &filename){
/*extract the magic string*/ /*extract the magic string*/
string magic; string magic;
ifs>>magic; ifs>>magic;
cout <<magic<<endl;
if (magic != "#!belr"){ if (magic != "#!belr"){
ifs.close(); ifs.close();
BCTBX_SLOGE<<filename<< " is not a belr grammar binary file."; BCTBX_SLOGE<<filename<< " is not a belr grammar binary file.";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment