|
Developer Documentation |
|||||||||
| prev file | next file | ||||||||||
| SUMMARY: fields | routine DETAILS: routine | ||||||||||
./toolbox/io index_file_section__define.pro
This is the base class for managing a section in an index file. Sections are started with a line: '[section_name]'. This class manages all basic i/o functions for a section. See UML for all IO Classes
| Fields Summary | |
|
LINES_INCR |
number of lines that buffers grow by internally as necessary. Placed here for consistency only. |
|
MAX_LINE_WIDTH |
maximum number of chars allowed on each line |
|
NUM_LINES |
the current number of lines in this section |
|
FILENAME |
full pathname to the file where this section resides |
|
SECTION_MARKER |
name of section |
|
LINE_NUMS |
pointer to an array of indicies locating each line in file (line #s zero based) |
|
ALL_LINES |
pointer to an array holding all lines in this section - not normally used except during testing. Derived classes should NOT rely on this. |
|
SECTION_READ |
boolean flag for wether section is in memory or not |
|
ALLOW_APPEND |
boolean flag for wether this section allows appends |
|
PAD_WIDTH |
boolean flag determines wether lines are padded to max width |
|
DEBUG |
boolean flag for wether this class is verbose or not |
| Routine Summary 27 routines |
procedure index_file_section__define | |
This is the base class for managing a section in an index file. |
function INDEX_FILE_SECTION::init(section, filename) | private |
Class Constructor |
procedure INDEX_FILE_SECTION::cleanup | private |
Class Destructor |
procedure INDEX_FILE_SECTION::set_file_name, file_name | |
Sets file name of file to be written to |
procedure INDEX_FILE_SECTION::pad_width_on | |
Sets object to pad lines written with spaces to their max width |
procedure INDEX_FILE_SECTION::pad_width_off | |
Sets object to NOT pad lines written with spaces to their max width |
procedure INDEX_FILE_SECTION::create[, start_line_number], [lines=string array], [append=bool], not_in_memory=not_in_memory | |
Creates the section in the file. |
function INDEX_FILE_SECTION::pad_line(line) | |
Adds extra blank characthers to end of given line, if this line is less then the max line width. |
function INDEX_FILE_SECTION::has_valid_lines() | |
Tests the validity of the pointer to array of lines in section |
function INDEX_FILE_SECTION::has_valid_line_numbers() | |
Tests the validity of the pointer to array of line numbers in section |
function INDEX_FILE_SECTION::get_line_nums([count]) | |
Retrieves the location of each section line in the file |
function INDEX_FILE_SECTION::get_num_lines() | |
Retrieves the number of lines in this section |
procedure INDEX_FILE_SECTION::increment_num_lines | private |
Increments the number of lines this class believes are in the section. |
function INDEX_FILE_SECTION::count_section_lines() | |
Counts lines in the section, not including the section line itself |
function INDEX_FILE_SECTION::get_lines([count]) | |
Retrieves array of lines in section; commented out lines are not included. |
procedure INDEX_FILE_SECTION::process_line, line, index | |
Procedure to process each line. |
function INDEX_FILE_SECTION::read_file([max_nrows=long]) | |
Reads the file, locates the section, and loads all lines and metainfo into objects memory |
procedure INDEX_FILE_SECTION::go_to_line, line_number, lun | private |
Advances file pointer to right before the line number parameter. |
function INDEX_FILE_SECTION::get_index_by_location(location) | |
Retrurns the index associated with the given location in the file, the line number. |
procedure INDEX_FILE_SECTION::set_line, line_number, line[, line_index] | |
Replaces a line already in the index with a new string. |
function INDEX_FILE_SECTION::get_current_file_length() | |
Uses the line numbers in memory to return what the last line number is for the file |
procedure INDEX_FILE_SECTION::append_lines, lines | |
Appends lines to end of section (if allowed). |
procedure INDEX_FILE_SECTION::set_debug_on | |
Makes object verbose |
procedure INDEX_FILE_SECTION::set_debug_off | |
Makes object quiet |
function INDEX_FILE_SECTION::is_section_read() | |
Has the section been read? |
procedure INDEX_FILE_SECTION::set_allow_append_on | |
Set this if the section can be appended to |
procedure INDEX_FILE_SECTION::show_state | |
Print out useful debugging information |
| Routine Details |
| index_file_section__define |
procedure index_file_section__define |
This is the base class for managing a section in an index file. Sections are started with a line: '[section_name]'. This class manages all basic i/o functions for a section. See UML for all IO Classes
| INDEX_FILE_SECTION::init | private |
Class Constructor
| Parameters | |
|
section |
. |
|
filename |
. |
| INDEX_FILE_SECTION::cleanup | private |
procedure INDEX_FILE_SECTION::cleanup |
Class Destructor
| INDEX_FILE_SECTION::set_file_name |
procedure INDEX_FILE_SECTION::set_file_name, file_name |
Sets file name of file to be written to
| Parameters | |
|
file_name |
name of index file |
| INDEX_FILE_SECTION::pad_width_on |
procedure INDEX_FILE_SECTION::pad_width_on |
Sets object to pad lines written with spaces to their max width
| INDEX_FILE_SECTION::pad_width_off |
procedure INDEX_FILE_SECTION::pad_width_off |
Sets object to NOT pad lines written with spaces to their max width
| INDEX_FILE_SECTION::create |
procedure INDEX_FILE_SECTION::create[, start_line_number], [lines=string array], [append=bool], not_in_memory=not_in_memory |
Creates the section in the file.
| Parameters | |
|
start_line_number |
what line to start section on in file |
| INDEX_FILE_SECTION::pad_line |
function INDEX_FILE_SECTION::pad_line(line) |
Adds extra blank characthers to end of given line, if this line is less then the max line width.
| Parameters | |
|
line |
line to pad |
| INDEX_FILE_SECTION::has_valid_lines |
function INDEX_FILE_SECTION::has_valid_lines() |
Tests the validity of the pointer to array of lines in section
| INDEX_FILE_SECTION::has_valid_line_numbers |
function INDEX_FILE_SECTION::has_valid_line_numbers() |
Tests the validity of the pointer to array of line numbers in section
| INDEX_FILE_SECTION::get_line_nums |
function INDEX_FILE_SECTION::get_line_nums([count]) |
Retrieves the location of each section line in the file
| Parameters | |
|
count |
number of line_nums |
| INDEX_FILE_SECTION::get_num_lines |
function INDEX_FILE_SECTION::get_num_lines() |
Retrieves the number of lines in this section
| INDEX_FILE_SECTION::increment_num_lines | private |
procedure INDEX_FILE_SECTION::increment_num_lines |
Increments the number of lines this class believes are in the section.
| INDEX_FILE_SECTION::count_section_lines |
function INDEX_FILE_SECTION::count_section_lines() |
Counts lines in the section, not including the section line itself
| INDEX_FILE_SECTION::get_lines |
function INDEX_FILE_SECTION::get_lines([count]) |
Retrieves array of lines in section; commented out lines are not included. This only works for testing and it should be replaced by the suitable version for any derived class as necessary.
| Parameters | |
|
count |
number of lines returned |
| INDEX_FILE_SECTION::process_line |
Procedure to process each line. Invoked by index_file_section::read_file. This is a dummy version that must be replaced by any derived class wanting to make use of read_file.
| Parameters | |
|
line |
The line to handle. |
|
index |
The index number for this line |
| INDEX_FILE_SECTION::read_file |
function INDEX_FILE_SECTION::read_file([max_nrows=long]) |
Reads the file, locates the section, and loads all lines and metainfo into objects memory
| Keywords | |
|
max_nrows |
Maximum number of rows to read. |
| INDEX_FILE_SECTION::go_to_line | private |
procedure INDEX_FILE_SECTION::go_to_line, line_number, lun |
Advances file pointer to right before the line number parameter. To be used to write to a specific line in file. File must be opened beforehand and closed after call. This is something that idl should provide.
| Parameters | |
|
line_number |
line number to go to (0-based) |
|
lun |
Already opened file unit number |
| INDEX_FILE_SECTION::get_index_by_location |
function INDEX_FILE_SECTION::get_index_by_location(location) |
Retrurns the index associated with the given location in the file, the line number.
| Parameters | |
|
location |
the file line number |
| INDEX_FILE_SECTION::set_line |
procedure INDEX_FILE_SECTION::set_line, line_number, line[, line_index] |
Replaces a line already in the index with a new string.
| INDEX_FILE_SECTION::get_current_file_length |
function INDEX_FILE_SECTION::get_current_file_length() |
Uses the line numbers in memory to return what the last line number is for the file
| INDEX_FILE_SECTION::append_lines |
procedure INDEX_FILE_SECTION::append_lines, lines |
Appends lines to end of section (if allowed). Keeps objects memory in sync with section
| Parameters | |
|
lines |
lines to append to section |
| INDEX_FILE_SECTION::set_debug_on |
procedure INDEX_FILE_SECTION::set_debug_on |
Makes object verbose
| INDEX_FILE_SECTION::set_debug_off |
procedure INDEX_FILE_SECTION::set_debug_off |
Makes object quiet
| INDEX_FILE_SECTION::is_section_read |
function INDEX_FILE_SECTION::is_section_read() |
Has the section been read?
| INDEX_FILE_SECTION::set_allow_append_on |
procedure INDEX_FILE_SECTION::set_allow_append_on |
Set this if the section can be appended to
| INDEX_FILE_SECTION::show_state |
procedure INDEX_FILE_SECTION::show_state |
Print out useful debugging information