Open Core Interface - MLPI
MLPI-MotionLogicProgrammingInterface(mlpi4COM)  1.26.2
IBuffer Interface Reference

Inherits IDispatch.

Collaboration diagram for IBuffer:
Collaboration graph

Classes

struct  TraceMessage
 

Public Types

Public Member Functions

HRESULT GetNewestMessageIndex ([out, retval] LONGLONG *newestIndex)
 
HRESULT GetOldestMessageIndex ([out, retval] LONGLONG *oldestIndex)
 
HRESULT ReadBuffer ([in] LONGLONG startIndex, [in] LONG numElements, [out, retval] SAFEARRAY(struct TraceMessage)*messages)
 

Detailed Description

Definition of the IBuffer interface to access settings of a single trace buffer.

Use the IBuffer interface to access the settings, configuration and status of a single trace buffer object.

Definition at line 71 of file IBuffer.idl.

Member Enumeration Documentation

This enumeration defines the different types of messages that can be found in a trace buffer.

Enumerator
TRACE_TYPE_OTHER 

Unspecified message type.

TRACE_TYPE_MESSAGE 

Message is log.

TRACE_TYPE_WARNING 

Message is warning.

TRACE_TYPE_ERROR 

Message is error.

Definition at line 75 of file IBuffer.idl.

Member Function Documentation

HRESULT IBuffer::GetNewestMessageIndex ( [out, retval] LONGLONG *  newestIndex)

This function returns the message index of the newest message available in the given trace buffer. You can use this information for subsequent calls to mlpiTraceReadBuffer to read the newest messages in the buffer.

Note
Each new message, that gets added to the trace buffer gets a new unique index. Indices are given in ascending order.
Parameters
[out]newestIndexIndex of the newest available trace message.
Returns
Return value indicating success (>=0) or error (<0).
Example C#:
...
// read the indices of the newest and oldest messages in the "MAIN" buffer
long newestIndex = connection.Trace.Buffers["MAIN"].GetNewestMessageIndex();
long oldestIndex = connection.Trace.Buffers["MAIN"].GetOldestMessageIndex();
// print to console
Console.WriteLine("Index of newest message in main buffer: " + newestIndex.ToString());
Console.WriteLine("Index of oldest message in main buffer: " + oldestIndex.ToString());
Note:
This method maps to the mlpiCore function mlpiTraceGetNewestMessageIndex, where you can find further documentation.
HRESULT IBuffer::GetOldestMessageIndex ( [out, retval] LONGLONG *  oldestIndex)

This function returns the message index of the oldest message available in the given trace buffer. You can use this information for subsequent calls to mlpiTraceReadBuffer to read the oldest messages in the buffer.

Note
Each new message that gets added to the trace buffer gets a new unique index. Indices are given in ascending order.
Parameters
[out]oldestIndexIndex of the oldest available trace message.
Returns
Return value indicating success (>=0) or error (<0).
Example C#:
...
// read the indices of the newest and oldest messages in the "MAIN" buffer
long newestIndex = connection.Trace.Buffers["MAIN"].GetNewestMessageIndex();
long oldestIndex = connection.Trace.Buffers["MAIN"].GetOldestMessageIndex();
// print to console
Console.WriteLine("Index of newest message in main buffer: " + newestIndex.ToString());
Console.WriteLine("Index of oldest message in main buffer: " + oldestIndex.ToString());
Note:
This method maps to the mlpiCore function mlpiTraceGetOldestMessageIndex, where you can find further documentation.
HRESULT IBuffer::ReadBuffer ( [in] LONGLONG  startIndex,
[in] LONG  numElements,
[out, retval] SAFEARRAY(struct TraceMessage)*  messages 
)

This function reads messages of the given buffer and returns them as an array.

Parameters
[in]startIndexIndex of the first message to read. Should be between the indices of GetNewestMessageIndex and GetOldestMessageIndex.
[in]numElementsArray size of buffer given to function in number of elements.
[out]messagesReturns the array of messages read.
Returns
Return value indicating success (>=0) or error (<0).
Example C#:
...
// read the indices of the newest and oldest messages in the "MAIN" buffer
long newestIndex = connection.Trace.Buffers["MAIN"].GetNewestMessageIndex();
long oldestIndex = connection.Trace.Buffers["MAIN"].GetOldestMessageIndex();
Console.WriteLine("Index of newest message in main buffer: " + newestIndex.ToString());
Console.WriteLine("Index of oldest message in main buffer: " + oldestIndex.ToString());
// now read all messages of the main buffer from newest to oldest index
TraceMessage[] messages = (TraceMessage[])connection.Trace.Buffers["MAIN"].ReadBuffer(newestIndex, (int)(newestIndex - oldestIndex));
// print all messages to console
foreach (TraceMessage message in messages)
{
Console.Out.WriteLine("{0} ({1}:{2}) {3,-10} --> {4}",
message.type.ToString(),
message.functionName,
message.lineNumber,
message.moduleName,
message.text);
}
Note:
This method maps to the mlpiCore function mlpiTraceReadBuffer, where you can find further documentation.

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