all pvData interfaces and implementration stubs now defined

Most methods are not implemented and throw an exception
This commit is contained in:
Marty Kraimer
2010-09-24 09:52:08 -04:00
parent 2c6a99a6cb
commit dd6ecf9bec
22 changed files with 524 additions and 103 deletions

View File

@@ -76,5 +76,10 @@ namespace epics { namespace pvData {
void PVArray::toString(StringPtr buf) const {toString(buf,0);}
void PVArray::toString(StringPtr buf, int indentLevel) const
{
throw std::logic_error(notImplemented);
}
}}
#endif /* ABSTRACTPVARRAY_H */

View File

@@ -10,6 +10,11 @@
namespace epics { namespace pvData {
static std::string notImplemented("not implemented");
static Convert *convert = 0;
class PVFieldPvt {
public:
PVFieldPvt(PVStructure *parent,FieldConstPtr field);
@@ -22,8 +27,15 @@ namespace epics { namespace pvData {
epicsBoolean immutable;
Requester *requester;
PostHandler *postHandler;
private:
static void init();
};
void PVFieldPvt::init()
{
convert = getConvert();
}
PVFieldPvt::PVFieldPvt(PVStructure *parent,FieldConstPtr field)
: parent(parent),field(field),
fieldOffset(0), nextFieldOffset(0),
@@ -112,24 +124,29 @@ namespace epics { namespace pvData {
void PVField::replacePVField(PVField * newPVField)
{
throw std::logic_error(notImplemented);
}
void PVField::renameField(StringConstPtr newName)
{
throw std::logic_error(notImplemented);
}
void PVField::postPut() const
{
throw std::logic_error(notImplemented);
}
void PVField::setPostHandler(PostHandler *ppostHandler)
{
throw std::logic_error(notImplemented);
}
void PVField::toString(StringPtr buf) const {toString(buf,0);}
void PVField::toString(StringPtr buf,int indentLevel) const
{
throw std::logic_error(notImplemented);
}
void PVField::computeOffset(PVField const * const pvField) {

View File

@@ -13,7 +13,8 @@ namespace epics { namespace pvData {
PVScalarArray::~PVScalarArray() {}
PVScalarArray::PVScalarArray(PVStructure *parent,ScalarArrayConstPtr scalarArray)
PVScalarArray::PVScalarArray(PVStructure *parent,
ScalarArrayConstPtr scalarArray)
: PVArray(parent,scalarArray) {}
ScalarArrayConstPtr PVScalarArray::getScalarArray() const

View File

@@ -6,6 +6,7 @@
#include <string>
#include <cstdio>
#include "pvData.h"
#include "convert.h"
#include "factory.h"
#include "AbstractPVField.h"
@@ -15,20 +16,53 @@ namespace epics { namespace pvData {
class BasePVDouble : public PVDouble {
public:
BasePVDouble(PVStructure *parent,ScalarConstPtr scalar)
: PVDouble(parent,scalar),value(0.0) {}
virtual ~BasePVDouble() {}
virtual double get()const { return value;}
virtual void put(double val){value = val;}
virtual void serialize(ByteBuffer *pbuffer,SerializableControl *pflusher) const{}
virtual void deserialize(ByteBuffer *pbuffer,DeserializableControl *pflusher){}
virtual void toString(StringPtr buf)const {}
virtual void toString(StringPtr buf,int indentLevel)const {}
BasePVDouble(PVStructure *parent,ScalarConstPtr scalar);
virtual ~BasePVDouble();
virtual double get()const;
virtual void put(double val);
virtual void serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher) const;
virtual void deserialize(ByteBuffer *pbuffer,
DeserializableControl *pflusher);
virtual void toString(StringPtr buf)const;
virtual void toString(StringPtr buf,int indentLevel)const;
private:
BasePVDouble(); // not implemented
BasePVDouble(BasePVDouble const & ); // not implemented
BasePVDouble & operator=(BasePVDouble const &); //not implemented
double value;
};
BasePVDouble::BasePVDouble(PVStructure *parent,ScalarConstPtr scalar)
: PVDouble(parent,scalar),value(0.0)
{}
BasePVDouble::~BasePVDouble() {}
double BasePVDouble::get()const { return value;}
void BasePVDouble::put(double val){value = val;}
void BasePVDouble::serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher) const
{
throw std::logic_error(notImplemented);
}
void BasePVDouble::deserialize(ByteBuffer *pbuffer,
DeserializableControl *pflusher)
{
throw std::logic_error(notImplemented);
}
void BasePVDouble::toString(StringPtr buf)const {toString(buf,0);}
void BasePVDouble::toString(StringPtr buf,int indentLevel) const
{
convert->getString(buf,this,indentLevel);
PVField::toString(buf,indentLevel);
}
}}
#endif /* BASEPVDOUBLE_H */

View File

@@ -37,10 +37,10 @@ namespace epics { namespace pvData {
DoubleArrayPtr doubleArray;
};
BasePVDoubleArray::BasePVDoubleArray(PVStructure *parent,ScalarArrayConstPtr scalarArray)
BasePVDoubleArray::BasePVDoubleArray(PVStructure *parent,
ScalarArrayConstPtr scalarArray)
: PVDoubleArray(parent,scalarArray),doubleArray(new double[0])
{
}
{ }
BasePVDoubleArray::~BasePVDoubleArray()
{
@@ -49,6 +49,7 @@ namespace epics { namespace pvData {
void BasePVDoubleArray::setCapacity(int capacity)
{
throw std::logic_error(notImplemented);
}
int BasePVDoubleArray::get(int offset, int length,
@@ -66,29 +67,37 @@ namespace epics { namespace pvData {
void BasePVDoubleArray::shareData(DoubleArrayPtr from)
{
}
void BasePVDoubleArray::serialize(ByteBuffer *pbuffer,SerializableControl *pflusher) const
{
}
void BasePVDoubleArray::deserialize(ByteBuffer *pbuffer,DeserializableControl *pflusher)
{
throw std::logic_error(notImplemented);
}
void BasePVDoubleArray::serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher, int offset, int count) const
SerializableControl *pflusher) const
{
throw std::logic_error(notImplemented);
}
void BasePVDoubleArray::deserialize(ByteBuffer *pbuffer,
DeserializableControl *pflusher)
{
throw std::logic_error(notImplemented);
}
void BasePVDoubleArray::serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher, int offset, int count) const
{
throw std::logic_error(notImplemented);
}
void BasePVDoubleArray::toString(StringPtr buf)const
{
toString(buf,1);
}
void BasePVDoubleArray::toString(StringPtr buf,int indentLevel)const
{
convert->getString(buf,this,indentLevel);
PVArray::toString(buf,indentLevel);
}
}}
#endif /* BASEPVDOUBLEARRAY_H */

View File

@@ -39,7 +39,7 @@ namespace epics { namespace pvData {
pImpl->numberFields = numberFields;
pImpl->pvFields = new PVFieldPtr[numberFields];
for(int i=0; i<numberFields; i++) {
// MARTY FINISH THIS
throw std::logic_error(notImplemented);
}
}
@@ -60,123 +60,132 @@ namespace epics { namespace pvData {
PVFieldPtr PVStructure::getSubField(StringConstPtr fieldName)
{
return 0;
throw std::logic_error(notImplemented);
}
PVFieldPtr PVStructure::getSubField(int fieldOffset)
{
return 0;
throw std::logic_error(notImplemented);
}
void PVStructure::appendPVField(PVFieldPtr pvField)
{
throw std::logic_error(notImplemented);
}
void PVStructure::appendPVFields(PVFieldArrayPtr pvFields)
{
throw std::logic_error(notImplemented);
}
void PVStructure::removePVField(StringConstPtr fieldName)
{
throw std::logic_error(notImplemented);
}
PVBoolean *PVStructure::getBooleanField(StringConstPtr fieldName)
{
return 0;
throw std::logic_error(notImplemented);
}
PVByte *PVStructure::getByteField(StringConstPtr fieldName)
{
return 0;
throw std::logic_error(notImplemented);
}
PVShort *PVStructure::getShortField(StringConstPtr fieldName)
{
return 0;
throw std::logic_error(notImplemented);
}
PVInt *PVStructure::getIntField(StringConstPtr fieldName)
{
return 0;
throw std::logic_error(notImplemented);
}
PVLong *PVStructure::getLongField(StringConstPtr fieldName)
{
return 0;
throw std::logic_error(notImplemented);
}
PVFloat *PVStructure::getFloatField(StringConstPtr fieldName)
{
return 0;
throw std::logic_error(notImplemented);
}
PVDouble *PVStructure::getDoubleField(StringConstPtr fieldName)
{
return 0;
throw std::logic_error(notImplemented);
}
PVString *PVStructure::getStringField(StringConstPtr fieldName)
{
return 0;
throw std::logic_error(notImplemented);
}
PVStructure *PVStructure::getStructureField(StringConstPtr fieldName)
{
return 0;
throw std::logic_error(notImplemented);
}
PVScalarArray *PVStructure::getScalarArrayField(
StringConstPtr fieldName,ScalarType elementType)
{
return 0;
throw std::logic_error(notImplemented);
}
PVStructureArray *PVStructure::getStructureArrayField(
StringConstPtr fieldName)
{
return 0;
throw std::logic_error(notImplemented);
}
StringConstPtr PVStructure::getExtendsStructureName()
{
return 0;
throw std::logic_error(notImplemented);
}
epicsBoolean PVStructure::putExtendsStructureName(
StringConstPtr extendsStructureName)
{
return epicsFalse;
throw std::logic_error(notImplemented);
}
void PVStructure::toString(StringPtr buf) const {toString(buf,0);}
void PVStructure::toString(StringPtr buf,int indentLevel) const
{
throw std::logic_error(notImplemented);
}
void PVStructure::serialize(
ByteBuffer *pbuffer,SerializableControl *pflusher) const
{
throw std::logic_error(notImplemented);
}
void PVStructure::deserialize(
ByteBuffer *pbuffer,DeserializableControl *pflusher)
{
throw std::logic_error(notImplemented);
}
void PVStructure::serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher, int offset, int count) const
{
throw std::logic_error(notImplemented);
}
void PVStructure::serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher,BitSet *pbitSet) const
{
throw std::logic_error(notImplemented);
}
void PVStructure::deserialize(ByteBuffer *pbuffer,
DeserializableControl*pflusher,BitSet *pbitSet)
{
throw std::logic_error(notImplemented);
}
class BasePVStructure : public PVStructure {

View File

@@ -19,7 +19,8 @@ namespace epics { namespace pvData {
StructureArrayData *structureArrayData;
PVStructureArrayPtr pvStructureArray;
};
PVStructureArrayPvt::PVStructureArrayPvt(StructureArrayConstPtr structureArray)
PVStructureArrayPvt::PVStructureArrayPvt(
StructureArrayConstPtr structureArray)
: structureArray(structureArray),
structureArrayData(new StructureArrayData()),
pvStructureArray(new PVStructurePtr[0])
@@ -32,8 +33,10 @@ namespace epics { namespace pvData {
}
PVStructureArray::PVStructureArray(PVStructure *parent,StructureArrayConstPtr structureArray)
: PVArray(parent,structureArray),pImpl(new PVStructureArrayPvt(structureArray))
PVStructureArray::PVStructureArray(PVStructure *parent,
StructureArrayConstPtr structureArray)
: PVArray(parent,structureArray),
pImpl(new PVStructureArrayPvt(structureArray))
{
}
@@ -47,48 +50,59 @@ namespace epics { namespace pvData {
return pImpl->structureArray;
}
int PVStructureArray::get(int offset, int length, StructureArrayData *data) const
int PVStructureArray::get(
int offset, int length, StructureArrayData *data) const
{
return 0;
throw std::logic_error(notImplemented);
}
int PVStructureArray::put(int offset,int length, PVStructureArrayPtr from, int fromOffset)
int PVStructureArray::put(int offset,int length,
PVStructureArrayPtr from, int fromOffset)
{
return 0;
throw std::logic_error(notImplemented);
}
void PVStructureArray::shareData(PVStructureArrayPtr from)
{
throw std::logic_error(notImplemented);
}
void PVStructureArray::serialize(ByteBuffer *pbuffer, SerializableControl *pflusher) const
void PVStructureArray::serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher) const
{
throw std::logic_error(notImplemented);
}
void PVStructureArray::deserialize(ByteBuffer *pbuffer, DeserializableControl *pflusher)
void PVStructureArray::deserialize(ByteBuffer *pbuffer,
DeserializableControl *pflusher)
{
throw std::logic_error(notImplemented);
}
void PVStructureArray::serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher, int offset, int count) const
{
throw std::logic_error(notImplemented);
}
void PVStructureArray::toString(StringPtr buf) const {toString(buf,0);}
void PVStructureArray::toString(StringPtr buf,int indentLevel) const
{
throw std::logic_error(notImplemented);
}
class BasePVStructureArray : public PVStructureArray {
public:
BasePVStructureArray(PVStructure *parent,StructureArrayConstPtr structureArray)
BasePVStructureArray(PVStructure *parent,
StructureArrayConstPtr structureArray)
: PVStructureArray(parent,structureArray) {}
~BasePVStructureArray(){}
private:
BasePVStructureArray(); // not implemented
BasePVStructureArray(BasePVStructureArray const & ); // not implemented
BasePVStructureArray & operator=(BasePVStructureArray const &); //not implemented
// following not implemented
BasePVStructureArray();
BasePVStructureArray(BasePVStructureArray const & );
BasePVStructureArray & operator=(BasePVStructureArray const &);
};
}}

View File

@@ -0,0 +1,263 @@
/* Convert.cpp */
#include <string>
#include <stdexcept>
#include <epicsMutex.h>
#include "convert.h"
namespace epics { namespace pvData {
static std::string notImplemented("not implemented");
Convert::Convert(){}
Convert::~Convert(){}
void Convert::getFullName(StringConstPtr buf,PVField const *pvField)
{
throw std::logic_error(notImplemented);
}
void Convert::getString(StringPtr buf,PVField const * pvField,int indentLevel)
{
throw std::logic_error(notImplemented);
}
void Convert::getString(StringPtr buf,PVField const *pvField)
{
throw std::logic_error(notImplemented);
}
void Convert::fromString(PVScalar *pv, StringConstPtr from)
{
throw std::logic_error(notImplemented);
}
int Convert::fromString(PVScalarArray *pv, StringConstPtr from)
{
throw std::logic_error(notImplemented);
}
int Convert::fromStringArray(PVScalarArray *pv, int offset, int length,
StringPtrArray from, int fromOffset)
{
throw std::logic_error(notImplemented);
}
int Convert::toStringArray(PVScalarArray const *pv, int offset, int length,
StringPtrArray to, int fromOffset)
{
throw std::logic_error(notImplemented);
}
epicsBoolean Convert::isCopyCompatible(FieldConstPtr from, FieldConstPtr to)
{
throw std::logic_error(notImplemented);
}
void Convert::copy(PVField const *from,PVField *to)
{
throw std::logic_error(notImplemented);
}
epicsBoolean Convert::isCopyScalarCompatible(
ScalarConstPtr from, ScalarConstPtr to)
{
throw std::logic_error(notImplemented);
}
void copyScalar(PVScalar const *from, PVScalar *to)
{
throw std::logic_error(notImplemented);
}
epicsBoolean Convert::isCopyScalarArrayCompatible(ScalarArrayConstPtr from,
ScalarArrayConstPtr to)
{
throw std::logic_error(notImplemented);
}
int Convert::copyScalarArray(PVScalarArray const *from, int offset,
PVScalarArray *to, int toOffset, int length)
{
throw std::logic_error(notImplemented);
}
epicsBoolean Convert::isCopyStructureCompatible(
StructureConstPtr from, StructureConstPtr to)
{
throw std::logic_error(notImplemented);
}
void Convert::copyStructure(PVStructure const *from, PVStructure *to)
{
throw std::logic_error(notImplemented);
}
epicsBoolean Convert::isCopyStructureArrayCompatible(
StructureArrayConstPtr from, StructureArrayConstPtr to)
{
throw std::logic_error(notImplemented);
}
void Convert::copyStructureArray(
PVStructureArray const *from, PVStructureArray *to)
{
throw std::logic_error(notImplemented);
}
epicsInt8 Convert::toByte(PVScalar const *pv)
{
throw std::logic_error(notImplemented);
}
epicsInt16 Convert::toShort(PVScalar const *pv)
{
throw std::logic_error(notImplemented);
}
epicsInt32 Convert::toInt(PVScalar const *pv)
{
throw std::logic_error(notImplemented);
}
epicsInt64 Convert::toLong(PVScalar const *pv)
{
throw std::logic_error(notImplemented);
}
float Convert::toFloat(PVScalar const *pv)
{
throw std::logic_error(notImplemented);
}
double Convert::toDouble(PVScalar const *pv)
{
throw std::logic_error(notImplemented);
}
void Convert::fromByte(PVScalar *pv,epicsInt8 from)
{
throw std::logic_error(notImplemented);
}
void Convert::fromShort(PVScalar *pv,epicsInt16 from)
{
throw std::logic_error(notImplemented);
}
void Convert::fromInt(PVScalar *pv, epicsInt32 from)
{
throw std::logic_error(notImplemented);
}
void Convert::fromLong(PVScalar *pv, epicsInt64 from)
{
throw std::logic_error(notImplemented);
}
void Convert::fromFloat(PVScalar* pv, float from)
{
throw std::logic_error(notImplemented);
}
void Convert::fromDouble(PVScalar *pv, double from)
{
throw std::logic_error(notImplemented);
}
int Convert::toByteArray(PVScalarArray const *pv, int offset, int length,
epicsInt8 to[], int toOffset)
{
throw std::logic_error(notImplemented);
}
int Convert::toShortArray(PVScalarArray const *pv, int offset, int length,
epicsInt16 to[], int toOffset)
{
throw std::logic_error(notImplemented);
}
int Convert::toIntArray(PVScalarArray const *pv, int offset, int length,
epicsInt32 to[], int toOffset)
{
throw std::logic_error(notImplemented);
}
int Convert::toLongArray(PVScalarArray const *pv, int offset, int length,
epicsInt64 to[], int toOffset)
{
throw std::logic_error(notImplemented);
}
int Convert::toFloatArray(PVScalarArray const *pv, int offset, int length,
float to[], int toOffset)
{
throw std::logic_error(notImplemented);
}
int Convert::toDoubleArray(PVScalarArray const *pv, int offset, int length,
double to[], int toOffset)
{
throw std::logic_error(notImplemented);
}
int Convert::fromByteArray(PVScalarArray *pv, int offset, int length,
epicsInt8 from[], int fromOffset)
{
throw std::logic_error(notImplemented);
}
int Convert::fromShortArray(PVScalarArray *pv, int offset, int length,
epicsInt16 from[], int fromOffset)
{
throw std::logic_error(notImplemented);
}
int Convert::fromIntArray(PVScalarArray *pv, int offset, int length,
epicsInt32 from[], int fromOffset)
{
throw std::logic_error(notImplemented);
}
int Convert::fromLongArray(PVScalarArray *pv, int offset, int length,
epicsInt64 from[], int fromOffset)
{
throw std::logic_error(notImplemented);
}
int Convert::fromFloatArray(PVScalarArray *pv, int offset, int length,
float from[], int fromOffset)
{
throw std::logic_error(notImplemented);
}
int Convert::fromDoubleArray(PVScalarArray *pv, int offset, int length,
double from[], int fromOffset)
{
throw std::logic_error(notImplemented);
}
void Convert::newLine(StringPtr buffer, int indentLevel)
{
*buffer += "\n";
for(int i=0; i<indentLevel; i++) *buffer += " ";
}
static Convert* instance = 0;
class ConvertExt : public Convert {
public:
ConvertExt(): Convert(){};
};
Convert * getConvert() {
static epicsMutex *lock = new epicsMutex();
lock->lock();
if(instance==0) instance = new ConvertExt();
lock->unlock();
return instance;
}
}}

View File

@@ -3,11 +3,18 @@
#include <cstdlib>
#include <string>
#include <cstdio>
#include "pvData.h"
#include <epicsMutex.h>
#include "pvIntrospect.h"
#include "factory.h"
namespace epics { namespace pvData {
static void newLine(StringPtr buffer, int indentLevel)
{
*buffer += "\n";
for(int i=0; i<indentLevel; i++) *buffer += " ";
}
Field::~Field(){}
class BaseField : public Field {
@@ -292,14 +299,18 @@ namespace epics { namespace pvData {
static FieldCreate* instance = 0;
class FieldCreateExt : public FieldCreate {
public:
FieldCreateExt(): FieldCreate(){};
};
FieldCreate * getFieldCreate() {
if(instance==0) instance = new FieldCreateExt();
return instance;
}
FieldCreate * getFieldCreate() {
static epicsMutex *lock = new epicsMutex();
lock->lock();
if(instance==0) instance = new FieldCreateExt();
lock->unlock();
return instance;
}
}}

View File

@@ -16,9 +16,12 @@ LIBSRCS += TypeFunc.cpp
LIBSRCS += PVAuxInfoImpl.cpp
LIBSRCS += FieldCreateFactory.cpp
LIBSRCS += PVDataCreateFactory.cpp
LIBSRCS += Convert.cpp
LIBRARY=pvFactory
pvFactory_LIBS += Com
include $(TOP)/configure/RULES
#----------------------------------------
# ADD RULES AFTER THIS LINE

View File

@@ -1,6 +1,4 @@
/*AbstractPVScalar.h*/
#ifndef ABSTRACTPVSCALAR_H
#define ABSTRACTPVSCALAR_H
/*PVAuxInfo.cpp*/
#include <cstddef>
#include <cstdlib>
#include <string>
@@ -27,6 +25,10 @@ namespace epics { namespace pvData {
{ }
PVAuxInfo::~PVAuxInfo() { delete pImpl;}
void PVAuxInfo::init() {
pvDataCreate = getPVDataCreate();
}
PVField * PVAuxInfo::getPVField() {
return pImpl->pvField;
@@ -44,7 +46,6 @@ namespace epics { namespace pvData {
ScalarTypeFunc::toString(&message,scalarType);
pImpl->pvField->message(&message,errorMessage);
}
if(pvDataCreate==0) pvDataCreate = getPVDataCreate();
PVScalar *pvScalar = pvDataCreate->createPVScalar(0,key,scalarType);
pImpl->theMap.insert(std::pair<StringConstPtr,PVScalar * >(key, pvScalar));
return pvScalar;
@@ -81,4 +82,3 @@ namespace epics { namespace pvData {
}
}
}}
#endif /* ABSTRACTPVSCALAR_H */

View File

@@ -3,7 +3,9 @@
#include <cstdlib>
#include <string>
#include <cstdio>
#include <epicsMutex.h>
#include "pvData.h"
#include "convert.h"
#include "factory.h"
#include "AbstractPVField.h"
#include "AbstractPVScalar.h"
@@ -17,8 +19,6 @@
namespace epics { namespace pvData {
static std::string notImplemented("not implemented");
static FieldCreate * fieldCreate = 0;
static PVDataCreate* pvDataCreate = 0;
@@ -156,8 +156,11 @@ namespace epics { namespace pvData {
};
PVDataCreate * getPVDataCreate() {
if(pvDataCreate==0) pvDataCreate = new PVDataCreateExt();
return pvDataCreate;
static epicsMutex *lock = new epicsMutex();
lock->lock();
if(pvDataCreate==0) pvDataCreate = new PVDataCreateExt();
lock->unlock();
return pvDataCreate;
}
}}

View File

@@ -4,7 +4,7 @@
#include <string>
#include <cstdio>
#include "pvData.h"
#include "pvIntrospect.h"
namespace epics { namespace pvData {

View File

@@ -8,10 +8,5 @@ namespace epics { namespace pvData {
static DebugLevel debugLevel = highDebug;
static void newLine(StringPtr buffer,int indentLevel) {
*buffer += "\n";
for(int i=0; i<indentLevel; i++) *buffer += " ";
}
}}
#endif /*FACTORY_H */

View File

@@ -4,6 +4,7 @@ include $(TOP)/configure/CONFIG
INC += pvIntrospect.h
INC += pvData.h
INC += convert.h
include $(TOP)/configure/RULES
#----------------------------------------

View File

@@ -1,7 +1,6 @@
/* convert.h */
#include <string>
#include <stdexcept>
#include <map>
#ifndef CONVERT_H
#define CONVERT_H
#include "pvIntrospect.h"
@@ -9,21 +8,76 @@
namespace epics { namespace pvData {
class Convert {
public:
Convert();
~Convert();
void getFullName(std::string *buf,PVField *pvField);
void getString(std::string *buf,PVfield *pvField,int indentLevel);
void getString(std::string *buf,PVfield *pvField);
void getFullName(StringConstPtr buf,PVField const *pvField);
void getString(StringPtr buf,PVField const * pvField,int indentLevel);
void getString(StringPtr buf,PVField const * pvField);
void fromString(PVScalar *pv, StringConstPtr from);
int fromString(PVScalarArray *pv, StringConstPtr from);
int fromStringArray(PVScalarArray *pv, int offset, int length,
StringPtrArray from, int fromOffset);
int toStringArray(PVScalarArray const *pv, int offset, int length,
StringPtrArray to, int fromOffset);
epicsBoolean isCopyCompatible(FieldConstPtr from, FieldConstPtr to);
void copy(PVField const *from,PVField *to);
epicsBoolean isCopyScalarCompatible(
ScalarConstPtr from, ScalarConstPtr to);
void copyScalar(PVScalar const *from, PVScalar *to);
epicsBoolean isCopyScalarArrayCompatible(ScalarArrayConstPtr from,
ScalarArrayConstPtr to);
int copyScalarArray(PVScalarArray const *from, int offset,
PVScalarArray *to, int toOffset, int length);
epicsBoolean isCopyStructureCompatible(
StructureConstPtr from, StructureConstPtr to);
void copyStructure(PVStructure const *from, PVStructure *to);
epicsBoolean isCopyStructureArrayCompatible(
StructureArrayConstPtr from, StructureArrayConstPtr to);
void copyStructureArray(
PVStructureArray const *from, PVStructureArray *to);
epicsInt8 toByte(PVScalar const *pv);
epicsInt16 toShort(PVScalar const *pv);
epicsInt32 toInt(PVScalar const *pv);
epicsInt64 toLong(PVScalar const *pv);
float toFloat(PVScalar const *pv);
double toDouble(PVScalar const *pv);
void fromByte(PVScalar *pv,epicsInt8 from);
void fromShort(PVScalar *pv,epicsInt16 from);
void fromInt(PVScalar *pv, epicsInt32 from);
void fromLong(PVScalar *pv, epicsInt64 from);
void fromFloat(PVScalar* pv, float from);
void fromDouble(PVScalar *pv, double from);
int toByteArray(PVScalarArray const *pv, int offset, int length,
epicsInt8 to[], int toOffset);
int toShortArray(PVScalarArray const *pv, int offset, int length,
epicsInt16 to[], int toOffset);
int toIntArray(PVScalarArray const *pv, int offset, int length,
epicsInt32 to[], int toOffset);
int toLongArray(PVScalarArray const *pv, int offset, int length,
epicsInt64 to[], int toOffset);
int toFloatArray(PVScalarArray const *pv, int offset, int length,
float to[], int toOffset);
int toDoubleArray(PVScalarArray const *pv, int offset, int length,
double to[], int toOffset);
int fromByteArray(PVScalarArray *pv, int offset, int length,
epicsInt8 from[], int fromOffset);
int fromShortArray(PVScalarArray *pv, int offset, int length,
epicsInt16 from[], int fromOffset);
int fromIntArray(PVScalarArray *pv, int offset, int length,
epicsInt32 from[], int fromOffset);
int fromLongArray(PVScalarArray *pv, int offset, int length,
epicsInt64 from[], int fromOffset);
int fromFloatArray(PVScalarArray *pv, int offset, int length,
float from[], int fromOffset);
int fromDoubleArray(PVScalarArray *pv, int offset, int length,
double from[], int fromOffset);
void newLine(StringPtr buf, int indentLevel);
private:
Convert(); // not implemented
Convert(Convert const & ); // not implemented
Convert & operator=(Convert const &); //not implemented
class Convert *pImpl;
};
extern Convert * getConvert();

View File

@@ -45,6 +45,7 @@ namespace epics { namespace pvData {
void toString(StringPtr buf);
void toString(StringPtr buf,int indentLevel);
private:
static void init();
PVAuxInfo(); // not implemented
PVAuxInfo(PVAuxInfo const & ); // not implemented
PVAuxInfo & operator=(PVAuxInfo const &); //not implemented

View File

@@ -11,6 +11,7 @@ namespace epics { namespace pvData {
class StructureArray;
typedef std::string * StringPtr;
typedef StringPtr * StringPtrArray;
// pointer to constant string
typedef std::string const * StringConstPtr;
//array of pointers to constant string

View File

@@ -2,9 +2,9 @@ TOP=../..
include $(TOP)/configure/CONFIG
PROD_HOST += test
test_SRCS += test.cpp
test_LIBS += pvFactory
PROD_HOST += testIntrospect
testIntrospect_SRCS += testIntrospect.cpp
testIntrospect_LIBS += pvFactory
PROD_HOST += testDumpStdString
testDumpStdString_SRCS += testDumpStdString.cpp

View File

@@ -7,7 +7,7 @@
#include <string.h>
#include <stdio.h>
#include "pvData.h"
#include "pvIntrospect.h"
using namespace epics::pvData;
using namespace std;

View File

@@ -7,7 +7,7 @@
#include <string.h>
#include <stdio.h>
#include "pvData.h"
#include "pvIntrospect.h"
using namespace epics::pvData;

View File

@@ -25,32 +25,32 @@ void testDouble() {
double value = 2;
pvValue->put(value);
double getValue = pvValue->get();
printf("put %lf get %lf\n",value,getValue);
if(value!=getValue) {
fprintf(stderr,"ERROR getValue put %f get %f\n",value,getValue);
}
FieldConstPtr field = pvValue->getField();
buffer->clear();
field->toString(buffer);
printf("%s\n",buffer->c_str());
epicsBoolean isImmutable = pvValue->isImmutable();
PVStructure *pvParent = pvValue->getParent();
printf("immutable %s parent %p\n",
((isImmutable==epicsFalse) ? "false" : "true"),
pvParent);
int offset = pvValue->getFieldOffset();
int nextOffset = pvValue->getNextFieldOffset();
int numberFields = pvValue->getNumberFields();
printf("offset %d nextOffset %d numberFields %d\n",
offset,nextOffset,numberFields);
ScalarConstPtr scalar = dynamic_cast<ScalarConstPtr>(field);
if(scalar!=field) {
fprintf(stderr,"ERROR field!=scalar field %p scalar %p\n",field,scalar);
}
buffer->clear();
*buffer += "value ";
pvValue->toString(buffer);
printf("%s\n",buffer->c_str());
int offset = pvValue->getFieldOffset();
int nextOffset = pvValue->getNextFieldOffset();
int numberFields = pvValue->getNumberFields();
PVAuxInfo *auxInfo = pvValue->getPVAuxInfo();
epicsBoolean isImmutable = pvValue->isImmutable();
PVStructure *pvParent = pvValue->getParent();
printf("offset %d nextOffset %d numberFields %d auxInfo %p immutable %s parent %p\n",
offset,nextOffset,numberFields,auxInfo,
((isImmutable==epicsFalse) ? "false" : "true"),
pvParent);
FieldConstPtr field = pvValue->getField();
buffer->clear();
*buffer += "field ";
field->toString(buffer);
printf("%s\n",buffer->c_str());
ScalarConstPtr scalar = dynamic_cast<ScalarConstPtr>(field);
if(scalar!=field) {
fprintf(stderr,"ERROR field!=scalar field %p scalar %p\n",field,scalar);
}
delete pvValue;
}