From 03d8c4a84400eecec739682de473bff8d8556b90 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michal=20Voc=C5=AF?= Date: Wed, 28 Apr 2010 14:42:28 +0000 Subject: [PATCH] added example to C++ api docs --- org.glite.lb.doc/src/consumer_api.tex | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) 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 -- 1.8.2.3