Pointwise Plugin SDK
Classes | Macros | Typedefs | Functions | Variables
apiPWPUtils.cxx File Reference
#include <map>
#include <sstream>
#include <string>
#include <utility>
#include <string.h>
#include "apiPWP.h"
#include "apiPWPUtils.h"
+ Include dependency graph for apiPWPUtils.cxx:

Go to the source code of this file.

Classes

class  NamedStrings
 

Macros

#define ENDIAN_MAXSIZE   32
 
#define STAT_BASE   ((PWP_UINT32)(0x9ABCDEF0))
 
#define STAT_CLOSED   ((PWP_UINT32)(STAT_BASE | 0x0))
 
#define STAT_MASK   ((PWP_UINT32)(0xFFFFFFF0))
 
#define STAT_OPEN   ((PWP_UINT32)(STAT_BASE | 0x1))
 
#define UDATA_INREC(pUD)   (UDATA_ISOPEN(pUD) && (pUD)->inRec)
 
#define UDATA_ISCLOSED(pUD)   ((pUD) && (STAT_CLOSED == (pUD)->status))
 
#define UDATA_ISINIT(pUD)   (STAT_BASE == (STAT_MASK & (pUD)->status))
 
#define UDATA_ISOPEN(pUD)   ((pUD) && (STAT_OPEN == (pUD)->status) && (pUD)->fp && !(pUD)->hadError)
 

Typedefs

typedef std::string PwuString
 

Functions

const void * PwuApplyEndianness (PWP_ENDIANNESS endianness, const void *buf, size_t size)
 Apply specified byte order to buf containing size bytes. More...
 
PWP_BOOL PwuAssignValue (const char group[], const char name[], const char value[], bool createIfNotExists)
 
PWP_BOOL PwuAssignValueEnum (const char group[], const char name[], const char value[], bool createIfNotExists)
 
PWP_BOOL PwuAssignValueInt (const char group[], const char name[], PWP_INT value, bool createIfNotExists)
 
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)
 
static PWU_RTITEMPwuFindAPI (const char api[], PWP_UINT32 cnt)
 
PWP_MESSAGECB PwuFindApiMsgCB (const char api[])
 Search pwpRtItem[] for an API's messageCB. More...
 
PWU_RTITEMPwuFindPublishedAPI (const char api[])
 Find a published api in pwpRtItem[]. More...
 
PWU_RTITEMPwuFindTotalAPI (const char api[])
 Find any api in pwpRtItem[]. More...
 
PWP_ENDIANNESS PwuGetOsEndianness (void)
 Query the OS's native endianness. More...
 
PWP_BOOL PwuGetValue (const char group[], const char name[], PWP_HVALUE hVal)
 Implementation of the PwpGetValue() API function. More...
 
PwuString PwuJoin (const PwuString &j1, const PwuString &j2, char sepChar='.')
 
PwuString PwuJoin (const PwuString &j1, const PwuString &j2, const PwuString &j3, char sepChar='.')
 
PwuString PwuJoin (const PwuString &j1, const PwuString &j2, const PwuString &j3, const PwuString &j4, char sepChar='.')
 
PWP_BOOL PwuProgressBegin (const char api[], PWP_UINT32 totalSteps)
 Send a progress begin message (PWP_MSGID_PROGBEGIN) to the framework. More...
 
void PwuProgressEnd (const char api[], PWP_BOOL ok)
 Send a progress end message (PWP_MSGID_PROGEND) to the framework. More...
 
PWP_BOOL PwuProgressNextStep (const char api[])
 Send a progress "next step" message (PWP_MSGID_PROGSTATUS, value = -1) to the framework. More...
 
PWP_BOOL PwuProgressQuit (const char api[])
 Send a progress query-quit message (PWP_MSGID_PROGQUIT) to the framework. More...
 
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. More...
 
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. More...
 
