[ Home | About | Tech Info & Data | Publications | References ] [ Site by Jeffrey Hall | Research funded by NSF ]
The Filelink class is a generic file I/O class. It inherits Root.
This class associates its child object with a disk file. It does not perform any excessively complex operations; its purpose is to encapsulate frequently used (and frequently miscoded) IDL file association commands into a simple command interface.
The class keeps track of which file is associated with the object via the data member fileName, when the file was last modified, and whether is has been modified since the object was created, encapsulating the opening and closing commands for consistent allocation and freeing of LUNs.
2008 July 07 - Documentation written.
string fileName
long lun
double lastMod
bool isMod
Calls Root::cleanup
Destructor. Clears its history list by calling Root::clear_history via Root::cleanup. Never call this procedure directly; it is invoked by IDL's Obj_Destroy function.
Calls Root::add_history
Return bool b
Closes the data file fileName and free the LUN associated with the stream. An error is written to the history list if there is an IO error.
Structure definition. Specifies the contents of the IDL structure instantiated by the Filelink class. Used by Obj_New; do not invoke directly.
Calls Root::dump_stat
This is a standard OIL class method. It dumps the current state of the object's data members, followed by those of the Root object, to the command output window. The dump will look best if the output font is fixed rather than proportional width.
Return string fileName
Returns the object's fileName data member, containing the file name to which the object is linked.
keyword string fileName
keyword struct _EXTRA
Return bool TRUE
Constructor. The keyword fileName is used to supply an initial value for the filename. If it is not set, the filename will be initialized to 'NULL' (this will also add an !OIL_WRN to the history list noting this). Never call this function directly; it is invoked by IDL's Obj_New function.
Return bool isMod
Returns the object's isMod data member.
Calls Root::add_history, Root::is_valid
Return long[2] valid
Each OIL class has an is_valid function that performs class-specific tests on its data members. If all members are found to be valid, however validity is defined for that class, this funtion returns 1. Otherwise, a negative number is returned that contains a bitwise combination of all errors detected. In the case of Filelink, the error codes are: -1 (filename is NULL) or -2 (isMod is not a Boolean value). The Filelink override of this function returns a two-element array of longs, the first element containing the validity state of the Root, and the second that of the Filelink. An event is written to the log if the Filelink is invalid.
Calls Root::add_history
Sets the value of the object's lastMod and isMod data members to the time of modification and !TRUE, respectively.
keyword bool w
keyword bool a
Calls Root::add_history
Return bool b
Opens the file fileName for writing (if the w keyword is set) or in append mode (if the a keyword is set). An error is written to the history list if there is an IO error.
argument string filename
Calls modified, Root::add_history
Sets the value of the object's f data member, the file name associated with the object.
Calls Root::add_history
Return bool, struct fs
Runs the IDL routine FStat on a file, returning !FALSE if no file is open.
obj = Obj_New( 'Filelink', fileName = 'C:\mydir\somefile' )
Obj_Destroy( obj )