1 //
2 //  Copyright (C) 2003-2006 Rational Discovery LLC
3 //
4 //  @@ All Rights Reserved @@
5 //  This file is part of the RDKit.
6 //  The contents are covered by the terms of the BSD license
7 //  which is included in the file license.txt, found at the root
8 //  of the RDKit source tree.
9 //
10 #include <RDGeneral/export.h>
11 #ifndef __RD_CATALOGENTRY_H__
12 #define __RD_CATALOGENTRY_H__
13 
14 #include <iostream>
15 #include <string>
16 
17 namespace RDCatalog {
18 
19 //! Abstract base class to be used to represent an entry in a Catalog
20 class RDKIT_CATALOGS_EXPORT CatalogEntry {
21  public:
22   virtual ~CatalogEntry() = 0;
23 
24   //! sets our bit Id
setBitId(int bid)25   void setBitId(int bid) { d_bitId = bid; };
26 
27   //! returns our bit Id
getBitId()28   int getBitId() const { return d_bitId; };
29 
30   //! returns a text description of this entry
31   virtual std::string getDescription() const = 0;
32 
33   //! serializes (pickles) to a stream
34   virtual void toStream(std::ostream &ss) const = 0;
35   //! returns a string with a serialized (pickled) representation
36   virtual std::string Serialize() const = 0;
37   //! initializes from a stream pickle
38   virtual void initFromStream(std::istream &ss) = 0;
39   //! initializes from a string pickle
40   virtual void initFromString(const std::string &text) = 0;
41 
42  private:
43   int d_bitId;  //!< our bit Id. This needs to be signed so that we can mark
44                 // uninitialized entries.
45 };
46 }  // namespace RDCatalog
47 
48 #endif
49