System documentation of the GNU Image-Finding Tool

CQuery.h
1 /* -*- mode: c++ -*-
2 */
3 /*
4 
5  GIFT, a flexible content based image retrieval system.
6  Copyright (C) 1998, 1999, 2000, 2001, 2002, CUI University of Geneva
7 
8  Copyright (C) 2003, 2004 Bayreuth University
9  2005 Bamberg University
10  This program is free software; you can redistribute it and/or modify
11  it under the terms of the GNU General Public License as published by
12  the Free Software Foundation; either version 2 of the License, or
13  (at your option) any later version.
14 
15  This program is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with this program; if not, write to the Free Software
22  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 
24 */
25 // -*- mode: c++ -*-
26 
27 #include "libMRML/include/CAccessorElement.h"
28 #include "libMRML/include/CXMLElement.h"
50 #ifndef _CQUERY
51 #define _CQUERY
52 #include "libMRML/include/uses-declarations.h"
53 #include <memory>
54 #include <map>
55 #include "libMRML/include/CSelfDestroyPointer.h"
56 #include "libMRML/include/CIDRelevanceLevelPairList.h"
57 #include "libMRML/include/CXMLElement.h"
58 
59 //#include "CWeightingFunctionPointerList.h"
60 //#include "CWeightingFunctionPointerHash.h"
61 
62 #include "libMRML/include/CAlgorithm.h"
63 #include "libMRML/include/CAccessor.h"
64 #include "libMRML/include/CAccessorAdminCollection.h"
65 #include "libMRML/include/CAccessorAdmin.h"
66 #include "libMRML/include/CMagic.h" //public CMagic
67 
68 class CScoreBoard;
69 class CAccessor;
70 
71 
73 class CQuery:public CMagic{
74 
75 protected:
92 
93 
99 
103  class lCChild{
104  public:
108  double mWeight;
109  };
111  typedef list<lCChild> lCChildren;
115 
116 
117 
118 protected:
124  virtual void init()=0;
125 
126 public:
132  CQuery();
138  virtual ~CQuery();
151  CQuery(CAccessorAdminCollection& inAccessorAdminCollection,
152  CAlgorithm& inAlgorithm);
153 
159  void addChild(CQuery* inChild,
160  double inWeight=1);
161 
162 
168  virtual CXMLElement* query(const CXMLElement& inQuery);
169 
176  virtual CIDRelevanceLevelPairList* fastQuery(const CXMLElement& inQuery,
177  int inNumberOfInterestingImages,
178  double inDifferenceToBest)=0;
179 
185  virtual CXMLElement* getRandomImages(int inNumberOfInterestingImages)const;
191  virtual CIDRelevanceLevelPairList* getRandomIDs(int inNumberOfInterestingImages)const;
197  virtual list<TID>* getAllIDs()const;
203  virtual list<CAccessorElement>* getAllAccessorElements()const;
210  virtual bool setAlgorithm(CAlgorithm& inAlgorithm);
217  const CAlgorithm& getAlgorithm()const;
218 
226  virtual void finishInit();
227 
228 }; /* end of class */
229 
230 #endif
231 
double mWeight
the weight
Definition: CQuery.h:108
virtual CIDRelevanceLevelPairList * getRandomIDs(int inNumberOfInterestingImages) const
get some random images (handed through to accessor)
virtual bool setAlgorithm(CAlgorithm &inAlgorithm)
set the Algorithm.
virtual CXMLElement * getRandomImages(int inNumberOfInterestingImages) const
get some random images (handed through to accessor)
Definition: CIDRelevanceLevelPairList.h:52
virtual void finishInit()
it might be necessary to wait until all the children are added before ending the initialisation phase...
This class captures the structure of an XML element.
Definition: CXMLElement.h:51
CAlgorithm * mAlgorithm
the structure containing everything we know about the algorithm used do not destroy this ...
Definition: CQuery.h:98
virtual list< CAccessorElement > * getAllAccessorElements() const
get the IDs of all images (handed through to accessor)
CQuery * mQuery
the child itself
Definition: CQuery.h:106
Definition: CScoreBoard.h:60
CQuery()
default constructor
An algorithm is a CXMLElement which is linked to a CSessionManager together they are able to build CQ...
Definition: CAlgorithm.h:43
The Query manager for Queries on inverted Files.
Definition: CQuery.h:73
void addChild(CQuery *inChild, double inWeight=1)
adding a child to this.
virtual ~CQuery()
destructor
CAccessor * mAccessor
needed to translate URLs to IDs this is a pointer, only because we cannot change references it does n...
Definition: CQuery.h:81
virtual CXMLElement * query(const CXMLElement &inQuery)
do a query
A child of this.
Definition: CQuery.h:103
virtual CIDRelevanceLevelPairList * fastQuery(const CXMLElement &inQuery, int inNumberOfInterestingImages, double inDifferenceToBest)=0
a query which returns ID/RelevanceLevel pairs instead of instead of URL/RelevanceLevel pairs ...
const CAlgorithm & getAlgorithm() const
get the Algorithm.
CAccessorAdmin: The goal of this is to make it possible to have a list containing accessors to all po...
Definition: CAccessorAdmin.h:45
This is in fact a collection of collections.
Definition: CAccessorAdminCollection.h:39
virtual void init()=0
Initializer, used by both construcors.
lCChildren mChildren
The children of this.
Definition: CQuery.h:114
CAccessor - an abstract base class for everything accessing a GIFT database.
Definition: CAccessor.h:55
virtual list< TID > * getAllIDs() const
get the IDs of all images (handed through to accessor)
CAccessorAdminCollection * mAccessorAdminCollection
Where to get CAccessorAdmins from.
Definition: CQuery.h:91
list< lCChild > lCChildren
type for children of this
Definition: CQuery.h:111
CAccessorAdmin * mAccessorAdmin
This is where the the Accessor comes from.
Definition: CQuery.h:86
This is a simple class for debugging.
Definition: CMagic.h:12

Need for discussion? Want to contribute? Contact
help-gift@gnu.org Generated using Doxygen