work on c++ api
authorMichal Voců <michal@ruk.cuni.cz>
Tue, 16 Dec 2008 07:53:37 +0000 (07:53 +0000)
committerMichal Voců <michal@ruk.cuni.cz>
Tue, 16 Dec 2008 07:53:37 +0000 (07:53 +0000)
org.glite.lb.doc/src/LBDG-Introduction.tex
org.glite.lb.doc/src/consumer_api.tex

index 6145130..a4b9b04 100644 (file)
@@ -181,6 +181,25 @@ glite/lb/jobstat.h & Job status structure returned by consumer API.\\
 \label{t:cheaders}
 \end{table}
 
+\subsubsection{Building Client Programs}
+The easiest way to build programs using the \LB library in C is to use
+GNU's libtool to take care of all the dependencies:
+\begin{verbatim}
+flavour=gcc32dbg
+libtool --mode=compile gcc -c example1.c util.c \
+        -I\$GLITE_LOCATION/include -D_GNU_SOURCE
+libtool --mode=link gcc -o example1 example1.o util.o \
+        -L$GLITE_LOCATION/lib -lglite_lb_client_$flavour
+\end{verbatim}
+The library comes in different flavours (with/without debugging
+symbols, with/without thread support) which are in turn linked with
+(and depend on) the correct Globus library flavours. When linking
+threaded programs you have to use the library flavour with thread
+support.
+
+The RPM package needed is \texttt{glite-lb-client} and its dependencies
+which contain all necessary libraries. 
+
 \subsubsection{Context}
 \label{s:edg_wll_context}
 \marginpar{Context initialization}%
@@ -428,23 +447,6 @@ same input list:
 
 For more information see file \verb'include/glite/lb/jobstat.h'
 
-\subsubsection{Building Client Programs}
-The easiest way to build programs using the \LB library in C is to use
-GNU's libtool to take care of all the dependencies:
-\begin{verbatim}
-flavour=gcc32dbg
-libtool --mode=compile gcc -c example1.c util.c \
-        -I\$GLITE_LOCATION/include -D_GNU_SOURCE
-libtool --mode=link gcc -o example1 example1.o util.o \
-        -L$GLITE_LOCATION/lib -lglite_lb_client_$flavour
-\end{verbatim}
-The library comes in different flavours (with/without debugging
-symbols, with/withou thread support) which in turn depend on the
-correct Globus library flavours.
-
-The package needed is \texttt{glite-lb-client} and its dependencies
-which contain all necessary libraries. 
-
 \subsection{C++ Language Binding}
 The C++ languague binding now only supports the consumer (querying)
 API. It is not the (re)implementation of the library in C++; instead
@@ -482,13 +484,12 @@ other hand differentiates between query context
 therefore part of the respective chapters.
 
 \subsubsection{Header Files}
-Header files for the C++ version of common definitions are suummarized
-in table~\ref{t:cppheaders}
+Header files for the C++ version of common definitions are summarized
+in table~\ref{t:cppheaders}
 
 \begin{table}[h]
 \begin{tabularx}{\textwidth}{>{\tt}lX}
 glite/jobid/JobId.h & Definition of job identifier. \\
-glite/lb/CountRef.h & Reference counting class for encapsulated C structures.\\
 glite/lb/LoggingExceptions.h & Exception class for \LB--specific errors.\\
 \end{tabularx}
 \caption{Header file for common C++ classes}
@@ -496,6 +497,19 @@ glite/lb/LoggingExceptions.h & Exception class for \LB--specific errors.\\
 
 \end{table}
 
+\subsubsection{Building Programs}
+The recommended way to build programs using the C++ \LB library is,
+like in the C case, use the \verb'libtool' utility:
+\begin{verbatim}
+flavour=gcc32dbg
+libtool --mode=compile gcc -c example1.c util.c \
+        -I\$GLITE_LOCATION/include -D_GNU_SOURCE
+libtool --mode=link gcc -o example1 example1.o util.o \
+        -L$GLITE_LOCATION/lib -lglite_lb_clientpp_$flavour
+\end{verbatim}
+The only difference is the library name, the RPM package required is
+again \verb'glite-lb-client'.
+
 \subsubsection{JobId}
 The \verb'glite::jobid::JobId' class represents job identification and
 provides convenient methods for manipulating the data. The
