PL.Net
These classes enable InterDynamics' Planimate® platform to be integrated in dotNET projects. Code is written in C# and VS2013 projects are provided.
Planimate.Engine.PLEngineCore Class Reference

This implements communication with Planimate using callbacks and works both with Planimate being a called DLL or Planimate being the caller to dotNET. More...

Public Member Functions

delegate ePLRESULT tPL_BroadcastCallback (IntPtr broadcast, int no_params, [MarshalAs(UnmanagedType.LPArray, ArraySubType=UnmanagedType.LPStr, SizeParamIndex=1)] string[] tuple_names, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex=1)] double[] tuple_values, IntPtr user_data)
 Planimate® broadcast callback function definition More...
 
delegate ePLRESULT tPL_PauseCallback (double the_time, ePLPauseReason stop_reason, IntPtr userdata)
 Planimate has paused callback function More...
 
 PLEngineCore ()
 Engine constructor More...
 
ePLRESULT InitPLEngine (String dll_pathname, string cmdline, IntPtr window_handle)
 Initialise the Planimate® engine for use when embedding PL in a dotNET application More...
 
void InitPLEngine (IntPtr[] pl_proctable)
 Initialise this for use with an existing Planimate which is calling C# using the PLCLR bridge DLL. PLCLR attempts to call the instantiated class which should call this if the engine is required. More...
 
void TermPLEngine ()
 Clean up gracefully. This is only required if Planimate is being embedded and the caller wants to gracefully shut it down without closing themselves. More...
 
ePLRESULT RunCommand (ePLRunCMD cmd)
 Send a run command to the Planimate® engine. More...
 
void SuspendThread ()
 Suspend the engine thread. More...
 
void ResumeThread ()
 Resume the engine thread. More...
 
string PlanimateVersion ()
 Returns the Planimate® version powering the engine. More...
 
double GetSystemInfo (ePLSysInfo sysinfo_id)
 Gets Planimate® System info. Times are in seconds with 0 = the run start date More...
 
ePLRESULT SetSystemInfo (ePLSysInfo sysinfo_id, double value)
 Sets writable Planimate® System info. Times are in seconds with 0 = the run start date More...
 
IntPtr FindDataObjectName (string DO_name)
 Finds a Planimate® data object by name More...
 
eDOTypes DataObjectType (IntPtr data_object)
 Returns the data object type More...
 
int Rows (IntPtr data_object)
 Returns the number of rows in a table data object More...
 
int Columns (IntPtr data_object)
 Returns the number of columns in a table data object More...
 
string ColumnName (IntPtr data_object, int column)
 Returns the column name of the specified column More...
 
eTFUnit GetColumnFormat (IntPtr data_object, int column)
 Returns Planimate® value format of the specified column More...
 
IntPtr GetColumnLabelList (IntPtr data_object, int column)
 Returns Planimate® label list that the specified column is formatted to. More...
 
int FindColumn (IntPtr data_object, string col_name)
 Finds the column index based on the string name of the column More...
 
double GetCell (IntPtr data_object, int row, int col)
 Gets the value from a cell More...
 
ePLRESULT SetCell (IntPtr data_object, int row, int col, double data)
 Sets the value of a cell More...
 
ePLRESULT SetCell (IntPtr data_object, int row, int col, string data)
 Sets the value of a Free Text cell More...
 
string GetCellText (IntPtr data_object, int row, int col)
 Gets the text from a Free Text cell More...
 
IntPtr GetNamedLabelList (string list_name)
 Returns a label list object based on a string label list name More...
 
string LookUpLabelLValue (IntPtr data_object, Int32 index)
 Returns the label string based on a long(Int32) label index More...
 
string LookUpLabelDValue (IntPtr data_object, double index)
 Returns the label string based on a double label index More...
 
Int32 LookUpLabelIndex (IntPtr data_object, string label)
 Returns the label index based on a label string More...
 
ePLRESULT GetColumn (IntPtr data_object, int column, int rows, double[] into)
 Returns a column as an array More...
 
ePLRESULT SetColumn (IntPtr data_object, int column, int rows, double[] to)
 Sets an array to a column More...
 
