You are here: Start » FIL.NET » FIL.NET - FIL Relation
FIL.NET - FIL Relation
Overview
FIL.NET is an FIL wrapper which means that when we call FIL.NET functions, we actually call native FIL functions. That requires the FIL.dll library to be present in the same location as the FilNet.dll assembly when running the application that references FilNet.dll assembly.
Functions
In .NET a function must be a member of some type (which makes it a method rather than a function). Therefore while in FIL functions
may be accessed through the namespace only (e.g. fil::AddImages(...)
), in FIL.NET all the library functions are
static methods of the Invoke
class:
using Fil; // Use function AddImages to add two images. Invoke.AddImages(image1, image2, null, 1.0f, imageSum);
Types
Most of the native FIL types have their counterpart in the FilNet.Types.dll assembly. Internally, a managed type, if not a simple structure or enumeration type, may contain a native pointer to the FIL type. Because of those native pointers (unmanaged resources),
objects of those types need to be disposed properly
when not used any more to avoid memory leaks. This is guaranteed thanks to the
System.IDisposable
interface but it is the user's responsibility to call it's
Dispose method
to release resources immediately instead of leaving it to the next
Garbage Collection. This may increase the application performance. More about managing FilNet types can be found here.
Optionals and Conditionals
The FIL's ftl::Optional
and ftl::Conditional
types are mapped by the Ftl.Optional<T>
and Ftl.Conditional<T>
respectively.
The table below lists how different types are handled in FIL.NET:
FIL Type | FIL.NET Type |
---|---|
int | int |
long | long |
float | float |
double | double |
bool | bool |
ftl::String |
string |
ftl::Optional<T> |
Ftl.Optional<T> |
ftl::Conditional<T> |
Ftl.Conditional<T> |
ftl::Array<T> |
System.Collections.Generic.List<T> |
Diagnostic outputs
All diagnostic outputs in FIL.NET are of type Fil.Diagnostic<T>
, all with default value of null which makes them an optional parameters.
For T
being a reference type it is safe to pass the T
variable to arguments expecting the Fil.Diagnostic<T>
values. This is due to implicit T
to Fil.Diagnostic<T>
conversion.
For value types Fil.Diagnostic<T>
object must be created before passing to the function, otherwise implicit conversion to Fil.Diagnostic<T>
will make the function operate on the copy of the T
object
and the result will not be passed back to the original T
variable.
Arguments with default value
Like in C++ functions, there are FilNet functions with arguments having default values that can be skipped. However this feature is not reproduced in every case since C# is more restrictive about optional arguments. Namely, in FilNet, optional arguments can be found only for the following types:
- Primitive types
- Value types with value as an expression of the form
default(T)
- Reference types with
null
value Ftl.Optional<T>
withnull
valueFil.Diagnostic<T>
withnull
value
Arguments of reference types other than Ftl.Optional<T>
and Fil.Diagnostic<T>
are always required, even if the underlying C++ function have default value defined for that argument.
Previous: Getting Started with FabImage Library .NET | Next: Serialization |