Open Core Interface - MLPI
MLPI-MotionLogicProgrammingInterface(mlpiCore)  1.26.2
UtilLogicHelper
Collaboration diagram for UtilLogicHelper:

Functions

MLPIRESULT utilLogicGetSymbolList (MLPIHANDLE connection, const std::wstring &application, SymbolList &symbolList)
 
MLPIRESULT utilLogicInflateSymbol (MLPIHANDLE connection, const std::wstring &symbol, SymbolList &symbolList, MlpiLogicSymbolInformation &symbolInfo)
 
MLPIRESULT utilLogicGetSymbolListExtended (MLPIHANDLE connection, const std::wstring &application, SymbolList &symbolList)
 

Detailed Description

This module contains some useful functions and macros for logic handling.

Please note that this piece of source code is not directly part of the MLPI. You do not need this file to program against the MLPI. Nevertheless, at least parts of this file have been considered to be somewhat useful when using or learning to use MLPI functionality. It is therefore included without any support, but to act as sample code and source of inspiration.

Function Documentation

MLPIRESULT utilLogicGetSymbolList ( MLPIHANDLE  connection,
const std::wstring &  application,
SymbolList symbolList 
)
inline

This functions reads the list of variables of a given application and returns it as as a SymbolList container.

Parameters
[in]connectionHandle for multiple connections.
[in]applicationName of application.
[out]symbolListContainer of strings which receives all symbols. Note that the container doesn't get cleared. New symbols only get added.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 SymbolList symbolsAll;
2 
3 MLPIRESULT result = utilLogicGetSymbolList(connection, L"Application", symbolsAll);
4 if (MLPI_FAILED(result))
5 return result;
6 
7 printf("\n\nList of symbol configuration:");
8 for (SymbolList::iterator iter=symbolsAll.begin(); iter!=symbolsAll.end(); iter++) {
9  printf("\n- %s", W2A16((*iter).c_str()));
10 }

Definition at line 136 of file mlpiLogicHelper.h.

References MLPI_FAILED, MLPI_S_OK, mlpiLogicGetSymbolsOfApplication(), and wcstok_r16().

Referenced by utilLogicGetSymbolListExtended().

Here is the call graph for this function:

Here is the caller graph for this function:

MLPIRESULT utilLogicInflateSymbol ( MLPIHANDLE  connection,
const std::wstring &  symbol,
SymbolList symbolList,
MlpiLogicSymbolInformation symbolInfo 
)
inline

Recursive function which checks if a symbol is an array or user defined structure and adds all array elements or struct elements also to the list of symbols.

Parameters
[in]connectionHandle for multiple connections.
[in]symbolName of application.
[out]symbolListContainer of strings which receives all symbols. Note that the container doesn't get cleared. New symbols only get added.
[in,out]symbolInfoUsed as optimization to minimize MLPI function calls and to reuse information from previous recursions.
Returns
Return value indicating success (>=0) or error (<0).

Definition at line 175 of file mlpiLogicHelper.h.

References MLPI_FAILED, MLPI_LOGIC_TYPE_ARRAY, MLPI_LOGIC_TYPE_UNSUPPORTED, MLPI_LOGIC_TYPE_USERDEF, MLPI_S_OK, mlpiLogicGetInformationOfSymbol(), and mlpiLogicGetInformationOfUserType().

Referenced by utilLogicGetSymbolListExtended().

Here is the call graph for this function:

Here is the caller graph for this function:

MLPIRESULT utilLogicGetSymbolListExtended ( MLPIHANDLE  connection,
const std::wstring &  application,
SymbolList symbolList 
)
inline

This functions reads the extended list of variables of a given application and returns it as as a SymbolList container. The extended list includes each array element as well as all elements of user defines structs. Please note, that this list might get very long in case of massive use of arrays!

Parameters
[in]connectionHandle for multiple connections.
[in]applicationName of application.
[out]symbolListContainer of strings which receives all symbols. Note, that the container doesn't get cleared. New symbols only get added.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 SymbolList symbolsAllExtended;
2 
3 MLPIRESULT result = utilLogicGetSymbolListExtended(connection, L"Application", symbolsAllExtended);
4 if (MLPI_FAILED(result))
5 return result;
6 
7 printf("\n\nExtended List of symbol configuration:");
8 for (SymbolList::iterator iter=symbolsAllExtended.begin(); iter!=symbolsAllExtended.end(); iter++) {
9  printf("\n- %s", W2A16((*iter).c_str()));
10 }

Definition at line 267 of file mlpiLogicHelper.h.

