Changeset 1015 in Sophya for trunk/DocHFI_L2


Ignore:
Timestamp:
May 20, 2000, 6:27:38 AM (25 years ago)
Author:
ansari
Message:

Document sdg.tex complete, et qui n'avait pas ete commite - Reza 19/5/2000

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DocHFI_L2/sdg.tex

    r794 r1015  
    88%  Extension de symboles mathematiques
    99\usepackage{amssymb}
     10
     11% package a mettre pour faire du pdf
     12\usepackage{palatino}
    1013
    1114%  Definition de taille de page
     
    2326\begin{titlepage}
    2427\vspace{1cm}
    25 \rule{110 mm}{0.5 mm}\makebox[50 mm]{\bf Planck HFI L2}
     28\vspace{1cm}
     29\makebox[34mm][c]{\includegraphics[width=3cm]{hfi_icon_vsmall.eps}}
     30\raisebox{12mm}{\rule{80 mm}{0.5 mm}\makebox[50 mm]{\bf Planck HFI L2}}
     31\vspace{2cm}
    2632\vspace{2cm}
    2733\begin{center}
     
    3743{É. Aubourg} & {\tt aubourg@hep.saclay.cea.fr} \\
    3844% {É. Lesquoy} & {\tt lesquoy@hep.saclay.cea.fr} \\
    39 % {C. Magneville} & {\tt cmv@hep.saclay.cea.fr} \\
     45{C. Magneville} & {\tt cmv@hep.saclay.cea.fr} \\
    4046\end{tabular}
    4147
     
    5157
    5258\newpage
    53 % \tableofcontents
    5459
    5560\section{Introduction}
    5661We intend to gather gradually in this document the guidelines
    57 for the development of Planck HFI Level 2 data processing softwares.
     62for the development of Planck HFI Level 2 data processing software.
    5863We assume throughout this document that C++ is the baseline option
    5964as the programming language for the development of Planck HFI
    60 Level 2 processing software.
    61 
    62 \section{Integration of software modules in different languages}
    63 We review here some of the problems which may arise when integrating software
    64 modules written in other languages into C++ programs.
    65 
    66 \subsection{C and C++}
     65Level 2 processing software, we review here briefly some of
     66the properties of the C++ and Java language and interoperability
     67with other language, mainly C and Fortran.
     68
     69
     70\section{C++}
     71{\bf C++ \ } is an object-oriented programming language which
     72has been developed by extending the {\bf C \ } language.
     73Some of the additional possibilities incorporated in C++ are:
     74\begin{itemize}
     75\item Introduction of object and classes
     76\item function overloading
     77\item Operator overloading
     78\item function and operator inlining
     79\item virtual functions (polymorphism)
     80\item public, protected and private members
     81\item dynamic memory management operators
     82\item Exception handling
     83\item generic (template) function and classes
     84\end{itemize}
     85
     86We discuss here the some of the problems and solutions arising when
     87integrating software modules written in other languages into C++ programs.
     88
     89\subsection{Calling C code from C++}
    6790C++ extends the possibilities offered by the C language.
    6891All of the C language data types and function call syntax are thus
     
    7598int fo(double a, double b);
    7699\end{verbatim}
    77 Using {\bf C}, one would have written:
     100Using {\bf C \ }, one would have written:
    78101\begin{verbatim}
    79102int foi(int a);
     
    83106C++ compilers use internally a name containing the encoding of the
    84107argument list. In order to instruct the compiler to use simple
    85 names, {\bf C} functions should be declared as \\
     108names, {\bf C \ } functions should be declared as \\
    86109{\tt extern "C" }. This is usually included in the header
    87110file (.h). In the example above, the header file (.h) file
     
    99122\end{verbatim}
    100123
    101 \subsection{Fortran and C++}
     124\subsection{Calling Fortran code from C++}
    102125Fortran is a simple language and uses only basic data types.
    103126Although the exact mapping between Fortran and C/C++ basic data types
     
    137160\end{verbatim}
    138161
    139 The case of character string arguments in fortran subroutines
     162The case of character string arguments in Fortran subroutines
    140163needs a bit more attention, and the string length needs to be passed
    141164as an additional integer type argument.
    142 As with {\bf C} functions, fortran functions or subroutines
    143 have to be delared {\tt extern "C"} to be used within {\bf C++}
    144 programs. {\bf C/C++} driver routines can easily be written for
    145 extensively used fortran modules, simplifying calling sequences.
    146 
    147 It should also be noted that the fortran support libraries have to be
     165As with {\bf C \ } functions, Fortran functions or subroutines
     166have to be declared {\tt extern "C"} to be used within {\bf C++ \ }
     167programs. {\bf C/C++ \ } driver routines can easily be written for
     168extensively used Fortran modules, simplifying calling sequences.
     169
     170It should also be noted that the Fortran support libraries have to be
    148171included for the link with the C++ driver.
    149 It is also possible to translate the whole fortran source code
    150 into {\bf C} code using {\bf f2c} program. The call syntax
     172It is also possible to translate the whole Fortran source code
     173into {\bf C \ } code using {\bf f2c \ } program. The call syntax
    151174will be exactly the same as with a Fortran compiler, and
    152175{\tt libf2c.a} should be used when linking the program.
    153176
    154 It is very difficult to use C++ classes directly from fortran.
    155 However, high level functionalities based on a C++ libray can
    156 be wrapped in a fortran style function which can be
    157 called from fortran. One looses of course many of the
     177It is very difficult to use C++ classes directly from Fortran.
     178However, high level functionalities based on a C++ library can
     179be wrapped in a Fortran style function which can be
     180called from Fortran. One looses of course many of the
    158181possibilities offered by underlying C++ library.
    159182
     
    220243
    221244
     245\section{Java}
     246Java \footnote{Information on the Java platform and language
     247can be found at {\bf http://java.sun.com} }
     248is a rather recent object-oriented programming language. It is
     249based on the concept of a virtual machine, and a very extended
     250standard library.
     251
     252Java compilers produce "byte-codes" that are interpreted in a virtual
     253machine (JVM). Thus, pure Java programs are platform-independent and
     254portable. The very extended libraries that are available for the
     255language make it a very good choice for user interfaces, network
     256programming, distributed objects, database access. Numeric
     257computation libraries start to appear but are still in early stages
     258of development.
     259
     260The Java language is strongly typed, with dynamic typing information.
     261It is dynamic in essence as class bytecodes can be loaded into the
     262JVM on request.
     263It uses a garbage collector for memory management. Memory leaks and
     264memory access errors cannot exist. All this makes debugging easier
     265than with C++.
     266
     267The overhead of interpreting the bytecodes in the virtual machine is
     268alleviated by the development of "JIT" (Just In Time) compilers, that
     269do a dynamic compilation. Java programs are typically 3 times slower
     270than their equivalent in C++, but the exact figure might vary between
     2711 and 5 depending on the type of program.
     272
     273Two features convenient for numeric library development and usage
     274present in C++ are missing in Java: templates and operator overloading.
     275Typically, a single code cannot be specialised for
     276floats and doubles automatically, and one must write, if A, B and C
     277are matrices, {\tt C = A.mult(B) instead of C = A*B} .
     278
     279\subsection{Calling C/C++ code from Java }
     280
     281A Java library (JNI, Java Native Interface) allows to call C/C++ code
     282from Java programs. Of course, portability is then lost.
     283Methods in Java objects can be declared {\tt native}. A tool then
     284produces C/C++ headers for coding these methods in C/C++. This code
     285can call existing C/C++/Fortran code, and even map the Java object to
     286a C++ object.
     287
     288Because the layout of objects in memory is not fixed in the JVM
     289specifications, all accesses to methods and member variables are done
     290through interface pointers. Accessing arrays can imply a copy of the
     291array on input, and a copy back on return if the array was modified.
     292
     293Since Java memory management is garbage-collector-based, C/C++
     294programs that want to hold references to Java objects, or create Java
     295objects, must interact with the garbage collector explicitly.
     296
     297JNI allows also C/C++ programs to instantiate a JVM and Java objects,
     298and access them.
     299
     300\subsection{Java and CORBA}
     301
     302Another solution to call C++ objects from Java, or vice-versa, is to
     303use CORBA. CORBA is a standard distributed objects framework, and
     304Java 2 comes with a CORBA-2 compliant ORB (Object Request Broker),
     305JavaIDL.
     306
     307Objects distributed through CORBA must have their interface defined
     308in a specific language, IDL. Tools then creates stubs for any
     309language, as well as implementation skeletons.
     310
     311An object can then physically exist on a machine, implemented in C++,
     312and be manipulated remotely through Java stubs, as if it were a local
     313Java object. CORBA offers thus language-independent distributed
     314objects.
     315
     316It adds overhead compared to JNI, because of the presence of a
     317network layer, but offers more functionality. In particular, the C++
     318objects are platform-dependent, but the Java code that uses them,
     319being pure Java code, remains portable.
     320
     321
    222322\newpage
    223323\appendix
    224324
    225 \section{The C++ language}
     325\section{C++ standard and compilers}
    226326\vspace{5 mm}
    227 {\bf C++} is a very powerful Object Oriented language.
    228 It has been developped by extending the {\bf C} language,
    229 keeping in mind the efficiency and performance,
    230 as well as easy integration with existing softwares.
    231 It incorporates new possibilities such as:
    232 
    233 \begin{itemize}
    234 \item Introduction of object and classes
    235 \item function overloading
    236 \item Operator overloading
    237 \item function and operator inlining (optimisation)
    238 \item virtual functions (polymorphism)
    239 \item public, protected and private members
    240 \item dynamic memory management operators
    241 \item Exception handling
    242 \item generic (template) function and classes
    243 \end{itemize}
    244327
    245328{\bf C++} can be considered now as a mature language.
    246 C++ class library covering various areas, including
    247 numerical data processing are available as freeware
    248 or commercial products. Many software tools feature
    249 a standard C++ API.
    250 \par \vspace{3mm}
    251329The current standard for C++ and C are defined by
    252330\footnote{Available from {\bf http://www.ansi.org/ } }:
    253331\begin{itemize}
    254 \item[] {\bf ISO/IEC 14882-1998(E)} Programming languages -- C++
    255 \item[] {\bf ANSI/ISO 9899-1990} for Programming Languages C 
     332\item[] {\bf ISO/IEC 14882-1998(E) \ } Programming languages -- C++
     333\item[] {\bf ANSI/ISO 9899-1990 \ } for Programming Languages C 
    256334\end{itemize}
    257335
    258 
    259 \newpage
    260 \section{C++ compilers}
    261 
    262 
    263 Powerful compilers are available on most platforms,
    264 including:
     336Powerful compilers are available on most platforms, including:
    265337
    266338\begin{itemize}
Note: See TracChangeset for help on using the changeset viewer.