================================================================================
This is C# implementation of OpenHPI baselib.
The implementation is an assembly named openhpi_baselib.dll.
The implementation has been tested with Mono-2.10.8 and Visual C# 2008/2010.

================================================================================
Build and Install Instructions:

With Mono:
- Configure MCS and MONO(optional) paths in Makefile.
- Run "make openhpi_baselib"

With Visual C#:
- Create assembly project
- Include all .cs files from openhpi_baselib dir to the project
- Set output assembly name to "openhpi_baselib"
- Build the project

================================================================================
Usage Example:

See example.cs as an example of using the C# OpenHPI baselib.
Run "make example" to compile it.

See example_iterators.cs as an example of using the C# OpenHPI iterators.
See example_handlers.cs as an example of using the oHpiHandler*() API.

Default domain address is "localhost" or OPENHPI_DAEMON_HOST env. var. value.
Default domain address is 4743 or OPENHPI_DAEMON_PORT env. var. value.

================================================================================
Datatypes and API Representation:

All SAF HPI integer data types:
- SaHpiBoolT, SaHpiUint8(16,32,64)T, SaHpiInt8(16,32,64)T, enum types
are mapped to C# long type.
One exception: arrays of SaHpiUint8T are mapped to C# byte[] type.

Every SAF HPI struct or union is mapped to C# class.
The class name is the same as for the corresponding SAF HPI struct or union.
The class contais only public fields with the same names as 
the corresponding SAF HPI struct or union fields have. 

SAF HPI constants are defined in the HpiConst class.
OpenHPI-specific constants are defined in the OHpiConst class.

SAF HPI API and OpenHPI API are defined in the Api class. 

API parameters are mapped as the following:
- SAHPI_IN parameter is mapped to the ordinary C# function parameter.
- SAHPI_INOUT parameter is mapped to ref C# function parameter.
- SAHPI_OUT or SAHPI_OUTNN parameter is mapped to out C# function parameter.
So there is no need for user to allocate memory for output parameters.

Example:

SaErrorT SAHPI_API saHpiGetIdByEntityPath (
    SAHPI_IN    SaHpiSessionIdT    SessionId,
    SAHPI_IN    SaHpiEntityPathT   EntityPath,
    SAHPI_IN    SaHpiRdrTypeT      InstrumentType,
    SAHPI_INOUT SaHpiUint32T       *InstanceId,
    SAHPI_OUT   SaHpiResourceIdT   *ResourceId,
    SAHPI_OUT   SaHpiInstrumentIdT *InstrumentId,
    SAHPI_OUT   SaHpiUint32T       *RptUpdateCount
);

is represented as

public static long saHpiGetIdByEntityPath(
    long SessionId,
    SaHpiEntityPathT EntityPath,
    long InstrumentType,
    ref long InstanceId,
    out long ResourceId,
    out long InstrumentId,
    out long RptUpdateCount
)

================================================================================
Utilities:

HpiUtil class provides the following utility functions:

- Set of functions for checking validity of an object of
a complex HPI data type X (representation of SAF HPI struct X):
-- public static bool Check( X x )
--- The validation checks are:
---- x is not null
---- Any member of x that is of a complex data types is valid
---- If a member of x is a SaHpiUint8T[] array then the array length is valid.

- Set of functions for checking validity of an object of
a complex HPI data type X (representation of SAF HPI union X):
-- public static bool Check( X x, long mod )
---- x is not null
---- A member of x that matches modifier mod and is of a complex data types
is valid
---- If a member of x that matches modifier mod is a SaHpiUint8T[] array then
the array length is valid.

- For string <-> integer HPI Data Type X conversion:
-- public static string FromX( long x ) - (for example FromSaHpiEventCategoryT)
-- public static long ToX( string s )   - (for example ToSaHpiEventCategoryT)

- For string <-> complex HPI Data Type conversion:
-- public static string FromSaHpiTextBufferT( SaHpiTextBufferT tb )
-- public static SaHpiTextBufferT ToSaHpiTextBufferT( string s )
-- public static string FromSaHpiEntityPathT( SaHpiEntityPathT ep )
-- public static SaHpiEntityPathT ToSaHpiEntityPathT( string s )

- For making unspecified, empty entity path and for entity path cloning:
- public static SaHpiEntityPathT MakeUnspecifiedSaHpiEntityPathT()
- public static SaHpiEntityPathT MakeRootSaHpiEntityPathT()
- public static SaHpiEntityPathT CloneSaHpiEntityPathT( SaHpiEntityPathT ep )

================================================================================
Current Limitations:

- Only oHpiVersionGet(), oHpiDomainAdd() and oHpiHandler*() OpenHPI API are supported
- openhpiclient.conf is not supported

================================================================================
TODO List:

- Implemented openhpiclient.conf support
- Implement the rest of OpenHPI API
- Domain ID translation for SAF HPI API
- Entity root translation for SAF HPI API
- XTCA entity types in HpiUtils

