10 #ifndef RD_MULTIFPBREADER_H_APR2016 11 #define RD_MULTIFPBREADER_H_APR2016 23 #include <boost/tuple/tuple.hpp> 24 #include <boost/foreach.hpp> 55 typedef boost::tuple<double, unsigned int, unsigned int>
ResultTuple;
57 : df_init(false), df_initOnSearch(false), df_takeOwnership(false){};
66 df_initOnSearch(initOnSearch),
67 df_takeOwnership(false){};
75 MultiFPBReader(std::vector<FPBReader *> &readers,
bool takeOwnership =
false,
76 bool initOnSearch =
false);
80 if (df_takeOwnership) {
81 BOOST_FOREACH (
FPBReader *rdr, d_readers) {
delete rdr; };
95 unsigned int length()
const {
return d_readers.size(); };
98 unsigned int nBits()
const;
122 d_readers.push_back(rdr);
123 if (df_init) rdr->
init();
124 return d_readers.size();
140 double threshold = 0.7,
141 int numThreads = 1)
const;
144 boost::shared_array<boost::uint8_t> bv,
double threshold = 0.7,
145 int numThreads = 1)
const {
150 double threshold = 0.7,
151 int numThreads = 1)
const;
168 double ca,
double cb,
169 double threshold = 0.7,
170 int numThreads = 1)
const;
173 boost::shared_array<boost::uint8_t> bv,
double ca,
double cb,
174 double threshold = 0.7,
int numThreads = 1)
const {
179 double ca,
double cb,
180 double threshold = 0.7,
181 int numThreads = 1)
const;
188 const boost::uint8_t *bv,
int numThreads = 1)
const;
191 boost::shared_array<boost::uint8_t> bv,
int numThreads = 1)
const {
199 std::vector<FPBReader *> d_readers;
200 bool df_init, df_initOnSearch, df_takeOwnership;
std::vector< ResultTuple > getTanimotoNeighbors(boost::shared_array< boost::uint8_t > bv, double threshold=0.7, int numThreads=1) const
std::vector< std::pair< unsigned int, unsigned int > > getContainingNeighbors(boost::shared_array< boost::uint8_t > bv, int numThreads=1) const
class for reading and searching FPB files
boost::tuple< double, unsigned int, unsigned int > ResultTuple
void init()
Read the data from the file and initialize internal data structures.
unsigned int nBits() const
std::vector< std::pair< unsigned int, unsigned int > > getContainingNeighbors(const boost::uint8_t *bv, int numThreads=1) const
returns indices of all fingerprints that completely contain this one
std::vector< ResultTuple > getTanimotoNeighbors(const boost::uint8_t *bv, double threshold=0.7, int numThreads=1) const
returns tanimoto neighbors that are within a similarity threshold
FPBReader * getReader(unsigned int which)
returns a particular reader
std::vector< ResultTuple > getTverskyNeighbors(boost::shared_array< boost::uint8_t > bv, double ca, double cb, double threshold=0.7, int numThreads=1) const
class for reading and searching multiple FPB files
void init()
Read the data from the file and initialize internal data structures.
MultiFPBReader(bool initOnSearch)
#define PRECONDITION(expr, mess)
a class for bit vectors that are densely occupied
unsigned int addReader(FPBReader *rdr)
adds a new FPBReader to our list
contains a simple class for reading and searching FPB files
unsigned int length() const
returns the number of readers
std::vector< ResultTuple > getTverskyNeighbors(const boost::uint8_t *bv, double ca, double cb, double threshold=0.7, int numThreads=1) const
returns Tversky neighbors that are within a similarity threshold