The changes make it clear what is a default implementation and what implements base classes defined in pvData.h.
67 lines
1.8 KiB
C++
67 lines
1.8 KiB
C++
/*PVLong.cpp*/
|
|
/**
|
|
* Copyright - See the COPYRIGHT that is included with this distribution.
|
|
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
|
|
* in file LICENSE that is included with this distribution.
|
|
*/
|
|
#include <cstddef>
|
|
#include <cstdlib>
|
|
#include <string>
|
|
#include <cstdio>
|
|
#include "pvData.h"
|
|
#include "convert.h"
|
|
#include "factory.h"
|
|
#include "byteBuffer.h"
|
|
|
|
namespace epics { namespace pvData {
|
|
|
|
class BasePVLong : public PVLong {
|
|
public:
|
|
BasePVLong(PVStructure *parent,ScalarConstPtr scalar);
|
|
virtual ~BasePVLong();
|
|
virtual int64 get();
|
|
virtual void put(int64 val);
|
|
virtual void serialize(ByteBuffer *pbuffer,
|
|
SerializableControl *pflusher) ;
|
|
virtual void deserialize(ByteBuffer *pbuffer,
|
|
DeserializableControl *pflusher);
|
|
virtual bool operator==(PVField& pv) ;
|
|
virtual bool operator!=(PVField& pv) ;
|
|
private:
|
|
int64 value;
|
|
};
|
|
|
|
BasePVLong::BasePVLong(PVStructure *parent,ScalarConstPtr scalar)
|
|
: PVLong(parent,scalar),value(0)
|
|
{}
|
|
|
|
BasePVLong::~BasePVLong() {}
|
|
|
|
int64 BasePVLong::get() { return value;}
|
|
|
|
void BasePVLong::put(int64 val){value = val;}
|
|
|
|
void BasePVLong::serialize(ByteBuffer *pbuffer,
|
|
SerializableControl *pflusher) {
|
|
pflusher->ensureBuffer(sizeof(int64));
|
|
pbuffer->putLong(value);
|
|
}
|
|
|
|
void BasePVLong::deserialize(ByteBuffer *pbuffer,
|
|
DeserializableControl *pflusher) {
|
|
pflusher->ensureData(sizeof(int64));
|
|
value = pbuffer->getLong();
|
|
}
|
|
|
|
bool BasePVLong::operator==(PVField& pvField)
|
|
{
|
|
return getConvert()->equals(this, &pvField);
|
|
}
|
|
|
|
bool BasePVLong::operator!=(PVField& pvField)
|
|
{
|
|
return !(getConvert()->equals(this, &pvField));
|
|
}
|
|
|
|
}}
|