29 #ifndef _CCOMMUNICATIONHANDLER 30 #define _CCOMMUNICATIONHANDLER 31 #include "libMRML/include/uses-declarations.h" 35 #include "libMRML/include/CAttributeList.h" 38 #include "libMRML/include/CSessionManager.h" 39 #include "libMRML/include/CXMLElement.h" 43 #include "libMRML/include/CMutex.h" 46 extern void startMRMLElement(
void *userData,
47 const char *inElementName,
48 const char **inAttributes);
49 extern void endMRMLElement(
void *userData,
const char *name);
86 string mPeerAddressString;
129 string frame(
const string& inSession,
130 const string& inString);
158 const string& inMessage);
163 const string& inSessionName);
166 const string& inNewName);
175 const string& inAlgorithmID);
195 const string& inAlgorithm,
196 const string& inCollection,
197 const string& inNumberOfImages) ;
216 void setResultCutoff(
const string& inCutoff);
218 void setResultCutoff(
double inCutoff);
221 void setCollectionID(
const string& inID);
224 void setAlgorithmID(
const string& inID);
230 const char*
const*
const inAttributes);
234 const char*
const*
const inAttributes);
276 const char*
const*
const inAttributes);
307 void clearParsingFinished();
308 void setParsingFinished();
309 bool isParsingFinished()
const;
331 void startMultiRequest(
const string& inSessionID,
const string& inLanguageCode=
"en");
370 ofstream& inLogFile);
void getPropertySheet(const string &inSessionID, const string &inAlgorithmID)
Gets the property sheet contained in the algorithm with inAlgorithmID.
void getSessions(const string &inUser)
getting the sessions for one user (new MRML)
bool isBuildingTree() const
is this building a tree at present?
CAlgorithm * readAlgorithmElement()
read the pointer to the algorithm tree
string frame(const string &inSession, const string &inString)
Frame: this is for all messages the same.
int mSocket
The socket, which is used for this communication.
Definition: CCommunicationHandler.h:108
void endAlgorithmElement()
end of an element in the tree of configured algorithms
int sendRandomImages(const string &inSession, const string &inAlgorithm, const string &inCollection, const string &inNumberOfImages)
random images
This class captures the structure of an XML element.
Definition: CXMLElement.h:51
void renameSession(const string &inSessionID, const string &inNewName)
renaming the current session
void openSession(const string &inUserName, const string &inSessionName)
Opening a session.
void moveUpCurrentTree()
move up in the tree
CSessionManager & getSessionManager()
Using the session manager which is a member.
void setSocket(int inSocket)
communications:
ofstream & mLog
The logfile which logs all communication.
Definition: CCommunicationHandler.h:112
int getQueryAtRandomCount() const
reading this flag
void getCollections()
getting collections available on a system
int mQueryAtRandomCount
We have said, that the user can tell, if he wants a query in the normal sense or rather a collection ...
Definition: CCommunicationHandler.h:105
int sendHandshake(const string &inUser)
the handshake message (old MRML)
void startAlgorithmElement(const char *inName, const char *const *const inAttributes)
start of an element in the tree of configured algorithms.
An algorithm is a CXMLElement which is linked to a CSessionManager together they are able to build CQ...
Definition: CAlgorithm.h:43
void clearAlgorithmElement()
Clear the algorithm tree element.
string preamble()
helpers for creating mrml messages
a helper class for use with expat, which also handles the socket stuff.
Definition: CCommunicationHandler.h:54
string toAttribute(string inName, string inString)
making attributes out of name/value pairs
void setPeerAddressString(string)
set the name of the peer, this is just an informative string, destined for the log.
bool mParsingFinished
parsing from a stream: read each character parse it
Definition: CCommunicationHandler.h:306
This structure handles the sessions; by this, it encapsulates the current state of the server...
Definition: CSessionManager.h:209
void incrementQueryAtRandomCount()
incrementing the QueryAtRandomCount flag
CXMLElement * gQueryImages
processing a query
Definition: CCommunicationHandler.h:198
const string & getPeerAddressString() const
get the Peer adress string
void endMultiRequest()
sends the message which has been built
void initAlgorithmElement()
clear the pointer to the algorithm tree
void deleteSession(const string &inName)
renaming the current session
void startTreeBuilding(const char *inElementName, const char *const *const inAttributes)
Start building a tree by successive adding of XML elements.
void parseString(const string &inMessage)
parse XML using expat
void setResultSize(int inResultSize)
setting properties of the query
void addToCurrentTree(const char *inElementName, const char *const *const inAttributes)
Start building a tree by successive adding of XML elements.
void addToMultiResponse(CXMLElement *inElement)
adds an XMLElement to the multi-response which is built
CSelfDestroyPointer< CXMLElement > mMultiResponse
A DOM-alike tree which will be built from all the answers given to the requests.
Definition: CCommunicationHandler.h:96
void startMultiRequest(const string &inSessionID, const string &inLanguageCode="en")
If we process multiple queries which are part of one message, we have to first collect the answers fr...
int sendResult(const string &inSession, const CXMLElement &inRLL)
the result of a query
void endConfiguration()
End the configuration i.e.
const string getCurrentSessionID()
returns the currently valid SessionID
int sendError(const string &inSession, const string &inMessage)
turning a relevance level element into a string
CCommunicationHandler(CSessionManager &inSessionManager, ofstream &inLogFile)
constructor/destructor
void getAlgorithms()
getting algorithms available on a system