Click or drag to resize
PFSBuilder Class
The PFSBuilder is a class that can build a PFS structure in a "line by line" manner.
Inheritance Hierarchy
SystemObject
  DHI.PFSPFSBuilder

Namespace: DHI.PFS
Assembly: DHI.PFS (in DHI.PFS.dll) Version: 16.0.0.0 (11.1.1.1111)
Syntax
public class PFSBuilder : IPFSBuilder

The PFSBuilder type exposes the following members.

Constructors
  NameDescription
Public methodPFSBuilder
Creates a new PFSFile object.
Top
Methods
  NameDescription
Public methodAddBool
Add a Boolean value to keyword.

The Boolean value is written true or false.

Restrictions: The function is only valid within the scope of a keyword.

Public methodAddClob
Add a Clob parameter to keyword

Restrictions: The function is only valid within the scope of a keyword.

Public methodAddClobBool
Add a bool value to the current Clob parameter.

Restrictions: The function is only valid within the scope of a Clob.

Public methodAddClobDouble
Add a double precision floating-point (real) value to Clob.

Restrictions: The function is only valid within the scope of a Clob.

Public methodAddClobFilename
Add a file name value to Clob.

Restrictions: The function is only valid within the scope of a Clob.

Public methodAddClobFloat
Add a single precision floating-point (real) value to Clob.

Restrictions: The function is only valid within the scope of a Clob.

Public methodAddClobInt
Add an integer (4 byte) value to the current Clob parameter.

Restrictions: The function is only valid within the scope of a Clob.

Public methodAddClobString
Add a string value to Clob.

Restrictions: The function is only valid within the scope of a Clob.

Public methodAddDouble
Add a double precision floating-point (real) value to keyword.

The output format is some 'default' format. Check if it may cause loss of precision.

Restrictions: The function is only valid within the scope of a keyword.

Public methodAddFileName
Add a filename (string) value parameter to keyword.

A file name string is in general a relative path string, relative to the pfs file at hand. If an absolute file name is entered, the PFS system will try to make the path relative to the pfs file, when the pfs file is written to disc, hence the relative string value in the PFS file will depend on the location of the pfs file for absolute file names.

Restrictions: The function is only valid within the scope of a keyword.

Public methodAddInt
Add a four-byte integer to keyword.

Restrictions: The function is only valid within the scope of a keyword

Public methodAddKeyword
Add a keyword to a section, ie the start of a list of parameter list.

This function is used to define the start of a list of parameters. It has no end-counterpart, and the keyword scope is automaticalle "ended" by any other keyword or section related method.

Restrictions: This function must be called within the scope of a section.

Public methodAddSection
Start a new section within the scope of a target/section
Public methodAddString
Add a null-terminated character string to keyword.

Restrictions: The function is only valid within the scope of a keyword.

Public methodAddTarget
Add a new target (top-level section) to a parameter file object.

This function is always the first function to be called, and the target definition must be terminated by a pfsEndSection.

A target is ended by calling EndSection

Restrictions: Possible previous targets must be have been properly terminated by calls to pfsEndSection.

Public methodAddUndefinedPar
Add an undefined parameter to keyword.

Undefined can mean different things for different applications, though the most common is "use default value". Before using the undefined parameter, be sure that the model/tool that uses the PFS file supports handling undefined parameters.

Restrictions: The function is only valid within the scope of a keyword.

Public methodEndSection
Terminate a target or a section.

Restrictions: Each pfsEndSection must match a pfsAddTarget or a pfsAddSection.

Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetInternalHandlePointer
Get the underlying internal PFS handle pointer.

For internal use only

Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodWrite
Write the contents of a PFS object to file
Top
Extension Methods
  NameDescription
Public Extension MethodAddDate
Add a date as 3 integers (yyyy, MM, dd). The time part is ignored

Restrictions: The function is only valid within the scope of a keyword.

(Defined by PFSExtensions.)
Public Extension MethodAddDateTime
Add a date and time as 6 integers (year, month, day, hours, minutes, seconds).

Restrictions: The function is only valid within the scope of a keyword.

(Defined by PFSExtensions.)
Public Extension MethodAddDouble(IEnumerableDouble)Overloaded.
Add a number of double precision floating-point (real) values.

The output format is some 'default' format. Check if it may cause loss of precision.

Restrictions: The function is only valid within the scope of a keyword.

(Defined by PFSExtensions.)
Public Extension MethodAddDouble(Double)Overloaded.
Add a number of double precision floating-point (real) values.

The output format is some 'default' format. Check if it may cause loss of precision.

Restrictions: The function is only valid within the scope of a keyword.

(Defined by PFSExtensions.)
Public Extension MethodAddInt(IEnumerableInt32)Overloaded.
Add a number of four-byte integer.

Restrictions: The function is only valid within the scope of a keyword

(Defined by PFSExtensions.)
Public Extension MethodAddInt(Int32)Overloaded.
Add a number of four-byte integer.

Restrictions: The function is only valid within the scope of a keyword

(Defined by PFSExtensions.)
Public Extension MethodAddKeywordValues
Define a keyword, and adds a number of default type of parameters. A convenience method that will call the appropriate Add method for the provided type.

Each parameter must be one of the types:

It can not handle filenames and CLOBs.

Restrictions: This function must be called within the scope of a section.

(Defined by PFSExtensions.)
Public Extension MethodAddTime
Add a time as 3 integers (hours, minutes, seconds). The date part is ignored

Restrictions: The function is only valid within the scope of a keyword.

(Defined by PFSExtensions.)
Top
Examples
Example on writing a simple PFS file:
PFSBuilder builder = new PFSBuilder();
builder.AddTarget("Run11");
// Add keyword and parameters
builder.AddKeyword("key1");
builder.AddInt(2);
builder.AddBool(true);
// Add keyword and parameters in once call
builder.AddKeywordValues("key2", 3.3, 4, "someText");

// Add subsections
builder.AddSection("Results");
builder.AddSection("Result");
builder.AddKeywordValues("outid", "default out");
// File name parameter
builder.AddKeyword("file");
builder.AddFileName(@".\output.res11");
builder.EndSection();
builder.EndSection();

// End target section (Run11)
builder.EndSection();
See Also