1 2 /* Web Polygraph http://www.web-polygraph.org/ 3 * Copyright 2003-2011 The Measurement Factory 4 * Licensed under the Apache License, Version 2.0 */ 5 6 #ifndef POLYGRAPH__CSM_CONTENTDBASE_H 7 #define POLYGRAPH__CSM_CONTENTDBASE_H 8 9 #include "xstd/String.h" 10 #include "xstd/Array.h" 11 #include "base/ObjId.h" 12 13 class OBStream; 14 class IBStream; 15 class WrBuf; 16 class InjectIter; 17 class EmbedContMdl; 18 class CdbEntry; 19 class CdbEntryPrnOpt; 20 21 // contains compiled information about content of Web objects 22 // can be used to simulate realistic content 23 24 class ContentDbase { 25 public: 26 static CdbEntry *CreateEntry(int type); 27 28 public: 29 ContentDbase(); 30 ~ContentDbase(); 31 name()32 const String &name() const { return theName; } 33 int count() const; // number of entries 34 bool hasLinkOrPage() const; // at least one cdbeLink or cdbePage entry 35 double entrySizeMean() const; // mean entry size entry(int pos)36 const CdbEntry *entry(int pos) const { return theEntries[pos]; } 37 38 void add(CdbEntry *e); 39 40 void load(IBStream &is); 41 void store(OBStream &os) const; 42 43 ostream &print(ostream &os) const; 44 45 protected: 46 Array<CdbEntry*> theEntries; 47 48 mutable String theName; // copied from the last BStream 49 }; 50 51 52 #endif 53