void PwuSendDebugMsg (const char api[], const char txt[], PWP_UINT32 code)
 Send a debug text message (PWP_MSGID_DEBUG) to the framework. More...
 
void PwuSendErrorMsg (const char api[], const char txt[], PWP_UINT32 code)
 Send an error text message (PWP_MSGID_ERROR) to the framework. More...
 
void PwuSendInfoMsg (const char api[], const char txt[], PWP_UINT32 code)
 Send an info text message (PWP_MSGID_INFO) to the framework. More...
 
PWP_UINT32 PwuSendMsg (const char api[], PWP_ENUM_MSGID id, void *pMsg)
 Send a message from an api. More...
 
static PWP_UINT32 PwuSendProgressMsg (const char api[], PWP_ENUM_MSGID id, PWP_UINT32 value)
 
static void PwuSendTextMsg (const char api[], PWP_ENUM_MSGID id, const char txt[], PWP_UINT32 code)
 
void PwuSendWarningMsg (const char api[], const char txt[], PWP_UINT32 code)
 Send a warning text message (PWP_MSGID_WARNING) to the framework. More...
 
PWP_BOOL PwuUnfFileBegin (FILE *fp, PWU_UNFDATA *pUData)
 Prepares a PWU_UNFDATA block for a new unformatted file I/O session. More...
 
PWP_BOOL PwuUnfFileEnd (PWU_UNFDATA *pUData)
 Finalize an unformatted file I/O session. More...
 
PWP_ENDIANNESS PwuUnfFileGetEndianness (PWU_UNFDATA *pUData)
 Get the output endianness setting for this PWU_UNFDATA block. More...
 
PWP_ENDIANNESS PwuUnfFileSetEndianness (PWU_UNFDATA *pUData, PWP_ENDIANNESS endianness)
 Set the output endianness. More...
 
PWP_BOOL PwuUnfHadError (PWU_UNFDATA *pUData)
 Check if an unformatted file I/O session has detected any errors. More...
 
PWP_BOOL PwuUnfRecBegin (PWU_UNFDATA *pUData)
 Prepares a PWU_UNFDATA block for writing a new unformatted data record. More...
 
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 written is known ahead of time. More...
 
PWP_UINT32 PwuUnfRecBytes (PWU_UNFDATA *pUData)
 Get the running total number of bytes written to the current record during an unformatted file I/O session. More...
 
PWP_UINT32 PwuUnfRecCount (PWU_UNFDATA *pUData)
 Get the running total number of finalized records written during an unformatted file I/O session. More...
 
PWP_BOOL PwuUnfRecEnd (PWU_UNFDATA *pUData)
 Finalize the current record write. More...
 
PWP_BOOL PwuUnfRecWriteArr (PWU_UNFDATA *pUData, const void *arr, size_t itemSize, size_t itemCnt)
 Write an array of data to the current record. More...
 
PWP_BOOL PwuUnfRecWriteBuf (PWU_UNFDATA *pUData, const void *buf, size_t size)
 Write a data buffer to the current record. More...
 
PWP_BOOL PwuUnfRecWriteEndianBuf (PWU_UNFDATA *pUData, const void *buf, size_t size)
 Write a data buffer to the current record with endian order applied. More...
 
PWP_BOOL PwuUnfRecWriteFLOAT (PWU_UNFDATA *pUData, PWP_FLOAT val)
 Write a PWP_FLOAT value to the current record with endian order applied. More...
 
PWP_BOOL PwuUnfRecWriteINT (PWU_UNFDATA *pUData, PWP_INT val)
 Write a PWP_INT value to the current record with endian order applied. More...
 
PWP_BOOL PwuUnfRecWriteINT16 (PWU_UNFDATA *pUData, PWP_INT16 val)
 Write a PWP_INT16 value to the current record with endian order applied. More...
 
PWP_BOOL PwuUnfRecWriteINT32 (PWU_UNFDATA *pUData, PWP_INT32 val)
 Write a PWP_INT32 value to the current record with endian order applied. More...
 