ePLRESULT UpdateDataTable (ref DataTable pl_table, IntPtr data_object, Boolean formatted)
 Updates a DataTable object with data from a Planimate® data object table and returns it as a DataTable. If the DataTable is specified to be formatted, all columns will be correct .NET data formats. Unformatted data is formatted as type Double More...
 
ePLRESULT UpdateDataTable (ref DataTable rTable, string DO_name, Boolean formatted)
 Finds a Planimate® data object by name and updates the supplied DataTable. If the DataTable is specified to be formatted, all columns will be correct .NET data formats. Unformatted data is formatted as type Double More...
 
DataTable GetDataTable (IntPtr data_object, Boolean formatted)
 Gets a Planimate® data object table and returns it as a DataTable. If the DataTable is specified to be formatted, all columns will be correct .NET data formats. Unformatted data is formatted as type Double More...
 
DataTable GetDataTable (string DO_name, Boolean formatted)
 Finds a Planimate® data object by name and returns it as a DataTable. If the DataTable is specified to be formatted, all columns will be correct .NET data formats. Unformatted data is formatted as type Double More...
 
ePLRESULT SetDataTable (ref DataTable data_table, IntPtr data_object)
 Sets a Planimate® data object table and from a DataTable. More...
 
IntPtr FindBroadcastName (string BC_name)
 Returns a broadcast object based on a string broadcast name More...
 
ePLRESULT SendBroadcast (IntPtr broadcast)
 Sends a broadcast into the engine based on broadcast object More...
 
ePLRESULT SendBroadcast (string BC_name)
 Sends a broadcast into the engine based on broadcast name More...
 
ePLRESULT SendBroadcast (IntPtr broadcast, int no_params, string[] tuple_names, double[] tuple_values)
 Sends a broadcast into the engine based on broadcast object and include tuple data for the item More...
 
ePLRESULT SendBroadcast (string BC_name, int no_params, string[] tuple_names, double[] tuple_values)
 Sends a broadcast into the engine based on broadcast name and include tuple data for the item More...
 
ePLRESULT RegisterBroadcastCallback (IntPtr broadcast, tPL_BroadcastCallback callback_func)
 Broadcast callback enables a user provided function to be called every time Planimate sends a defined broadcast. Thread Notes: More...
 
ePLRESULT RegisterBroadcastCallback (string BC_name, tPL_BroadcastCallback callback_func)
 Register broadcast callback using broadcast name. More...
 
ePLRESULT RegisterPauseCallback (tPL_PauseCallback callback_func, IntPtr userdata)
 Pause callback enables a user provided function to be called every time Planimate becomes paused. This function is called in PL's thread context so do as little as possible and message to your main thread as required. More...
 
ePLRESULT ConvertStringToPLValue (string str, IntPtr val, eTFUnit format)
 Converts a string to a Planimate® value based on the specified Planimate® format More...
 
DateTime ConvertFromPLTimestamp (double timestamp)
 Converts a Planimate® timestamp (seconds) into a DateTime structure. More...
 
double ConvertToPLTimestamp (DateTime date)
 Converts a DateTime structure into a Planimate® timestamp (seconds). More...
 

Detailed Description

This implements communication with Planimate using callbacks and works both with Planimate being a called DLL or Planimate being the caller to dotNET.

Constructor & Destructor Documentation

Planimate.Engine.PLEngineCore.PLEngineCore ( )
inline

Engine constructor

Member Function Documentation

string Planimate.Engine.PLEngineCore.ColumnName ( IntPtr  data_object,
int  column 
)
inline

Returns the column name of the specified column

Parameters
data_objectPointer to Planimate® data object
columnIndex of the column
int Planimate.Engine.PLEngineCore.Columns ( IntPtr  data_object)
inline

Returns the number of columns in a table data object

Parameters
data_objectPointer to Planimate® data object
DateTime Planimate.Engine.PLEngineCore.ConvertFromPLTimestamp ( double  timestamp)
inline

Converts a Planimate® timestamp (seconds) into a DateTime structure.

