26 #ifndef _CSESSIONMANAGER
27 #define _CSESSIONMANAGER
28 #include "libMRML/include/uses-declarations.h"
33 #include "libMRML/include/CXMLElement.h"
34 #include "libMRML/include/CAccessorAdminCollection.h"
35 #include "libMRML/include/CI18nTranslator.h"
36 #include "libMRML/include/CAlgorithm.h"
37 #include "libMRML/include/CPropertySheetList.h"
38 #include "libMRML/include/CAccessorElement.h"
39 #include "libMRML/include/CAlgorithmCollection.h"
40 #include "libMRML/include/CQueryTreeBuilder.h"
41 #include "libMRML/include/CMutex.h"
108 ostream&
write(ostream& outStream)
const;
110 istream&
read(istream& inStream);
115 void setUser(
const string& inUser);
119 void setID(
const string& inID);
154 const string& inAlgorithm,
172 bool rename(
const string& inName);
190 string toXML(
bool isPrivate)
const;
213 CMutex mMutexSessionManager;
228 typedef map<string,CSession*> CIDToSession;
230 mutable CUserToSessions mUserToSessions;
232 mutable CIDToSession mIDToSession;
250 string inConfiguration,
251 string inI18nFileName);
262 istream&
read(istream&);
264 ostream&
write(ostream&);
271 string inSessionName);
277 string inSessionName);
307 const string& inAlgorithm,
312 const string& inAlgorithm
316 list<TID>*
getAllIDs(
const string& inSessionID,
317 const string& inAlgorithm
331 const string& inSessionName);
334 const string& inUser,
335 const string& inSessionName);
339 const string& inNewSessionName);
369 string toXML(
bool isPrivate=
false)
const;
378 bool isPrivate=
false)
const;
389 string inAlgorithmID)
const;
417 const string& inLanguageCode);
bool rename(const string &inName)
Renaming this session (calls setSessionName, at present)
list< string > getLanguages() const
get the preferred languages of this session
A class containing a session.
Definition: CSessionManager.h:63
bool clearSessionLanguages(const string &inSessionID)
i18n clear the preferred languages list of a given session
string mPreferredLanguage
the language to be used in this session
Definition: CSessionManager.h:66
void setUser(const string &inUser)
set user of this session
pair< string, string > toXMLHandshake(const string &inUser)
this is almost the complete shandshake message
CSessionManager(string inSessions, string inConfiguration, string inI18nFileName)
The session manager slurps in two XML files and generates out of this its initial state...
The algorithm collection is kind of a factory for CQuery structures:
Definition: CAlgorithmCollection.h:58
list< TID > * getAllIDs(const string &inSessionID, const string &inAlgorithm)
retrieving the IDs of all images (for generating distance matrices)
CI18nTranslator mI18nTranslator
The Translator for this.
Definition: CSessionManager.h:222
string getPreferredLanguage() const
get the preferred languages of this session
ostream & write(ostream &)
Write into a stream.
CXMLElement * getPropertySheet(string inSessionID, string inAlgorithmID) const
Get the property sheet of the algorithm with ID inAlgorithmID.
ostream & write(ostream &outStream) const
Read the state.
void translate(string inSessionID, CXMLElement &inoutToBeTranslated) const
i18n: get the list of preferred languages of this session
CAlgorithm * mActiveAlgorithm
The algorithm used for the next query At present this fully describes a session.
Definition: CSessionManager.h:86
CStaticQueryFactory * mBaseTypeFactory
The base type factory is a factory for query base types.
Definition: CSessionManager.h:243
This class captures the structure of an XML element.
Definition: CXMLElement.h:51
This class builds and maintains a query tree.
Definition: CQueryTreeBuilder.h:30
takes the information contained in the list of properties, which is given in the config.mrml file.
Definition: CPropertySheetList.h:41
CXMLElement * getPropertySheetSubtree()
This function gets us the current property sheet subtree.
string toXML(bool isPrivate=false) const
turn this into a part of the welcome message in fact, this generates standard property sheets out of ...
istream & read(istream &)
Initialization: read from a stream.
list< string > getSessionLanguages(const string &inSessionID) const
i18n: get the list of preferred languages of this session
CXMLElement * getRandomImages(const string &inSessionID, const string &inAlgorithm, int inResultSize)
retrieving random images (as seeds for subsequent searches)
string mSessionName
the name of this session
Definition: CSessionManager.h:82
This class does nothing but wrap the current query interface in a way, that it can be used with CORBA...
Definition: CQueryTreeNode.h:24
CXMLElement * mPropertySheetSubtree
The subtree from which the mPropertySheets will be built.
Definition: CSessionManager.h:240
An algorithm is a CXMLElement which is linked to a CSessionManager together they are able to build CQ...
Definition: CAlgorithm.h:43
CPropertySheetList * mPropertySheetList
These are the building blocks of the property sheets to be generated by *this.
Definition: CSessionManager.h:237
This class offers runtime translation of strings.
Definition: CI18nTranslator.h:38
bool open()
opening this session.
The Query manager for Queries on inverted Files.
Definition: CQuery.h:73
A factory for base types of algorithms.
Definition: CStaticQueryFactory.h:38
void addLanguage(string inLanguageCode)
one language code is added at the back of the list of preferred languages
string toXML(bool isPrivate) const
generating XML output for configuration/shandshake
string toXMLSessionConfiguration() const
The sessions for everybody known to the system.
void endPropertySheetSubtree()
This function does the actual breaking down into a CPropertySheetList.
bool close()
Closing this session.
list< CAccessorElement > * getAllAccessorElements(const string &inSessionID, const string &inAlgorithm)
retrieving the URLs of all images (for generating distance matrices)
map< string, list< CSession > > CUserToSessions
point the user to all the sessions
Definition: CSessionManager.h:226
string getUser() const
get user of this session
string newSession(const string &inUser, const string &inSessionName)
making a new session and returning its ID
CXMLElement * openSession(string inUserName, string inSessionID, string inSessionName)
to be used by the Interface.
CMutex mMutexSession
the mutex for this session
Definition: CSessionManager.h:72
This structure handles the sessions; by this, it encapsulates the current state of the server...
Definition: CSessionManager.h:209
This is in fact a collection of collections.
Definition: CAccessorAdminCollection.h:39
CAccessorAdminCollection mAccessorAdminCollection
The accessor collection is needed for constructing queries.
Definition: CSessionManager.h:218
CXMLElement * getAlgorithms() const
This function probably will quite soon be removed from this class, and it will become part of a class...
pair< CQueryContainer *, CQueryTreeNode * > mQueryTree
The information about the current query tree.
Definition: CSessionManager.h:88
void commitLanguages(const CI18nTranslator &inTranslator)
commit the list of languages.
CXMLElement * getRandomImages(CSessionManager &inCaller, const string &inAlgorithm, int inResultSize)
retrieving random images as seeds
bool addSessionLanguage(const string &inSessionID, const string &inLanguageCode)
i18n: add one language code to the list of preferred languages
string getID() const
set ID of this session
void setID(const string &inID)
get ID of this session
bool setAlgorithm(const string &inSessionID, CAlgorithm *inAlgorithm)
set the algorithm used in this session it will also lead to a new construction of the query...
istream & read(istream &inStream)
Write the state.
string getSessionName() const
get the displayname of this session
This class offers an abstraction from the locking method used.
Definition: CMutex.h:40
bool setActiveAlgorithm(CAccessorAdminCollection &inCaller, CAlgorithmCollection &inAlgorithmCollection, CAlgorithm *inActiveAlgorithm, CStaticQueryFactory &inBaseTypeFactory)
set the algorithm of this session.
CXMLElement * query(const string &inSessionID, const CXMLElement &inRelevanceLevelList)
VeryImportantFunction:
CAlgorithm * getActiveAlgorithm()
get the algorithm of this session
void clearLanguages()
the list of preferred languages of this is cleared
CXMLElement * closeSession(string inSessionID)
Closes the session, but keeps it in memory.
bool commitSessionLanguages(const string &inSessionID)
commit the languages to be used for a session.
~CSession()
destroys all members
CLanguageList mLanguages
the list of languages to be used
Definition: CSessionManager.h:70
CXMLElement * query(CSessionManager &inCaller, const CXMLElement &inQuery)
set the collection of this session
CXMLElement * renameSession(string inSessionID, string inSessionName)
to be used by the Interface.
CQuery * makeQuery(const string &inBaseType, CAlgorithm &inAlgorithm)
this CSessionManager has all the information to make a query structure.
void setSessionName(const string &inSessionName)
set the displayname of this session
list< string > CLanguageList
the list of languages to be used
Definition: CSessionManager.h:68
void startPropertySheetSubtree()
Building a property sheet list I consider building a list on a call by call basis as tedious...
CXMLElement * getCollections() const
This function probably will quite soon be removed from this class, and it will become part of a class...
void setSessionName(const string &inOldSessionName, const string &inNewSessionName)
Set the name of the current session.
string toXMLSessions(const string &inUser, bool isPrivate=false) const
The sessions for one user only.
CXMLElement * deleteSession(string inSessionID)
to be used by the Interface.