@@ -547,37 +561,13 @@ cout << (a < b) ? a.unique() : b.unique() << " comes first" << endl;
 cout << "Complete jobid: " << a.toString() << endl;
 \end{lstlisting}
 
-\subsubsection{Event}
-The objects of class \verb'glite::lb::Event' are returned by the \LB event
-queries. The \verb'Event' class introduces symbolic names for event attributes
-and their types, feature not available through the C API, as well as
-(read only) access to the attribute values.  Using these methods you can 
-\begin{itemize}
-\item get the event type (both symbolic and string),
-\begin{lstlisting}
-       const std::string & name(void) const;
-       static const std::string getEventName(Type type);
-\end{lstlisting}
-\item get the list of attribute types and values,
-\begin{lstlisting}
-       const std::vector<std::pair<Attr,AttrType> >  & getAttrs(void) const;
-\end{lstlisting}
-\item get string representation of attribute names,
-\begin{lstlisting}
-       static const std::string & getAttrName(Attr name);
-\end{lstlisting}
-\item get value of given attribute.
+\subsubsection{Exception}
+The \verb'glite::lb::Exception' is a base class for all exceptions
+thrown by the \LB library. It inherits from \verb'std::runtime_error'
+and adds no additional members or methods except constructors:
 \begin{lstlisting}
-       int     getValInt(Attr name) const;
-       float   getValFloat(Attr name) const;
-       double  getValDouble(Attr name) const;
-       std::string getValString(Attr name) const;
-        struct timeval getValTime(Attr name) const;
-        const glite::jobid::JobId getValJobId(Attr name) const;
+try {
+} catch (glite::lb::Exception &e) {
+       cerr << "LB library exception: " << e.what() << endl;
+}
 \end{lstlisting}
-\end{itemize}
-
-Following example demonstrates this by printing the event attributes:
-\lstinputlisting[title={\bf File: }\lstname,firstline=8,numbers=left]{util.C}
-
-\subsubsection{Building Programs}
index 56f3827..efe46a0 100644 (file)
@@ -308,11 +308,60 @@ demonstrated in the client example \texttt{job\_log.c} (in the client module).
 
 \subsection{C++ Language Binding}
 \TODO{michal}
+The querying C++ \LB API is modelled after the C \LB API using these basic principles:
+\begin{itemize}
+\item 
+\end{itemize}
 
 \subsubsection{Header Files}
+Header files for the \LB consumer API are summarized in table~\ref{t:ccppheaders}.
+\begin{table}[h]
+\begin{tabularx}{\textwidth}{>{\tt}lX}
+glite/lb/Event.h & \\
+glite/lb/ServerConnection.h & \\
+glite/lb/Job.h & \\
+glite/lb/JobStatus.h & \\
+
+\end{tabularx}
+\end{table}
+
+\subsubsection{QueryRecord}
+\subsubsection{Event}
+The objects of class \verb'glite::lb::Event' are returned by the \LB event
+queries. The \verb'Event' class introduces symbolic names for event attributes
+and their types, feature not available through the C API, as well as
+(read only) access to the attribute values.  Using these methods you can 
+\begin{itemize}
+\item get the event type (both symbolic and string),
+\begin{lstlisting}
+       const std::string & name(void) const;
+       static const std::string getEventName(Type type);
+\end{lstlisting}
+\item get the list of attribute types and values,
+\begin{lstlisting}
+       const std::vector<std::pair<Attr,AttrType> >  & getAttrs(void) const;
+\end{lstlisting}
+\item get string representation of attribute names,
+\begin{lstlisting}
+       static const std::string & getAttrName(Attr name);
+\end{lstlisting}
+\item get value of given attribute.
+\begin{lstlisting}
+       int     getValInt(Attr name) const;
+       float   getValFloat(Attr name) const;
+       double  getValDouble(Attr name) const;
+       std::string getValString(Attr name) const;
+        struct timeval getValTime(Attr name) const;
+        const glite::jobid::JobId getValJobId(Attr name) const;
+\end{lstlisting}
+\end{itemize}
+
+Following example demonstrates this by printing the event attributes:
+\lstinputlisting[title={\bf File: }\lstname,firstline=8,numbers=left]{util.C}
+
+\subsubsection{JobStatus}
 \subsubsection{ServerConnection}\label{s:ServerConnection}
 \subsubsection{Job}
-\subsubsection{JobStatus}
 
 
 \subsection{Web-Services Binding}\label{s:Consumer-API-WS}