buds  0.1
FORTRAN reference counted types
Modules | Data Types | Functions/Subroutines | Variables

Detailed Description

Perform file operations such as open/close/delete etc.

Exposes functionality regarding files. It allows interaction with the files in a standard way by opening, closing, deleting files in a simple and clean interface.

Collaboration diagram for File:

Modules

module  bud_file
 

Data Types

type  file
 File bud. More...
 
interface  new
 Create a new file bud. More...
 
interface  new_file
 See interface new More...
 
interface  open
 Open file via object. More...
 
interface  close
 Close file via object. More...
 
interface  rewind
 Rewind file to the beginning of the file. More...
 
interface  backspace
 Backspace the file. More...
 
interface  unopened_unit
 Retrieve new unused unit (global function) More...
 
interface  filename
 Query filename of the file bud. More...
 
interface  get_unit
 Unit of opened file bud. More...
 
interface  unit
 See interface #get_unit More...
 
interface  is_open
 Query whether file is open. More...
 
interface  exists
 Query whether file exists. More...
 
interface  is_direct
 Query file opened in DIRECT mode. More...
 
interface  is_sequential
 Query file opened in SEQUENTIAL mode. More...
 
interface  is_formatted
 Query file opened in FORMATTED mode. More...
 
interface  is_unformatted
 Query file opened in UNFORMATTED mode. More...
 
interface  get_stat
 Status of the latest action with iostat. More...
 
interface  file_delete
 Delete file on disk. More...
 
interface  print
 Print, to std-out, some basic information of the data-container. More...
 
interface  assignment(=)
 Assignment of bud to another bud. More...
 
interface  initialize
 Initialization of data container. More...
 
interface  is_initialized
 Query whether bud is associated with any data. More...
 
interface  initialized
 See interface is_initialized More...
 
interface  is_initd
 See interface is_initialized More...
 
interface  is_same
 Check whether two buds point to the same data (function) More...
 
interface  same
 See interface #is_same More...
 
interface  delete
 Deletes the bud by decreasing references to the underlying data. More...
 
interface  nullify
 Nullifies the current bud. More...
 
interface  references
 Query number of references to the bud. More...
 
interface  refs
 See interface #references More...
 

Functions/Subroutines

procedure, public delete => delete_
 See interface delete More...
 
procedure, public nullify => nullify_
 See interface nullify More...
 
procedure, public initialize => initialize_
 See interface initialize More...
 
procedure, public is_initialized => is_initialized_
 See interface is_initialized More...
 
procedure, public is_initd => is_initialized_
 See interface is_initialized More...
 
procedure, public initialized => is_initialized_
 See interface is_initialized More...
 
procedure, public is_same => is_same_
 See interface is_same More...
 
procedure, public same => is_same_
 See interface is_same More...
 
procedure, public references => references_
 See interface references More...
 
procedure, public refs => references_
 See interface references More...
 
procedure, public print => print_
 See interface print More...
 
procedure, public new => new_
 See interface new More...
 
procedure, public open => open_
 See interface open More...
 
procedure, public close => close_
 See interface close More...
 
procedure, public rewind => rewind_
 See interface rewind More...
 
procedure, public backspace => backspace_
 See interface backspace More...
 
procedure, public file => filename_
 See interface filename More...
 
procedure, public name => filename_
 See interface filename More...
 
procedure, public filename => filename_
 See interface filename More...
 
procedure, public unit => get_unit_
 See interface get_unit More...
 
procedure, nopass, public unopened_unit => unopened_unit_
 See interface unopened_unit More...
 
procedure, public is_open => is_open_
 See interface is_open More...
 
procedure, public exists => exists_
 See interface exists More...
 
procedure, public file_delete => file_delete_
 See interface file_delete More...
 
procedure, public stat => get_stat_
 See interface get_stat More...
 
subroutine new_ (this, filename)
 
subroutine new_ (this, filename)
 
subroutine open_ (this, D, form, access, action, status)
 
subroutine close_ (this)
 
subroutine rewind_ (this)
 
subroutine backspace_ (this, n)
 
integer function unopened_unit_ ()
 
pure character(len=len_trim(this%d%file)) function filename_ (this)
 
integer function get_unit_ (this)
 
integer function get_unit_ (this)
 
logical function is_open_ (this)
 
logical function exists_ (this)
 
logical function is_direct_ (this)
 
logical function is_sequential_ (this)
 
logical function is_formatted_ (this)
 
logical function is_unformatted_ (this)
 
integer function get_stat_ (this)
 
subroutine file_delete_ (this)
 
