# Marine Tank Program

Topics
Overview | User Interfaces
Directory Contents | Compiling
Customizing | Config File
Database Files | Welcome Message

Overview

Aquarium water test database program. The Marine Tank Program is used to track the results of the individual water tests for marine aquariums. This example program stores and manipulates dates, strings, integer values, and floating-point values. The code has been compiled and tested under DOS, Windows 95, HPUX 10.20, and Solaris 2.4.

User interfaces

wxWindows Version:

For detailed instructions on using the wxWindows program, see the wxWindows User Interface page.

A portable windows based version was developed for Windows 95 and Motif using the "wxWindows" GUI library, version 1.68B. For more information on wxWindows, visit the wxWindows Home Site at: http://web.ukonline.co.uk/julian.smart/wxwin/. The Windows 95 version was built with Microsoft Visual C/C++ version 4.2 and tested under Windows 95A, Windows 95B, and Windows NT workstation version 4.0. The Motif version was built with HPUX C++ version 10.24 and tested under HPUX 10.20 on series 700 workstations and series 800 servers.

Curses Version:

For detailed instructions on using the Curses program, see the Curses User Interface page.

The curses version was developed for use with UNIX systems to access the database via telnet sessions. It was built with the Independent Terminal Type class and ported to DOS for testing purposes. In order for the terminal interface to work under DOS and Windows 95 the ANSI.SYS driver must be loaded.

Directory Contents

All the components of the Marine Tank Program are located in the "examples" subdirectory, under "mtank".

    base     - Source code directory for the base programs.
    bin      - Binary directory for the program executables.
    curses   - Source code and makefiles for the Curses user interface.
    db_files - Default location for the data file and the index file.
    wxwin    - Source code and makefile for the wxWindows user interface.

Compiling the applications

Curses Version:

Four makefiles are provided in the "curses" directory to compile the source code on one of four different compilers:

    "msvc40.mak"  - Makefile for Microsoft visual C/C++ 4.2
    "djgpp.mak"   - Makefile for DJGPP gcc 2.7.2.1
    "gnu_gcc.mak" - Makefile for GNU g++ 2.7.2.1
    "hpux10.mak"  - Makefile for HPUX C++ A.10.24

wxWindows Version:

Two makefiles are provided in the "wxwin" directory to compile the source code with wxWindows version 1.68B on one of two different compilers:

    "msvc40.mak"  - Makefile for Microsoft visual C/C++ 4.2
    "hpux10.mak"  - Makefile for HPUX C++ A.10.24

Building the Executable:

If you want to change the name of the executable, modify the PROJECT macro in the makefile. To compile use the "make -f" option followed by the makefile name. To compile using MSVC use the "nmake -f" option. The resulting executable will be named after the name set by the PROJECT macro in the makefile.

Installing:

Execute a "make -f (makefile name) install" to move the executable to the bin directory. A default program configuration file should exist in the "bin" directory. A copy of the program configuration is stored in the "curses" and the "wxwin" directories.

Removing the Object Files and the Executable:

To remove the object files and the executable use the "make -f" option followed by the makefile name, followed by "clean": make -f hpux10.mak clean

Under MSVC use the "nmake -f" option followed by the makefile name, followed by "clean": nmake -f msvc40.mak clean

Customizing the User Interface

To customize the application, enter the "base" directory and modify the "dbconfig.hpp" file. This file is used to set the default file locations of the database files and the program configuration file. All the global field names for controls, displays, and printing operations are set in the "dbconfig.hpp" file. Also the "dbconfig.hpp" file is used to set upper and lower limits for water test analyses.

Program Configuration Files

Both the Windows version and the Curses version share a common program configuration file. The "bin" subdirectory is the default location for the configuration file.

    Mtank.ini(DOS, Windows 95 configuration file)
    _mtank   (UNIX configuration file, must rename to .mtank)

This program will search for the its configuration file in the directory where it was executed. If the program cannot find its configuration file, it will search the environment for the MTANKCFG variable. The MTANKCFG is used to tell the program where its configuration file is if it is located in a different directory. Under UNIX a copy of the configuration file can be placed in each users directory to create a custom profile. The following are some examples of how to set a path to the program configuration file in the environment:

    POSIX compatible shell under UNIX:
    MTANKCFG=/apps/vbdbase/examples/mtank/bin/.mtank
    export MTANKCFG

    C shell under UNIX:
    setenv MTANKCFG /apps/vbdbase/examples/mtank/bin/.mtank

    Under DOS, Windows 95:
    set MTANKCFG=C:\vbdbase\examples\mtank\bin\mtank.ini

Database Files

The "db_files" subdirectory is the default location for the database files. The program uses both a data file and an index file. The data file named "mtank.pod" stores the database and the index file named "mtank.btx" stores the location of each object in the data file. Both the names and location of the database files can be changed in the program configuration file. You can use any text editor to edit the program's configuration file.

When a database file is created the binary file itself is platform independent. Different types of machines running the same version of the application compiled for that platform can access the file. This allows a single database to be distributed across the network. For example: if the main database file resides on an UNIX server then a PC client or another UNIX work station can NFS mount the directory where the database resides and use the same database.

All of the persistent objects created by the MarineTank class is managed by the Persistent Object Database manager and the Persistent base class. Files created by the POD manager are given a ".pod" extension to allow the user to identify them as POD data files. Index files created by the POD manager are given a ".btx" extenuation to allow the user to identify them as B-tree index files. An index file is a VBD file used to store the address where the object's data can be found in the data file. Index files were implemented to increase the speed of search operations.

Any files created directly with the VBD file manager are usually given a ".vbd" file extension. The POD manager and the Persistent base class gives persistent objects the ability to store complex types, pointers, and references. The VBD file manager used alone is not limited to object oriented databases. It can be used to store any type of variable length binary data. However, files created using either the POD manager or the VBD file manager will maintain the same file structure and be identified by a signature stored in the file header.

Welcome Message

The program's welcome message is only used in the Windows version. A file named "welcome.txt", located in the "bin" subdirectory by default, contains the program's welcome message. The welcome message is used to display program information when the program first starts. Both the name and location of the welcome message can be changed in the program configuration file. You can use any text editor to edit the program's configuration file and welcome message.

End Of Document