2) implemented Lock. See effective C++ item 14.
This is as easy to use as Java synchronize.
3) wrapper on top of std::string. All usage of string in pvData is one of:
String - Just a std::string
StringBuilder - Used where StringBuilder is used in Java
StringConst - Just a "std::string const". This is used wherever String is used in Java
StringConstArray - Just like a String[] in Java.
4) The reference counting (incReferenceCount and decReferenceCount) are now private. It is completely handled by the implenentaion.
NO code that uses pvData needs even know about reference counting.
106 lines
2.8 KiB
C++
106 lines
2.8 KiB
C++
/*BasePVStructureArray.h*/
|
|
#ifndef BASEPVSTRUCTUREARRAY_H
|
|
#define BASEPVSTRUCTUREARRAY_H
|
|
#include <cstddef>
|
|
#include <cstdlib>
|
|
#include <string>
|
|
#include <cstdio>
|
|
#include "pvData.h"
|
|
#include "factory.h"
|
|
|
|
namespace epics { namespace pvData {
|
|
|
|
class PVStructureArrayPvt {
|
|
public:
|
|
PVStructureArrayPvt(StructureArrayConstPtr structureArray);
|
|
~PVStructureArrayPvt();
|
|
|
|
StructureArrayConstPtr structureArray;
|
|
StructureArrayData *structureArrayData;
|
|
PVStructureArrayPtr pvStructureArray;
|
|
};
|
|
PVStructureArrayPvt::PVStructureArrayPvt(
|
|
StructureArrayConstPtr structureArray)
|
|
: structureArray(structureArray),
|
|
structureArrayData(new StructureArrayData()),
|
|
pvStructureArray(new PVStructurePtr[0])
|
|
{}
|
|
|
|
PVStructureArrayPvt::~PVStructureArrayPvt()
|
|
{
|
|
delete structureArrayData;
|
|
delete pvStructureArray;
|
|
}
|
|
|
|
|
|
PVStructureArray::PVStructureArray(PVStructure *parent,
|
|
StructureArrayConstPtr structureArray)
|
|
: PVArray(parent,structureArray),
|
|
pImpl(new PVStructureArrayPvt(structureArray))
|
|
{
|
|
}
|
|
|
|
PVStructureArray::~PVStructureArray()
|
|
{
|
|
delete pImpl;
|
|
}
|
|
|
|
StructureArrayConstPtr PVStructureArray::getStructureArray() const
|
|
{
|
|
return pImpl->structureArray;
|
|
}
|
|
|
|
int PVStructureArray::get(
|
|
int offset, int length, StructureArrayData *data) const
|
|
{
|
|
throw std::logic_error(notImplemented);
|
|
}
|
|
|
|
int PVStructureArray::put(int offset,int length,
|
|
PVStructureArrayPtr from, int fromOffset)
|
|
{
|
|
throw std::logic_error(notImplemented);
|
|
}
|
|
|
|
void PVStructureArray::shareData(PVStructureArrayPtr from)
|
|
{
|
|
throw std::logic_error(notImplemented);
|
|
}
|
|
|
|
void PVStructureArray::serialize(ByteBuffer *pbuffer,
|
|
SerializableControl *pflusher) const
|
|
{
|
|
throw std::logic_error(notImplemented);
|
|
}
|
|
|
|
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(StringBuilder buf) const {toString(buf,0);}
|
|
|
|
void PVStructureArray::toString(StringBuilder buf,int indentLevel) const
|
|
{
|
|
throw std::logic_error(notImplemented);
|
|
}
|
|
|
|
class BasePVStructureArray : public PVStructureArray {
|
|
public:
|
|
BasePVStructureArray(PVStructure *parent,
|
|
StructureArrayConstPtr structureArray)
|
|
: PVStructureArray(parent,structureArray) {}
|
|
~BasePVStructureArray(){}
|
|
private:
|
|
};
|
|
|
|
}}
|
|
#endif /* BASEPVSTRUCTUREARRAY_H */
|