subroutine print_ (this, info, indent)
 
subroutine assign_ (lhs, rhs)
 
subroutine initialize_ (this)
 
pure logical function is_initialized_ (this)
 
pure logical function is_initialized_ (this)
 
pure logical function is_initialized_ (this)
 
elemental logical function is_same_ (lhs, rhs)
 
elemental logical function is_same_ (lhs, rhs)
 
subroutine delete_ (this)
 
elemental subroutine nullify_ (this)
 
elemental integer function references_ (this)
 
elemental integer function references_ (this)
 
subroutine initialize_ (this)
 
pure logical function is_initialized_ (this)
 
elemental logical function is_same_ (lhs, rhs)
 
subroutine delete_ (this)
 
elemental subroutine nullify_ (this)
 
subroutine assign_ (lhs, rhs)
 
elemental integer function references_ (this)
 
subroutine new_ (this, filename)
 
integer function unopened_unit_ ()
 
pure character(len=len_trim(this%d%file)) function filename_ (this)
 
integer function get_unit_ (this)
 
logical function is_open_ (this)
 
logical function exists_ (this)
 
logical function is_direct_ (this)
 
logical function is_sequential_ (this)
 
logical function is_formatted_ (this)
 
logical function is_unformatted_ (this)
 
integer function get_stat_ (this)
 
subroutine open_ (this, D, form, access, action, status)
 
subroutine close_ (this)
 
subroutine rewind_ (this)
 
subroutine backspace_ (this, n)
 
subroutine file_delete_ (this)
 
subroutine print_ (this, info, indent)
 

Variables

integer, parameter, private bud_id_len = 36
 Size of ID parameter for bud data-containers. More...
 
character(len=*), parameter, private bud_mod = "bud_" // "bud_File"
 Name of module. More...
 
character(len=*), parameter, private bud_type = "File"
 Name of bud in this module. More...
 
integer, parameter file_name_len = 256
 Maximum path length for the filenames. More...
 
type(file_), pointer d => null()
 Stored pointer which contains the reference counting etc. More...
 

Function/Subroutine Documentation

subroutine assign_ ( class(file), intent(inout)  lhs,
class(file), intent(in)  rhs 
)
private
Parameters
[in,out]lhscontains rhs after exit
[in]rhscopy the containing element bud
subroutine bud_file::assign_ ( class(file), intent(inout)  lhs,
class(file), intent(in)  rhs 
)
private
Parameters
[in,out]lhscontains rhs after exit
[in]rhscopy the containing element bud
procedure, public backspace ( )

See interface backspace

subroutine bud_file::backspace_ ( class(file), intent(inout)  this,
integer, intent(in), optional  n 
)
private
Parameters
[in,out]thisfile bud
[in]noptional=1 number of times to backspace
subroutine backspace_ ( class(file), intent(inout)  this,
integer, intent(in), optional  n 
)
private
Parameters
[in,out]thisfile bud
[in]noptional=1 number of times to backspace
procedure, public close ( )

See interface close

subroutine bud_file::close_ ( class(file), intent(inout)  this)
private
Parameters
[in,out]thisfile bud
subroutine close_ ( class(file), intent(inout)  this)
private
Parameters
[in,out]thisfile bud
procedure, public delete ( )

See interface delete

subroutine delete_ ( class(file), intent(inout)  this)
private
Parameters
[in,out]thisreturned bud is un-initialized with no data associated
subroutine bud_file::delete_ ( class(file), intent(inout)  this)
private
Parameters
[in,out]thisreturned bud is un-initialized with no data associated
procedure, public exists ( )

See interface exists

logical function bud_file::exists_ ( class(file), intent(inout)  this)
private
Parameters
[in]thisfile bud
Returns
.true. if the file exists on disk
logical function exists_ ( class(file), intent(inout)  this)
private
Parameters
[in]thisfile bud
Returns
.true. if the file exists on disk
procedure, public file ( )

See interface filename

procedure, public file_delete ( )

See interface file_delete

subroutine bud_file::file_delete_ ( class(file), intent(inout)  this)
private
Parameters
[in,out]thisfile bud
subroutine file_delete_ ( class(file), intent(inout)  this)
private
Parameters
[in,out]thisfile bud
procedure, public filename ( )

See interface filename

