// Copyright (C) 1999 Jean-Marc Valin #include "CodebookMap.h" using namespace std; namespace FD { DECLARE_TYPE(CodebookMap) //@implements CMap CodebookMap::CodebookMap(const RCPtr &_mapIn, const vector dataIn, const vector dataOut, int length) : mapIn(_mapIn) , mapOut(_mapIn->nbClasses(),Vector (length,0)) { //for (int i=0;i<_mapIn.nbClasses();i++) // mapOut[i].resize(length); int mapSize = mapIn->nbClasses(); vector counts(mapSize,0); for (int i=0;igetClassID(dataIn[i]); for (int j=0;jgetClassID(dataIn[i]); for (int j=0;j" << endl; out << "" << endl; out << ">\n"; } void CodebookMap::readFrom (istream &in) { string tag; while (1) { char ch; in >> ch; if (ch == '>') break; else if (ch != '<') throw new ParsingException ("CodebookMap::readFrom : Parse error: '<' expected"); in >> tag; if (tag == "mapIn") { in >> mapIn; } else if (tag == "mapOut") { in >> mapOut; } else throw new ParsingException ("CodebookMap::readFrom : unknown argument: " + tag); if (!in) throw new ParsingException ("CodebookMap::readFrom : Parse error trying to build " + tag); in >> tag; if (tag != ">") throw new ParsingException ("CodebookMap::readFrom : Parse error: '>' expected "); } } istream &operator >> (istream &in, CodebookMap &net) { if (!isValidType(in, "CodebookMap")) return in; net.readFrom(in); return in; } }//namespace FD