PWP_BOOL PwuUnfRecWriteINT64 (PWU_UNFDATA *pUData, PWP_INT64 val)
 Write a PWP_INT64 value to the current record with endian order applied. More...
 
PWP_BOOL PwuUnfRecWriteINT8 (PWU_UNFDATA *pUData, PWP_INT8 val)
 Write a PWP_INT8 value to the current record with endian order applied. More...
 
PWP_BOOL PwuUnfRecWriteREAL (PWU_UNFDATA *pUData, PWP_REAL val)
 Write a PWP_REAL value to the current record with endian order applied. More...
 
PWP_BOOL PwuUnfRecWriteUINT (PWU_UNFDATA *pUData, PWP_UINT val)
 Write a PWP_UINT value to the current record with endian order applied. More...
 
PWP_BOOL PwuUnfRecWriteUINT16 (PWU_UNFDATA *pUData, PWP_UINT16 val)
 Write a PWP_UINT16 value to the current record with endian order applied. More...
 
PWP_BOOL PwuUnfRecWriteUINT32 (PWU_UNFDATA *pUData, PWP_UINT32 val)
 Write a PWP_UINT32 value to the current record with endian order applied. More...
 
PWP_BOOL PwuUnfRecWriteUINT64 (PWU_UNFDATA *pUData, PWP_UINT64 val)
 Write a PWP_UINT64 value to the current record with endian order applied. More...
 
PWP_BOOL PwuUnfRecWriteUINT8 (PWU_UNFDATA *pUData, PWP_UINT8 val)
 Write a PWP_UINT8 value to the current record with endian order applied. More...
 
PWP_UINT32 PwuUnfTotRecBytes (PWU_UNFDATA *pUData)
 Get the running total number of bytes written to all records during an unformatted file I/O session. More...
 
static PwuString PwuValueDefnAccessKey (const PwuString &rootGroup, const PwuString &valName)
 
static PwuString PwuValueDefnAttrGroup (const PwuString &rootGroup, const PwuString &valName)
 
static PwuString PwuValueDefnDefaultKey (const PwuString &rootGroup, const PwuString &valName)
 
static PwuString PwuValueDefnDescKey (const PwuString &rootGroup, const PwuString &valName)
 
static PwuString PwuValueDefnNameKey (const PwuString &rootGroup, const PwuString &valName)
 
static PwuString PwuValueDefnRangeKey (const PwuString &rootGroup, const PwuString &valName)
 
static PwuString PwuValueDefnsGroup (const PwuString &rootGroup)
 
static PwuString PwuValueDefnTypeKey (const PwuString &rootGroup, const PwuString &valName)
 
static PwuString PwuValueNamesGroup (const PwuString &rootGroup)
 
PWP_BOOL PwuValueSetBool (PWP_HVALUE hVal, PWP_BOOL val)
 
PWP_BOOL PwuValueSetEnum (PWP_HVALUE hVal, const char *val)
 
PWP_BOOL PwuValueSetInt (PWP_HVALUE hVal, PWP_INT val)
 
PWP_BOOL PwuValueSetReal (PWP_HVALUE hVal, PWP_REAL val)
 
PWP_BOOL PwuValueSetString (PWP_HVALUE hVal, const char *val)
 Set the value of a variable handle. More...
 
template<typename T , PWP_ENUM_VALTYPE TId>
static PWP_BOOL PwuValueSetter (PWP_HVALUE hVal, T *val)
 
PWP_BOOL PwuValueSetUInt (PWP_HVALUE hVal, PWP_UINT val)
 
static const char * typeToString (PWP_ENUM_VALTYPE type)
 
static PWP_BOOL unfHdrLenWrite (PWU_UNFDATA *pUData)
 
static PWP_BOOL unfUDataInit (PWU_UNFDATA *pUData)
 

Variables

static NamedStrings namedStrings
 

Macro Definition Documentation