pure character(len=len_trim(this%d%file)) function bud_file::filename_ ( class(file), intent(in)  this)
private
Parameters
[in]thisquery filename from this file bud
Returns
filename of the file bud
pure character(len=len_trim(this%d%file)) function filename_ ( class(file), intent(in)  this)
private
Parameters
[in]thisquery filename from this file bud
Returns
filename of the file bud
integer function bud_file::get_stat_ ( class(file), intent(inout)  this)
private
Parameters
[in]thisfile bud
Returns
status from the last operation
integer function get_stat_ ( class(file), intent(inout)  this)
private
Parameters
[in]thisfile bud
Returns
status from the last operation
integer function bud_file::get_unit_ ( class(file), intent(inout)  this)
private
Parameters
[in]thisfile bud
Returns
unit of the opened file (-1 if unopened)
integer function get_unit_ ( class(file), intent(inout)  this)
private
Parameters
[in]thisfile bud
Returns
unit of the opened file (-1 if unopened)
integer function get_unit_ ( class(file), intent(inout)  this)
private
Parameters
[in]thisfile bud
Returns
unit of the opened file (-1 if unopened)
procedure, public initialize ( )

See interface initialize

subroutine initialize_ ( class(file), intent(inout)  this)
private
Parameters
[in,out]thisbud that is initialized
subroutine bud_file::initialize_ ( class(file), intent(inout)  this)
private
Parameters
[in,out]thisbud that is initialized
procedure, public initialized ( )

See interface is_initialized

logical function bud_file::is_direct_ ( class(file), intent(inout)  this)
private
Parameters
[in]thisfile bud
Returns
.true. if the file is opened in access=DIRECT mode
logical function is_direct_ ( class(file), intent(inout)  this)
private
Parameters
[in]thisfile bud
Returns
.true. if the file is opened in access=DIRECT mode
logical function is_formatted_ ( class(file), intent(inout)  this)
private
Parameters
[in]thisfile bud
Returns
.true. if the file is opened in form=FORMATTED mode
logical function bud_file::is_formatted_ ( class(file), intent(inout)  this)
private
Parameters
[in]thisfile bud
Returns
.true. if the file is opened in form=FORMATTED mode
procedure, public is_initd ( )

See interface is_initialized

procedure, public is_initialized ( )

See interface is_initialized

pure logical function is_initialized_ ( class(file), intent(in)  this)
private
Parameters
[in]thischeck if this bud is initialized
Returns
.true. if it is associated, else .false.
pure logical function is_initialized_ ( class(file), intent(in)  this)
private
Parameters
[in]thischeck if this bud is initialized
Returns
.true. if it is associated, else .false.
pure logical function is_initialized_ ( class(file), intent(in)  this)
private
Parameters
[in]thischeck if this bud is initialized
Returns
.true. if it is associated, else .false.
pure logical function bud_file::is_initialized_ ( class(file), intent(in)  this)
private
Parameters
[in]thischeck if this bud is initialized
Returns
.true. if it is associated, else .false.
procedure, public is_open ( )

See interface is_open

logical function is_open_ ( class(file), intent(inout)  this)
private
Parameters
[in]thisfile bud
Returns
.true. if the file is opened
logical function bud_file::is_open_ ( class(file), intent(inout)  this)
private
Parameters
[in]thisfile bud
Returns
.true. if the file is opened
procedure, public is_same ( )

See interface is_same

elemental logical function bud_file::is_same_ ( class(file), intent(in)  lhs,
class(file), intent(in)  rhs 
)
private
Parameters
[in]lhsfirst bud
[in]rhssecond bud
Returns
.true. if lhs and rhs point to the same data
elemental logical function is_same_ ( class(file), intent(in)  lhs,
class(file), intent(in)  rhs 
)
private
Parameters
[in]lhsfirst bud
[in]rhssecond bud
Returns
.true. if lhs and rhs point to the same data
elemental logical function is_same_ ( class(file), intent(in)  lhs,
class(file), intent(in)  rhs 
)
private
Parameters
[in]lhsfirst bud
[in]rhssecond bud
Returns
.true. if lhs and rhs point to the same data
logical function is_sequential_ ( class(file), intent(inout)  this)
private
Parameters
[in]thisfile bud
Returns
.true. if the file is opened in access=SEQUENTIAL mode
logical function bud_file::is_sequential_ ( class(file), intent(inout)  this)
private
Parameters
[in]thisfile bud
Returns
.true. if the file is opened in access=SEQUENTIAL mode
logical function is_unformatted_ ( class(file), intent(inout)  this)
private
Parameters
[in]thisfile bud
Returns
.true. if the file is opened in form=UNFORMATTED mode
logical function bud_file::is_unformatted_ ( class(file), intent(inout)  this)
private
Parameters
[in]thisfile bud
Returns
.true. if the file is opened in form=UNFORMATTED mode
procedure, public name ( )

