Pointwise Plugin SDK
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
apiPWPUtils.h
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * Pointwise Plugin utility functions
4  *
5  * (C) 2021 Cadence Design Systems, Inc. All rights reserved worldwide.
6  *
7  ***************************************************************************/
8 
9 #ifndef _APIPWPUTILS_H_
10 #define _APIPWPUTILS_H_
11 
12 
13 #include "apiPWP.h"
14 #include "pwpPlatform.h"
15 
16 
17 extern "C" {
18 
32 //***************************************************************************
33 //***************************************************************************
42 struct PWU_RTITEM {
49 
56 };
57 
58 
78 extern PWU_RTITEM pwpRtItem[];
79 
80 
85 extern PWP_UINT32 totalApiCnt;
86 
87 
93  /* DOXGRP_APIPWP_UTILS_DATA */
95 
96 
97 //***************************************************************************
98 //***************************************************************************
106 //-------------------------------------------------------------------------
114 PWU_RTITEM* PwuFindTotalAPI (const char api[]);
115 
116 //-------------------------------------------------------------------------
122 PWU_RTITEM* PwuFindPublishedAPI (const char api[]);
123 
124 //-------------------------------------------------------------------------
131 PWP_MESSAGECB PwuFindApiMsgCB (const char api[]);
132  /* DOXGRP_APIPWP_UTILS_SDKPWP */
134 
135 
136 //***************************************************************************
137 //***************************************************************************
150 //-------------------------------------------------------------------------
160 PWP_UINT32 PwuSendMsg (const char api[], PWP_ENUM_MSGID id, void *pMsg);
161 
162 //-------------------------------------------------------------------------
170 void PwuSendDebugMsg (const char api[], const char txt[], PWP_UINT32 code);
171 
172 //-------------------------------------------------------------------------
180 void PwuSendInfoMsg (const char api[], const char txt[], PWP_UINT32 code);
181 
182 //-------------------------------------------------------------------------
190 void PwuSendWarningMsg (const char api[], const char txt[], PWP_UINT32 code);
191 
192 //-------------------------------------------------------------------------
200 void PwuSendErrorMsg (const char api[], const char txt[], PWP_UINT32 code);
201  /* DOXGRP_APIPWP_UTILS_MSGS */
203 
204 
205 //***************************************************************************
206 //***************************************************************************
220 //-------------------------------------------------------------------------
230 PWP_BOOL PwuProgressBegin (const char api[], PWP_UINT32 totalSteps);
231 
232 //-------------------------------------------------------------------------
242 void PwuProgressEnd (const char api[], PWP_BOOL ok);
243 
244 //-------------------------------------------------------------------------
255 PWP_BOOL PwuProgressStatus (const char api[], PWP_UINT32 complete,
256  PWP_UINT32 total);
257 
258 //-------------------------------------------------------------------------
267 PWP_BOOL PwuProgressNextStep (const char api[]);
268 
269 //-------------------------------------------------------------------------
278 PWP_BOOL PwuProgressQuit (const char api[]);
279  /* DOXGRP_APIPWP_UTILS_PROGRESS */
281 
282 
283 //***************************************************************************
284 //***************************************************************************
294 //--------------------------------------------
299 #define PWU_ENDIANNESS PWP_ENDIANNESS
300 #define PWU_ENDIAN_ERROR PWP_ENDIAN_ERROR
301 #define PWU_ENDIAN_LITTLE PWP_ENDIAN_LITTLE
302 #define PWU_ENDIAN_BIG PWP_ENDIAN_BIG
303 #define PWU_ENDIAN_NATIVE PWP_ENDIAN_NATIVE
304 #define PWU_ENDIAN_FOREIGN PWP_ENDIAN_FOREIGN
305 
307 //--------------------------------------------
313 
314 //--------------------------------------------
319 const void* PwuApplyEndianness(PWP_ENDIANNESS endianness, const void *buf,
320  size_t size);
321  /* DOXGRP_APIPWP_UTILS_ENDIAN */
323 
324 
325 //***************************************************************************
326 //***************************************************************************
335 //--------------------------------------------
344 struct PWU_UNFDATA {
346  FILE *fp;
355 };
356 
357 //-------------------------------------------------------------------------
374  PWP_ENDIANNESS endianness);
375 
376 //-------------------------------------------------------------------------
384 
385 //-------------------------------------------------------------------------
396 PWP_BOOL PwuUnfFileBegin (FILE *fp, PWU_UNFDATA *pUData);
397 
398 //-------------------------------------------------------------------------
410 
411 //-------------------------------------------------------------------------
429  PWP_UINT32 count);
430 
431 //-------------------------------------------------------------------------
442 PWP_BOOL PwuUnfRecWriteArr (PWU_UNFDATA *pUData, const void *arr,
443  size_t itemSize, size_t itemCnt);
444 
445 //-------------------------------------------------------------------------
455 PWP_BOOL PwuUnfRecWriteBuf (PWU_UNFDATA *pUData, const void *buf, size_t size);
456 
457 //-------------------------------------------------------------------------
467 PWP_BOOL PwuUnfRecWriteEndianBuf(PWU_UNFDATA *pUData, const void *buf,
468  size_t size);
469 
470 //-------------------------------------------------------------------------
480 
481 //-------------------------------------------------------------------------
491 
492 //-------------------------------------------------------------------------
502 
503 //-------------------------------------------------------------------------
513 
514 //-------------------------------------------------------------------------
524 
525 //-------------------------------------------------------------------------
535 
536 //-------------------------------------------------------------------------
546 
547 //-------------------------------------------------------------------------
557 
558 //-------------------------------------------------------------------------
568 
569 //-------------------------------------------------------------------------
579 
580 //-------------------------------------------------------------------------
590 
591 //-------------------------------------------------------------------------
601 
602 //-------------------------------------------------------------------------
611 
612 //-------------------------------------------------------------------------
625 
626 //-------------------------------------------------------------------------
637 
638 //-------------------------------------------------------------------------
650 
651 //-------------------------------------------------------------------------
662 
663 //-------------------------------------------------------------------------
674  /* DOXGRP_APIPWP_UTILS_UNFORMATTED */
676 
677 
678 //***************************************************************************
679 //***************************************************************************
687 //-------------------------------------------------------------------------
702 PWP_BOOL PwuPublishValueDefinition(const char group[], const char name[],
703  PWP_ENUM_VALTYPE type, const char value[], const char access[],
704  const char desc[], const char range[]);
705 
706 //-------------------------------------------------------------------------
720 PWP_BOOL PwuGetValue(const char group[], const char name[], PWP_HVALUE value);
721 
722 //-------------------------------------------------------------------------
729 PWP_BOOL PwuValueSetString(PWP_HVALUE value, const char *val);
731 PWP_BOOL PwuValueSetInt(PWP_HVALUE value, PWP_INT val);
732 PWP_BOOL PwuValueSetUInt(PWP_HVALUE value, PWP_UINT val);
733 PWP_BOOL PwuValueSetReal(PWP_HVALUE value, PWP_REAL val);
734 PWP_BOOL PwuValueSetEnum(PWP_HVALUE value, const char *val);
736 
737 //-------------------------------------------------------------------------
748 PWP_BOOL PwuAssignValue(const char group[], const char name[],
750  const char value[], bool createIfNotExists = false);
751 PWP_BOOL PwuAssignValueInt(const char group[], const char name[],
752  PWP_INT value, bool createIfNotExists = false);
753 PWP_BOOL PwuAssignValueUInt(const char group[], const char name[],
754  PWP_UINT value, bool createIfNotExists = false);
755 PWP_BOOL PwuAssignValueReal(const char group[], const char name[],
756  PWP_REAL value, bool createIfNotExists = false);
757 PWP_BOOL PwuAssignValueEnum(const char group[], const char name[],
758  const char value[], bool createIfNotExists = false);
760  /* DOXGRP_APIPWP_UTILS_VARS */
762  /* DOXGRP_APIPWP_UTILS */
764 
765 } /* extern "C" */
766 
767 #endif /* _APIPWPUTILS_H_ */
unsigned char PWP_UINT8
8-bit unsigned integer
Definition: apiPWP.h:170
PWP_BOOL PwuUnfRecBeginFixed(PWU_UNFDATA *pUData, PWP_UINT32 bytes, PWP_UINT32 count)
Prepares a PWU_UNFDATA block for writing a new unformatted data record when the amount of data being ...
PWP_MESSAGECB msgCB
The API's assigned message callback.
Definition: apiPWPUtils.h:55
PWP_BOOL PwuValueSetReal(PWP_HVALUE hVal, PWP_REAL val)
PWP_UINT32 recCnt
of records written
Definition: apiPWPUtils.h:352
PWP_ENUM_VALTYPE
Supported PWP-API getValue() transfer types.
Definition: apiPWP.h:696
PWP_BOOL PwuUnfRecWriteUINT16(PWU_UNFDATA *pUData, PWP_UINT16 val)
Write a PWP_UINT16 value to the current record with endian order applied.
unsigned long long PWP_UINT64
64-bit unsigned integer
Definition: apiPWP.h:243
unsigned int PWP_UINT32
32-bit unsigned integer
Definition: apiPWP.h:210
PWP_BOOL PwuValueSetUInt(PWP_HVALUE hVal, PWP_UINT val)
Pointwise Plugin API (PWP-API)
PWP_BOOL PwuPublishValueDefinition(const char group[], const char name[], PWP_ENUM_VALTYPE type, const char value[], const char access[], const char desc[], const char range[])
Create a value.
PWP_BOOL PwuValueSetEnum(PWP_HVALUE hVal, const char *val)
PWP_BOOL PwuAssignValue(const char group[], const char name[], const char value[], bool createIfNotExists)
Assign or create a value.
void PwuSendInfoMsg(const char api[], const char txt[], PWP_UINT32 code)
Send an info text message (PWP_MSGID_INFO) to the framework.
PWP_BOOL PwuValueSetInt(PWP_HVALUE hVal, PWP_INT val)
PWP_BOOL PwuAssignValueInt(const char group[], const char name[], PWP_INT value, bool createIfNotExists)
PWP_BOOL PwuUnfRecWriteBuf(PWU_UNFDATA *pUData, const void *buf, size_t size)
Write a data buffer to the current record.
PWP_BOOL inRec
"in record" flag
Definition: apiPWPUtils.h:349
PWP_BOOL PwuProgressBegin(const char api[], PWP_UINT32 totalSteps)
Send a progress begin message (PWP_MSGID_PROGBEGIN) to the framework.
PWP_UINT32 PwuUnfRecBytes(PWU_UNFDATA *pUData)
Get the running total number of bytes written to the current record during an unformatted file I/O se...
PWP_ENDIANNESS PwuUnfFileSetEndianness(PWU_UNFDATA *pUData, PWP_ENDIANNESS endianness)
Set the output endianness.
PWP_BOOL hadError
error flag
Definition: apiPWPUtils.h:348
PWP_ENUM_MSGID
Supported PWP-API message ids.
Definition: apiPWP.h:504
PWP_UINT32 PwuSendMsg(const char api[], PWP_ENUM_MSGID id, void *pMsg)
Send a message from an api.
Definition: apiPWPUtils.cxx:69
PWP_BOOL PwuUnfFileBegin(FILE *fp, PWU_UNFDATA *pUData)
Prepares a PWU_UNFDATA block for a new unformatted file I/O session.
PWP_BOOL PwuValueSetString(PWP_HVALUE hVal, const char *val)
Set the value of a variable handle.
PWP_UINT32 PwuUnfRecCount(PWU_UNFDATA *pUData)
Get the running total number of finalized records written during an unformatted file I/O session...
PWP_BOOL PwuUnfRecWriteINT(PWU_UNFDATA *pUData, PWP_INT val)
Write a PWP_INT value to the current record with endian order applied.
PWP_BOOL PwuUnfFileEnd(PWU_UNFDATA *pUData)
Finalize an unformatted file I/O session.
PWP_BOOL PwuProgressQuit(const char api[])
Send a progress query-quit message (PWP_MSGID_PROGQUIT) to the framework.
PWP_UINT32 totalApiCnt
The total # of published and unpublished entries in pwpRtItem[].
Definition: apiPWP.cxx:47
fpos_t sysFILEPOS
File position data type.
Definition: pwpPlatform.h:51
PWP_BOOL PwuUnfRecWriteEndianBuf(PWU_UNFDATA *pUData, const void *buf, size_t size)
Write a data buffer to the current record with endian order applied.
PWP_BOOL PwuGetValue(const char group[], const char name[], PWP_HVALUE hVal)
Implementation of the PwpGetValue() API function.
PWU_RTITEM pwpRtItem[]
The runtime array of PWU_RTITEM items.
Definition: apiPWP.cxx:29
FILE * fp
file pointer
Definition: apiPWPUtils.h:346
float PWP_FLOAT
32-bit real
Definition: apiPWP.h:261
Cross Platform Functions.
PWP_BOOL PwuUnfRecWriteUINT(PWU_UNFDATA *pUData, PWP_UINT val)
Write a PWP_UINT value to the current record with endian order applied.
const void * PwuApplyEndianness(PWP_ENDIANNESS endianness, const void *buf, size_t size)
Apply specified byte order to buf containing size bytes.
unsigned short PWP_UINT16
16-bit unsigned integer
Definition: apiPWP.h:190
PWP_MESSAGECB PwuFindApiMsgCB(const char api[])
Search pwpRtItem[] for an API's messageCB.
Definition: apiPWPUtils.cxx:54
Unformatted file data block.
Definition: apiPWPUtils.h:344
PWP_BOOL PwuUnfRecWriteArr(PWU_UNFDATA *pUData, const void *arr, size_t itemSize, size_t itemCnt)
Write an array of data to the current record.
PWP_UINT32 PwuUnfTotRecBytes(PWU_UNFDATA *pUData)
Get the running total number of bytes written to all records during an unformatted file I/O session...
PWP_UINT32 fixedBytes
user provided # record bytes
Definition: apiPWPUtils.h:354
The API information returned by plugins for each supported API.
Definition: apiPWP.h:652
PWP_BOOL PwuUnfRecWriteREAL(PWU_UNFDATA *pUData, PWP_REAL val)
Write a PWP_REAL value to the current record with endian order applied.
PWP_BOOL PwuUnfHadError(PWU_UNFDATA *pUData)
Check if an unformatted file I/O session has detected any errors.
PWP_UINT32(* PWP_MESSAGECB)(const char api[], PWP_ENUM_MSGID id, void *pMsg)
Message handler callback function signature.
Definition: apiPWP.h:555
PWP_BOOL PwuUnfRecWriteINT32(PWU_UNFDATA *pUData, PWP_INT32 val)
Write a PWP_INT32 value to the current record with endian order applied.
PWP_UINT32 recBytes
bytes written to current record
Definition: apiPWPUtils.h:350
PWP_BOOL PwuAssignValueEnum(const char group[], const char name[], const char value[], bool createIfNotExists)
sysFILEPOS fPos
file position value
Definition: apiPWPUtils.h:347
void PwuSendWarningMsg(const char api[], const char txt[], PWP_UINT32 code)
Send a warning text message (PWP_MSGID_WARNING) to the framework.
PWP_BOOL PwuUnfRecWriteUINT32(PWU_UNFDATA *pUData, PWP_UINT32 val)
Write a PWP_UINT32 value to the current record with endian order applied.
short PWP_INT16
16-bit integer
Definition: apiPWP.h:187
PWP_BOOL PwuUnfRecEnd(PWU_UNFDATA *pUData)
Finalize the current record write.
signed char PWP_INT8
8-bit integer
Definition: apiPWP.h:167
int PWP_BOOL
logical value
Definition: apiPWP.h:303
long long PWP_INT64
64-bit integer
Definition: apiPWP.h:240
PWP_UINT32 publishedApiCnt
The total # of published entries in pwpRtItem[].
Definition: apiPWP.cxx:48
PWP_BOOL PwuUnfRecWriteINT16(PWU_UNFDATA *pUData, PWP_INT16 val)
Write a PWP_INT16 value to the current record with endian order applied.
void PwuSendDebugMsg(const char api[], const char txt[], PWP_UINT32 code)
Send a debug text message (PWP_MSGID_DEBUG) to the framework.
PWP_UINT32 totRecBytes
total # bytes written to all records
Definition: apiPWPUtils.h:351
The runtime data representing a PWP-API suported by a plugin.
Definition: apiPWPUtils.h:42
void PwuSendErrorMsg(const char api[], const char txt[], PWP_UINT32 code)
Send an error text message (PWP_MSGID_ERROR) to the framework.
PWP_ENDIANNESS endianness
write data using this endianness
Definition: apiPWPUtils.h:353
PWP_BOOL PwuAssignValueReal(const char group[], const char name[], PWP_REAL value, bool createIfNotExists)
PWP_BOOL PwuAssignValueUInt(const char group[], const char name[], PWP_UINT value, bool createIfNotExists)
PWU_RTITEM * PwuFindPublishedAPI(const char api[])
Find a published api in pwpRtItem[].
Definition: apiPWPUtils.cxx:47
PWP_UINT32 PWP_UINT
unsigned integer same size as void*
Definition: apiPWP.h:285
void PwuProgressEnd(const char api[], PWP_BOOL ok)
Send a progress end message (PWP_MSGID_PROGEND) to the framework.
PWP_BOOL PwuUnfRecBegin(PWU_UNFDATA *pUData)
Prepares a PWU_UNFDATA block for writing a new unformatted data record.
PWP_BOOL PwuUnfRecWriteUINT64(PWU_UNFDATA *pUData, PWP_UINT64 val)
Write a PWP_UINT64 value to the current record with endian order applied.
PWP_ENDIANNESS PwuUnfFileGetEndianness(PWU_UNFDATA *pUData)
Get the output endianness setting for this PWU_UNFDATA block.
PWP_BOOL PwuUnfRecWriteFLOAT(PWU_UNFDATA *pUData, PWP_FLOAT val)
Write a PWP_FLOAT value to the current record with endian order applied.
PWP_ENDIANNESS
Flags used to indicate endianness or control endian behaviors in functions.
Definition: apiPWP.h:822
PWP_UINT32 status
current file status
Definition: apiPWPUtils.h:345
PWP_INT32 PWP_INT
integer same size as void*
Definition: apiPWP.h:282
PWP_BOOL PwuProgressStatus(const char api[], PWP_UINT32 complete, PWP_UINT32 total)
Send a progress status message (PWP_MSGID_PROGSTATUS, value >= 0) to the framework.
PWP_ENDIANNESS PwuGetOsEndianness(void)
Query the OS's native endianness.
PWP_BOOL PwuUnfRecWriteUINT8(PWU_UNFDATA *pUData, PWP_UINT8 val)
Write a PWP_UINT8 value to the current record with endian order applied.
PWP_BOOL PwuProgressNextStep(const char api[])
Send a progress "next step" message (PWP_MSGID_PROGSTATUS, value = -1) to the framework.
PWP_APIINFO apiInfo
The PWP-API instance information.
Definition: apiPWPUtils.h:48
PWP_BOOL PwuUnfRecWriteINT8(PWU_UNFDATA *pUData, PWP_INT8 val)
Write a PWP_INT8 value to the current record with endian order applied.
double PWP_REAL
64-bit real
Definition: apiPWP.h:264
PWP_BOOL PwuUnfRecWriteINT64(PWU_UNFDATA *pUData, PWP_INT64 val)
Write a PWP_INT64 value to the current record with endian order applied.
int PWP_INT32
32-bit integer
Definition: apiPWP.h:207
PWU_RTITEM * PwuFindTotalAPI(const char api[])
Find any api in pwpRtItem[].
Definition: apiPWPUtils.cxx:40