Parameters
timestampPlanimate® timestamp (seconds from offset)
ePLRESULT Planimate.Engine.PLEngineCore.ConvertStringToPLValue ( string  str,
IntPtr  val,
eTFUnit  format 
)
inline

Converts a string to a Planimate® value based on the specified Planimate® format

Parameters
strString to convert
valPointer to value that will be returned (as double)
formatPlanimate® format of the string 'str'
double Planimate.Engine.PLEngineCore.ConvertToPLTimestamp ( DateTime  date)
inline

Converts a DateTime structure into a Planimate® timestamp (seconds).

Parameters
dateDateTime structure to convert
eDOTypes Planimate.Engine.PLEngineCore.DataObjectType ( IntPtr  data_object)
inline

Returns the data object type

Parameters
data_objectPointer to Planimate® data object
IntPtr Planimate.Engine.PLEngineCore.FindBroadcastName ( string  BC_name)
inline

Returns a broadcast object based on a string broadcast name

Parameters
BC_nameName of broadcast (string)
int Planimate.Engine.PLEngineCore.FindColumn ( IntPtr  data_object,
string  col_name 
)
inline

Finds the column index based on the string name of the column

Parameters
data_objectPointer to Planimate® data object
col_nameString column name of the target column
IntPtr Planimate.Engine.PLEngineCore.FindDataObjectName ( string  DO_name)
inline

Finds a Planimate® data object by name

Parameters
DO_nameString name of the Planimate® data object
double Planimate.Engine.PLEngineCore.GetCell ( IntPtr  data_object,
int  row,
int  col 
)
inline

Gets the value from a cell

Parameters
data_objectPointer to Planimate® data object (table)
rowCell row index
colCell column index
string Planimate.Engine.PLEngineCore.GetCellText ( IntPtr  data_object,
int  row,
int  col 
)
inline

Gets the text from a Free Text cell

Parameters
data_objectPointer to Planimate® data object (table)
rowCell row index
colCell column index
ePLRESULT Planimate.Engine.PLEngineCore.GetColumn ( IntPtr  data_object,
int  column,
int  rows,
double[]  into 
)
inline

Returns a column as an array

Parameters
data_objectPointer to Planimate® data object (table)
columnIndex of column in DataTable
rowsThe number of rows to return in the array
intoArray of double to place column in
eTFUnit Planimate.Engine.PLEngineCore.GetColumnFormat ( IntPtr  data_object,
int  column 
)
inline

Returns Planimate® value format of the specified column

Parameters
data_objectPointer to Planimate® data object
columnIndex of the column
IntPtr Planimate.Engine.PLEngineCore.GetColumnLabelList ( IntPtr  data_object,
int  column 
)
inline

Returns Planimate® label list that the specified column is formatted to.

Parameters
data_objectPointer to Planimate® data object
columnIndex of the column
DataTable Planimate.Engine.PLEngineCore.GetDataTable ( IntPtr  data_object,
Boolean  formatted 
)
inline

Gets a Planimate® data object table and returns it as a DataTable. If the DataTable is specified to be formatted, all columns will be correct .NET data formats. Unformatted data is formatted as type Double

Parameters
data_objectPointer to Planimate® data object (table)
formattedSpecifies if the returned DataTable should be formatted. True = format
DataTable Planimate.Engine.PLEngineCore.GetDataTable ( string  DO_name,
Boolean  formatted 
)
inline

Finds a Planimate® data object by name and returns it as a DataTable. If the DataTable is specified to be formatted, all columns will be correct .NET data formats. Unformatted data is formatted as type Double

Parameters
DO_nameString name of the Planimate® table data object
formattedSpecifies if the returned DataTable should be formatted. True = format
IntPtr Planimate.Engine.PLEngineCore.GetNamedLabelList ( string  list_name)
inline

Returns a label list object based on a string label list name

Parameters
list_nameLabel list name
double Planimate.Engine.PLEngineCore.GetSystemInfo ( ePLSysInfo  sysinfo_id)
inline

Gets Planimate® System info. Times are in seconds with 0 = the run start date