◆ ENDIAN_MAXSIZE

#define ENDIAN_MAXSIZE   32

Referenced by PwuApplyEndianness().

◆ STAT_BASE

#define STAT_BASE   ((PWP_UINT32)(0x9ABCDEF0))

Definition at line 292 of file apiPWPUtils.cxx.

◆ STAT_CLOSED

#define STAT_CLOSED   ((PWP_UINT32)(STAT_BASE | 0x0))

Definition at line 294 of file apiPWPUtils.cxx.

Referenced by PwuUnfFileEnd().

◆ STAT_MASK

#define STAT_MASK   ((PWP_UINT32)(0xFFFFFFF0))

Definition at line 291 of file apiPWPUtils.cxx.

◆ STAT_OPEN

#define STAT_OPEN   ((PWP_UINT32)(STAT_BASE | 0x1))

Definition at line 293 of file apiPWPUtils.cxx.

Referenced by unfUDataInit().

◆ UDATA_INREC

#define UDATA_INREC (   pUD)    (UDATA_ISOPEN(pUD) && (pUD)->inRec)

Definition at line 298 of file apiPWPUtils.cxx.

Referenced by PwuUnfRecEnd(), PwuUnfRecWriteArr(), and unfHdrLenWrite().

◆ UDATA_ISCLOSED

#define UDATA_ISCLOSED (   pUD)    ((pUD) && (STAT_CLOSED == (pUD)->status))

Definition at line 299 of file apiPWPUtils.cxx.

◆ UDATA_ISINIT

#define UDATA_ISINIT (   pUD)    (STAT_BASE == (STAT_MASK & (pUD)->status))

Definition at line 296 of file apiPWPUtils.cxx.

Referenced by PwuUnfHadError(), PwuUnfRecBytes(), PwuUnfRecCount(), and PwuUnfTotRecBytes().

◆ UDATA_ISOPEN

#define UDATA_ISOPEN (   pUD)    ((pUD) && (STAT_OPEN == (pUD)->status) && (pUD)->fp && !(pUD)->hadError)

Definition at line 297 of file apiPWPUtils.cxx.

Referenced by PwuUnfFileSetEndianness(), PwuUnfRecBegin(), and PwuUnfRecBeginFixed().

Typedef Documentation

◆ PwuString

typedef std::string PwuString

Definition at line 20 of file apiPWPUtils.cxx.

Function Documentation

◆ PwuAssignValue()

PWP_BOOL PwuAssignValue ( const char  group[],
const char  name[],
const char  value[],
bool  createIfNotExists 
)

◆ PwuFindAPI()

static PWU_RTITEM* PwuFindAPI ( const char  api[],
PWP_UINT32  cnt 
)
static

Definition at line 25 of file apiPWPUtils.cxx.

References pwpRtItem.

Referenced by PwuFindPublishedAPI(), and PwuFindTotalAPI().

◆ PwuJoin() [1/3]

PwuString PwuJoin ( const PwuString j1,
const PwuString j2,
char  sepChar = '.' 
)

◆ PwuJoin() [2/3]

PwuString PwuJoin ( const PwuString j1,
const PwuString j2,
const PwuString j3,
char  sepChar = '.' 
)

Definition at line 765 of file apiPWPUtils.cxx.

References PwuJoin().

◆ PwuJoin() [3/3]

PwuString PwuJoin ( const PwuString j1,
const PwuString j2,
const PwuString j3,
const PwuString j4,
char  sepChar = '.' 
)

Definition at line 773 of file apiPWPUtils.cxx.

References PwuJoin().

◆ PwuSendProgressMsg()

static PWP_UINT32 PwuSendProgressMsg ( const char  api[],
PWP_ENUM_MSGID  id,
PWP_UINT32  value 
)
static

◆ PwuSendTextMsg()

static void PwuSendTextMsg ( const char  api[],
PWP_ENUM_MSGID  id,
const char  txt[],
PWP_UINT32  code 
)
static

