#ifndef _PROFILE_H_ #define _PROFILE_H_ #include #include #include #include #include #include #include #include typedef long long tIid; // type for item ids typedef std::map::value_type tIidSValue; typedef std::map::value_type tIIValue; typedef std::map::value_type tIidSValue; typedef std::map::value_type tIidIValue; typedef std::string File; typedef std::string Relation; typedef int Field; enum ResultType {DERIV, MRS}; namespace delphin { class Profile { public: Profile(const std::string &pn); ~Profile(); std::string getItem(tIid); //i-input std::string getInput(tIid); //p-input int getLength(tIid); //i-length int getPreference(tIid); //append=true: add a preference, append=false: reset the preference void setPreference(tIid &, int &, bool append=false); bool isGold(tIid,int); int numGold(tIid); int getReadings(tIid); void getItemIDs(std::set *itemset); //get next result std::pair,std::string> getResult(ResultType t=DERIV); //get result b for item a std::string getResult(tIid &a, int &b, ResultType t=DERIV); std::string &getPath(); bool isVirtual(); //exact match within top n void scoreProfile(const std::string &scorefile, bool all=false, int n=1); private: std::string pname; //profile path bool virtualprofile; //vectors rather than singletons for virtual profiles //single profiles have vector length 1 std::vector profiles; std::vector *> items; std::vector *> inputs; std::vector *> lengths; std::vector > *> preferences; std::vector > *> relations; std::vector *> readings; std::map itemToProfile; //keep track of which profile result file we are reading boost::iostreams::filtering_stream resultfilter; std::ifstream resultfile; int resultprofilecount; //for opening possibly zipped files bool openf(boost::iostreams::filtering_stream &, std::ifstream &, const std::string &); std::string getField(std::string, int); }; } //namespace #endif