References MLPI_FAILED, MLPI_LOGIC_TYPE_UNSUPPORTED, MLPI_S_OK, mlpiLogicReadMemoryAreaArrayChar(), mlpiLogicReadMemoryAreaArrayDouble(), mlpiLogicReadMemoryAreaArrayFloat(), mlpiLogicReadMemoryAreaArrayLlong(), mlpiLogicReadMemoryAreaArrayLong(), mlpiLogicReadMemoryAreaArrayShort(), mlpiLogicReadMemoryAreaArrayUchar(), mlpiLogicReadMemoryAreaArrayUllong(), mlpiLogicReadMemoryAreaArrayUlong(), mlpiLogicReadMemoryAreaArrayUshort(), mlpiLogicReadMemoryAreaBool8(), mlpiLogicReadMemoryAreaChar(), mlpiLogicReadMemoryAreaDouble(), mlpiLogicReadMemoryAreaFloat(), mlpiLogicReadMemoryAreaLlong(), mlpiLogicReadMemoryAreaLong(), mlpiLogicReadMemoryAreaShort(), mlpiLogicReadMemoryAreaUchar(), mlpiLogicReadMemoryAreaUllong(), mlpiLogicReadMemoryAreaUlong(), mlpiLogicReadMemoryAreaUshort(), mlpiLogicReadVariableBySymbolArrayBool8(), mlpiLogicReadVariableBySymbolArrayChar(), mlpiLogicReadVariableBySymbolArrayDouble(), mlpiLogicReadVariableBySymbolArrayFloat(), mlpiLogicReadVariableBySymbolArrayLlong(), mlpiLogicReadVariableBySymbolArrayLong(), mlpiLogicReadVariableBySymbolArrayShort(), mlpiLogicReadVariableBySymbolArrayUchar(), mlpiLogicReadVariableBySymbolArrayUllong(), mlpiLogicReadVariableBySymbolArrayUlong(), mlpiLogicReadVariableBySymbolArrayUshort(), mlpiLogicReadVariableBySymbolBool8(), mlpiLogicReadVariableBySymbolChar(), mlpiLogicReadVariableBySymbolDouble(), mlpiLogicReadVariableBySymbolFloat(), mlpiLogicReadVariableBySymbolLlong(), mlpiLogicReadVariableBySymbolLong(), mlpiLogicReadVariableBySymbolShort(), mlpiLogicReadVariableBySymbolString(), mlpiLogicReadVariableBySymbolUchar(), mlpiLogicReadVariableBySymbolUllong(), mlpiLogicReadVariableBySymbolUlong(), mlpiLogicReadVariableBySymbolUshort(), mlpiLogicWriteMemoryAreaArrayChar(), mlpiLogicWriteMemoryAreaArrayDouble(), mlpiLogicWriteMemoryAreaArrayFloat(), mlpiLogicWriteMemoryAreaArrayLlong(), mlpiLogicWriteMemoryAreaArrayLong(), mlpiLogicWriteMemoryAreaArrayShort(), mlpiLogicWriteMemoryAreaArrayUchar(), mlpiLogicWriteMemoryAreaArrayUllong(), mlpiLogicWriteMemoryAreaArrayUlong(), mlpiLogicWriteMemoryAreaArrayUshort(), mlpiLogicWriteMemoryAreaBool8(), mlpiLogicWriteMemoryAreaChar(), mlpiLogicWriteMemoryAreaDouble(), mlpiLogicWriteMemoryAreaFloat(), mlpiLogicWriteMemoryAreaLlong(), mlpiLogicWriteMemoryAreaLong(), mlpiLogicWriteMemoryAreaShort(), mlpiLogicWriteMemoryAreaUchar(), mlpiLogicWriteMemoryAreaUllong(), mlpiLogicWriteMemoryAreaUlong(), mlpiLogicWriteMemoryAreaUshort(), mlpiLogicWriteVariableBySymbolArrayBool8(), mlpiLogicWriteVariableBySymbolArrayChar(), mlpiLogicWriteVariableBySymbolArrayDouble(), mlpiLogicWriteVariableBySymbolArrayFloat(), mlpiLogicWriteVariableBySymbolArrayLlong(), mlpiLogicWriteVariableBySymbolArrayLong(), mlpiLogicWriteVariableBySymbolArrayShort(), mlpiLogicWriteVariableBySymbolArrayUchar(), mlpiLogicWriteVariableBySymbolArrayUllong(), mlpiLogicWriteVariableBySymbolArrayUlong(), mlpiLogicWriteVariableBySymbolArrayUshort(), mlpiLogicWriteVariableBySymbolBool8(), mlpiLogicWriteVariableBySymbolChar(), mlpiLogicWriteVariableBySymbolDouble(), mlpiLogicWriteVariableBySymbolFloat(), mlpiLogicWriteVariableBySymbolLlong(), mlpiLogicWriteVariableBySymbolLong(), mlpiLogicWriteVariableBySymbolShort(), mlpiLogicWriteVariableBySymbolString(), mlpiLogicWriteVariableBySymbolUchar(), mlpiLogicWriteVariableBySymbolUllong(), mlpiLogicWriteVariableBySymbolUlong(), mlpiLogicWriteVariableBySymbolUshort(), utilLogicGetSymbolList(), and utilLogicInflateSymbol().