◆ PwuValueDefnAccessKey()

static PwuString PwuValueDefnAccessKey ( const PwuString rootGroup,
const PwuString valName 
)
static

Definition at line 823 of file apiPWPUtils.cxx.

References PWU_VALUE_DEFN_ACCESS_STR, PwuJoin(), and PwuValueDefnAttrGroup().

Referenced by PwuPublishValueDefinition().

◆ PwuValueDefnAttrGroup()

static PwuString PwuValueDefnAttrGroup ( const PwuString rootGroup,
const PwuString valName 
)
static

◆ PwuValueDefnDefaultKey()

static PwuString PwuValueDefnDefaultKey ( const PwuString rootGroup,
const PwuString valName 
)
static

◆ PwuValueDefnDescKey()

static PwuString PwuValueDefnDescKey ( const PwuString rootGroup,
const PwuString valName 
)
static

Definition at line 832 of file apiPWPUtils.cxx.

References PWU_VALUE_DEFN_DESC_STR, PwuJoin(), and PwuValueDefnAttrGroup().

Referenced by PwuPublishValueDefinition().

◆ PwuValueDefnNameKey()

static PwuString PwuValueDefnNameKey ( const PwuString rootGroup,
const PwuString valName 
)
static

Definition at line 805 of file apiPWPUtils.cxx.

References PWU_VALUE_DEFN_NAME_STR, PwuJoin(), and PwuValueDefnAttrGroup().

Referenced by PwuPublishValueDefinition().

◆ PwuValueDefnRangeKey()

static PwuString PwuValueDefnRangeKey ( const PwuString rootGroup,
const PwuString valName 
)
static

Definition at line 850 of file apiPWPUtils.cxx.

References PWU_VALUE_DEFN_RANGE_STR, PwuJoin(), and PwuValueDefnAttrGroup().

Referenced by PwuPublishValueDefinition().

◆ PwuValueDefnsGroup()

static PwuString PwuValueDefnsGroup ( const PwuString rootGroup)
static

Definition at line 789 of file apiPWPUtils.cxx.

References PWU_PUBLISH_DEFNS_STR, and PwuJoin().

Referenced by PwuValueDefnAttrGroup().

◆ PwuValueDefnTypeKey()

static PwuString PwuValueDefnTypeKey ( const PwuString rootGroup,
const PwuString valName 
)
static

Definition at line 814 of file apiPWPUtils.cxx.

References PWU_VALUE_DEFN_TYPE_STR, PwuJoin(), and PwuValueDefnAttrGroup().

Referenced by PwuPublishValueDefinition().

◆ PwuValueNamesGroup()

static PwuString PwuValueNamesGroup ( const PwuString rootGroup)
static

Definition at line 781 of file apiPWPUtils.cxx.

References PWU_PUBLISH_NAMES_STR, and PwuJoin().

Referenced by PwuPublishValueDefinition().

◆ PwuValueSetBool()

PWP_BOOL PwuValueSetBool ( PWP_HVALUE  hVal,
PWP_BOOL  val 
)

Definition at line 1016 of file apiPWPUtils.cxx.

◆ PwuValueSetter()

template<typename T , PWP_ENUM_VALTYPE TId>
static PWP_BOOL PwuValueSetter ( PWP_HVALUE  hVal,
T *  val 
)
static

◆ typeToString()

static const char* typeToString ( PWP_ENUM_VALTYPE  type)
static

◆ unfHdrLenWrite()

static PWP_BOOL unfHdrLenWrite ( PWU_UNFDATA pUData)
static

◆ unfUDataInit()

static PWP_BOOL unfUDataInit ( PWU_UNFDATA pUData)
static

Variable Documentation

◆ namedStrings

NamedStrings namedStrings
static

Definition at line 727 of file apiPWPUtils.cxx.

Referenced by PwuAssignValue(), PwuGetValue(), and PwuPublishValueDefinition().