Pointwise Plugin SDK
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_ */
pwpRtItem
PWU_RTITEM pwpRtItem[]
The runtime array of PWU_RTITEM items.
Definition: apiPWP.cxx:29
PwuUnfRecWriteUINT8
PWP_BOOL PwuUnfRecWriteUINT8(PWU_UNFDATA *pUData, PWP_UINT8 val)
Write a PWP_UINT8 value to the current record with endian order applied.
Definition: apiPWPUtils.cxx:531
totalApiCnt
PWP_UINT32 totalApiCnt
The total # of published and unpublished entries in pwpRtItem[].
Definition: apiPWP.cxx:47
PwuFindTotalAPI
PWU_RTITEM * PwuFindTotalAPI(const char api[])
Find any api in pwpRtItem[].
Definition: apiPWPUtils.cxx:40
PwuUnfRecWriteINT8
PWP_BOOL PwuUnfRecWriteINT8(PWU_UNFDATA *pUData, PWP_INT8 val)
Write a PWP_INT8 value to the current record with endian order applied.
Definition: apiPWPUtils.cxx:524
sysFILEPOS
fpos_t sysFILEPOS
File position data type.
Definition: pwpPlatform.h:51
PwuValueSetEnum
PWP_BOOL PwuValueSetEnum(PWP_HVALUE value, const char *val)
Set the value of a variable handle.
Definition: apiPWPUtils.cxx:1007
PWU_UNFDATA::inRec
PWP_BOOL inRec
"in record" flag
Definition: apiPWPUtils.h:349
PwuProgressEnd
void PwuProgressEnd(const char api[], PWP_BOOL ok)
Send a progress end message (PWP_MSGID_PROGEND) to the framework.
Definition: apiPWPUtils.cxx:163
PWP_ENUM_VALTYPE
PWP_ENUM_VALTYPE
Supported PWP-API getValue() transfer types.
Definition: apiPWP.h:696
PwuUnfRecWriteEndianBuf
PWP_BOOL PwuUnfRecWriteEndianBuf(PWU_UNFDATA *pUData, const void *buf, size_t size)
Write a data buffer to the current record with endian order applied.
Definition: apiPWPUtils.cxx:502
PWP_UINT32
unsigned int PWP_UINT32
32-bit unsigned integer
Definition: apiPWP.h:210
PWU_RTITEM
The runtime data representing a PWP-API suported by a plugin.
Definition: apiPWPUtils.h:42
PwuAssignValue
PWP_BOOL PwuAssignValue(const char group[], const char name[], const char value[], bool createIfNotExists=false)
Assign or create a value.
Definition: apiPWPUtils.cxx:856
PwuUnfRecWriteINT64
PWP_BOOL PwuUnfRecWriteINT64(PWU_UNFDATA *pUData, PWP_INT64 val)
Write a PWP_INT64 value to the current record with endian order applied.
Definition: apiPWPUtils.cxx:566
PWP_UINT16
unsigned short PWP_UINT16
16-bit unsigned integer
Definition: apiPWP.h:190
PwuAssignValueInt
PWP_BOOL PwuAssignValueInt(const char group[], const char name[], PWP_INT value, bool createIfNotExists=false)
Assign or create a value.
Definition: apiPWPUtils.cxx:875
PWP_INT16
short PWP_INT16
16-bit integer
Definition: apiPWP.h:187
PWP_INT32
int PWP_INT32
32-bit integer
Definition: apiPWP.h:207
PwuProgressStatus
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.
Definition: apiPWPUtils.cxx:173
PwuPublishValueDefinition
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.
Definition: apiPWPUtils.cxx:909
PwuProgressNextStep
PWP_BOOL PwuProgressNextStep(const char api[])
Send a progress "next step" message (PWP_MSGID_PROGSTATUS, value = -1) to the framework.
Definition: apiPWPUtils.cxx:189
PWP_UINT
PWP_UINT32 PWP_UINT
unsigned integer same size as void*
Definition: apiPWP.h:285
PwuGetOsEndianness
PWP_ENDIANNESS PwuGetOsEndianness(void)
Query the OS's native endianness.
Definition: apiPWPUtils.cxx:218
PwuFindApiMsgCB
PWP_MESSAGECB PwuFindApiMsgCB(const char api[])
Search pwpRtItem[] for an API's messageCB.
Definition: apiPWPUtils.cxx:54
PwuUnfRecBegin
PWP_BOOL PwuUnfRecBegin(PWU_UNFDATA *pUData)
Prepares a PWU_UNFDATA block for writing a new unformatted data record.
Definition: apiPWPUtils.cxx:428
publishedApiCnt
PWP_UINT32 publishedApiCnt
The total # of published entries in pwpRtItem[].
Definition: apiPWP.cxx:48
PwuUnfFileEnd
PWP_BOOL PwuUnfFileEnd(PWU_UNFDATA *pUData)
Finalize an unformatted file I/O session.
Definition: apiPWPUtils.cxx:594
PwuUnfFileSetEndianness
PWP_ENDIANNESS PwuUnfFileSetEndianness(PWU_UNFDATA *pUData, PWP_ENDIANNESS endianness)
Set the output endianness.
Definition: apiPWPUtils.cxx:340
PwuSendWarningMsg
void PwuSendWarningMsg(const char api[], const char txt[], PWP_UINT32 code)
Send a warning text message (PWP_MSGID_WARNING) to the framework.
Definition: apiPWPUtils.cxx:123
PwuValueSetReal
PWP_BOOL PwuValueSetReal(PWP_HVALUE value, PWP_REAL val)
Set the value of a variable handle.
Definition: apiPWPUtils.cxx:1000
PwuUnfRecWriteBuf
PWP_BOOL PwuUnfRecWriteBuf(PWU_UNFDATA *pUData, const void *buf, size_t size)
Write a data buffer to the current record.
Definition: apiPWPUtils.cxx:495
PwuUnfRecWriteINT
PWP_BOOL PwuUnfRecWriteINT(PWU_UNFDATA *pUData, PWP_INT val)
Write a PWP_INT value to the current record with endian order applied.
Definition: apiPWPUtils.cxx:510
PWU_UNFDATA::recBytes
PWP_UINT32 recBytes
Definition: apiPWPUtils.h:350
PwuUnfRecWriteREAL
PWP_BOOL PwuUnfRecWriteREAL(PWU_UNFDATA *pUData, PWP_REAL val)
Write a PWP_REAL value to the current record with endian order applied.
Definition: apiPWPUtils.cxx:587
PwuUnfRecWriteUINT
PWP_BOOL PwuUnfRecWriteUINT(PWU_UNFDATA *pUData, PWP_UINT val)
Write a PWP_UINT value to the current record with endian order applied.
Definition: apiPWPUtils.cxx:517
PwuSendInfoMsg
void PwuSendInfoMsg(const char api[], const char txt[], PWP_UINT32 code)
Send an info text message (PWP_MSGID_INFO) to the framework.
Definition: apiPWPUtils.cxx:116
PWU_UNFDATA::endianness
PWP_ENDIANNESS endianness
write data using this endianness
Definition: apiPWPUtils.h:353
PwuUnfRecEnd
PWP_BOOL PwuUnfRecEnd(PWU_UNFDATA *pUData)
Finalize the current record write.
Definition: apiPWPUtils.cxx:371
PwuGetValue
PWP_BOOL PwuGetValue(const char group[], const char name[], PWP_HVALUE value)
Implementation of the PwpGetValue() API function.
Definition: apiPWPUtils.cxx:953
PwuFindPublishedAPI
PWU_RTITEM * PwuFindPublishedAPI(const char api[])
Find a published api in pwpRtItem[].
Definition: apiPWPUtils.cxx:47
PWU_UNFDATA::status
PWP_UINT32 status
current file status
Definition: apiPWPUtils.h:345
PwuSendMsg
PWP_UINT32 PwuSendMsg(const char api[], PWP_ENUM_MSGID id, void *pMsg)
Send a message from an api.
Definition: apiPWPUtils.cxx:69
pwpPlatform.h
Cross Platform Functions.
PwuSendErrorMsg
void PwuSendErrorMsg(const char api[], const char txt[], PWP_UINT32 code)
Send an error text message (PWP_MSGID_ERROR) to the framework.
Definition: apiPWPUtils.cxx:130
PwuUnfRecCount
PWP_UINT32 PwuUnfRecCount(PWU_UNFDATA *pUData)
Get the running total number of finalized records written during an unformatted file I/O session.
Definition: apiPWPUtils.cxx:630
PWP_REAL
double PWP_REAL
64-bit real
Definition: apiPWP.h:264
PwuUnfRecWriteINT16
PWP_BOOL PwuUnfRecWriteINT16(PWU_UNFDATA *pUData, PWP_INT16 val)
Write a PWP_INT16 value to the current record with endian order applied.
Definition: apiPWPUtils.cxx:538
PWU_UNFDATA::fixedBytes
PWP_UINT32 fixedBytes
user provided # record bytes
Definition: apiPWPUtils.h:354
PwuAssignValueUInt
PWP_BOOL PwuAssignValueUInt(const char group[], const char name[], PWP_UINT value, bool createIfNotExists=false)
Assign or create a value.
Definition: apiPWPUtils.cxx:884
PWU_UNFDATA::recCnt
PWP_UINT32 recCnt
Definition: apiPWPUtils.h:352
PWP_APIINFO
The API information returned by plugins for each supported API.
Definition: apiPWP.h:652
PWP_ENUM_MSGID
PWP_ENUM_MSGID
Supported PWP-API message ids.
Definition: apiPWP.h:504
PWP_FLOAT
float PWP_FLOAT
32-bit real
Definition: apiPWP.h:261
PWP_INT8
signed char PWP_INT8
8-bit integer
Definition: apiPWP.h:167
PwuUnfRecWriteArr
PWP_BOOL PwuUnfRecWriteArr(PWU_UNFDATA *pUData, const void *arr, size_t itemSize, size_t itemCnt)
Write an array of data to the current record.
Definition: apiPWPUtils.cxx:477
PwuValueSetString
PWP_BOOL PwuValueSetString(PWP_HVALUE value, const char *val)
Set the value of a variable handle.
Definition: apiPWPUtils.cxx:979
PwuUnfFileBegin
PWP_BOOL PwuUnfFileBegin(FILE *fp, PWU_UNFDATA *pUData)
Prepares a PWU_UNFDATA block for a new unformatted file I/O session.
Definition: apiPWPUtils.cxx:359
PWP_ENDIANNESS
PWP_ENDIANNESS
Flags used to indicate endianness or control endian behaviors in functions.
Definition: apiPWP.h:822
PwuUnfRecWriteUINT64
PWP_BOOL PwuUnfRecWriteUINT64(PWU_UNFDATA *pUData, PWP_UINT64 val)
Write a PWP_UINT64 value to the current record with endian order applied.
Definition: apiPWPUtils.cxx:573
PWP_INT
PWP_INT32 PWP_INT
integer same size as void*
Definition: apiPWP.h:282
PwuUnfRecWriteINT32
PWP_BOOL PwuUnfRecWriteINT32(PWU_UNFDATA *pUData, PWP_INT32 val)
Write a PWP_INT32 value to the current record with endian order applied.
Definition: apiPWPUtils.cxx:552
PwuUnfHadError
PWP_BOOL PwuUnfHadError(PWU_UNFDATA *pUData)
Check if an unformatted file I/O session has detected any errors.
Definition: apiPWPUtils.cxx:609
PWU_RTITEM::msgCB
PWP_MESSAGECB msgCB
The API's assigned message callback.
Definition: apiPWPUtils.h:55
PWU_UNFDATA::totRecBytes
PWP_UINT32 totRecBytes
total # bytes written to all records
Definition: apiPWPUtils.h:351
PWP_BOOL
int PWP_BOOL
logical value
Definition: apiPWP.h:303
PwuProgressQuit
PWP_BOOL PwuProgressQuit(const char api[])
Send a progress query-quit message (PWP_MSGID_PROGQUIT) to the framework.
Definition: apiPWPUtils.cxx:200
PwuUnfTotRecBytes
PWP_UINT32 PwuUnfTotRecBytes(PWU_UNFDATA *pUData)
Get the running total number of bytes written to all records during an unformatted file I/O session.
Definition: apiPWPUtils.cxx:623
PwuUnfRecWriteFLOAT
PWP_BOOL PwuUnfRecWriteFLOAT(PWU_UNFDATA *pUData, PWP_FLOAT val)
Write a PWP_FLOAT value to the current record with endian order applied.
Definition: apiPWPUtils.cxx:580
PWU_UNFDATA::fp
FILE * fp
file pointer
Definition: apiPWPUtils.h:346
PWU_RTITEM::apiInfo
PWP_APIINFO apiInfo
The PWP-API instance information.
Definition: apiPWPUtils.h:48
PwuUnfRecWriteUINT32
PWP_BOOL PwuUnfRecWriteUINT32(PWU_UNFDATA *pUData, PWP_UINT32 val)
Write a PWP_UINT32 value to the current record with endian order applied.
Definition: apiPWPUtils.cxx:559
PwuAssignValueReal
PWP_BOOL PwuAssignValueReal(const char group[], const char name[], PWP_REAL value, bool createIfNotExists=false)
Assign or create a value.
Definition: apiPWPUtils.cxx:893
PwuSendDebugMsg
void PwuSendDebugMsg(const char api[], const char txt[], PWP_UINT32 code)
Send a debug text message (PWP_MSGID_DEBUG) to the framework.
Definition: apiPWPUtils.cxx:109
PWU_UNFDATA::hadError
PWP_BOOL hadError
error flag
Definition: apiPWPUtils.h:348
PWP_MESSAGECB
PWP_UINT32(* PWP_MESSAGECB)(const char api[], PWP_ENUM_MSGID id, void *pMsg)
Message handler callback function signature.
Definition: apiPWP.h:555
PwuApplyEndianness
const void * PwuApplyEndianness(PWP_ENDIANNESS endianness, const void *buf, size_t size)
Apply specified byte order to buf containing size bytes.
Definition: apiPWPUtils.cxx:230
PWP_INT64
long long PWP_INT64
64-bit integer
Definition: apiPWP.h:240
apiPWP.h
Pointwise Plugin API (PWP-API)
PWP_UINT64
unsigned long long PWP_UINT64
64-bit unsigned integer
Definition: apiPWP.h:243
PwuAssignValueEnum
PWP_BOOL PwuAssignValueEnum(const char group[], const char name[], const char value[], bool createIfNotExists=false)
Assign or create a value.
Definition: apiPWPUtils.cxx:902
PwuUnfRecBeginFixed
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 ...
Definition: apiPWPUtils.cxx:453
PwuUnfFileGetEndianness
PWP_ENDIANNESS PwuUnfFileGetEndianness(PWU_UNFDATA *pUData)
Get the output endianness setting for this PWU_UNFDATA block.
Definition: apiPWPUtils.cxx:352
PWU_UNFDATA::fPos
sysFILEPOS fPos
file position value
Definition: apiPWPUtils.h:347
PwuUnfRecWriteUINT16
PWP_BOOL PwuUnfRecWriteUINT16(PWU_UNFDATA *pUData, PWP_UINT16 val)
Write a PWP_UINT16 value to the current record with endian order applied.
Definition: apiPWPUtils.cxx:545
PwuUnfRecBytes
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...
Definition: apiPWPUtils.cxx:616
PwuValueSetInt
PWP_BOOL PwuValueSetInt(PWP_HVALUE value, PWP_INT val)
Set the value of a variable handle.
Definition: apiPWPUtils.cxx:986
PWP_UINT8
unsigned char PWP_UINT8
8-bit unsigned integer
Definition: apiPWP.h:170
PwuProgressBegin
PWP_BOOL PwuProgressBegin(const char api[], PWP_UINT32 totalSteps)
Send a progress begin message (PWP_MSGID_PROGBEGIN) to the framework.
Definition: apiPWPUtils.cxx:152
PwuValueSetUInt
PWP_BOOL PwuValueSetUInt(PWP_HVALUE value, PWP_UINT val)
Set the value of a variable handle.
Definition: apiPWPUtils.cxx:993
PWU_UNFDATA
Unformatted file data block.
Definition: apiPWPUtils.h:344