mirror of
https://github.com/rdkit/rdkit.git
synced 2026-06-03 21:44:30 +08:00
initial import
This commit is contained in:
15
Code/Catalogs/Catalog.cpp
Executable file
15
Code/Catalogs/Catalog.cpp
Executable file
@@ -0,0 +1,15 @@
|
||||
// $Id: Catalog.cpp 4942 2006-02-17 01:19:53Z glandrum $
|
||||
//
|
||||
// Copyright (C) 2003-2006 Rational Discovery LLC
|
||||
//
|
||||
// @@ All Rights Reserved @@
|
||||
//
|
||||
//
|
||||
|
||||
#include "Catalog.h"
|
||||
|
||||
namespace RDCatalog {
|
||||
|
||||
|
||||
}
|
||||
|
||||
469
Code/Catalogs/Catalog.h
Executable file
469
Code/Catalogs/Catalog.h
Executable file
@@ -0,0 +1,469 @@
|
||||
//
|
||||
// Copyright (C) 2003-2006 Rational Discovery LLC
|
||||
//
|
||||
// @@ All Rights Reserved @@
|
||||
//
|
||||
|
||||
#ifndef __RD_CATALOG_H__
|
||||
#define __RD_CATALOG_H__
|
||||
|
||||
// Boost graph stuff
|
||||
#include <boost/graph/graph_traits.hpp>
|
||||
#include <boost/graph/adjacency_list.hpp>
|
||||
#include <boost/property_map.hpp>
|
||||
|
||||
// for some typedefs
|
||||
#include <RDGeneral/types.h>
|
||||
#include <RDGeneral/StreamOps.h>
|
||||
|
||||
namespace RDCatalog {
|
||||
const int versionMajor=1;
|
||||
const int versionMinor=0;
|
||||
const int versionPatch=0;
|
||||
const int endianId=0xDEADBEEF;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//! abstract base class for a catalog object
|
||||
template <class entryType, class paramType>
|
||||
class Catalog {
|
||||
public:
|
||||
//------------------------------------
|
||||
Catalog() : d_fpLength(0), dp_cParams(0) {};
|
||||
|
||||
//------------------------------------
|
||||
virtual ~Catalog(){
|
||||
if (dp_cParams) {
|
||||
delete dp_cParams;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------
|
||||
//! return a serialized form of the Catalog as an std::string
|
||||
virtual std::string Serialize() const = 0;
|
||||
|
||||
//------------------------------------
|
||||
//! adds an entry to the catalog
|
||||
/*!
|
||||
|
||||
\param entry the entry to be added
|
||||
\param updateFPLength (optional) if this is true, our internal
|
||||
fingerprint length will also be updated.
|
||||
|
||||
*/
|
||||
virtual unsigned int addEntry(entryType *entry, bool updateFPLength = true) = 0;
|
||||
|
||||
//------------------------------------
|
||||
//! returns a particular entry in the Catalog
|
||||
virtual const entryType* getEntryWithIdx(unsigned int idx) const = 0;
|
||||
|
||||
//------------------------------------
|
||||
//! returns the number of entries
|
||||
virtual unsigned int getNumEntries() const = 0;
|
||||
|
||||
//------------------------------------
|
||||
//! returns the length of our fingerprint
|
||||
unsigned int getFPLength() const {return d_fpLength;}
|
||||
|
||||
//------------------------------------
|
||||
//! sets our fingerprint length
|
||||
void setFPLength(unsigned int val) {d_fpLength = val;}
|
||||
|
||||
//------------------------------------
|
||||
//! sets our parameters by copying the \c params argument
|
||||
void setCatalogParams(paramType *params) {
|
||||
PRECONDITION(params,"bad parameter object");
|
||||
//if we already have a paramter object throw an exception
|
||||
PRECONDITION(!dp_cParams,"A parameter object already exists on the catalog" );
|
||||
/*
|
||||
if (dp_cParams) {
|
||||
// we already have parameter object on the catalog
|
||||
// can't overwrite it
|
||||
PRECONDITION(0, "A parameter object already exist on the catalog");
|
||||
}*/
|
||||
dp_cParams = new paramType(*params);
|
||||
}
|
||||
|
||||
//------------------------------------
|
||||
//! returns a pointer to our parameters
|
||||
const paramType *getCatalogParams() const { return dp_cParams;}
|
||||
|
||||
protected:
|
||||
// this is the ID that will be assigned to the next entry
|
||||
// added to the catalog - need not be same as the number of entries
|
||||
// in the catalog and does not correspond with the
|
||||
// id of the entry in the catalog.
|
||||
// this is more along the lines of bitId
|
||||
unsigned int d_fpLength; //!< the length of our fingerprint
|
||||
paramType *dp_cParams; //!< our params object
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//! A Catalog with a hierarchical structure
|
||||
/*!
|
||||
|
||||
The entries of a HierarchCatalog are arranged in a directed graph
|
||||
|
||||
<b>The difference between <i>Indices</i> and <i>Bit Ids</i></b>
|
||||
|
||||
A HierarchCatalog may contain more entries than the user is actually
|
||||
interested in. For example a HierarchCatalog constructed to contain
|
||||
orders 5 through 8 may well contain information about orders 1-5,
|
||||
in order to facilitate some search optimizations.
|
||||
|
||||
- <i>Bit Ids</i> refer to the "interesting" bits.
|
||||
So, in the above example, Bit Id \c 0 will be the first entry
|
||||
with order 5.
|
||||
- <i>Indices</i> refer to the underlying structure of the catalog.
|
||||
So, in the above example, the entry with index \c 0 will be
|
||||
the first entry with order 1.
|
||||
|
||||
*/
|
||||
template <class entryType, class paramType, class orderType>
|
||||
class HierarchCatalog : public Catalog <entryType, paramType> {
|
||||
// the entries in the catalog can be traversed using the edges
|
||||
// in a desired order
|
||||
public:
|
||||
//! used by the BGL to set up the node properties in our graph
|
||||
struct vertex_entry_t {
|
||||
enum { num=1003 };
|
||||
typedef boost::vertex_property_tag kind;
|
||||
};
|
||||
typedef boost::property<vertex_entry_t, entryType *> EntryProperty;
|
||||
|
||||
//! the type of the graph itself:
|
||||
typedef boost::adjacency_list<boost::vecS,
|
||||
boost::vecS, // FIX: should be using setS for edges so that parallel edges are never added (page 225 BGL book)
|
||||
// but that seems result in compile errors
|
||||
boost::bidirectionalS,
|
||||
EntryProperty> CatalogGraph;
|
||||
|
||||
typedef boost::graph_traits<CatalogGraph> CAT_GRAPH_TRAITS;
|
||||
typedef typename CAT_GRAPH_TRAITS::vertex_iterator VER_ITER;
|
||||
typedef std::pair<VER_ITER, VER_ITER> ENT_ITER_PAIR;
|
||||
typedef typename CAT_GRAPH_TRAITS::adjacency_iterator DOWN_ENT_ITER;
|
||||
typedef std::pair<DOWN_ENT_ITER, DOWN_ENT_ITER> DOWN_ENT_ITER_PAIR;
|
||||
|
||||
//------------------------------------
|
||||
HierarchCatalog<entryType, paramType, orderType>() {};
|
||||
|
||||
//------------------------------------
|
||||
//! Construct by making a copy of the input \c params object
|
||||
HierarchCatalog<entryType, paramType, orderType>(paramType *params) : Catalog<entryType,paramType>() {
|
||||
this->setCatalogParams(params);
|
||||
}
|
||||
|
||||
//------------------------------------
|
||||
//! Construct from a \c pickle (a serialized form of the HierarchCatalog)
|
||||
HierarchCatalog<entryType, paramType, orderType>(const std::string &pickle) {
|
||||
this->initFromString(pickle);
|
||||
}
|
||||
|
||||
//------------------------------------
|
||||
~HierarchCatalog() {
|
||||
destroy();
|
||||
}
|
||||
|
||||
//------------------------------------
|
||||
//! serializes this object to a stream
|
||||
void toStream(std::ostream &ss) const {
|
||||
// the i/o header:
|
||||
RDKit::streamWrite(ss,endianId);
|
||||
RDKit::streamWrite(ss,versionMajor);
|
||||
RDKit::streamWrite(ss,versionMinor);
|
||||
RDKit::streamWrite(ss,versionPatch);
|
||||
|
||||
// information about the catalog itself:
|
||||
int tmpUInt;
|
||||
tmpUInt = this->getFPLength();
|
||||
RDKit::streamWrite(ss,tmpUInt);
|
||||
tmpUInt = this->getNumEntries();
|
||||
RDKit::streamWrite(ss,tmpUInt);
|
||||
|
||||
//std::cout << ">>>>-------------------------------" << std::endl;
|
||||
//std::cout << "\tlength: " << getFPLength() << " " << getNumEntries() << std::endl;
|
||||
|
||||
// add the params object:
|
||||
this->getCatalogParams()->toStream(ss);
|
||||
//std::cout << "\tparams: " << getCatalogParams()->getLowerFragLength();
|
||||
//std::cout << " " << getCatalogParams()->getUpperFragLength();
|
||||
//std::cout << " " << getCatalogParams()->getNumFuncGroups();
|
||||
//std::cout << std::endl;
|
||||
|
||||
// write the entries in order:
|
||||
for(unsigned int i=0;i<getNumEntries();i++){
|
||||
this->getEntryWithIdx(i)->toStream(ss);
|
||||
}
|
||||
|
||||
// finally the adjacency list:
|
||||
for(unsigned int i=0;i<getNumEntries();i++){
|
||||
RDKit::INT_VECT children=this->getDownEntryList(i);
|
||||
tmpUInt = children.size();
|
||||
RDKit::streamWrite(ss,tmpUInt);
|
||||
for(RDKit::INT_VECT::const_iterator ivci=children.begin();
|
||||
ivci!=children.end();
|
||||
ivci++){
|
||||
RDKit::streamWrite(ss,*ivci);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------
|
||||
//! serializes this object and returns the resulting \c pickle
|
||||
std::string Serialize() const {
|
||||
std::stringstream ss(std::ios_base::binary|std::ios_base::out|std::ios_base::in);
|
||||
this->toStream(ss);
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
//------------------------------------
|
||||
//! fills the contents of this object from a stream containing a \c pickle
|
||||
void initFromStream(std::istream &ss) {
|
||||
int tmpInt;
|
||||
// FIX: at the moment we ignore the header info:
|
||||
RDKit::streamRead(ss,tmpInt);
|
||||
RDKit::streamRead(ss,tmpInt);
|
||||
RDKit::streamRead(ss,tmpInt);
|
||||
RDKit::streamRead(ss,tmpInt);
|
||||
|
||||
unsigned int tmpUInt;
|
||||
RDKit::streamRead(ss,tmpUInt);// fp length
|
||||
this->setFPLength(tmpUInt);
|
||||
|
||||
unsigned int numEntries;
|
||||
RDKit::streamRead(ss,numEntries);
|
||||
//std::cout << "<<<-------------------------------" << std::endl;
|
||||
//std::cout << "\tlength: " << getFPLength() << " " << numEntries << std::endl;
|
||||
|
||||
|
||||
// grab the params:
|
||||
paramType *params = new paramType();
|
||||
params->initFromStream(ss);
|
||||
this->setCatalogParams(params);
|
||||
|
||||
//std::cout << "\tparams: " << getCatalogParams()->getLowerFragLength();
|
||||
//std::cout << " " << getCatalogParams()->getUpperFragLength();
|
||||
//std::cout << " " << getCatalogParams()->getNumFuncGroups();
|
||||
//std::cout << std::endl;
|
||||
|
||||
// now all of the entries:
|
||||
for(unsigned int i=0;i<numEntries;i++){
|
||||
entryType *entry = new entryType();
|
||||
entry->initFromStream(ss);
|
||||
this->addEntry(entry,false);
|
||||
}
|
||||
|
||||
// and, finally, the adjacency list:
|
||||
for(unsigned int i=0;i<numEntries;i++){
|
||||
unsigned int nNeighbors;
|
||||
RDKit::streamRead(ss,nNeighbors);
|
||||
for(unsigned int j=0;j<nNeighbors;j++){
|
||||
RDKit::streamRead(ss,tmpInt);
|
||||
this->addEdge(i,tmpInt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------
|
||||
unsigned int getNumEntries() const {
|
||||
return boost::num_vertices(d_graph);
|
||||
}
|
||||
|
||||
//------------------------------------
|
||||
//! fills the contents of this object from a string containing a \c pickle
|
||||
void initFromString(const std::string &text){
|
||||
std::stringstream ss(std::ios_base::binary|std::ios_base::out|std::ios_base::in);
|
||||
// initialize the stream:
|
||||
ss.write(text.c_str(),text.length());
|
||||
// now start reading out values:
|
||||
this->initFromStream(ss);
|
||||
}
|
||||
|
||||
//------------------------------------
|
||||
//! add a new entry to the catalog
|
||||
/*!
|
||||
|
||||
\param entry the entry to be added
|
||||
\param updateFPLength (optional) if this is true, our internal
|
||||
fingerprint length will also be updated.
|
||||
|
||||
*/
|
||||
unsigned int addEntry(entryType *entry, bool updateFPLength = true){
|
||||
PRECONDITION(entry,"bad arguments");
|
||||
if (updateFPLength) {
|
||||
unsigned int fpl = this->getFPLength();
|
||||
entry->setBitId(fpl);
|
||||
fpl++;
|
||||
this->setFPLength(fpl);
|
||||
}
|
||||
unsigned int eid = boost::add_vertex(EntryProperty(entry), d_graph);
|
||||
orderType etype = entry->getOrder();
|
||||
// REVIEW: this initialization is not required: the STL map, in
|
||||
// theory, will create a new object when operator[] is called
|
||||
// for a new item
|
||||
if (d_orderMap.find(etype) == d_orderMap.end()) {
|
||||
RDKit::INT_VECT nets;
|
||||
d_orderMap[etype] = nets;
|
||||
}
|
||||
d_orderMap[etype].push_back(eid);
|
||||
return eid;
|
||||
}
|
||||
|
||||
//------------------------------------
|
||||
//! adds an edge between two entries in the catalog
|
||||
/*!
|
||||
Since we are using a bidirectional graph - the order in
|
||||
which the ids are supplied here makes a difference
|
||||
|
||||
\param id1 index of the edge's beginning
|
||||
\param id2 index of the edge's end
|
||||
|
||||
*/
|
||||
void addEdge(unsigned int id1, unsigned int id2) {
|
||||
unsigned int nents = getNumEntries();
|
||||
RANGE_CHECK(0, id1, nents-1);
|
||||
RANGE_CHECK(0, id2, nents-1);
|
||||
// FIX: if we boost::setS for the edgeList BGL will
|
||||
// do the checking for duplicity (parallel edges)
|
||||
// But for reasons unknown setS results in compile
|
||||
// errors while using adjacent_vertices.
|
||||
typename CAT_GRAPH_TRAITS::edge_descriptor edge;
|
||||
bool found;
|
||||
boost::tie(edge,found) = boost::edge(boost::vertex(id1,d_graph),
|
||||
boost::vertex(id2,d_graph),
|
||||
d_graph);
|
||||
if (!found) {
|
||||
boost::add_edge(id1, id2, d_graph);
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------
|
||||
//! returns a pointer to our entry with a particular index
|
||||
const entryType *getEntryWithIdx(unsigned int idx) const {
|
||||
RANGE_CHECK(0,idx,getNumEntries()-1);
|
||||
int vd = boost::vertex(idx, d_graph);
|
||||
typename boost::property_map < CatalogGraph, vertex_entry_t>::const_type
|
||||
pMap = boost::get(vertex_entry_t(), d_graph);
|
||||
return pMap[vd];
|
||||
}
|
||||
|
||||
//------------------------------------
|
||||
//! returns a pointer to our entry with a particular bit ID
|
||||
const entryType *getEntryWithBitId(unsigned int idx) const {
|
||||
RANGE_CHECK(0,idx,this->getFPLength()-1);
|
||||
typename boost::property_map < CatalogGraph, vertex_entry_t>::const_type
|
||||
pMap = boost::get(vertex_entry_t(), d_graph);
|
||||
const entryType *res=NULL;
|
||||
for(unsigned int i=idx;i<this->getNumEntries();i++){
|
||||
const entryType *e=pMap[i];
|
||||
if(e->getBitId()==idx){
|
||||
res=e;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//------------------------------------
|
||||
//! returns the index of the entry with a particular bit ID
|
||||
int getIdOfEntryWithBitId(unsigned int idx) const {
|
||||
RANGE_CHECK(0,idx,this->getFPLength()-1);
|
||||
typename boost::property_map < CatalogGraph, vertex_entry_t>::const_type
|
||||
pMap = boost::get(vertex_entry_t(), d_graph);
|
||||
int res=-1;
|
||||
for(unsigned int i=idx;i<this->getNumEntries();i++){
|
||||
const entryType *e=pMap[i];
|
||||
if(e->getBitId()==idx){
|
||||
res=i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//------------------------------------
|
||||
//! returns a list of the indices of entries below the one passed in
|
||||
RDKit::INT_VECT getDownEntryList(unsigned int idx) const {
|
||||
RDKit::INT_VECT res;
|
||||
DOWN_ENT_ITER nbrIdx, endIdx;
|
||||
boost::tie(nbrIdx, endIdx) = boost::adjacent_vertices(idx, d_graph);
|
||||
while (nbrIdx != endIdx) {
|
||||
res.push_back(*nbrIdx);
|
||||
nbrIdx++;
|
||||
}
|
||||
//std::cout << res.size() << "\n";
|
||||
return res;
|
||||
}
|
||||
|
||||
//------------------------------------
|
||||
//! returns a list of the indices that have a particular order
|
||||
const RDKit::INT_VECT &getEntriesOfOrder(orderType ord) {
|
||||
return d_orderMap[ord];
|
||||
}
|
||||
|
||||
//------------------------------------
|
||||
//! returns a list of the indices that have a particular order
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
const RDKit::INT_VECT &getEntriesOfOrder(orderType ord) const {
|
||||
typename std::map<orderType, RDKit::INT_VECT>::const_iterator elem;
|
||||
elem = d_orderMap.find(ord);
|
||||
CHECK_INVARIANT(elem!=d_orderMap.end()," catalog does not contain any entries of the order specified");
|
||||
return elem->second;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
// graphs that store the entries in the catalog in a hierachical manner
|
||||
CatalogGraph d_graph;
|
||||
// a map that maps the order type of entries in the catalog to
|
||||
// a vector of vertex indices in the graphs above
|
||||
// e.g. for a catalog with molecular fragments, the order of a fragment can
|
||||
// simply be the number of bond in it. The list this oder maps to is all the
|
||||
// vertex ids of these fragment in the catalog that have this many bonds in them
|
||||
std::map<orderType, RDKit::INT_VECT> d_orderMap;
|
||||
|
||||
//------------------------------------
|
||||
//! clear any memory that we've used
|
||||
void destroy() {
|
||||
ENT_ITER_PAIR entItP = boost::vertices(d_graph);
|
||||
typename boost::property_map < CatalogGraph, vertex_entry_t>::type
|
||||
pMap = boost::get(vertex_entry_t(), d_graph);
|
||||
while (entItP.first != entItP.second) {
|
||||
delete pMap[*(entItP.first++)];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//! a linear Catalog (analogous to an std::vector)
|
||||
/*!
|
||||
Here there is no particular hierarchy, simply a
|
||||
collection of entries.
|
||||
*/
|
||||
template <class entryType, class orderType>
|
||||
class LinearCatalog : public Catalog <entryType, orderType> {
|
||||
// here there is no particular hierarchy of entries
|
||||
// we simply model it as a vector of entries
|
||||
// FIX: for retrieval purposes a better model map be std::map
|
||||
|
||||
public:
|
||||
std::string Serialize();
|
||||
|
||||
unsigned int addEntry(entryType *entry, bool updateFPLength = true);
|
||||
|
||||
const entryType *getEntryWithIdx(unsigned int idx) const;
|
||||
|
||||
private:
|
||||
std::vector<entryType*> d_vector;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
13
Code/Catalogs/CatalogEntry.cpp
Executable file
13
Code/Catalogs/CatalogEntry.cpp
Executable file
@@ -0,0 +1,13 @@
|
||||
// $Id: CatalogEntry.cpp 4942 2006-02-17 01:19:53Z glandrum $
|
||||
//
|
||||
// Copyright (C) 2004-2006 Rational Discovery LLC
|
||||
//
|
||||
// @@ All Rights Reserved @@
|
||||
//
|
||||
|
||||
#include "CatalogEntry.h"
|
||||
|
||||
namespace RDCatalog {
|
||||
CatalogEntry::~CatalogEntry() {}
|
||||
|
||||
}
|
||||
45
Code/Catalogs/CatalogEntry.h
Executable file
45
Code/Catalogs/CatalogEntry.h
Executable file
@@ -0,0 +1,45 @@
|
||||
//
|
||||
// Copyright (C) 2003-2006 Rational Discovery LLC
|
||||
//
|
||||
// @@ All Rights Reserved @@
|
||||
//
|
||||
#ifndef __RD_CATALOGENTRY_H__
|
||||
#define __RD_CATALOGENTRY_H__
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
namespace RDCatalog {
|
||||
|
||||
//! Abstract base class to be used to represent an entry in a Catalog
|
||||
class CatalogEntry {
|
||||
public:
|
||||
virtual ~CatalogEntry() = 0;
|
||||
|
||||
//! sets our bit Id
|
||||
void setBitId(int bid) {d_bitId = bid;};
|
||||
|
||||
//! returns our bit Id
|
||||
int getBitId() const {return d_bitId;};
|
||||
|
||||
//! returns a text description of this entry
|
||||
virtual std::string getDescription() const = 0;
|
||||
|
||||
//! serializes (pickles) to a stream
|
||||
virtual void toStream(std::ostream &ss) const = 0;
|
||||
//! returns a string with a serialized (pickled) representation
|
||||
virtual std::string Serialize() const = 0;
|
||||
//! initializes from a stream pickle
|
||||
virtual void initFromStream(std::istream &ss) = 0;
|
||||
//! initializes from a string pickle
|
||||
virtual void initFromString(const std::string &text) = 0;
|
||||
|
||||
|
||||
|
||||
private:
|
||||
int d_bitId; //!< our bit Id. This needs to be signed so that we can mark uninitialized entries.
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
12
Code/Catalogs/CatalogParams.cpp
Executable file
12
Code/Catalogs/CatalogParams.cpp
Executable file
@@ -0,0 +1,12 @@
|
||||
// $Id: CatalogParams.cpp 4942 2006-02-17 01:19:53Z glandrum $
|
||||
//
|
||||
// Copyright (C) 2003-2006 Rational Discovery LLC
|
||||
//
|
||||
// @@ All Rights Reserved @@
|
||||
//
|
||||
|
||||
#include "CatalogParams.h"
|
||||
|
||||
namespace RDCatalog {
|
||||
CatalogParams::~CatalogParams() {};
|
||||
}
|
||||
37
Code/Catalogs/CatalogParams.h
Executable file
37
Code/Catalogs/CatalogParams.h
Executable file
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// Copyright (C) 2003-2006 Rational Discovery LLC
|
||||
//
|
||||
// @@ All Rights Reserved @@
|
||||
//
|
||||
#ifndef __RD_CATALOGPARAMS_H__
|
||||
#define __RD_CATALOGPARAMS_H__
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace RDCatalog {
|
||||
//! abstract base class for the container used to create a catalog
|
||||
class CatalogParams {
|
||||
public:
|
||||
virtual ~CatalogParams() = 0;
|
||||
|
||||
//! returns our type string
|
||||
std::string getTypeStr() const { return d_typeStr; };
|
||||
|
||||
//! sets our type string
|
||||
void setTypeStr(const std::string &typeStr) { d_typeStr=typeStr; };
|
||||
|
||||
//! serializes (pickles) to a stream
|
||||
virtual void toStream(std::ostream &) const = 0;
|
||||
//! returns a string with a serialized (pickled) representation
|
||||
virtual std::string Serialize() const = 0;
|
||||
//! initializes from a stream pickle
|
||||
virtual void initFromStream(std::istream &ss) = 0;
|
||||
//! initializes from a string pickle
|
||||
virtual void initFromString(const std::string &text) = 0;
|
||||
|
||||
protected:
|
||||
std::string d_typeStr; //!< our type string
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
117
Code/Catalogs/Catalogs.dsp
Executable file
117
Code/Catalogs/Catalogs.dsp
Executable file
@@ -0,0 +1,117 @@
|
||||
# Microsoft Developer Studio Project File - Name="Catalogs" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
CFG=Catalogs - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "Catalogs.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "Catalogs.mak" CFG="Catalogs - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "Catalogs - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "Catalogs - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "Catalogs - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Catalogs___Win32_Release"
|
||||
# PROP BASE Intermediate_Dir "Catalogs___Win32_Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Catalogs___Win32_Release"
|
||||
# PROP Intermediate_Dir "Catalogs___Win32_Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "." /I "$(RDBASE)/code" /I "$(RDBASE)/code/graphmol" /I "$(RDBASE)/External/$(BOOSTBASE)" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ELSEIF "$(CFG)" == "Catalogs - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Catalogs___Win32_Debug0"
|
||||
# PROP BASE Intermediate_Dir "Catalogs___Win32_Debug0"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Catalogs___Win32_Debug0"
|
||||
# PROP Intermediate_Dir "Catalogs___Win32_Debug0"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "." /I "$(RDBASE)/code" /I "$(RDBASE)/code/graphmol" /I "$(RDBASE)/External/$(BOOSTBASE)" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FD /GZ /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "Catalogs - Win32 Release"
|
||||
# Name "Catalogs - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Catalog.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\CatalogEntry.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\CatalogParams.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Catalog.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\CatalogEntry.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\CatalogParams.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
204
Code/Catalogs/Catalogs.vcproj
Executable file
204
Code/Catalogs/Catalogs.vcproj
Executable file
@@ -0,0 +1,204 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="libCatalogs"
|
||||
SccProjectName=""
|
||||
SccLocalPath="">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\Catalogs___Win32_Release"
|
||||
IntermediateDirectory=".\Catalogs___Win32_Release"
|
||||
ConfigurationType="4"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories=".,$(RDBASE)/code,$(RDBASE)/External/boost/include/$(BOOSTBASE)"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="TRUE"
|
||||
RuntimeTypeInfo="TRUE"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile=".\Catalogs___Win32_Release/Catalogs.pch"
|
||||
AssemblerListingLocation=".\Catalogs___Win32_Release/"
|
||||
ObjectFile=".\Catalogs___Win32_Release/"
|
||||
ProgramDataBaseFileName=".\Catalogs___Win32_Release/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile=".\Catalogs___Win32_Release\Catalogs.lib"
|
||||
SuppressStartupBanner="TRUE"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1033"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\Catalogs___Win32_Debug0"
|
||||
IntermediateDirectory=".\Catalogs___Win32_Debug0"
|
||||
ConfigurationType="4"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".,$(RDBASE)/code,$(RDBASE)/External/boost/include/$(BOOSTBASE)"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
RuntimeTypeInfo="TRUE"
|
||||
PrecompiledHeaderFile=".\Catalogs___Win32_Debug0/Catalogs.pch"
|
||||
AssemblerListingLocation=".\Catalogs___Win32_Debug0/"
|
||||
ObjectFile=".\Catalogs___Win32_Debug0/"
|
||||
ProgramDataBaseFileName=".\Catalogs___Win32_Debug0/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile=".\Catalogs___Win32_Debug0\Catalogs.lib"
|
||||
SuppressStartupBanner="TRUE"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1033"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
|
||||
<File
|
||||
RelativePath="Catalog.cpp">
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="CatalogEntry.cpp">
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="CatalogParams.cpp">
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl">
|
||||
<File
|
||||
RelativePath="Catalog.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="CatalogEntry.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="CatalogParams.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath=".\VTune\Catalogs.vpj">
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
14
Code/Catalogs/Makefile
Executable file
14
Code/Catalogs/Makefile
Executable file
@@ -0,0 +1,14 @@
|
||||
include $(RDBASE)/Code/rdvars.make
|
||||
include $(RDBASE)/Code/rdrules.make
|
||||
CXXFLAGS=$(BASECXXFLAGS) $(VFLIBINC)
|
||||
|
||||
SOURCES=Catalog.cpp CatalogParams.cpp CatalogEntry.cpp
|
||||
LIB=$(RDCATALOGLIB)
|
||||
|
||||
$(LIB): $(OBJS)
|
||||
ar -rv $@ $?
|
||||
clean:
|
||||
rm -f $(OBJS) $(LIB) $(DEPENDS)
|
||||
|
||||
include $(DEPENDS)
|
||||
|
||||
Reference in New Issue
Block a user