Parameters
sysinfo_idSystem info id from ePLSysInfo.
ePLRESULT Planimate.Engine.PLEngineCore.InitPLEngine ( String  dll_pathname,
string  cmdline,
IntPtr  window_handle 
)
inline

Initialise the Planimate® engine for use when embedding PL in a dotNET application

void Planimate.Engine.PLEngineCore.InitPLEngine ( IntPtr[]  pl_proctable)
inline

Initialise this for use with an existing Planimate which is calling C# using the PLCLR bridge DLL. PLCLR attempts to call the instantiated class which should call this if the engine is required.

string Planimate.Engine.PLEngineCore.LookUpLabelDValue ( IntPtr  data_object,
double  index 
)
inline

Returns the label string based on a double label index

Parameters
data_objectPointer to Planimate® data object (label list)
indexLabel index as double
Int32 Planimate.Engine.PLEngineCore.LookUpLabelIndex ( IntPtr  data_object,
string  label 
)
inline

Returns the label index based on a label string

Parameters
data_objectPointer to Planimate® data object (label list)
labelLabel string
string Planimate.Engine.PLEngineCore.LookUpLabelLValue ( IntPtr  data_object,
Int32  index 
)
inline

Returns the label string based on a long(Int32) label index

Parameters
data_objectPointer to Planimate® data object (label list)
indexLabel index as integer
string Planimate.Engine.PLEngineCore.PlanimateVersion ( )
inline

Returns the Planimate® version powering the engine.

ePLRESULT Planimate.Engine.PLEngineCore.RegisterBroadcastCallback ( IntPtr  broadcast,
tPL_BroadcastCallback  callback_func 
)
inline

Broadcast callback enables a user provided function to be called every time Planimate sends a defined broadcast. Thread Notes:

The callback will be called in the context of PL's thread. The PLBroadcast handle is unique per broadcast per thread. The userdata will be returned and is useful for passing a pointer to the class/instance.

Data must be processed/copied before returning from this function. All pointers are invalid after the callback returns.

Parameters
broadcastPointer to broadcast object
callback_funcFunction to register as callback
ePLRESULT Planimate.Engine.PLEngineCore.RegisterBroadcastCallback ( string  BC_name,
tPL_BroadcastCallback  callback_func 
)
inline

Register broadcast callback using broadcast name.

Parameters
BC_namePointer to broadcast object
callback_funcFunction to register as callback
ePLRESULT Planimate.Engine.PLEngineCore.RegisterPauseCallback ( tPL_PauseCallback  callback_func,
IntPtr  userdata 
)
inline

Pause callback enables a user provided function to be called every time Planimate becomes paused. This function is called in PL's thread context so do as little as possible and message to your main thread as required.

Parameters
callback_funcFunction to register as callback
userdataUser data
void Planimate.Engine.PLEngineCore.ResumeThread ( )
inline

Resume the engine thread.

int Planimate.Engine.PLEngineCore.Rows ( IntPtr  data_object)
inline

Returns the number of rows in a table data object

Parameters
data_objectPointer to Planimate® data object
ePLRESULT Planimate.Engine.PLEngineCore.RunCommand ( ePLRunCMD  cmd)
inline

Send a run command to the Planimate® engine.

Parameters
cmdRun command from ePLRunCMD.
ePLRESULT Planimate.Engine.PLEngineCore.SendBroadcast ( IntPtr  broadcast)
inline

Sends a broadcast into the engine based on broadcast object

Parameters
broadcastPointer to broadcast object
ePLRESULT Planimate.Engine.PLEngineCore.SendBroadcast ( string  BC_name)
inline

Sends a broadcast into the engine based on broadcast name

Parameters
BC_nameName of broadcast (string)
ePLRESULT Planimate.Engine.PLEngineCore.SendBroadcast ( IntPtr  broadcast,
int  no_params,
string[]  tuple_names,
double[]  tuple_values 
)
inline

Sends a broadcast into the engine based on broadcast object and include tuple data for the item

Parameters
broadcastPointer to broadcast object
no_paramsNumber of tuple parameters to include
tuple_namesArray of tuple names (length = no_params)
tuple_valuesArray of tuple values (length = no_params)
ePLRESULT Planimate.Engine.PLEngineCore.SendBroadcast ( string  BC_name,
int  no_params,
string[]  tuple_names,
double[]  tuple_values 
)
inline

