OOSTAR - More Details

Last Update Nov. 07, 1995
CIF Editor

Objective C versus C++

OOSTAR is an object oriented tool set for STAR representation written in Objective-C. We conclude that Objective-C offers advantages over the more popular object oriented language, C++. These advantages including a) loose typing system. b) run-time type checking, and c) better message passing ability.

Objective-C is a loose typing system while C++ is a strong typing language. Loose typing allows software designers to delay the design decisions and results in a flexible software system that is capable of adapting to various applications. Strong typed systems, on the other hand, result in a more efficient application by constraining the design decision ahead of time. Loose typing language usually also have the ability of query typing information at run-time. Objective-C provide a run- time library that enables a software system to query the meta information of objects at run-time, while C++ provide relatively weak run-time typing support. Message passing is one of the major benefits of the object oriented approach. C++ supports message passing through the virtual method mechanism. In order for this mechanism to work, a proper class inheritance tree is pre- requisite. Objective-C dynamically interprets messages by the run- time system and does not require a supporting class inheritance tree. The design flexibility and software adaptability was an objective of this project, therefore, Objective-C was chosen.

Both C++ and Objective C have the disadvantage that they are not in common use by crystallographic programmers.

The design of the library is currently being written up for publication.

Applications

The following applications have been developed. Binaries exist for SunOS 4.1.3, otherwise source will need to be compiled after installing the GNU Objective C compiler.

Aca2Html

Convert a CIF file conforming to the dictionary developed for the ACA Montreal Meeting to HTML for use with a Web browser. This could be used as an example in understanding the approach.


Usage: Aca2Html file

where: file is the name of an ACA dictionary compliant file.

StarHtml

Convert any CIF file to an HTML file with appropriate links.


Usage: StarHtml dir dic {dic {dic} ...} {file {file} ...} 

where: dir = directory name that contains dictionaries & STAR files.
       dic = dictionary name(s).
      file = STAR file name(s).

Note: Two html files will be generated for every dictionary and STAR file plus one master html file named SFBrowser.html which points to the other two. These files will be generated in the directory dir (the current directory by default).

parser

Parse a STAR compliant file.


Usage:  parser  file

where: file is the name of a STAR file.

stargrep

Return data values associated with data names in a CIF file.


Usage: stargrep file blockname itemname 

where: file = the name of a STAR compliant file.
  blockname = the name of a block within the data file.
   itemname = the dataname(s) for which the data value(s)
                     should be returned.

Example:

$> cat ex.3

data_Ex3

loop_
_display_id
_display_object
_display_symbol
_display_colour
_display_size
_display_coord_x
_display_coord_y
loop_
_display_conn_id
_display_conn_symbol

1  text  BH    blue    5   35  70  2 1b  7 1b  8 1b 12 1b stop_
2  text  BH    blue    5   10  60  3 1b  7 1b  8 1b  8 1b stop_
3  text  BH    blue    5   10  30  4 1b  8 1b  9 1b 10 1b stop_
4  text  BH    blue    5   35  20  5 1b  9 1b 10 1b 11 1b stop_
5  text  BH    blue    5   60  30  6 1b 10 1b 11 1b 12 1b stop_
6  text  BH    blue    5   60  30  1 1b 11 1b 12 1b  7 1b stop_
7  text  BH    blue    5   35  57  9 1b stop_
15  text  Me    black   5   80  50 stop_
16  text  Me    black   5  100  50 stop_

$> stargrep ex.3 data_Ex3 _display_conn_id

2
7
8
12
.
.
.
.
.
.
11
12
7
9

startuple

Flaten the data loop structure in a STAR file and present them in a tabular form.


Usage:  startuple file blockname itemname(s) 

where: file = the name of a STAR compliant file.
  blockname = the name of a block within the data file.
   itemname = the dataname(s) for which the data value(s)
                     should be returned.

Example:


$> startuple ex.4 data_Ex3 _display_id _display_colour
_display_conn_id _display_conn_symbol

 1 blue 2 1b
 1 blue 7 1b
 1 blue 8 1b
 1 blue 12 1b
 2 blue 3 1b
 2 blue 7 1b
 2 blue 8 1b
 2 blue 8 1b
 .
 .
 5 blue 6 1b
 5 blue 10 1b
 5 blue 11 1b
 5 blue 12 1b
 6 blue 1 1b
 .
 6 blue 7 1b
 7 blue 9 1b
 15 black (null) (null)
 16 black (null) (null)