See interface filename

procedure, public new ( )

See interface new

subroutine new_ ( class(file), intent(inout)  this,
character(len=*), intent(in)  filename 
)
private
Parameters
[in,out]thisfile bud
[in]filenamethe path this will contain
subroutine new_ ( class(file), intent(inout)  this,
character(len=*), intent(in)  filename 
)
private
Parameters
[in,out]thisfile bud
[in]filenamethe path this will contain
subroutine bud_file::new_ ( class(file), intent(inout)  this,
character(len=*), intent(in)  filename 
)
private
Parameters
[in,out]thisfile bud
[in]filenamethe path this will contain
procedure, public nullify ( )

See interface nullify

elemental subroutine nullify_ ( class(file), intent(inout)  this)
private
Parameters
[in,out]thisnullify references from this bud
elemental subroutine bud_file::nullify_ ( class(file), intent(inout)  this)
private
Parameters
[in,out]thisnullify references from this bud
procedure, public open ( )

See interface open

subroutine open_ ( class(file), intent(inout)  this,
character(len=*), intent(in), optional  D,
character(len=*), intent(in), optional  form,
character(len=*), intent(in), optional  access,
character(len=*), intent(in), optional  action,
character(len=*), intent(in), optional  status 
)
private
Parameters
[in,out]thisfile bud
[in]D(dummy argument which should NEVER be used, forces explicit interface usage)
[in]formoptional='FORMATTED' format of opened file
[in]accessoptional='SEQUENTIAL' file access pattern
[in]actionoptional='READWRITE' file R/W access
[in]statusoptional='OLD' file-existance
subroutine bud_file::open_ ( class(file), intent(inout)  this,
character(len=*), intent(in), optional  D,
character(len=*), intent(in), optional  form,
character(len=*), intent(in), optional  access,
character(len=*), intent(in), optional  action,
character(len=*), intent(in), optional  status 
)
private
Parameters
[in,out]thisfile bud
[in]D(dummy argument which should NEVER be used, forces explicit interface usage)
[in]formoptional='FORMATTED' format of opened file
[in]accessoptional='SEQUENTIAL' file access pattern
[in]actionoptional='READWRITE' file R/W access
[in]statusoptional='OLD' file-existance
procedure, public print ( )

See interface print

subroutine bud_file::print_ ( class(file), intent(inout)  this,
character(len=*), intent(in), optional  info,
integer, intent(in), optional  indent 
)
private
Parameters
[in]thisdata type
[in]infooptional="File" additional information printed
[in]indentoptional=1 possible indentation of printed statement
subroutine print_ ( class(file), intent(inout)  this,
character(len=*), intent(in), optional  info,
integer, intent(in), optional  indent 
)
private
Parameters
[in]thisdata type
[in]infooptional="File" additional information printed
[in]indentoptional=1 possible indentation of printed statement
procedure, public references ( )

See interface references

elemental integer function references_ ( class(file), intent(in)  this)
private
Parameters
[in]thisreference counted bud
Returns
number of times this has been referenced
elemental integer function bud_file::references_ ( class(file), intent(in)  this)
private
Parameters
[in]thisreference counted bud
Returns
number of times this has been referenced
elemental integer function references_ ( class(file), intent(in)  this)
private
Parameters
[in]thisreference counted bud
Returns
number of times this has been referenced
procedure, public refs ( )

See interface references

procedure, public rewind ( )

See interface rewind

subroutine rewind_ ( class(file), intent(inout)  this)
private
Parameters
[in,out]thisfile bud
subroutine bud_file::rewind_ ( class(file), intent(inout)  this)
private
Parameters
[in,out]thisfile bud
procedure, public same ( )

See interface is_same

procedure, public stat ( )

See interface get_stat

procedure, public unit ( )

See interface get_unit

procedure, nopass, public unopened_unit ( )

See interface unopened_unit

integer function unopened_unit_ ( )
private
Returns
unit currently un-used
integer function bud_file::unopened_unit_ ( )
private
Returns
unit currently un-used

Variable Documentation

integer, parameter, private bud_id_len = 36
private

Size of ID parameter for bud data-containers.

character(len=*), parameter, private bud_mod = "bud_" // "bud_File"
private

Name of module.

character(len=*), parameter, private bud_type = "File"
private

Name of bud in this module.

type(file_), pointer d => null()
private

Stored pointer which contains the reference counting etc.

integer, parameter file_name_len = 256
private

Maximum path length for the filenames.