DfsFile Class |
This dfs file is of the type: all items, fixed space.
Namespace: DHI.Generic.MikeZero.DFS
The DfsFile type exposes the following members.
Name | Description | |
---|---|---|
![]() | FileInfo |
Information in the header.
|
![]() | FileMode |
Mode that the file was opened in.
(Inherited from DfsAbstractFile.) |
![]() | FileName |
Name of file
(Inherited from DfsAbstractFile.) |
![]() | ItemInfo |
List of dynamic item info's.
|
Name | Description | |
---|---|---|
![]() | Close |
Close the file
(Overrides DfsAbstractFileClose.) |
![]() | DfsCurrentVersion |
Returns the current version of the Dfs file library
|
![]() | Dispose |
Close file and release ressources on the unmanaged side.
|
![]() | Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) |
![]() | FindItem |
Positions the file pointer at the location in the file where the specified item at the specified time step starts.
|
![]() | FindTimeStep |
Positions the file pointer at the location in the file where the the specified time step starts.
|
![]() | Flush |
Flush cached data to the file. This will especially update the header information,
such that if another process is reading the file while it is being read, the new
header information can be retrieved.
|
![]() | FlushTimeStep |
Flush cached data to the file. This will update the time part of the header information,
but not other parts of the header.
Compared to the Flush method; the Flush will update statistics of all items (if enabled) and all modifications to the header data. This method will only update the time part. The Flush method can be an expensive operations especially for files with many dynamic items. This method is independent of the file at hand. |
![]() | GetHashCode | Serves as the default hash function. (Inherited from Object.) |
![]() | GetNextItemNumber |
Get the number of the next item to be read.
|
![]() | GetNextTimeStepIndex |
Get the index of the next time step to be read.
If the next item is a static item, this will return -1;
|
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | ReadItemTimeStep(Int32, Int32) |
Reads the dynamic item-timestep as specified from the file. It throws an
exception if itemNumber or timestepIndex
is out of range.
|
![]() | ReadItemTimeStep(IDfsItemData, Int32) |
Read the specified item and time step. With this you can reuse
the data buffer in IDfsItemData, Data.
The data is updated in place.
If the data from a timestep is to be stored, the user is responsible to copy the data before using this method again. The itemData must origin from the dfs file at hand, either returned by another ReadItemTimeStep call, or by use of a CreateEmptyItemData |
![]() | ReadItemTimeStepNext | |
![]() | ReadStaticItem |
Read the number staticItemNo static item from the file.
|
![]() | ReadStaticItemNext | |
![]() | Reset |
Resets the file pointer to point on the first dynamic item time step in the file.
Can also be used if it is required to restart reading the static items. |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
![]() | WriteItemTimeStep |
Writes data to the specified item and timestep in the file.
If the item-timestep exists already, data is updated. If it does not exist, the item number and timestep index must match exactly the next item-timestep after the last one in the file. The size of the data must match the data size of the item that is to be written. The time value is only relevant for files with non-equidistant time axis. For files with an equidistant time axis, the time value is ignored, and a zero can be used. |
![]() | WriteItemTimeStepNext | Writes the next dynamic item-timestep. If the file pointer points to the end of the file, this will append a new item-timestep to the file. If the file pointer points to an existing item-timestep, the data of that item-timestep is updated. Remember that the file pointer position depends on the mode that the file was opened: In edit mode the file pointer points at the first item-timestep. In append mode the file pointer points initially at the end of file. It iterates over the item-timesteps as the ReadItemTimeStepNext, see there for more details. This is the most efficient way to iterate through and update/append the items and timesteps in a file, since it iterates exactly as the data is stored on the disk. The size of the data must match the data size of the item that is to be written. The time value is only relevant for files with non-equidistant time axis. For files with an equidistant time axis, the time value is ignored, and a zero can be used. |
![]() | WriteStaticItemData |
Write the static item back to the file. the staticItem must
originate from this file. This will update and overwrite the static item information and
the data of the static item.
|
Name | Description | |
---|---|---|
![]() | CreateEmptyItemData(Int32) | Overloaded.
Create an IDfsItemDataT of the correct type for the
item with the given itemNumber.
(Defined by DfsExtensions.)The result can be used by ReadItemTimeStep(IDfsItemData, Int32) |
![]() | CreateEmptyItemDataT(Int32) | Overloaded.
Create an IDfsItemDataT of the correct type for the
item with the given itemNumber.
(Defined by DfsExtensions.)The result can be used by ReadItemTimeStep(IDfsItemData, Int32) If not the item is of type {T}, an exception will be thrown. |
![]() | CreateEmptyItemDatas | Overloaded.
Create an IDfsItemDataT of the correct type for each of the
dynamic items in the file.
(Defined by DfsExtensions.)The result can be used by ReadItemTimeStep(IDfsItemData, Int32) |
![]() | CreateEmptyItemDatasT | Overloaded.
Create an IDfsItemDataT of the provided type for each of the
dynamic items in the file.
(Defined by DfsExtensions.)The result can be used by ReadItemTimeStep(IDfsItemData, Int32) If not all items are of type {T}, an exception will be thrown. |
![]() | Search(DateTime) | Overloaded.
Searches the dfs file for the time step index of a time,
and returns the zero-based time step index. The time axis of the file
must be a calendar type time axis
(Defined by DfsExtensions.)NOTE: For the non-equidistant time axes, the metod will read the first item in the file for a number of timesteps in random order, performing a binary search in the file data on disc. This will be slow if used many times on the same file. In such a case, use the lazy version of GetDateTimes(IDfsFile, Boolean) or GetDateTimes(IDfsFile, DateTime, Boolean). For the equidistant time axis, the method will calculate the time step index directly without reading data from the file. |
![]() | Search(Double) | Overloaded.
Searches the dfs file for the time step index of a time,
and returns the zero-based time step index.
(Defined by DfsExtensions.)NOTE: For the non-equidistant time axes, the metod will read the first item in the file for a number of timesteps in random order, performing a binary search in the file data on disc. This will be slow if used many times on the same file. In such a case, use the lazy version of GetDateTimes(IDfsFile, Boolean) or GetDateTimes(IDfsFile, DateTime, Boolean). For the equidistant time axis, the method will calculate the time step index directly without reading data from the file. |