Sends a broadcast into the engine based on broadcast name and include tuple data for the item

Parameters
BC_nameName of broadcast (string)
no_paramsNumber of tuple parameters to include
tuple_namesArray of tuple names (length = no_params)
tuple_valuesArray of tuple values (length = no_params)
ePLRESULT Planimate.Engine.PLEngineCore.SetCell ( IntPtr  data_object,
int  row,
int  col,
double  data 
)
inline

Sets the value of a cell

Parameters
data_objectPointer to Planimate® data object (table)
rowCell row index
colCell column index
dataData to write to the cell
ePLRESULT Planimate.Engine.PLEngineCore.SetCell ( IntPtr  data_object,
int  row,
int  col,
string  data 
)
inline

Sets the value of a Free Text cell

Parameters
data_objectPointer to Planimate® data object (table)
rowCell row index
colCell column index
dataData to write to the cell (string)
ePLRESULT Planimate.Engine.PLEngineCore.SetColumn ( IntPtr  data_object,
int  column,
int  rows,
double[]  to 
)
inline

Sets an array to a column

Parameters
data_objectPointer to Planimate® data object (table)
columnIndex of column in DataTable
rowsThe number of rows to set from the array
toArray of doubles to place into the column
ePLRESULT Planimate.Engine.PLEngineCore.SetDataTable ( ref DataTable  data_table,
IntPtr  data_object 
)
inline

Sets a Planimate® data object table and from a DataTable.

Parameters
data_tableReference to the DataTable to be written to Planimate®
data_objectPointer to Planimate® data object (table)
ePLRESULT Planimate.Engine.PLEngineCore.SetSystemInfo ( ePLSysInfo  sysinfo_id,
double  value 
)
inline

Sets writable Planimate® System info. Times are in seconds with 0 = the run start date

Parameters
sysinfo_idSystem info id from ePLSysInfo.
valueValue to write.
void Planimate.Engine.PLEngineCore.SuspendThread ( )
inline

Suspend the engine thread.

void Planimate.Engine.PLEngineCore.TermPLEngine ( )
inline

Clean up gracefully. This is only required if Planimate is being embedded and the caller wants to gracefully shut it down without closing themselves.

delegate ePLRESULT Planimate.Engine.PLEngineCore.tPL_BroadcastCallback ( IntPtr  broadcast,
int  no_params,
[MarshalAs(UnmanagedType.LPArray, ArraySubType=UnmanagedType.LPStr, SizeParamIndex=1)] string[]  tuple_names,
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex=1)] double[]  tuple_values,
IntPtr  user_data 
)

Planimate® broadcast callback function definition

delegate ePLRESULT Planimate.Engine.PLEngineCore.tPL_PauseCallback ( double  the_time,
ePLPauseReason  stop_reason,
IntPtr  userdata 
)

Planimate has paused callback function

ePLRESULT Planimate.Engine.PLEngineCore.UpdateDataTable ( ref DataTable  pl_table,
IntPtr  data_object,
Boolean  formatted 
)
inline

Updates a DataTable object with data from a Planimate® data object table and returns it as a DataTable. If the DataTable is specified to be formatted, all columns will be correct .NET data formats. Unformatted data is formatted as type Double

Parameters
pl_tableDataTable that will be updated
data_objectPointer to Planimate® data object (table)
formattedSpecifies if the returned DataTable should be formatted. True = format
ePLRESULT Planimate.Engine.PLEngineCore.UpdateDataTable ( ref DataTable  rTable,
string  DO_name,
Boolean  formatted 
)
inline

Finds a Planimate® data object by name and updates the supplied DataTable. If the DataTable is specified to be formatted, all columns will be correct .NET data formats. Unformatted data is formatted as type Double

Parameters
rTableDataTable that will be updated.
DO_nameString name of the Planimate® table data object
formattedSpecifies if the returned DataTable should be formatted. True = format

The documentation for this class was generated from the following file: