Still working on initial version
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
/*AbstractPVField.cpp*/
|
||||
/*AbstractPVField.h*/
|
||||
#ifndef ABSTRACTPVFIELD_H
|
||||
#define ABSTRACTPVFIELD_H
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
@@ -8,6 +10,8 @@
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
PVField::~PVField(){}
|
||||
|
||||
class AbstractPVField : public PVField {
|
||||
public:
|
||||
AbstractPVField(PVStructure *parent,FieldConstPtr field);
|
||||
@@ -20,16 +24,16 @@ namespace epics { namespace pvData {
|
||||
virtual int getFieldOffset() const;
|
||||
virtual int getNextFieldOffset() const;
|
||||
virtual int getNumberFields() const;
|
||||
virtual PVAuxInfo * getPVAuxInfo() const;
|
||||
virtual epicsBoolean isImmutable() const;
|
||||
virtual void setImmutable();
|
||||
virtual FieldConstPtr getField() const;
|
||||
virtual PVStructure * getParent() const;
|
||||
virtual PVAuxInfo * getPVAuxInfo() const {return pvAuxInfo;}
|
||||
virtual epicsBoolean isImmutable() const {return immutable;}
|
||||
virtual void setImmutable() {immutable = epicsTrue;}
|
||||
virtual FieldConstPtr getField() const {return field;}
|
||||
virtual PVStructure * getParent() const {return parent;}
|
||||
virtual void replacePVField(PVField * newPVField);
|
||||
virtual void renameField(StringConstPtr newName);
|
||||
virtual void postPut() const;
|
||||
virtual void setPostHandler(PostHandler *ppostHandler);
|
||||
virtual void toString(StringPtr buf) const;
|
||||
virtual void toString(StringPtr buf) const {toString(buf,0);}
|
||||
virtual void toString(StringPtr buf,int indentLevel) const;
|
||||
protected:
|
||||
void replaceStructure();
|
||||
@@ -86,4 +90,41 @@ namespace epics { namespace pvData {
|
||||
throw std::logic_error(requesterPresent);
|
||||
}
|
||||
|
||||
int AbstractPVField::getFieldOffset() const
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int AbstractPVField::getNextFieldOffset() const
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int AbstractPVField::getNumberFields() const
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
void AbstractPVField::replacePVField(PVField * newPVField)
|
||||
{
|
||||
}
|
||||
|
||||
void AbstractPVField::renameField(StringConstPtr newName)
|
||||
{
|
||||
}
|
||||
|
||||
void AbstractPVField::postPut() const
|
||||
{
|
||||
}
|
||||
|
||||
void AbstractPVField::setPostHandler(PostHandler *ppostHandler)
|
||||
{
|
||||
}
|
||||
|
||||
void AbstractPVField::toString(StringPtr buf,int indentLevel) const
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
}}
|
||||
#endif /* ABSTRACTPVFIELD_H */
|
||||
|
||||
28
pvDataApp/factory/AbstractPVScalar.h
Normal file
28
pvDataApp/factory/AbstractPVScalar.h
Normal file
@@ -0,0 +1,28 @@
|
||||
/*AbstractPVScalar.h*/
|
||||
#ifndef ABSTRACTPVSCALAR_H
|
||||
#define ABSTRACTPVSCALAR_H
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <cstdio>
|
||||
#include "pvData.h"
|
||||
#include "factory.h"
|
||||
#include "AbstractPVField.h"
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
PVScalar::~PVScalar() {}
|
||||
|
||||
class AbstractPVScalar : public AbstractPVField, public PVScalar {
|
||||
public:
|
||||
AbstractPVScalar(PVStructure *parent,ScalarConstPtr scalar)
|
||||
: AbstractPVField(parent,scalar) {}
|
||||
virtual ~AbstractPVScalar() {}
|
||||
virtual Scalar *getScalar()const {
|
||||
return (Scalar*)AbstractPVField::getField();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}}
|
||||
#endif /* ABSTRACTPVSCALAR_H */
|
||||
72
pvDataApp/factory/BasePVDouble.h
Normal file
72
pvDataApp/factory/BasePVDouble.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/*BasePVDouble.h*/
|
||||
#ifndef BASEPVDOUBLE_H
|
||||
#define BASEPVDOUBLE_H
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <cstdio>
|
||||
#include "pvData.h"
|
||||
#include "factory.h"
|
||||
#include "AbstractPVField.h"
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
PVScalar::~PVScalar() {}
|
||||
PVDouble::~PVDouble() {}
|
||||
|
||||
class BasePVDouble : public AbstractPVField, public PVDouble {
|
||||
public:
|
||||
BasePVDouble(PVStructure *parent,ScalarConstPtr scalar)
|
||||
: AbstractPVField(parent,scalar),value(0.0) {}
|
||||
virtual ~BasePVDouble() {}
|
||||
// from Requester
|
||||
virtual StringConstPtr getRequesterName() const{
|
||||
return AbstractPVField::getRequesterName();}
|
||||
virtual void message(StringConstPtr message,MessageType messageType) const{
|
||||
AbstractPVField::message(message,messageType);}
|
||||
// from PVScalar
|
||||
virtual Scalar *getScalar() const{
|
||||
return (Scalar *)getField();}
|
||||
// from PVField
|
||||
virtual void setRequester(Requester *requester){
|
||||
AbstractPVField::setRequester(requester);}
|
||||
virtual int getFieldOffset() const{
|
||||
return AbstractPVField::getFieldOffset();}
|
||||
virtual int getNextFieldOffset() const{
|
||||
return AbstractPVField::getNextFieldOffset();}
|
||||
virtual int getNumberFields() const{
|
||||
return AbstractPVField::getNumberFields();}
|
||||
virtual PVAuxInfo * getPVAuxInfo() const{
|
||||
return AbstractPVField::getPVAuxInfo();}
|
||||
virtual epicsBoolean isImmutable() const{
|
||||
return AbstractPVField::isImmutable();}
|
||||
virtual void setImmutable(){
|
||||
AbstractPVField::setImmutable();}
|
||||
virtual FieldConstPtr getField() const{
|
||||
return AbstractPVField::getField();}
|
||||
virtual PVStructure * getParent() const{
|
||||
return AbstractPVField::getParent();}
|
||||
virtual void replacePVField(PVField * newPVField){
|
||||
AbstractPVField::replacePVField(newPVField);}
|
||||
virtual void renameField(StringConstPtr newName){
|
||||
AbstractPVField::renameField(newName);}
|
||||
virtual void postPut() const{
|
||||
AbstractPVField::postPut();}
|
||||
virtual void setPostHandler(PostHandler *postHandler){
|
||||
AbstractPVField::setPostHandler(postHandler);}
|
||||
virtual void toString(StringPtr buf) const {toString(buf,0);}
|
||||
virtual void toString(StringPtr buf,int indentLevel) const{
|
||||
AbstractPVField::toString(buf,indentLevel);}
|
||||
// from PVDouble
|
||||
virtual double get()const { return value;}
|
||||
virtual void put(double val){value = val;}
|
||||
// from Serializable
|
||||
virtual void serialize(ByteBuffer *pbuffer,SerializableControl *pflusher) const{}
|
||||
virtual void deserialize(ByteBuffer *pbuffer,DeserializableControl *pflusher){}
|
||||
private:
|
||||
double value;
|
||||
};
|
||||
|
||||
|
||||
}}
|
||||
#endif /* BASEPVDOUBLE_H */
|
||||
@@ -4,6 +4,8 @@ include $(TOP)/configure/CONFIG
|
||||
|
||||
INC += factory.h
|
||||
INC += AbstractPVField.h
|
||||
INC += AbstractPVScalar.h
|
||||
INC += BasePVDouble.h
|
||||
LIBSRCS += TypeFunc.cpp
|
||||
LIBSRCS += FieldCreateFactory.cpp
|
||||
LIBSRCS += PVDataCreateFactory.cpp
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "pvData.h"
|
||||
#include "factory.h"
|
||||
#include "AbstractPVField.h"
|
||||
#include "BasePVDouble.h"
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
@@ -27,6 +28,13 @@ namespace epics { namespace pvData {
|
||||
|
||||
PVScalar *PVDataCreate::createPVScalar(PVStructure *parent,ScalarConstPtr scalar) const
|
||||
{
|
||||
ScalarType scalarType = scalar->getScalarType();
|
||||
switch(scalarType) {
|
||||
case pvDouble:
|
||||
return new BasePVDouble(parent,scalar);
|
||||
default:
|
||||
throw std::logic_error(notImplemented);
|
||||
}
|
||||
throw std::logic_error(notImplemented);
|
||||
};
|
||||
|
||||
|
||||
15
pvDataApp/pv/MakefileBack
Normal file
15
pvDataApp/pv/MakefileBack
Normal file
@@ -0,0 +1,15 @@
|
||||
TOP=../..
|
||||
|
||||
include $(TOP)/configure/CONFIG
|
||||
|
||||
INC += pvIntrospect.h
|
||||
INC += bitSet.h
|
||||
INC += requester.h
|
||||
INC += byteBuffer.h
|
||||
INC += serialize.h
|
||||
INC += pvData.h
|
||||
|
||||
include $(TOP)/configure/RULES
|
||||
#----------------------------------------
|
||||
# ADD RULES AFTER THIS LINE
|
||||
|
||||
@@ -10,7 +10,7 @@ PROD_HOST += testDumpStdString
|
||||
testDumpStdString_SRCS += testDumpStdString.cpp
|
||||
testDumpStdString_LIBS += pvFactory
|
||||
|
||||
PROD_HOST = testPVScalar
|
||||
PROD_HOST += testPVScalar
|
||||
testPVScalar_SRCS += testPVScalar.cpp
|
||||
testPVScalar_LIBS += pvFactory
|
||||
|
||||
|
||||
Reference in New Issue
Block a user