remove use of std lib for now
This commit is contained in:
@@ -174,7 +174,7 @@ inline void casChannelI::postAccessRightsEvent()
|
||||
//
|
||||
// casChannelI::enumStringTable ()
|
||||
//
|
||||
inline const std::vector< std::string >& casChannelI::enumStringTable () const
|
||||
inline const gddEnumStringTable & casChannelI::enumStringTable () const
|
||||
{
|
||||
return this->pv.enumStringTable ();
|
||||
}
|
||||
|
||||
@@ -345,7 +345,7 @@ public:
|
||||
|
||||
void postAccessRightsEvent ();
|
||||
|
||||
const std::vector< std::string >& enumStringTable () const;
|
||||
const gddEnumStringTable & enumStringTable () const;
|
||||
|
||||
//
|
||||
// virtual functions
|
||||
@@ -448,7 +448,7 @@ public:
|
||||
|
||||
epicsShareFunc virtual casResType resourceType () const;
|
||||
|
||||
const std::vector< std::string >& enumStringTable () const;
|
||||
const gddEnumStringTable & enumStringTable () const;
|
||||
void updateEnumStringTable ();
|
||||
|
||||
//
|
||||
@@ -471,7 +471,7 @@ public:
|
||||
|
||||
private:
|
||||
tsDLList<casPVListChan> chanList;
|
||||
std::vector< std::string > enumStrTbl;
|
||||
gddEnumStringTable enumStrTbl;
|
||||
caServerI *pCAS;
|
||||
unsigned nMonAttached;
|
||||
unsigned nIOAttached;
|
||||
|
||||
@@ -254,11 +254,15 @@ void casPVI::updateEnumStringTable ()
|
||||
if (pTmp->dimension()==0) {
|
||||
if (pTmp->primitiveType()==aitEnumString) {
|
||||
aitString *pStr = (aitString *) pTmp->dataVoid ();
|
||||
this->enumStrTbl[0].assign (pStr->string());
|
||||
if ( ! this->enumStrTbl.setString ( 0, pStr->string() ) ) {
|
||||
errMessage ( S_cas_noMemory, "no memory to set enumerated PV string cache" );
|
||||
}
|
||||
}
|
||||
else if (pTmp->primitiveType()==aitEnumFixedString) {
|
||||
aitFixedString *pStr = (aitFixedString *) pTmp->dataVoid ();
|
||||
this->enumStrTbl[0].assign (pStr->fixed_string);
|
||||
if ( ! this->enumStrTbl.setString ( 0, pStr->fixed_string ) ) {
|
||||
errMessage ( S_cas_noMemory, "no memory to set enumerated PV string cache" );
|
||||
}
|
||||
}
|
||||
else {
|
||||
errMessage (S_cas_badType, "application type \"enums\" string conversion table for enumerated PV isnt a string type?");
|
||||
@@ -274,18 +278,22 @@ void casPVI::updateEnumStringTable ()
|
||||
//
|
||||
// preallocate the correct amount
|
||||
//
|
||||
this->enumStrTbl.reserve (count);
|
||||
this->enumStrTbl.reserve ( count );
|
||||
|
||||
if (pTmp->primitiveType()==aitEnumString) {
|
||||
aitString *pStr = (aitString *) pTmp->dataVoid ();
|
||||
for (index = 0; index<count; index++) {
|
||||
this->enumStrTbl[index].assign (pStr[index].string());
|
||||
for ( index = 0; index<count; index++ ) {
|
||||
if ( ! this->enumStrTbl.setString ( index, pStr[index].string() ) ) {
|
||||
errMessage ( S_cas_noMemory, "no memory to set enumerated PV string cache" );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (pTmp->primitiveType()==aitEnumFixedString) {
|
||||
aitFixedString *pStr = (aitFixedString *) pTmp->dataVoid ();
|
||||
for (index = 0; index<count; index++) {
|
||||
this->enumStrTbl[index].assign (pStr[index].fixed_string);
|
||||
for ( index = 0; index<count; index++ ) {
|
||||
if ( ! this->enumStrTbl.setString ( index, pStr[index].fixed_string ) ) {
|
||||
errMessage ( S_cas_noMemory, "no memory to set enumerated PV string cache" );
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -158,7 +158,7 @@ inline aitIndex casPVI::nativeCount ()
|
||||
//
|
||||
// casPVI::enumStringTable ()
|
||||
//
|
||||
inline const std::vector< std::string >& casPVI::enumStringTable () const
|
||||
inline const gddEnumStringTable & casPVI::enumStringTable () const
|
||||
{
|
||||
return this->enumStrTbl;
|
||||
}
|
||||
|
||||
+4
-2
@@ -24,6 +24,7 @@ INC += gddAppTable.h
|
||||
INC += gddAppFuncTable.h
|
||||
INC += smartGDDPointer.h
|
||||
INC += gddApps.h
|
||||
INC += gddEnumStringTable.h
|
||||
|
||||
HTMLS += gdd.html
|
||||
HTMLS += gddref.html
|
||||
@@ -31,12 +32,13 @@ HTMLS += gddref2.html
|
||||
|
||||
AITGENSRCS := gdd.cc gddTest.cc gddAppTable.cc gddNewDel.cc \
|
||||
gddAppDefs.cc aitTypes.c aitConvert.cc aitHelpers.cc \
|
||||
gddArray.cc gddContainer.cc gddErrorCodes.cc gddUtils.cc
|
||||
gddArray.cc gddContainer.cc gddErrorCodes.cc gddUtils.cc \
|
||||
gddEnumStringTable.cc
|
||||
|
||||
gdd_SRCS := gdd.cc gddTest.cc gddAppTable.cc gddNewDel.cc \
|
||||
gddAppDefs.cc aitTypes.c aitConvert.cc aitHelpers.cc dbMapper.cc \
|
||||
gddArray.cc gddContainer.cc gddErrorCodes.cc gddUtils.cc \
|
||||
smartGDDPointer.cc
|
||||
smartGDDPointer.cc gddEnumStringTable.cc
|
||||
|
||||
LIBRARY = gdd
|
||||
|
||||
|
||||
+40
-38
@@ -5,6 +5,9 @@
|
||||
// $Id$
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.14 2001/07/03 00:58:17 jhill
|
||||
// changed interface so that unreferenced table will not optimize away
|
||||
//
|
||||
// Revision 1.13 2001/06/11 22:28:50 jhill
|
||||
// revert because workaround for RTEMS didnt build
|
||||
//
|
||||
@@ -62,7 +65,7 @@
|
||||
#define epicsExportSharedSymbols
|
||||
#include "aitConvert.h"
|
||||
|
||||
int aitNoConvert(void* /*dest*/,const void* /*src*/,aitIndex /*count*/, const std::vector< std::string > *) {return -1;}
|
||||
int aitNoConvert(void* /*dest*/,const void* /*src*/,aitIndex /*count*/, const gddEnumStringTable *) {return -1;}
|
||||
|
||||
#ifdef AIT_CONVERT
|
||||
#undef AIT_CONVERT
|
||||
@@ -82,7 +85,7 @@ int aitNoConvert(void* /*dest*/,const void* /*src*/,aitIndex /*count*/, const st
|
||||
|
||||
/* ------- extra string conversion functions --------- */
|
||||
static int aitConvertStringString(void* d,const void* s,
|
||||
aitIndex c, const std::vector< std::string > *)
|
||||
aitIndex c, const gddEnumStringTable *)
|
||||
{
|
||||
// does not work - need to be fixed
|
||||
aitIndex i;
|
||||
@@ -92,29 +95,29 @@ static int aitConvertStringString(void* d,const void* s,
|
||||
return 0;
|
||||
}
|
||||
static int aitConvertToNetStringString(void* d,const void* s,
|
||||
aitIndex c, const std::vector< std::string > *pEnumStringTable)
|
||||
aitIndex c, const gddEnumStringTable *pEnumStringTable)
|
||||
{ return aitConvertStringString(d,s,c, pEnumStringTable);}
|
||||
static int aitConvertFromNetStringString(void* d,const void* s,
|
||||
aitIndex c, const std::vector< std::string > *pEnumStringTable)
|
||||
aitIndex c, const gddEnumStringTable *pEnumStringTable)
|
||||
{ return aitConvertStringString(d,s,c, pEnumStringTable);}
|
||||
|
||||
/* ------ all the fixed string conversion functions ------ */
|
||||
static int aitConvertFixedStringFixedString(void* d,const void* s,
|
||||
aitIndex c, const std::vector< std::string > *)
|
||||
aitIndex c, const gddEnumStringTable *)
|
||||
{
|
||||
aitUint32 len = c*AIT_FIXED_STRING_SIZE;
|
||||
memcpy(d,s,len);
|
||||
return 0;
|
||||
}
|
||||
static int aitConvertToNetFixedStringFixedString(void* d,const void* s,
|
||||
aitIndex c, const std::vector< std::string > *pEnumStringTable)
|
||||
aitIndex c, const gddEnumStringTable *pEnumStringTable)
|
||||
{ return aitConvertFixedStringFixedString(d,s,c,pEnumStringTable);}
|
||||
static int aitConvertFromNetFixedStringFixedString(void* d,const void* s,
|
||||
aitIndex c, const std::vector< std::string > *pEnumStringTable)
|
||||
aitIndex c, const gddEnumStringTable *pEnumStringTable)
|
||||
{ return aitConvertFixedStringFixedString(d,s,c,pEnumStringTable);}
|
||||
|
||||
static int aitConvertStringFixedString(void* d,const void* s,
|
||||
aitIndex c, const std::vector< std::string > *)
|
||||
aitIndex c, const gddEnumStringTable *)
|
||||
{
|
||||
aitIndex i;
|
||||
aitString* out = (aitString*)d;
|
||||
@@ -125,7 +128,7 @@ static int aitConvertStringFixedString(void* d,const void* s,
|
||||
}
|
||||
|
||||
static int aitConvertFixedStringString(void* d,const void* s,
|
||||
aitIndex c, const std::vector< std::string > *)
|
||||
aitIndex c, const gddEnumStringTable *)
|
||||
{
|
||||
aitIndex i;
|
||||
aitString* in = (aitString*)s;
|
||||
@@ -145,20 +148,20 @@ static int aitConvertFixedStringString(void* d,const void* s,
|
||||
}
|
||||
|
||||
static int aitConvertToNetStringFixedString(void* d,const void* s,
|
||||
aitIndex c, const std::vector< std::string > *pEnumStringTable)
|
||||
aitIndex c, const gddEnumStringTable *pEnumStringTable)
|
||||
{ return aitConvertStringFixedString(d,s,c,pEnumStringTable); }
|
||||
static int aitConvertFromNetFixedStringString(void* d,const void* s,
|
||||
aitIndex c, const std::vector< std::string > *pEnumStringTable)
|
||||
aitIndex c, const gddEnumStringTable *pEnumStringTable)
|
||||
{ return aitConvertFixedStringString(d,s,c,pEnumStringTable); }
|
||||
static int aitConvertToNetFixedStringString(void* d,const void* s,
|
||||
aitIndex c, const std::vector< std::string > *pEnumStringTable)
|
||||
aitIndex c, const gddEnumStringTable *pEnumStringTable)
|
||||
{ return aitConvertStringFixedString(d,s,c,pEnumStringTable); }
|
||||
static int aitConvertFromNetStringFixedString(void* d,const void* s,
|
||||
aitIndex c, const std::vector< std::string > *pEnumStringTable)
|
||||
aitIndex c, const gddEnumStringTable *pEnumStringTable)
|
||||
{ return aitConvertFixedStringString(d,s,c,pEnumStringTable); }
|
||||
|
||||
static int aitConvertStringEnum16(void* d,const void* s,
|
||||
aitIndex c, const std::vector< std::string > *pEnumStringTable)
|
||||
aitIndex c, const gddEnumStringTable *pEnumStringTable)
|
||||
{
|
||||
aitIndex i;
|
||||
int status=0;
|
||||
@@ -167,9 +170,9 @@ static int aitConvertStringEnum16(void* d,const void* s,
|
||||
aitEnum16* in=(aitEnum16*)s;
|
||||
for (i=0;i<c;i++) {
|
||||
unsigned nChar;
|
||||
if (pEnumStringTable&&in[i]<pEnumStringTable->size()) {
|
||||
out[i].copy((*pEnumStringTable)[in[i]].c_str());
|
||||
nChar = (*pEnumStringTable)[in[i]].length();
|
||||
if ( pEnumStringTable && in[i] < pEnumStringTable->numberOfStrings() ) {
|
||||
out[i].copy( pEnumStringTable->getString (in[i]) );
|
||||
nChar = pEnumStringTable->getStringLength ( in[i] );
|
||||
}
|
||||
else {
|
||||
nChar = sprintf(temp, "%hu",in[i]);
|
||||
@@ -181,19 +184,19 @@ static int aitConvertStringEnum16(void* d,const void* s,
|
||||
}
|
||||
|
||||
static int aitConvertToNetStringEnum16(void* d,const void* s,
|
||||
aitIndex c, const std::vector< std::string > *pEnumStringTable)
|
||||
aitIndex c, const gddEnumStringTable *pEnumStringTable)
|
||||
{
|
||||
return aitConvertStringEnum16(d,s,c,pEnumStringTable);
|
||||
}
|
||||
|
||||
static int aitConvertFromNetStringEnum16(void* d,const void* s,
|
||||
aitIndex c, const std::vector< std::string > *pEnumStringTable)
|
||||
aitIndex c, const gddEnumStringTable *pEnumStringTable)
|
||||
{
|
||||
return aitConvertStringEnum16(d,s,c,pEnumStringTable);
|
||||
}
|
||||
|
||||
static int aitConvertFixedStringEnum16(void* d,const void* s,
|
||||
aitIndex c, const std::vector< std::string > *pEnumStringTable)
|
||||
aitIndex c, const gddEnumStringTable *pEnumStringTable)
|
||||
{
|
||||
aitIndex i;
|
||||
int status=0;
|
||||
@@ -201,10 +204,9 @@ static int aitConvertFixedStringEnum16(void* d,const void* s,
|
||||
aitEnum16* in=(aitEnum16*)s;
|
||||
for (i=0;i<c;i++) {
|
||||
unsigned nChar;
|
||||
if (pEnumStringTable&&in[i]<pEnumStringTable->size()) {
|
||||
strncpy(out[i].fixed_string, (*pEnumStringTable)[in[i]].c_str(),sizeof(out[i].fixed_string));
|
||||
out[i].fixed_string[sizeof(out[i].fixed_string)-1] = '\0';
|
||||
nChar = sizeof(out[i].fixed_string);
|
||||
if ( pEnumStringTable && in[i] < pEnumStringTable->numberOfStrings() ) {
|
||||
pEnumStringTable->getString ( in[i], out[i].fixed_string, sizeof( out[i].fixed_string ) );
|
||||
nChar = pEnumStringTable->getStringLength ( in[i] );
|
||||
}
|
||||
else {
|
||||
nChar = sprintf(out[i].fixed_string,"%hu",in[i]);
|
||||
@@ -216,19 +218,19 @@ static int aitConvertFixedStringEnum16(void* d,const void* s,
|
||||
}
|
||||
|
||||
static int aitConvertToNetFixedStringEnum16(void* d,const void* s,
|
||||
aitIndex c, const std::vector< std::string > *pEnumStringTable)
|
||||
aitIndex c, const gddEnumStringTable *pEnumStringTable)
|
||||
{
|
||||
return aitConvertFixedStringEnum16(d,s,c,pEnumStringTable);
|
||||
}
|
||||
|
||||
static int aitConvertFromNetFixedStringEnum16(void* d,const void* s,
|
||||
aitIndex c, const std::vector< std::string > *pEnumStringTable)
|
||||
aitIndex c, const gddEnumStringTable *pEnumStringTable)
|
||||
{
|
||||
return aitConvertFixedStringEnum16(d,s,c,pEnumStringTable);
|
||||
}
|
||||
|
||||
static int aitConvertEnum16FixedString (void* d,const void* s,aitIndex c,
|
||||
const std::vector< std::string > *pEnumStringTable)
|
||||
const gddEnumStringTable *pEnumStringTable)
|
||||
{
|
||||
aitIndex i;
|
||||
int status = 0;
|
||||
@@ -240,8 +242,8 @@ static int aitConvertEnum16FixedString (void* d,const void* s,aitIndex c,
|
||||
// convert only after a range check
|
||||
//
|
||||
if ( pEnumStringTable ) {
|
||||
assert (pEnumStringTable->size()<=0xffff);
|
||||
nChoices = static_cast<aitEnum16>(pEnumStringTable->size());
|
||||
assert (pEnumStringTable->numberOfStrings()<=0xffff);
|
||||
nChoices = static_cast<aitEnum16>(pEnumStringTable->numberOfStrings());
|
||||
}
|
||||
else {
|
||||
nChoices = 0;
|
||||
@@ -252,7 +254,7 @@ static int aitConvertEnum16FixedString (void* d,const void* s,aitIndex c,
|
||||
// find the choice that matches
|
||||
//
|
||||
for (choice=0;choice<nChoices;choice++) {
|
||||
if (strcmp((*pEnumStringTable)[choice].c_str(), in[i].fixed_string)==0) {
|
||||
if (strcmp( pEnumStringTable->getString(choice), in[i].fixed_string)==0) {
|
||||
out[i] = choice;
|
||||
status += sizeof(out[i]);
|
||||
break;
|
||||
@@ -269,19 +271,19 @@ static int aitConvertEnum16FixedString (void* d,const void* s,aitIndex c,
|
||||
}
|
||||
|
||||
static int aitConvertToNetEnum16FixedString(void* d,const void* s,
|
||||
aitIndex c, const std::vector< std::string > *pEnumStringTable)
|
||||
aitIndex c, const gddEnumStringTable *pEnumStringTable)
|
||||
{
|
||||
return aitConvertEnum16FixedString(d,s,c,pEnumStringTable);
|
||||
}
|
||||
|
||||
static int aitConvertFromNetEnum16FixedString(void* d,const void* s,
|
||||
aitIndex c, const std::vector< std::string > *pEnumStringTable)
|
||||
aitIndex c, const gddEnumStringTable *pEnumStringTable)
|
||||
{
|
||||
return aitConvertEnum16FixedString(d,s,c,pEnumStringTable);
|
||||
}
|
||||
|
||||
static int aitConvertEnum16String (void* d,const void* s,
|
||||
aitIndex c, const std::vector< std::string > *pEnumStringTable)
|
||||
aitIndex c, const gddEnumStringTable *pEnumStringTable)
|
||||
{
|
||||
aitIndex i;
|
||||
int status = 0;
|
||||
@@ -293,8 +295,8 @@ static int aitConvertEnum16String (void* d,const void* s,
|
||||
// convert only after a range check
|
||||
//
|
||||
if ( pEnumStringTable ) {
|
||||
assert (pEnumStringTable->size()<=0xffff);
|
||||
nChoices = static_cast<aitEnum16>(pEnumStringTable->size());
|
||||
assert (pEnumStringTable->numberOfStrings()<=0xffff);
|
||||
nChoices = static_cast<aitEnum16>(pEnumStringTable->numberOfStrings());
|
||||
}
|
||||
else {
|
||||
nChoices = 0u;
|
||||
@@ -305,7 +307,7 @@ static int aitConvertEnum16String (void* d,const void* s,
|
||||
// find the choice that matches
|
||||
//
|
||||
for (choice=0;choice<nChoices;choice++) {
|
||||
if (strcmp((*pEnumStringTable)[choice].c_str(), in[i].string())==0) {
|
||||
if (strcmp(pEnumStringTable->getString(choice), in[i].string())==0) {
|
||||
out[i] = choice;
|
||||
status += sizeof(out[i]);
|
||||
break;
|
||||
@@ -322,13 +324,13 @@ static int aitConvertEnum16String (void* d,const void* s,
|
||||
}
|
||||
|
||||
static int aitConvertToNetEnum16String(void* d,const void* s,
|
||||
aitIndex c, const std::vector< std::string > *pEnumStringTable)
|
||||
aitIndex c, const gddEnumStringTable *pEnumStringTable)
|
||||
{
|
||||
return aitConvertEnum16String(d,s,c,pEnumStringTable);
|
||||
}
|
||||
|
||||
static int aitConvertFromNetEnum16String(void* d,const void* s,
|
||||
aitIndex c, const std::vector< std::string > *pEnumStringTable)
|
||||
aitIndex c, const gddEnumStringTable *pEnumStringTable)
|
||||
{
|
||||
return aitConvertEnum16String(d,s,c,pEnumStringTable);
|
||||
}
|
||||
|
||||
+14
-8
@@ -8,6 +8,9 @@
|
||||
* $Id$
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.14 2001/09/05 00:50:36 jhill
|
||||
* removed GNU compiler ifdef
|
||||
*
|
||||
* Revision 1.13 2001/07/03 00:58:18 jhill
|
||||
* changed interface so that unreferenced table will not optimize away
|
||||
*
|
||||
@@ -56,16 +59,15 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1200
|
||||
#pragma warning (disable:4786)
|
||||
# pragma warning ( push )
|
||||
# pragma warning ( disable:4786 )
|
||||
#endif
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
|
||||
#include "shareLib.h"
|
||||
#include "osiSock.h"
|
||||
|
||||
#include "aitTypes.h"
|
||||
#include "gddEnumStringTable.h"
|
||||
|
||||
#if defined(__i386) || defined(i386)
|
||||
#define AIT_NEED_BYTE_SWAP 1
|
||||
@@ -80,7 +82,7 @@
|
||||
typedef enum { aitLocalDataFormat=0, aitNetworkDataFormat } aitDataFormat;
|
||||
|
||||
/* all conversion functions have this prototype */
|
||||
typedef int (*aitFunc)(void* dest,const void* src,aitIndex count,const std::vector< std::string > *pEnumStringTable);
|
||||
typedef int (*aitFunc)(void* dest,const void* src,aitIndex count,const gddEnumStringTable *pEnumStringTable);
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -107,17 +109,17 @@ epicsShareExtern aitFunc aitConvertFromNetTable[aitTotal][aitTotal];
|
||||
|
||||
inline int aitConvert(aitEnum desttype, void* dest,
|
||||
aitEnum srctype, const void* src, aitIndex count,
|
||||
const std::vector<std::string> *pEnumStringTable = 0 )
|
||||
const gddEnumStringTable *pEnumStringTable = 0 )
|
||||
{ return (*aitConvertTable[desttype][srctype])(dest,src,count,pEnumStringTable); }
|
||||
|
||||
inline int aitConvertToNet(aitEnum desttype, void* dest,
|
||||
aitEnum srctype, const void* src, aitIndex count,
|
||||
const std::vector<std::string> *pEnumStringTable = 0 )
|
||||
const gddEnumStringTable *pEnumStringTable = 0 )
|
||||
{ return (*aitConvertToNetTable[desttype][srctype])(dest,src,count,pEnumStringTable); }
|
||||
|
||||
inline int aitConvertFromNet(aitEnum desttype, void* dest,
|
||||
aitEnum srctype, const void* src, aitIndex count,
|
||||
const std::vector<std::string> *pEnumStringTable = 0 )
|
||||
const gddEnumStringTable *pEnumStringTable = 0 )
|
||||
{ return (*aitConvertFromNetTable[desttype][srctype])(dest,src,count,pEnumStringTable); }
|
||||
|
||||
#else
|
||||
@@ -193,5 +195,9 @@ inline void aitFromNetOrder64(aitUint64* dest, aitUint64* src)
|
||||
#define aitFromNetFloat64 aitFromNetOrder64
|
||||
#define aitFromNetFloat32 aitFromNetOrder32
|
||||
|
||||
#if defined ( _MSC_VER ) && _MSC_VER < 1200
|
||||
# pragma warning ( pop )
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
+8
-5
@@ -5,6 +5,9 @@
|
||||
* $Id$
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.11 2001/07/03 00:58:18 jhill
|
||||
* changed interface so that unreferenced table will not optimize away
|
||||
*
|
||||
* Revision 1.10 2000/10/12 21:52:48 jhill
|
||||
* changes to support compilation by borland
|
||||
*
|
||||
@@ -234,7 +237,7 @@ void MakeStringFuncFrom(int i,int j,int k)
|
||||
/* assumes that void* d in an array of char pointers of length c */
|
||||
/* takes numeric data from source j and convert it to string in dest i */
|
||||
|
||||
pr(dfd,"static int %s%s%s(void* d,const void* s,aitIndex c, const std::vector<std::string> *)\n",
|
||||
pr(dfd,"static int %s%s%s(void* d,const void* s,aitIndex c, const gddEnumStringTable *)\n",
|
||||
table_type[k],&(aitName[i])[3],&(aitName[j])[3]);
|
||||
pr(dfd,"{\n");
|
||||
pr(dfd,"\taitIndex i;\n");
|
||||
@@ -264,7 +267,7 @@ void MakeStringFuncTo(int i,int j,int k)
|
||||
/* assumes that void* d in an array of char pointers of length c */
|
||||
/* takes string data from source j and convert it to numeric in dest i */
|
||||
|
||||
pr(dfd,"static int %s%s%s(void* d,const void* s,aitIndex c, const std::vector<std::string> *)\n",
|
||||
pr(dfd,"static int %s%s%s(void* d,const void* s,aitIndex c, const gddEnumStringTable *)\n",
|
||||
table_type[k],&(aitName[i])[3],&(aitName[j])[3]);
|
||||
pr(dfd,"{\n");
|
||||
pr(dfd,"\taitIndex i;\n");
|
||||
@@ -312,7 +315,7 @@ void MakeFStringFuncFrom(int i,int j,int k)
|
||||
/* assumes that void* d in an array of char pointers of length c */
|
||||
/* takes numeric data from source j and convert it to string in dest i */
|
||||
|
||||
pr(dfd,"static int %s%s%s(void* d,const void* s,aitIndex c, const std::vector<std::string> *)\n",
|
||||
pr(dfd,"static int %s%s%s(void* d,const void* s,aitIndex c, const gddEnumStringTable *)\n",
|
||||
table_type[k],&(aitName[i])[3],&(aitName[j])[3]);
|
||||
pr(dfd,"{\n");
|
||||
pr(dfd,"\taitIndex i;\n");
|
||||
@@ -349,7 +352,7 @@ void MakeFStringFuncTo(int i,int j,int k)
|
||||
{
|
||||
/* assumes that void* d in an array of char pointers of length c */
|
||||
/* takes string data from source j and convert it to numeric in dest i */
|
||||
pr(dfd,"static int %s%s%s(void* d,const void* s,aitIndex c, const std::vector<std::string> *)\n",
|
||||
pr(dfd,"static int %s%s%s(void* d,const void* s,aitIndex c, const gddEnumStringTable *)\n",
|
||||
table_type[k],&(aitName[i])[3],&(aitName[j])[3]);
|
||||
pr(dfd,"{\n");
|
||||
pr(dfd,"\taitIndex i;\n");
|
||||
@@ -395,7 +398,7 @@ void GenName(int i,int j,int k)
|
||||
const char* i_name = &((aitName[i])[3]);
|
||||
const char* j_name = &((aitName[j])[3]);
|
||||
|
||||
pr(dfd,"static int %s%s%s(void* d,const void* s,aitIndex c, const std::vector<std::string> *)\n",
|
||||
pr(dfd,"static int %s%s%s(void* d,const void* s,aitIndex c, const gddEnumStringTable *)\n",
|
||||
table_type[k],i_name,j_name);
|
||||
}
|
||||
|
||||
|
||||
+40
-37
@@ -4,6 +4,9 @@
|
||||
// $Id$
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.35 2001/07/03 00:58:18 jhill
|
||||
// changed interface so that unreferenced table will not optimize away
|
||||
//
|
||||
// Revision 1.34 2000/09/27 19:43:52 jhill
|
||||
// cosmetic
|
||||
//
|
||||
@@ -264,7 +267,7 @@ static smartGDDPointer mapStringToGdd(void* v,aitIndex count) {
|
||||
}
|
||||
|
||||
static int mapGddToString(void* vd, aitIndex count,
|
||||
const gdd & dd, const std::vector< std::string > &enumStringTable) {
|
||||
const gdd & dd, const gddEnumStringTable &enumStringTable) {
|
||||
aitFixedString* db = (aitFixedString*)vd;
|
||||
aitIndex sz = dd.getDataSizeElements();
|
||||
const void* v = dd.dataVoid();
|
||||
@@ -312,7 +315,7 @@ static smartGDDPointer mapShortToGdd(void* v,aitIndex count) {
|
||||
}
|
||||
|
||||
static int mapGddToShort(void* vd, aitIndex count, const gdd &dd,
|
||||
const std::vector< std::string > &enumStringTable) {
|
||||
const gddEnumStringTable &enumStringTable) {
|
||||
dbr_short_t* sv = (dbr_short_t*)vd;
|
||||
aitIndex sz = dd.getDataSizeElements();
|
||||
const void * v=dd.dataVoid();
|
||||
@@ -360,7 +363,7 @@ static smartGDDPointer mapFloatToGdd(void* v,aitIndex count) {
|
||||
}
|
||||
|
||||
static int mapGddToFloat(void* vd, aitIndex count,
|
||||
const gdd & dd, const std::vector< std::string > &enumStringTable) {
|
||||
const gdd & dd, const gddEnumStringTable &enumStringTable) {
|
||||
dbr_float_t* sv = (dbr_float_t*)vd;
|
||||
aitIndex sz=dd.getDataSizeElements();
|
||||
const void * v = dd.dataVoid();
|
||||
@@ -408,7 +411,7 @@ static smartGDDPointer mapEnumToGdd(void* v,aitIndex count) {
|
||||
}
|
||||
|
||||
static int mapGddToEnum(void* vd, aitIndex count, const gdd & dd,
|
||||
const std::vector< std::string > &enumStringTable) {
|
||||
const gddEnumStringTable &enumStringTable) {
|
||||
dbr_enum_t* sv = (dbr_enum_t*)vd;
|
||||
aitIndex sz=dd.getDataSizeElements();
|
||||
const void* v = dd.dataVoid();
|
||||
@@ -456,7 +459,7 @@ static smartGDDPointer mapCharToGdd(void* v,aitIndex count) {
|
||||
}
|
||||
|
||||
static int mapGddToChar(void* vd, aitIndex count,
|
||||
const gdd & dd, const std::vector< std::string > &enumStringTable) {
|
||||
const gdd & dd, const gddEnumStringTable &enumStringTable) {
|
||||
dbr_char_t* sv = (dbr_char_t*)vd;
|
||||
aitIndex sz=dd.getDataSizeElements();
|
||||
const void* v = dd.dataVoid();
|
||||
@@ -504,7 +507,7 @@ static smartGDDPointer mapLongToGdd(void* v,aitIndex count) {
|
||||
}
|
||||
|
||||
static int mapGddToLong(void* vd, aitIndex count, const gdd & dd,
|
||||
const std::vector< std::string > &enumStringTable) {
|
||||
const gddEnumStringTable &enumStringTable) {
|
||||
dbr_long_t* sv = (dbr_long_t*)vd;
|
||||
aitIndex sz=dd.getDataSizeElements();
|
||||
const void* v = dd.dataVoid();
|
||||
@@ -552,7 +555,7 @@ static smartGDDPointer mapDoubleToGdd(void* v,aitIndex count) {
|
||||
}
|
||||
|
||||
static int mapGddToDouble(void* vd, aitIndex count, const gdd & dd,
|
||||
const std::vector< std::string > &enumStringTable) {
|
||||
const gddEnumStringTable &enumStringTable) {
|
||||
dbr_double_t* sv = (dbr_double_t*)vd;
|
||||
aitIndex sz=dd.getDataSizeElements();
|
||||
const void* v = dd.dataVoid();
|
||||
@@ -611,7 +614,7 @@ static smartGDDPointer mapStsStringToGdd(void* v,aitIndex count)
|
||||
return dd;
|
||||
}
|
||||
|
||||
static int mapStsGddToString(void* v, aitIndex count, const gdd & dd, const std::vector< std::string > &enumStringTable)
|
||||
static int mapStsGddToString(void* v, aitIndex count, const gdd & dd, const gddEnumStringTable &enumStringTable)
|
||||
{
|
||||
dbr_sts_string* db = (dbr_sts_string*)v;
|
||||
aitFixedString* dbv = (aitFixedString*)db->value;
|
||||
@@ -628,7 +631,7 @@ static smartGDDPointer mapStsShortToGdd(void* v,aitIndex count)
|
||||
return dd;
|
||||
}
|
||||
|
||||
static int mapStsGddToShort(void* v, aitIndex count, const gdd & dd, const std::vector< std::string > &enumStringTable)
|
||||
static int mapStsGddToShort(void* v, aitIndex count, const gdd & dd, const gddEnumStringTable &enumStringTable)
|
||||
{
|
||||
dbr_sts_short* dbv = (dbr_sts_short*)v;
|
||||
dd.getStatSevr(dbv->status,dbv->severity);
|
||||
@@ -643,7 +646,7 @@ static smartGDDPointer mapStsFloatToGdd(void* v,aitIndex count)
|
||||
return dd;
|
||||
}
|
||||
|
||||
static int mapStsGddToFloat(void* v, aitIndex count, const gdd & dd, const std::vector< std::string > &enumStringTable)
|
||||
static int mapStsGddToFloat(void* v, aitIndex count, const gdd & dd, const gddEnumStringTable &enumStringTable)
|
||||
{
|
||||
dbr_sts_float* dbv = (dbr_sts_float*)v;
|
||||
dd.getStatSevr(dbv->status,dbv->severity);
|
||||
@@ -658,7 +661,7 @@ static smartGDDPointer mapStsEnumToGdd(void* v,aitIndex count)
|
||||
return dd;
|
||||
}
|
||||
|
||||
static int mapStsGddToEnum(void* v, aitIndex count, const gdd & dd, const std::vector< std::string > &enumStringTable)
|
||||
static int mapStsGddToEnum(void* v, aitIndex count, const gdd & dd, const gddEnumStringTable &enumStringTable)
|
||||
{
|
||||
dbr_sts_enum* dbv = (dbr_sts_enum*)v;
|
||||
dd.getStatSevr(dbv->status,dbv->severity);
|
||||
@@ -673,7 +676,7 @@ static smartGDDPointer mapStsCharToGdd(void* v,aitIndex count)
|
||||
return dd;
|
||||
}
|
||||
|
||||
static int mapStsGddToChar(void* v, aitIndex count, const gdd & dd, const std::vector< std::string > &enumStringTable)
|
||||
static int mapStsGddToChar(void* v, aitIndex count, const gdd & dd, const gddEnumStringTable &enumStringTable)
|
||||
{
|
||||
dbr_sts_char* dbv = (dbr_sts_char*)v;
|
||||
dd.getStatSevr(dbv->status,dbv->severity);
|
||||
@@ -689,7 +692,7 @@ static smartGDDPointer mapStsLongToGdd(void* v,aitIndex count)
|
||||
return dd;
|
||||
}
|
||||
|
||||
static int mapStsGddToLong(void* v, aitIndex count, const gdd & dd, const std::vector< std::string > &enumStringTable)
|
||||
static int mapStsGddToLong(void* v, aitIndex count, const gdd & dd, const gddEnumStringTable &enumStringTable)
|
||||
{
|
||||
dbr_sts_long* dbv = (dbr_sts_long*)v;
|
||||
dd.getStatSevr(dbv->status,dbv->severity);
|
||||
@@ -704,7 +707,7 @@ static smartGDDPointer mapStsDoubleToGdd(void* v,aitIndex count)
|
||||
return dd;
|
||||
}
|
||||
|
||||
static int mapStsGddToDouble(void* v, aitIndex count, const gdd & dd, const std::vector< std::string > &enumStringTable)
|
||||
static int mapStsGddToDouble(void* v, aitIndex count, const gdd & dd, const gddEnumStringTable &enumStringTable)
|
||||
{
|
||||
dbr_sts_double* dbv = (dbr_sts_double*)v;
|
||||
dd.getStatSevr(dbv->status,dbv->severity);
|
||||
@@ -744,7 +747,7 @@ static smartGDDPointer mapTimeStringToGdd(void* v,aitIndex count)
|
||||
return dd;
|
||||
}
|
||||
|
||||
static int mapTimeGddToString(void* v, aitIndex count, const gdd & dd, const std::vector< std::string > &enumStringTable)
|
||||
static int mapTimeGddToString(void* v, aitIndex count, const gdd & dd, const gddEnumStringTable &enumStringTable)
|
||||
{
|
||||
dbr_time_string* db = (dbr_time_string*)v;
|
||||
aitFixedString* dbv = (aitFixedString*)db->value;
|
||||
@@ -763,7 +766,7 @@ static smartGDDPointer mapTimeShortToGdd(void* v,aitIndex count)
|
||||
return dd;
|
||||
}
|
||||
|
||||
static int mapTimeGddToShort(void* v, aitIndex count, const gdd & dd, const std::vector< std::string > &enumStringTable)
|
||||
static int mapTimeGddToShort(void* v, aitIndex count, const gdd & dd, const gddEnumStringTable &enumStringTable)
|
||||
{
|
||||
dbr_time_short* dbv = (dbr_time_short*)v;
|
||||
dd.getStatSevr(dbv->status,dbv->severity);
|
||||
@@ -781,7 +784,7 @@ static smartGDDPointer mapTimeFloatToGdd(void* v,aitIndex count)
|
||||
return dd;
|
||||
}
|
||||
|
||||
static int mapTimeGddToFloat(void* v, aitIndex count, const gdd & dd, const std::vector< std::string > &enumStringTable)
|
||||
static int mapTimeGddToFloat(void* v, aitIndex count, const gdd & dd, const gddEnumStringTable &enumStringTable)
|
||||
{
|
||||
dbr_time_float* dbv = (dbr_time_float*)v;
|
||||
dd.getStatSevr(dbv->status,dbv->severity);
|
||||
@@ -798,7 +801,7 @@ static smartGDDPointer mapTimeEnumToGdd(void* v,aitIndex count)
|
||||
return dd;
|
||||
}
|
||||
|
||||
static int mapTimeGddToEnum(void* v, aitIndex count, const gdd & dd, const std::vector< std::string > &enumStringTable)
|
||||
static int mapTimeGddToEnum(void* v, aitIndex count, const gdd & dd, const gddEnumStringTable &enumStringTable)
|
||||
{
|
||||
dbr_time_enum* dbv = (dbr_time_enum*)v;
|
||||
dd.getStatSevr(dbv->status,dbv->severity);
|
||||
@@ -816,7 +819,7 @@ static smartGDDPointer mapTimeCharToGdd(void* v,aitIndex count)
|
||||
return dd;
|
||||
}
|
||||
|
||||
static int mapTimeGddToChar(void* v, aitIndex count, const gdd & dd, const std::vector< std::string > &enumStringTable)
|
||||
static int mapTimeGddToChar(void* v, aitIndex count, const gdd & dd, const gddEnumStringTable &enumStringTable)
|
||||
{
|
||||
dbr_time_char* dbv = (dbr_time_char*)v;
|
||||
dd.getStatSevr(dbv->status,dbv->severity);
|
||||
@@ -835,7 +838,7 @@ static smartGDDPointer mapTimeLongToGdd(void* v,aitIndex count)
|
||||
return dd;
|
||||
}
|
||||
|
||||
static int mapTimeGddToLong(void* v, aitIndex count, const gdd & dd, const std::vector< std::string > &enumStringTable)
|
||||
static int mapTimeGddToLong(void* v, aitIndex count, const gdd & dd, const gddEnumStringTable &enumStringTable)
|
||||
{
|
||||
dbr_time_long* dbv = (dbr_time_long*)v;
|
||||
dd.getStatSevr(dbv->status,dbv->severity);
|
||||
@@ -852,7 +855,7 @@ static smartGDDPointer mapTimeDoubleToGdd(void* v,aitIndex count)
|
||||
return dd;
|
||||
}
|
||||
|
||||
static int mapTimeGddToDouble(void* v, aitIndex count, const gdd & dd, const std::vector< std::string > &enumStringTable)
|
||||
static int mapTimeGddToDouble(void* v, aitIndex count, const gdd & dd, const gddEnumStringTable &enumStringTable)
|
||||
{
|
||||
dbr_time_double* dbv = (dbr_time_double*)v;
|
||||
dd.getStatSevr(dbv->status,dbv->severity);
|
||||
@@ -938,7 +941,7 @@ static smartGDDPointer mapControlShortToGdd(void* v, aitIndex count)
|
||||
return dd;
|
||||
}
|
||||
|
||||
static int mapGraphicGddToShort(void* v, aitIndex count, const gdd & dd, const std::vector< std::string > &enumStringTable)
|
||||
static int mapGraphicGddToShort(void* v, aitIndex count, const gdd & dd, const gddEnumStringTable &enumStringTable)
|
||||
{
|
||||
const aitString* str;
|
||||
dbr_gr_short* db = (dbr_gr_short*)v;
|
||||
@@ -961,7 +964,7 @@ static int mapGraphicGddToShort(void* v, aitIndex count, const gdd & dd, const s
|
||||
return mapGddToShort(&db->value,count,vdd, enumStringTable);
|
||||
}
|
||||
|
||||
static int mapControlGddToShort(void* v, aitIndex count, const gdd & dd, const std::vector< std::string > &enumStringTable)
|
||||
static int mapControlGddToShort(void* v, aitIndex count, const gdd & dd, const gddEnumStringTable &enumStringTable)
|
||||
{
|
||||
const aitString* str;
|
||||
dbr_ctrl_short* db = (dbr_ctrl_short*)v;
|
||||
@@ -1061,7 +1064,7 @@ static smartGDDPointer mapControlFloatToGdd(void* v, aitIndex count)
|
||||
return dd;
|
||||
}
|
||||
|
||||
static int mapGraphicGddToFloat(void* v, aitIndex count, const gdd & dd, const std::vector< std::string > &enumStringTable)
|
||||
static int mapGraphicGddToFloat(void* v, aitIndex count, const gdd & dd, const gddEnumStringTable &enumStringTable)
|
||||
{
|
||||
const aitString* str;
|
||||
dbr_gr_float* db = (dbr_gr_float*)v;
|
||||
@@ -1086,7 +1089,7 @@ static int mapGraphicGddToFloat(void* v, aitIndex count, const gdd & dd, const s
|
||||
return mapGddToFloat(&db->value,count,vdd, enumStringTable);
|
||||
}
|
||||
|
||||
static int mapControlGddToFloat(void* v, aitIndex count, const gdd & dd, const std::vector< std::string > &enumStringTable)
|
||||
static int mapControlGddToFloat(void* v, aitIndex count, const gdd & dd, const gddEnumStringTable &enumStringTable)
|
||||
{
|
||||
const aitString* str;
|
||||
dbr_ctrl_float* db = (dbr_ctrl_float*)v;
|
||||
@@ -1198,7 +1201,7 @@ static smartGDDPointer mapControlEnumToGdd(void* v, aitIndex /*count*/)
|
||||
return dd;
|
||||
}
|
||||
|
||||
static int mapGraphicGddToEnum(void* v, aitIndex count, const gdd & dd, const std::vector< std::string > &enumStringTable)
|
||||
static int mapGraphicGddToEnum(void* v, aitIndex count, const gdd & dd, const gddEnumStringTable &enumStringTable)
|
||||
{
|
||||
dbr_gr_enum* db = (dbr_gr_enum*)v;
|
||||
const gdd& menu = dd[gddAppTypeIndex_dbr_gr_enum_enums];
|
||||
@@ -1221,7 +1224,7 @@ static int mapGraphicGddToEnum(void* v, aitIndex count, const gdd & dd, const st
|
||||
return mapGddToEnum(&db->value, count, vdd, enumStringTable);
|
||||
}
|
||||
|
||||
static int mapControlGddToEnum(void* v, aitIndex count, const gdd & dd, const std::vector< std::string > &enumStringTable)
|
||||
static int mapControlGddToEnum(void* v, aitIndex count, const gdd & dd, const gddEnumStringTable &enumStringTable)
|
||||
{
|
||||
dbr_ctrl_enum* db = (dbr_ctrl_enum*)v;
|
||||
const gdd& menu = dd[gddAppTypeIndex_dbr_ctrl_enum_enums];
|
||||
@@ -1317,7 +1320,7 @@ static smartGDDPointer mapControlCharToGdd(void* v, aitIndex count)
|
||||
return dd;
|
||||
}
|
||||
|
||||
static int mapGraphicGddToChar(void* v, aitIndex count, const gdd & dd, const std::vector< std::string > &enumStringTable)
|
||||
static int mapGraphicGddToChar(void* v, aitIndex count, const gdd & dd, const gddEnumStringTable &enumStringTable)
|
||||
{
|
||||
const aitString* str;
|
||||
dbr_gr_char* db = (dbr_gr_char*)v;
|
||||
@@ -1341,7 +1344,7 @@ static int mapGraphicGddToChar(void* v, aitIndex count, const gdd & dd, const st
|
||||
return mapGddToChar(&db->value,count,vdd, enumStringTable);
|
||||
}
|
||||
|
||||
static int mapControlGddToChar(void* v, aitIndex count, const gdd & dd, const std::vector< std::string > &enumStringTable)
|
||||
static int mapControlGddToChar(void* v, aitIndex count, const gdd & dd, const gddEnumStringTable &enumStringTable)
|
||||
{
|
||||
const aitString* str;
|
||||
dbr_ctrl_char* db = (dbr_ctrl_char*)v;
|
||||
@@ -1440,7 +1443,7 @@ static smartGDDPointer mapControlLongToGdd(void* v, aitIndex count)
|
||||
return dd;
|
||||
}
|
||||
|
||||
static int mapGraphicGddToLong(void* v, aitIndex count, const gdd & dd, const std::vector< std::string > &enumStringTable)
|
||||
static int mapGraphicGddToLong(void* v, aitIndex count, const gdd & dd, const gddEnumStringTable &enumStringTable)
|
||||
{
|
||||
const aitString* str;
|
||||
dbr_gr_long* db = (dbr_gr_long*)v;
|
||||
@@ -1463,7 +1466,7 @@ static int mapGraphicGddToLong(void* v, aitIndex count, const gdd & dd, const st
|
||||
return mapGddToLong(&db->value,count,vdd, enumStringTable);
|
||||
}
|
||||
|
||||
static int mapControlGddToLong(void* v, aitIndex count, const gdd & dd, const std::vector< std::string > &enumStringTable)
|
||||
static int mapControlGddToLong(void* v, aitIndex count, const gdd & dd, const gddEnumStringTable &enumStringTable)
|
||||
{
|
||||
const aitString* str;
|
||||
dbr_ctrl_long* db = (dbr_ctrl_long*)v;
|
||||
@@ -1563,7 +1566,7 @@ static smartGDDPointer mapControlDoubleToGdd(void* v, aitIndex count)
|
||||
return dd;
|
||||
}
|
||||
|
||||
static int mapGraphicGddToDouble(void* v, aitIndex count, const gdd & dd, const std::vector< std::string > &enumStringTable)
|
||||
static int mapGraphicGddToDouble(void* v, aitIndex count, const gdd & dd, const gddEnumStringTable &enumStringTable)
|
||||
{
|
||||
const aitString* str;
|
||||
dbr_gr_double* db = (dbr_gr_double*)v;
|
||||
@@ -1588,7 +1591,7 @@ static int mapGraphicGddToDouble(void* v, aitIndex count, const gdd & dd, const
|
||||
return mapGddToDouble(&db->value,count,vdd, enumStringTable);
|
||||
}
|
||||
|
||||
static int mapControlGddToDouble(void* v, aitIndex count, const gdd & dd, const std::vector< std::string > &enumStringTable)
|
||||
static int mapControlGddToDouble(void* v, aitIndex count, const gdd & dd, const gddEnumStringTable &enumStringTable)
|
||||
{
|
||||
const aitString* str;
|
||||
dbr_ctrl_double* db = (dbr_ctrl_double*)v;
|
||||
@@ -1645,7 +1648,7 @@ static smartGDDPointer mapStsAckStringToGdd(void* v, aitIndex count)
|
||||
}
|
||||
|
||||
static int mapStsAckGddToString(void* v, aitIndex count, const gdd &dd,
|
||||
const std::vector< std::string > &enumStringTable)
|
||||
const gddEnumStringTable &enumStringTable)
|
||||
{
|
||||
dbr_stsack_string* db = (dbr_stsack_string*)v;
|
||||
const gdd& vdd = dd[gddAppTypeIndex_dbr_stsack_string_value];
|
||||
@@ -1685,7 +1688,7 @@ static smartGDDPointer mapAcktToGdd(void* v,aitIndex count) {
|
||||
}
|
||||
|
||||
static int mapGddToAckt(void* vd, aitIndex count, const gdd & dd,
|
||||
const std::vector< std::string > &enumStringTable) {
|
||||
const gddEnumStringTable &enumStringTable) {
|
||||
dbr_put_ackt_t* sv = (dbr_put_ackt_t*)vd;
|
||||
aitIndex sz = dd.getDataSizeElements();
|
||||
const void* v=dd.dataVoid();
|
||||
@@ -1737,7 +1740,7 @@ static smartGDDPointer mapAcksToGdd(void* v,aitIndex count) {
|
||||
}
|
||||
|
||||
static int mapGddToAcks(void* vd, aitIndex count, const gdd &dd,
|
||||
const std::vector< std::string > &enumStringTable) {
|
||||
const gddEnumStringTable &enumStringTable) {
|
||||
dbr_put_acks_t* sv = (dbr_put_acks_t*)vd;
|
||||
aitIndex sz = dd.getDataSizeElements();
|
||||
const void* v=dd.dataVoid();
|
||||
@@ -1795,7 +1798,7 @@ static smartGDDPointer mapClassNameToGdd(void* v,aitIndex count) {
|
||||
}
|
||||
|
||||
static int mapGddToClassName(void* vd, aitIndex count, const gdd & dd,
|
||||
const std::vector< std::string > &enumStringTable) {
|
||||
const gddEnumStringTable &enumStringTable) {
|
||||
aitFixedString* db = (aitFixedString*)vd;
|
||||
aitIndex sz = dd.getDataSizeElements();
|
||||
const void* v = dd.dataVoid();
|
||||
|
||||
+4
-1
@@ -8,6 +8,9 @@
|
||||
* $Id$
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.13 2000/10/12 21:52:49 jhill
|
||||
* changes to support compilation by borland
|
||||
*
|
||||
* Revision 1.12 2000/10/12 16:10:53 jhill
|
||||
* changing include order fixes GNU warning
|
||||
*
|
||||
@@ -71,7 +74,7 @@ typedef smartGDDPointer (*to_gdd)(void* db_struct, aitIndex element_count);
|
||||
// gdd points to an array or -1 if the number of elements in the value
|
||||
// field is not identical to element_count available in db_struct.
|
||||
typedef int (*to_dbr)(void* db_struct, aitIndex element_count,
|
||||
const gdd &, const std::vector< std::string > &enumStringTable);
|
||||
const gdd &, const gddEnumStringTable &enumStringTable);
|
||||
|
||||
struct gddDbrMapFuncTable {
|
||||
to_gdd conv_gdd;
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
//
|
||||
// gddEnumStringTable.cc
|
||||
// Author: Jeff Hill
|
||||
//
|
||||
|
||||
#include <new>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "gddEnumStringTable.h"
|
||||
|
||||
gddEnumStringTable::~gddEnumStringTable ()
|
||||
{
|
||||
for ( unsigned i = 0u; i < this->nStringSlots; i++ ) {
|
||||
delete [] this->pStringTable[i].pString;
|
||||
}
|
||||
delete [] this->pStringTable;
|
||||
}
|
||||
|
||||
bool gddEnumStringTable::expand ( unsigned nStringsRequired )
|
||||
{
|
||||
stringEntry * pNextTable = new ( std::nothrow ) stringEntry [nStringsRequired];
|
||||
if ( pNextTable ) {
|
||||
for ( unsigned i = 0u; i < this->nStringSlots; i++ ) {
|
||||
pNextTable[i] = this->pStringTable[i];
|
||||
}
|
||||
for ( unsigned j = this->nStringSlots; j < nStringsRequired; j++ ) {
|
||||
pNextTable[j].pString = 0;
|
||||
pNextTable[j].length = 0;
|
||||
}
|
||||
delete [] this->pStringTable;
|
||||
this->pStringTable = pNextTable;
|
||||
this->nStringSlots = nStringsRequired;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void gddEnumStringTable::reserve ( unsigned nStrings )
|
||||
{
|
||||
if ( nStrings > this->nStringSlots ) {
|
||||
this->expand ( nStrings );
|
||||
}
|
||||
}
|
||||
|
||||
void gddEnumStringTable::clear ()
|
||||
{
|
||||
for ( unsigned i = 0u; i < this->nStringSlots; i++ ) {
|
||||
delete [] this->pStringTable[i].pString;
|
||||
}
|
||||
delete [] this->pStringTable;
|
||||
this->pStringTable = 0;
|
||||
this->nStringSlots = 0;
|
||||
this->nStrings = 0;
|
||||
}
|
||||
|
||||
bool gddEnumStringTable::setString ( unsigned index, const char *pString )
|
||||
{
|
||||
if ( index >= this->nStringSlots ) {
|
||||
unsigned nStringsNext;
|
||||
if ( this->nStringSlots < 16 ) {
|
||||
nStringsNext = 16;
|
||||
}
|
||||
else {
|
||||
nStringsNext = this->nStringSlots;
|
||||
}
|
||||
while ( index >= nStringsNext ) {
|
||||
nStringsNext += nStringsNext;
|
||||
}
|
||||
if ( ! this->expand ( nStringsNext ) ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
unsigned nChar = strlen ( pString );
|
||||
char *pNewString = new ( std::nothrow ) char [ nChar + 1 ];
|
||||
if ( ! pNewString ) {
|
||||
return false;
|
||||
}
|
||||
delete [] this->pStringTable[index].pString;
|
||||
this->pStringTable[index].pString = pNewString;
|
||||
strcpy ( this->pStringTable[index].pString, pString );
|
||||
this->pStringTable[index].length = nChar;
|
||||
if ( this->nStrings <= index ) {
|
||||
this->nStrings = index + 1;
|
||||
}
|
||||
}
|
||||
|
||||
void gddEnumStringTable::getString ( unsigned index, char *pBuf, unsigned size ) const
|
||||
{
|
||||
if ( index < this->nStrings && size ) {
|
||||
if ( this->pStringTable[index].pString ) {
|
||||
strncpy ( pBuf, this->pStringTable[index].pString, size );
|
||||
pBuf[ size - 1 ] = '\0';
|
||||
}
|
||||
else {
|
||||
pBuf[ 0 ] = '\0';
|
||||
}
|
||||
}
|
||||
else {
|
||||
pBuf[ 0 ] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
const char * gddEnumStringTable::getString ( unsigned index ) const
|
||||
{
|
||||
if ( index < this->nStrings ) {
|
||||
if ( this->pStringTable[index].pString ) {
|
||||
return this->pStringTable[index].pString;
|
||||
}
|
||||
else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
unsigned gddEnumStringTable::getStringLength ( unsigned index ) const
|
||||
{
|
||||
if ( index < this->nStrings ) {
|
||||
return this->pStringTable[index].length;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
//
|
||||
// gddEnumStringTable.cpp
|
||||
//
|
||||
|
||||
#ifndef gddEnumStringTableh
|
||||
#define gddEnumStringTableh
|
||||
|
||||
#include "shareLib.h"
|
||||
|
||||
class epicsShareClass gddEnumStringTable {
|
||||
public:
|
||||
gddEnumStringTable ();
|
||||
~gddEnumStringTable ();
|
||||
void clear ();
|
||||
void reserve ( unsigned nStrings );
|
||||
bool setString ( unsigned index, const char *pString );
|
||||
void getString ( unsigned index, char *pBuf, unsigned size ) const;
|
||||
const char * getString ( unsigned index ) const;
|
||||
unsigned getStringLength ( unsigned index ) const;
|
||||
unsigned numberOfStrings () const;
|
||||
private:
|
||||
unsigned nStrings;
|
||||
unsigned nStringSlots;
|
||||
struct stringEntry {
|
||||
char * pString;
|
||||
unsigned length;
|
||||
} * pStringTable;
|
||||
bool expand ( unsigned nStringsRequired );
|
||||
};
|
||||
|
||||
inline gddEnumStringTable::gddEnumStringTable () :
|
||||
nStrings ( 0 ), nStringSlots ( 0 ), pStringTable ( 0 ) {}
|
||||
|
||||
inline unsigned gddEnumStringTable::numberOfStrings () const
|
||||
{
|
||||
return this->nStrings;
|
||||
}
|
||||
|
||||
#endif // ifndef gddEnumStringTableh
|
||||
Reference in New Issue
Block a user