Pointwise Plugin SDK
apiPWPUtils.h
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * Pointwise Plugin utility functions
4  *
5  * Proprietary software product of Pointwise, Inc.
6  * Copyright (c) 1995-2018 Pointwise, Inc.
7  * All rights reserved.
8  *
9  ***************************************************************************/
10 
11 #ifndef _APIPWPUTILS_H_
12 #define _APIPWPUTILS_H_
13 
14 
15 #include "apiPWP.h"
16 #include "pwpPlatform.h"
17 
18 
19 extern "C" {
20 
34 //***************************************************************************
35 //***************************************************************************
44 struct PWU_RTITEM {
51 
58 };
59 
60 
80 extern PWU_RTITEM pwpRtItem[];
81 
82 
87 extern PWP_UINT32 totalApiCnt;
88 
89 
95  /* DOXGRP_APIPWP_UTILS_DATA */
97 
98 
99 //***************************************************************************
100 //***************************************************************************
108 //-------------------------------------------------------------------------
116 PWU_RTITEM* PwuFindTotalAPI (const char api[]);
117 
118 //-------------------------------------------------------------------------
124 PWU_RTITEM* PwuFindPublishedAPI (const char api[]);
125 
126 //-------------------------------------------------------------------------
133 PWP_MESSAGECB PwuFindApiMsgCB (const char api[]);
134  /* DOXGRP_APIPWP_UTILS_SDKPWP */
136 
137 
138 //***************************************************************************
139 //***************************************************************************
152 //-------------------------------------------------------------------------
162 PWP_UINT32 PwuSendMsg (const char api[], PWP_ENUM_MSGID id, void *pMsg);
163 
164 //-------------------------------------------------------------------------
172 void PwuSendDebugMsg (const char api[], const char txt[], PWP_UINT32 code);
173 
174 //-------------------------------------------------------------------------
182 void PwuSendInfoMsg (const char api[], const char txt[], PWP_UINT32 code);
183 
184 //-------------------------------------------------------------------------
192 void PwuSendWarningMsg (const char api[], const char txt[], PWP_UINT32 code);
193 
194 //-------------------------------------------------------------------------
202 void PwuSendErrorMsg (const char api[], const char txt[], PWP_UINT32 code);
203  /* DOXGRP_APIPWP_UTILS_MSGS */
205 
206 
207 //***************************************************************************
208 //***************************************************************************
222 //-------------------------------------------------------------------------
232 PWP_BOOL PwuProgressBegin (const char api[], PWP_UINT32 totalSteps);
233 
234 //-------------------------------------------------------------------------
244 void PwuProgressEnd (const char api[], PWP_BOOL ok);
245 
246 //-------------------------------------------------------------------------
257 PWP_BOOL PwuProgressStatus (const char api[], PWP_UINT32 complete,
258  PWP_UINT32 total);
259 
260 //-------------------------------------------------------------------------
269 PWP_BOOL PwuProgressNextStep (const char api[]);
270 
271 //-------------------------------------------------------------------------
280 PWP_BOOL PwuProgressQuit (const char api[]);
281  /* DOXGRP_APIPWP_UTILS_PROGRESS */
283 
284 
285 //***************************************************************************
286 //***************************************************************************
296 //--------------------------------------------
301 #define PWU_ENDIANNESS PWP_ENDIANNESS
302 #define PWU_ENDIAN_ERROR PWP_ENDIAN_ERROR
303 #define PWU_ENDIAN_LITTLE PWP_ENDIAN_LITTLE
304 #define PWU_ENDIAN_BIG PWP_ENDIAN_BIG
305 #define PWU_ENDIAN_NATIVE PWP_ENDIAN_NATIVE
306 #define PWU_ENDIAN_FOREIGN PWP_ENDIAN_FOREIGN
307 
309 //--------------------------------------------
315 
316 //--------------------------------------------
321 const void* PwuApplyEndianness(PWP_ENDIANNESS endianness, const void *buf,
322  size_t size);
323  /* DOXGRP_APIPWP_UTILS_ENDIAN */
325 
326 
327 //***************************************************************************
328 //***************************************************************************
337 //--------------------------------------------
346 struct PWU_UNFDATA {
348  FILE *fp;
357 };
358 
359 //-------------------------------------------------------------------------
376  PWP_ENDIANNESS endianness);
377 
378 //-------------------------------------------------------------------------
386 
387 //-------------------------------------------------------------------------
398 PWP_BOOL PwuUnfFileBegin (FILE *fp, PWU_UNFDATA *pUData);
399 
400 //-------------------------------------------------------------------------
412 
413 //-------------------------------------------------------------------------
431  PWP_UINT32 count);
432 
433 //-------------------------------------------------------------------------
444 PWP_BOOL PwuUnfRecWriteArr (PWU_UNFDATA *pUData, const void *arr,
445  size_t itemSize, size_t itemCnt);
446 
447 //-------------------------------------------------------------------------
457 PWP_BOOL PwuUnfRecWriteBuf (PWU_UNFDATA *pUData, const void *buf, size_t size);
458 
459 //-------------------------------------------------------------------------
469 PWP_BOOL PwuUnfRecWriteEndianBuf(PWU_UNFDATA *pUData, const void *buf,
470  size_t size);
471 
472 //-------------------------------------------------------------------------
482 
483 //-------------------------------------------------------------------------
493 
494 //-------------------------------------------------------------------------
504 
505 //-------------------------------------------------------------------------
515 
516 //-------------------------------------------------------------------------
526 
527 //-------------------------------------------------------------------------
537 
538 //-------------------------------------------------------------------------
548 
549 //-------------------------------------------------------------------------
559 
560 //-------------------------------------------------------------------------
570 
571 //-------------------------------------------------------------------------
581 
582 //-------------------------------------------------------------------------
592 
593 //-------------------------------------------------------------------------
603 
604 //-------------------------------------------------------------------------
613 
614 //-------------------------------------------------------------------------
627 
628 //-------------------------------------------------------------------------
639 
640 //-------------------------------------------------------------------------
652 
653 //-------------------------------------------------------------------------
664 
665 //-------------------------------------------------------------------------
676  /* DOXGRP_APIPWP_UTILS_UNFORMATTED */
678 
679 
680 //***************************************************************************
681 //***************************************************************************
689 //-------------------------------------------------------------------------
703 PWP_BOOL PwuAssignValueString(const char group[], const char name[],
704  const char value[], bool createIfNotExists = false);
705 PWP_BOOL PwuAssignValueInt(const char group[], const char name[],
706  PWP_INT value, bool createIfNotExists = false);
707 PWP_BOOL PwuAssignValueUInt(const char group[], const char name[],
708  PWP_UINT value, bool createIfNotExists = false);
709 PWP_BOOL PwuAssignValueReal(const char group[], const char name[],
710  PWP_REAL value, bool createIfNotExists = false);
711 PWP_BOOL PwuAssignValueEnum(const char group[], const char name[],
712  const char value[], bool createIfNotExists = false);
714 
715 //-------------------------------------------------------------------------
730 PWP_BOOL PwuPublishValueDefinition(const char group[], const char name[],
731  PWP_ENUM_VALTYPE type, const char value[], const char access[],
732  const char desc[], const char range[]);
733 
734 //-------------------------------------------------------------------------
748 PWP_BOOL PwuGetValue(const char group[], const char name[], PWP_HVALUE value);
749 
750 //-------------------------------------------------------------------------
758 PWP_BOOL PwuValueSetString(PWP_HVALUE value, const char *val);
759 PWP_BOOL PwuValueSetInt(PWP_HVALUE value, PWP_INT val);
760 PWP_BOOL PwuValueSetUInt(PWP_HVALUE value, PWP_UINT val);
761 PWP_BOOL PwuValueSetReal(PWP_HVALUE value, PWP_REAL val);
762 PWP_BOOL PwuValueSetEnum(PWP_HVALUE value, const char *val);
764  /* DOXGRP_APIPWP_UTILS_VARS */
766  /* DOXGRP_APIPWP_UTILS */
768 
769 } /* extern "C" */
770 
771 #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:57
PWP_BOOL PwuValueSetReal(PWP_HVALUE value, PWP_REAL val)
Set the value of a variable handle.
PWP_UINT32 recCnt
of records written
Definition: apiPWPUtils.h:354
PWP_ENUM_VALTYPE
Supported PWP-API getValue() transfer types.
Definition: apiPWP.h:612
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:206
unsigned int PWP_UINT32
32-bit unsigned integer
Definition: apiPWP.h:194
PWP_BOOL PwuValueSetUInt(PWP_HVALUE value, PWP_UINT val)
Set the value of a variable handle.
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 value, const char *val)
Set the value of a variable handle.
PWP_UINT32(* PWP_MESSAGECB)(const char api[], PWP_ENUM_MSGID id, void *pMsg)
Message handler callback function signature.
Definition: apiPWP.h:471
unsigned long PWP_UINT
unsigned integer same size as void*
Definition: apiPWP.h:158
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 value, PWP_INT val)
Set the value of a variable handle.
PWP_BOOL PwuAssignValueInt(const char group[], const char name[], PWP_INT value, bool createIfNotExists=false)
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:351
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_BOOL PwuAssignValueString(const char group[], const char name[], const char value[], bool createIfNotExists=false)
Assign or create a value.
PWP_ENDIANNESS PwuUnfFileSetEndianness(PWU_UNFDATA *pUData, PWP_ENDIANNESS endianness)
Set the output endianness.
PWP_BOOL hadError
error flag
Definition: apiPWPUtils.h:350
PWP_ENUM_MSGID
Supported PWP-API message ids.
Definition: apiPWP.h:420
PWP_UINT32 PwuSendMsg(const char api[], PWP_ENUM_MSGID id, void *pMsg)
Send a message from an api.
Definition: apiPWPUtils.cxx:71
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 value, 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:44
fpos_t sysFILEPOS
File position data type.
Definition: pwpPlatform.h:53
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 value)
Implementation of the PwpGetValue() API function.
PWU_RTITEM pwpRtItem[]
The runtime array of PWU_RTITEM items.
Definition: apiPWP.cxx:26
FILE * fp
file pointer
Definition: apiPWPUtils.h:348
float PWP_FLOAT
32-bit real
Definition: apiPWP.h:215
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:182
PWP_MESSAGECB PwuFindApiMsgCB(const char api[])
Search pwpRtItem[] for an API's messageCB.
Definition: apiPWPUtils.cxx:56
Unformatted file data block.
Definition: apiPWPUtils.h:346
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:356
The API information returned by plugins for each supported API.
Definition: apiPWP.h:568
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_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:352
PWP_BOOL PwuAssignValueEnum(const char group[], const char name[], const char value[], bool createIfNotExists=false)
sysFILEPOS fPos
file position value
Definition: apiPWPUtils.h:349
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:179
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:221
long long PWP_INT64
64-bit integer
Definition: apiPWP.h:203
PWP_UINT32 publishedApiCnt
The total # of published entries in pwpRtItem[].
Definition: apiPWP.cxx:45
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:353
The runtime data representing a PWP-API suported by a plugin.
Definition: apiPWPUtils.h:44
void PwuSendErrorMsg(const char api[], const char txt[], PWP_UINT32 code)
Send an error text message (PWP_MSGID_ERROR) to the framework.
long PWP_INT
integer same size as void*
Definition: apiPWP.h:155
PWP_ENDIANNESS endianness
write data using this endianness
Definition: apiPWPUtils.h:355
PWP_BOOL PwuAssignValueReal(const char group[], const char name[], PWP_REAL value, bool createIfNotExists=false)
PWP_BOOL PwuAssignValueUInt(const char group[], const char name[], PWP_UINT value, bool createIfNotExists=false)
PWU_RTITEM * PwuFindPublishedAPI(const char api[])
Find a published api in pwpRtItem[].
Definition: apiPWPUtils.cxx:49
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:738
PWP_UINT32 status
current file status
Definition: apiPWPUtils.h:347
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:50
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:218
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:191
PWU_RTITEM * PwuFindTotalAPI(const char api[])
Find any api in pwpRtItem[].
Definition: apiPWPUtils.cxx:42