From: Michal Voců Date: Wed, 28 Apr 2010 14:42:28 +0000 (+0000) Subject: added example to C++ api docs X-Git-Tag: glite-security-gsoap-plugin_R_2_1_2_1~37 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=03d8c4a84400eecec739682de473bff8d8556b90;p=jra1mw.git added example to C++ api docs --- diff --git a/org.glite.lb.doc/src/consumer_api.tex b/org.glite.lb.doc/src/consumer_api.tex index d081b38..cac90db 100644 --- a/org.glite.lb.doc/src/consumer_api.tex +++ b/org.glite.lb.doc/src/consumer_api.tex @@ -520,13 +520,27 @@ Print the results: The operations can throw an exception, so the code should be enclosed within try--catch clause. -The second example rewritten to C++ looks like that; first the query +The second example rewritten to C++ is shown here; first the query condition vector: \lstinputlisting[title={\bf File: }\lstname,numbers=left,linerange=queryrec-end\ queryrec]{cons_example2.cpp} The query itself: \lstinputlisting[title={\bf File: }\lstname,numbers=left,linerange=query-end\ query]{cons_example2.cpp} +The third example shows event query (as opposed to job state query in +the first two examples). We are looking for events of jobs, that were +in past painted (tagged by user) green, but now they are red. The +necessary query condition vectors are here: +\lstinputlisting[title={\bf File: }\lstname,numbers=left,linerange=queryrec-end\ queryrec]{cons_example3.cpp} + +The query itself: +\lstinputlisting[title={\bf File: }\lstname,numbers=left,linerange=query-end\ query]{cons_example3.cpp} + +The resulting event vector is dumped using the utility function +\verb'dumpEvent()' listed above: +\lstinputlisting[title={\bf File: }\lstname,numbers=left,linerange=printevents-end\ printevents]{cons_example3.cpp} + + \subsubsection{Job} The \verb'glite::lb::Job' class encapsulates \LB server queries specific for particular job as well as client part of context. The @@ -539,7 +553,7 @@ void log(std::vector &events) const; \end{lstlisting} \marginpar{\bf Important!}% -It is important to notice that \verb'Job' objects contain +It is important to notice that \verb'Job' contain \verb'ServerConnection' as private member and thus encapsulate client part of context. That makes them relatively heavy--weight objects and therefore it is not recommended to create too many instances, but