A class containing a session. More...
#include <CSessionManager.h>
Public Member Functions | |
CSession () | |
Constructors. | |
CSession (string inUser, string inID, string inSessionName, CAlgorithm *inActiveAlgorithm) | |
~CSession () | |
destroys all members | |
ostream & | write (ostream &outStream) const |
Read the state. | |
istream & | read (istream &inStream) |
Write the state. | |
string | getUser () const |
get user of this session | |
void | setUser (const string &inUser) |
set user of this session | |
string | getID () const |
set ID of this session | |
void | setID (const string &inID) |
get ID of this session | |
string | getSessionName () const |
get the displayname of this session | |
void | setSessionName (const string &inSessionName) |
set the displayname of this session | |
CAlgorithm * | getActiveAlgorithm () |
get the algorithm of this session | |
bool | setActiveAlgorithm (CAccessorAdminCollection &inCaller, CAlgorithmCollection &inAlgorithmCollection, CAlgorithm *inActiveAlgorithm, CStaticQueryFactory &inBaseTypeFactory) |
set the algorithm of this session. More... | |
CXMLElement * | query (CSessionManager &inCaller, const CXMLElement &inQuery) |
set the collection of this session More... | |
CXMLElement * | getRandomImages (CSessionManager &inCaller, const string &inAlgorithm, int inResultSize) |
retrieving random images as seeds | |
bool | open () |
opening this session. More... | |
bool | close () |
Closing this session. | |
bool | rename (const string &inName) |
Renaming this session (calls setSessionName, at present) | |
void | clearLanguages () |
the list of preferred languages of this is cleared | |
void | addLanguage (string inLanguageCode) |
one language code is added at the back of the list of preferred languages | |
void | commitLanguages (const CI18nTranslator &inTranslator) |
commit the list of languages. More... | |
list< string > | getLanguages () const |
get the preferred languages of this session | |
string | getPreferredLanguage () const |
get the preferred languages of this session | |
string | toXML (bool isPrivate) const |
generating XML output for configuration/shandshake | |
Protected Types | |
typedef list< string > | CLanguageList |
the list of languages to be used | |
Protected Attributes | |
string | mPreferredLanguage |
the language to be used in this session | |
CLanguageList | mLanguages |
the list of languages to be used | |
CMutex | mMutexSession |
the mutex for this session | |
bool | mIsOpen |
string | mUser |
string | mID |
string | mSessionName |
the name of this session | |
CAlgorithm * | mActiveAlgorithm |
The algorithm used for the next query At present this fully describes a session. | |
pair< CQueryContainer *, CQueryTreeNode * > | mQueryTree |
The information about the current query tree. | |
Static Protected Attributes | |
static CQueryTreeBuilder | mQueryTreeBuilder |
A class containing a session.
At present a session is just a quite rudimentary container for an algorithm.
Later we hope to make sessions persistent (using blobs in msql, for example).
ATTENTION MULTITHREADING: WHAT TO LOCK AND WHAT TO UNLOCK IS NOT ENTIRELY TRIVIAL THIS MIGHT BE A SOURCE OF MISTAKES
void CSession::commitLanguages | ( | const CI18nTranslator & | inTranslator | ) |
commit the list of languages.
That means, here the actual language that will be used throughout the translation is determined
bool CSession::open | ( | ) |
opening this session.
This implements a lock, such that one user can have several open session which do not interfere.
The return value tells the use if the open was successful (true)
CXMLElement* CSession::query | ( | CSessionManager & | inCaller, |
const CXMLElement & | inQuery | ||
) |
set the collection of this session
get the collection of this session performing a query
Gets from the current algorithm the right inSubAlgorithm, from that the right CQuery and hands parameters through to it.
bool CSession::setActiveAlgorithm | ( | CAccessorAdminCollection & | inCaller, |
CAlgorithmCollection & | inAlgorithmCollection, | ||
CAlgorithm * | inActiveAlgorithm, | ||
CStaticQueryFactory & | inBaseTypeFactory | ||
) |
set the algorithm of this session.
in fact this amounts to building a complete query tree.
We also would like to do a bit of tree matching to see, how much of the query we can rescue after reconfiguration.