|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T i
Length: 4149 (0x1035) Types: TextFile Names: »image.h++«
└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki └─⟦this⟧ »EUUGD11/euug-87hel/sec1/image/varc++/image.h++«
#ifndef IMAGE_H #define IMAGE_H /* This file contains the definitions for the generic stuff for handling images */ /* define cardinal as integer (later I might want to implement a type of integer that does bounds checking) */ typedef int card; /* tolerance for equality in floating point */ static const double EPSILON = 0.0000001; /* Infinite loop (real useful) */ #define LOOP for(;;) /* define some constants for unbuffered io */ static const int inputd = 0; static const int outputd = 1; static const int errord = 2; /* define some system routines */ int read ( int fd , void * buffer , int size ); int write ( int fd , void * buffer , int size ); /* The operations that can be applied when creating the window. one can read in an image or create one. */ enum create_image_type { CREATE = 7 }; enum read_image_type { READ = 4 }; /* protection for images */ enum image_prot { CAN_READ = 1 , CAN_WRITE = 2 , CAN_READ_AND_WRITE = 3 , CAN_NOT_DO_ANYTHING = 4 }; /* useful for determining the status of data structures */ enum status { INITIALIZED = 8 , UNINITIALIZED = 16 }; /* This is the abstract data type for any image Actually objects of this type are not useful it is meant to have derived types */ class image_class { public: card number_rows; // number rows in image card number_cols; // number of collumns in image void * header_info ; // any further header information required by implementation image_prot prot; // the protection of the image card comment_length; // the length of the comments char * comments ; // comments about the image status image_status; // determines when image data is initialized /* position in image */ status window_status; // determines when the window has been initialized card collumn; // the collumn card row; // the row card window_width; // width of possible window in image card window_length; // length of possible window in image FILE * file; // file associated with image /* constructors for images */ /* constructor when reading an image from a file */ image_class ( const read_image_type rit , // marker that the image is being read const FILE * image_file , // file for image const card w_width , // window width const card w_length // window length ); /* constructor for creating a new image */ image_class ( const create_image_type cit, // maker that the image is being created const FILE * image_file , // the file for the image const card n_rows , // the number of rows in the image const card n_cols , // the number of collumns in the image const card w_width , // the width of the window const card w_length // the length of the window ); /* destructor for images */ ~image_class () { ; } /* comment manipulation */ /* sets the comments */ void set_comments( char * string , const card length ); /* adds a string to the comments */ void add_comment( char * string , const card length ); /* for moving around in an image */ /* move in row n steps returns 1 when that motion is legal 0 otherwise */ virtual int move_collumn ( const int n ) ; /* move in collumn n steps returns 1 when that motion is legal 0 otherwise */ virtual int move_row ( const int n ) ; /* move to specified row */ virtual void move_to_row ( const card n ) ; /* move to specified collumn */ virtual void move_to_collumn ( const card n ) ; /* routine to write out the image to a file */ virtual void write ( ) ; /* change the protection from CAN_WRITE to CAN_READ_AND_WRITE */ virtual void read_and_write ( ); }; /* returns a null terminated string for comments */ const char * comment_string ( image_class& i ); #endif IMAGE_H /* Copyright (C) 1986, David Sher in the University of Rochester Permission is granted to any individual or institution to use, copy, or redistribute this software so long as it is not sold for profit, provided this copyright notice is retained. */