use Michael Davidsaver version of introspection
This commit is contained in:
@@ -58,8 +58,15 @@ INC += factory.h
|
||||
LIBSRCS += TypeFunc.cpp
|
||||
LIBSRCS += PVAuxInfoImpl.cpp
|
||||
LIBSRCS += FieldCreateFactory.cpp
|
||||
LIBSRCS += PVField.cpp
|
||||
LIBSRCS += PVScalar.cpp
|
||||
LIBSRCS += PVArray.cpp
|
||||
LIBSRCS += PVScalarArray.cpp
|
||||
LIBSRCS += PVStructure.cpp
|
||||
LIBSRCS += DefaultPVStructureArray.cpp
|
||||
LIBSRCS += PVDataCreateFactory.cpp
|
||||
LIBSRCS += Convert.cpp
|
||||
LIBSRCS += Compare.cpp
|
||||
LIBSRCS += StandardField.cpp
|
||||
LIBSRCS += StandardPVField.cpp
|
||||
|
||||
|
||||
83
pvDataApp/factory/Compare.cpp
Normal file
83
pvDataApp/factory/Compare.cpp
Normal file
@@ -0,0 +1,83 @@
|
||||
|
||||
#include "convert.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <sstream>
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
// Introspection object comparision
|
||||
|
||||
/** Field equality conditions:
|
||||
* 1) same instance
|
||||
* 2) same type (field and scalar/element)
|
||||
* Note: not the same name
|
||||
*/
|
||||
bool operator==(const Field& a, const Field& b)
|
||||
{
|
||||
if(&a==&b)
|
||||
return true;
|
||||
if(a.getType()!=b.getType())
|
||||
return false;
|
||||
switch(a.getType()) {
|
||||
case scalar: {
|
||||
const Scalar &A=static_cast<const Scalar&>(a);
|
||||
const Scalar &B=static_cast<const Scalar&>(b);
|
||||
return A==B;
|
||||
}
|
||||
case scalarArray: {
|
||||
const ScalarArray &A=static_cast<const ScalarArray&>(a);
|
||||
const ScalarArray &B=static_cast<const ScalarArray&>(b);
|
||||
return A==B;
|
||||
}
|
||||
case structure: {
|
||||
const Structure &A=static_cast<const Structure&>(a);
|
||||
const Structure &B=static_cast<const Structure&>(b);
|
||||
return A==B;
|
||||
}
|
||||
case structureArray: {
|
||||
const StructureArray &A=static_cast<const StructureArray&>(a);
|
||||
const StructureArray &B=static_cast<const StructureArray&>(b);
|
||||
return A==B;
|
||||
}
|
||||
default:
|
||||
throw std::logic_error("Invalid Field type in comparision");
|
||||
}
|
||||
}
|
||||
|
||||
bool operator==(const Scalar& a, const Scalar& b)
|
||||
{
|
||||
if(&a==&b)
|
||||
return true;
|
||||
return a.getScalarType()==b.getScalarType();
|
||||
}
|
||||
|
||||
bool operator==(const ScalarArray& a, const ScalarArray& b)
|
||||
{
|
||||
if(&a==&b)
|
||||
return true;
|
||||
return a.getElementType()==b.getElementType();
|
||||
}
|
||||
|
||||
bool operator==(const Structure& a, const Structure& b)
|
||||
{
|
||||
if(&a==&b)
|
||||
return true;
|
||||
int nflds=a.getNumberFields();
|
||||
if (b.getNumberFields()!=nflds)
|
||||
return false;
|
||||
return std::equal(a.getFields(), a.getFields()+nflds,
|
||||
b.getFields());
|
||||
}
|
||||
|
||||
bool operator==(const StructureArray& a, const StructureArray& b)
|
||||
{
|
||||
return a.structure() == b.structure();
|
||||
}
|
||||
|
||||
namespace nconvert {
|
||||
|
||||
} // namespace nconvert
|
||||
|
||||
}} // namespace epics::pvData
|
||||
@@ -13,6 +13,9 @@
|
||||
#include "pvData.h"
|
||||
#include "convert.h"
|
||||
|
||||
using std::tr1::static_pointer_cast;
|
||||
using std::tr1::const_pointer_cast;
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
static Convert* convert = 0;
|
||||
@@ -228,20 +231,20 @@ bool Convert::isCopyCompatible(FieldConstPtr from, FieldConstPtr to)
|
||||
switch(from->getType()) {
|
||||
case scalar:
|
||||
return isCopyScalarCompatible(
|
||||
static_cast<ScalarConstPtr>(from),
|
||||
static_cast<ScalarConstPtr>(to));
|
||||
static_pointer_cast<const Scalar>(from),
|
||||
static_pointer_cast<const Scalar>(to));
|
||||
case scalarArray:
|
||||
return isCopyScalarArrayCompatible(
|
||||
static_cast<ScalarArrayConstPtr>(from),
|
||||
static_cast<ScalarArrayConstPtr>(to));
|
||||
static_pointer_cast<const ScalarArray>(from),
|
||||
static_pointer_cast<const ScalarArray>(to));
|
||||
case structure:
|
||||
return isCopyStructureCompatible(
|
||||
static_cast<StructureConstPtr>(from),
|
||||
static_cast<StructureConstPtr>(to));
|
||||
static_pointer_cast<const Structure>(from),
|
||||
static_pointer_cast<const Structure>(to));
|
||||
case structureArray:
|
||||
return isCopyStructureArrayCompatible(
|
||||
static_cast<StructureArrayConstPtr>(from),
|
||||
static_cast<StructureArrayConstPtr>(to));
|
||||
static_pointer_cast<const StructureArray>(from),
|
||||
static_pointer_cast<const StructureArray>(to));
|
||||
}
|
||||
String message("Convert::isCopyCompatible should never get here");
|
||||
throw std::logic_error(message);
|
||||
@@ -487,26 +490,26 @@ bool Convert::isCopyStructureCompatible(
|
||||
switch(fromType) {
|
||||
case scalar:
|
||||
if(!convert->isCopyScalarCompatible(
|
||||
static_cast<ScalarConstPtr>(from),
|
||||
static_cast<ScalarConstPtr>(to)))
|
||||
static_pointer_cast<const Scalar>(from),
|
||||
static_pointer_cast<const Scalar>(to)))
|
||||
return false;
|
||||
break;
|
||||
case scalarArray:
|
||||
if(!isCopyScalarArrayCompatible(
|
||||
static_cast<ScalarArrayConstPtr>(from),
|
||||
static_cast<ScalarArrayConstPtr>(to)))
|
||||
static_pointer_cast<const ScalarArray>(from),
|
||||
static_pointer_cast<const ScalarArray>(to)))
|
||||
return false;
|
||||
break;
|
||||
case structure:
|
||||
if(!isCopyStructureCompatible(
|
||||
static_cast<StructureConstPtr>(from),
|
||||
static_cast<StructureConstPtr>(to)))
|
||||
static_pointer_cast<const Structure>(from),
|
||||
static_pointer_cast<const Structure>(to)))
|
||||
return false;
|
||||
break;
|
||||
case structureArray:
|
||||
if(!isCopyStructureArrayCompatible(
|
||||
static_cast<StructureArrayConstPtr>(from),
|
||||
static_cast<StructureArrayConstPtr>(to)))
|
||||
static_pointer_cast<const StructureArray>(from),
|
||||
static_pointer_cast<const StructureArray>(to)))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,41 +9,16 @@
|
||||
#include <string>
|
||||
#include <cstdio>
|
||||
#include "pvData.h"
|
||||
#include "convert.h"
|
||||
#include "factory.h"
|
||||
#include "serializeHelper.h"
|
||||
#include "DefaultPVStructureArray.h"
|
||||
|
||||
using std::tr1::static_pointer_cast;
|
||||
using std::tr1::const_pointer_cast;
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
class BasePVStructureArray : public PVStructureArray {
|
||||
public:
|
||||
BasePVStructureArray(PVStructure *parent,
|
||||
StructureArrayConstPtr structureArray);
|
||||
virtual ~BasePVStructureArray();
|
||||
virtual StructureArrayConstPtr getStructureArray();
|
||||
virtual int append(int number);
|
||||
virtual bool remove(int offset,int number);
|
||||
virtual void compress();
|
||||
virtual void setCapacity(int capacity);
|
||||
virtual int get(int offset, int length,
|
||||
StructureArrayData *data);
|
||||
virtual int put(int offset,int length,
|
||||
PVStructurePtrArray from, int fromOffset);
|
||||
virtual bool operator==(PVField &pv);
|
||||
virtual bool operator!=(PVField &pv);
|
||||
virtual void shareData( PVStructurePtrArray value,int capacity,int length);
|
||||
virtual void serialize(ByteBuffer *pbuffer,
|
||||
SerializableControl *pflusher) const;
|
||||
virtual void deserialize(ByteBuffer *buffer,
|
||||
DeserializableControl *pflusher);
|
||||
virtual void serialize(ByteBuffer *pbuffer,
|
||||
SerializableControl *pflusher, int offset, int count) const;
|
||||
private:
|
||||
StructureArrayConstPtr structureArray;
|
||||
StructureArrayData *structureArrayData;
|
||||
PVStructurePtrArray value;
|
||||
};
|
||||
|
||||
|
||||
BasePVStructureArray::BasePVStructureArray(
|
||||
PVStructure *parent,StructureArrayConstPtr structureArray)
|
||||
: PVStructureArray(parent,structureArray),
|
||||
@@ -72,7 +47,6 @@ namespace epics { namespace pvData {
|
||||
setCapacity(newLength);
|
||||
StructureConstPtr structure = structureArray->getStructure();
|
||||
for(int i=currentLength; i<newLength; i++) {
|
||||
structure->incReferenceCount();
|
||||
value[i] = getPVDataCreate()->createPVStructure(0,structure);
|
||||
}
|
||||
return newLength;
|
||||
@@ -234,7 +208,6 @@ namespace epics { namespace pvData {
|
||||
}
|
||||
else {
|
||||
if(value[i]==NULL) {
|
||||
structureArray->getStructure()->incReferenceCount();
|
||||
value[i] = getPVDataCreate()->createPVStructure(
|
||||
NULL, structureArray->getStructure());
|
||||
}
|
||||
|
||||
50
pvDataApp/factory/DefaultPVStructureArray.h
Normal file
50
pvDataApp/factory/DefaultPVStructureArray.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/*DefaultPVStructureArray.h*/
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
#ifndef DEFAULTPVSTRUCTUREARRAY_H
|
||||
#define DEFAULTPVSTRUCTUREARRAY_H
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <cstdio>
|
||||
#include "pvData.h"
|
||||
#include "convert.h"
|
||||
#include "factory.h"
|
||||
#include "serializeHelper.h"
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
class BasePVStructureArray : public PVStructureArray {
|
||||
public:
|
||||
BasePVStructureArray(PVStructure *parent,
|
||||
StructureArrayConstPtr structureArray);
|
||||
virtual ~BasePVStructureArray();
|
||||
virtual StructureArrayConstPtr getStructureArray();
|
||||
virtual int append(int number);
|
||||
virtual bool remove(int offset,int number);
|
||||
virtual void compress();
|
||||
virtual void setCapacity(int capacity);
|
||||
virtual int get(int offset, int length,
|
||||
StructureArrayData *data);
|
||||
virtual int put(int offset,int length,
|
||||
PVStructurePtrArray from, int fromOffset);
|
||||
virtual bool operator==(PVField &pv);
|
||||
virtual bool operator!=(PVField &pv);
|
||||
virtual void shareData( PVStructurePtrArray value,int capacity,int length);
|
||||
virtual void serialize(ByteBuffer *pbuffer,
|
||||
SerializableControl *pflusher) const;
|
||||
virtual void deserialize(ByteBuffer *buffer,
|
||||
DeserializableControl *pflusher);
|
||||
virtual void serialize(ByteBuffer *pbuffer,
|
||||
SerializableControl *pflusher, int offset, int count) const;
|
||||
private:
|
||||
StructureArrayConstPtr structureArray;
|
||||
StructureArrayData *structureArrayData;
|
||||
PVStructurePtrArray value;
|
||||
};
|
||||
}}
|
||||
|
||||
#endif /*DEFAULTPVSTRUCTUREARRAY_H*/
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "factory.h"
|
||||
#include "CDRMonitor.h"
|
||||
|
||||
using std::tr1::static_pointer_cast;
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
static DebugLevel debugLevel = lowDebug;
|
||||
@@ -26,22 +28,9 @@ static void newLine(StringBuilder buffer, int indentLevel)
|
||||
|
||||
PVDATA_REFCOUNT_MONITOR_DEFINE(field);
|
||||
|
||||
class FieldPvt {
|
||||
public :
|
||||
FieldPvt(String fieldName,Type type);
|
||||
String fieldName;
|
||||
Type type;
|
||||
int referenceCount;
|
||||
};
|
||||
|
||||
FieldPvt::FieldPvt(String fieldName,Type type)
|
||||
: fieldName(fieldName),type(type),referenceCount(1)
|
||||
{PVDATA_REFCOUNT_MONITOR_INCREF(field);}
|
||||
|
||||
static Mutex refCountMutex;
|
||||
|
||||
Field::Field(String fieldName,Type type)
|
||||
: pImpl(new FieldPvt(fieldName,type))
|
||||
:m_fieldName(fieldName)
|
||||
,m_type(type)
|
||||
{
|
||||
PVDATA_REFCOUNT_MONITOR_CONSTRUCT(field);
|
||||
}
|
||||
@@ -49,157 +38,17 @@ Field::Field(String fieldName,Type type)
|
||||
Field::~Field() {
|
||||
PVDATA_REFCOUNT_MONITOR_DESTRUCT(field);
|
||||
// note that compiler automatically calls destructor for fieldName
|
||||
if(debugLevel==highDebug) printf("~Field %s\n",pImpl->fieldName.c_str());
|
||||
delete pImpl;
|
||||
pImpl = 0;
|
||||
if(debugLevel==highDebug) printf("~Field %s\n",m_fieldName.c_str());
|
||||
}
|
||||
|
||||
int Field::getReferenceCount() const {
|
||||
Lock xx(refCountMutex);
|
||||
return pImpl->referenceCount;
|
||||
}
|
||||
|
||||
String Field::getFieldName() const {return pImpl->fieldName;}
|
||||
|
||||
Type Field::getType() const {return pImpl->type;}
|
||||
|
||||
void Field::renameField(String newName)
|
||||
{
|
||||
pImpl->fieldName = newName;
|
||||
m_fieldName = newName;
|
||||
}
|
||||
|
||||
void Field::incReferenceCount() const {
|
||||
PVDATA_REFCOUNT_MONITOR_INCREF(field);
|
||||
Lock xx(refCountMutex);
|
||||
pImpl->referenceCount++;
|
||||
if(pImpl->type!=structure) return;
|
||||
StructureConstPtr structure = static_cast<StructureConstPtr>(this);
|
||||
FieldConstPtrArray fields = structure->getFields();
|
||||
int numberFields = structure->getNumberFields();
|
||||
for(int i=0; i<numberFields; i++) {
|
||||
fields[i]->incReferenceCount();
|
||||
}
|
||||
}
|
||||
|
||||
void Field::decReferenceCount() const {
|
||||
PVDATA_REFCOUNT_MONITOR_DECREF(field);
|
||||
Lock xx(refCountMutex);
|
||||
if(pImpl->referenceCount<=0) {
|
||||
String message("logicError field ");
|
||||
message += pImpl->fieldName;
|
||||
throw std::logic_error(message);
|
||||
}
|
||||
pImpl->referenceCount--;
|
||||
if(pImpl->type!=structure) {
|
||||
if(pImpl->referenceCount==0) {
|
||||
delete this;
|
||||
}
|
||||
return;
|
||||
}
|
||||
StructureConstPtr structure = static_cast<StructureConstPtr>(this);
|
||||
FieldConstPtrArray fields = structure->getFields();
|
||||
int numberFields = structure->getNumberFields();
|
||||
for(int i=0; i<numberFields; i++) {
|
||||
fields[i]->decReferenceCount();
|
||||
}
|
||||
if(pImpl->referenceCount==0) {
|
||||
delete this;
|
||||
}
|
||||
}
|
||||
|
||||
void Field:: dumpReferenceCount(StringBuilder buffer,int indentLevel) const {
|
||||
*buffer += getFieldName();
|
||||
char buf[40];
|
||||
sprintf(buf," referenceCount %d",getReferenceCount());
|
||||
*buffer += buf;
|
||||
if(pImpl->type!=structure) return;
|
||||
Convert *convert = getConvert();
|
||||
StructureConstPtr structure = static_cast<StructureConstPtr>(this);
|
||||
FieldConstPtrArray fields = structure->getFields();
|
||||
int numberFields = structure->getNumberFields();
|
||||
for(int i=0; i<numberFields; i++) {
|
||||
convert->newLine(buffer,indentLevel+1);
|
||||
fields[i]->dumpReferenceCount(buffer,indentLevel +1);
|
||||
}
|
||||
}
|
||||
|
||||
void Field::toString(StringBuilder buffer,int indentLevel) const{
|
||||
*buffer += " ";
|
||||
*buffer += pImpl->fieldName.c_str();
|
||||
}
|
||||
|
||||
static bool fieldEquals(FieldConstPtr a,FieldConstPtr b);
|
||||
inline bool scalarFieldEquals(ScalarConstPtr a,ScalarConstPtr b)
|
||||
{
|
||||
ScalarType ascalarType = a->getScalarType();
|
||||
ScalarType bscalarType = b->getScalarType();
|
||||
if(ascalarType != bscalarType)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool scalarArrayFieldEquals(ScalarArrayConstPtr a,ScalarArrayConstPtr b)
|
||||
{
|
||||
ScalarType aType = a->getElementType();
|
||||
ScalarType bType = b->getElementType();
|
||||
if(aType != bType)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool structureFieldEquals(StructureConstPtr a,StructureConstPtr b)
|
||||
{
|
||||
int length = a->getNumberFields();
|
||||
if(length != b->getNumberFields()) return false;
|
||||
FieldConstPtrArray aFields = a->getFields();
|
||||
FieldConstPtrArray bFields = b->getFields();
|
||||
for(int i=0; i<length; i++)
|
||||
{
|
||||
if(!fieldEquals(aFields[i],bFields[i])) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool structureArrayFieldEquals(StructureArrayConstPtr a,StructureArrayConstPtr b)
|
||||
{
|
||||
StructureConstPtr aStruct = a->getStructure();
|
||||
StructureConstPtr bStruct = b->getStructure();
|
||||
return fieldEquals(aStruct,bStruct);
|
||||
}
|
||||
|
||||
static bool fieldEquals(FieldConstPtr a,FieldConstPtr b)
|
||||
{
|
||||
const void * avoid = static_cast<const void *>(a);
|
||||
const void * bvoid = static_cast<const void *>(b);
|
||||
if(avoid == bvoid) return true;
|
||||
if(a->getFieldName() != b->getFieldName()) return false;
|
||||
Type atype = a->getType();
|
||||
Type btype = b->getType();
|
||||
if(atype!=btype) return false;
|
||||
if(atype==scalar) return scalarFieldEquals(
|
||||
static_cast<ScalarConstPtr>(a),static_cast<ScalarConstPtr>(b));
|
||||
if(atype==scalarArray) return scalarArrayFieldEquals(
|
||||
static_cast<ScalarArrayConstPtr>(a),static_cast<ScalarArrayConstPtr>(b));
|
||||
if(atype==structureArray) return structureArrayFieldEquals(
|
||||
static_cast<StructureArrayConstPtr>(a),static_cast<StructureArrayConstPtr>(b));
|
||||
if(atype==structure) return structureFieldEquals(
|
||||
static_cast<StructureConstPtr>(a),static_cast<StructureConstPtr>(b));
|
||||
String message("should not get here");
|
||||
throw std::logic_error(message);
|
||||
}
|
||||
|
||||
bool Field::operator==(const Field& field) const
|
||||
{
|
||||
return fieldEquals(this, &field);
|
||||
}
|
||||
|
||||
bool Field::operator!=(const Field& field) const
|
||||
{
|
||||
return !fieldEquals(this, &field);
|
||||
*buffer += m_fieldName.c_str();
|
||||
}
|
||||
|
||||
Scalar::Scalar(String fieldName,ScalarType scalarType)
|
||||
@@ -231,7 +80,6 @@ StructureArray::StructureArray(String fieldName,StructureConstPtr structure)
|
||||
|
||||
StructureArray::~StructureArray() {
|
||||
if(debugLevel==highDebug) printf("~StructureArray\n");
|
||||
pstructure->decReferenceCount();
|
||||
}
|
||||
|
||||
void StructureArray::toString(StringBuilder buffer,int indentLevel) const {
|
||||
@@ -248,9 +96,6 @@ Structure::Structure (String fieldName,
|
||||
numberFields(numberFields),
|
||||
fields(infields)
|
||||
{
|
||||
for(int i=0; i<numberFields; i++) {
|
||||
fields[i] = infields[i];
|
||||
}
|
||||
for(int i=0; i<numberFields; i++) {
|
||||
String name = fields[i]->getFieldName();
|
||||
// look for duplicates
|
||||
@@ -269,9 +114,7 @@ Structure::Structure (String fieldName,
|
||||
Structure::~Structure() {
|
||||
if(debugLevel==highDebug)
|
||||
printf("~Structure %s\n",Field::getFieldName().c_str());
|
||||
for(int i=0; i<numberFields; i++) {
|
||||
fields[i] = 0;
|
||||
}
|
||||
|
||||
delete[] fields;
|
||||
}
|
||||
|
||||
@@ -281,7 +124,7 @@ FieldConstPtr Structure::getField(String fieldName) const {
|
||||
int result = fieldName.compare(pfield->getFieldName());
|
||||
if(result==0) return pfield;
|
||||
}
|
||||
return 0;
|
||||
return FieldConstPtr();
|
||||
}
|
||||
|
||||
int Structure::getFieldIndex(String fieldName) const {
|
||||
@@ -320,7 +163,7 @@ void Structure::removeField(int index)
|
||||
String("Structure::removeField index out of bounds"));
|
||||
}
|
||||
FieldConstPtr *newFields = new FieldConstPtr[numberFields-1];
|
||||
fields[index]->decReferenceCount();
|
||||
|
||||
int ind=0;
|
||||
for(int i=0; i<numberFields; i++) {
|
||||
if(i==index) continue;
|
||||
@@ -346,56 +189,57 @@ void Structure::toString(StringBuilder buffer,int indentLevel) const{
|
||||
ScalarConstPtr FieldCreate::createScalar(String fieldName,
|
||||
ScalarType scalarType) const
|
||||
{
|
||||
Scalar *scalar = new Scalar(fieldName,scalarType);
|
||||
ScalarConstPtr scalar(new Scalar(fieldName,scalarType), Field::Deleter());
|
||||
return scalar;
|
||||
}
|
||||
|
||||
ScalarArrayConstPtr FieldCreate::createScalarArray(
|
||||
String fieldName,ScalarType elementType) const
|
||||
{
|
||||
ScalarArray *scalarArray = new ScalarArray(fieldName,elementType);
|
||||
ScalarArrayConstPtr scalarArray(new ScalarArray(fieldName,elementType), Field::Deleter());
|
||||
return scalarArray;
|
||||
}
|
||||
StructureConstPtr FieldCreate::createStructure (
|
||||
String fieldName,int numberFields,
|
||||
FieldConstPtr fields[]) const
|
||||
{
|
||||
Structure *structure = new Structure(
|
||||
fieldName,numberFields,fields);
|
||||
StructureConstPtr structure(new Structure(
|
||||
fieldName,numberFields,fields), Field::Deleter());
|
||||
return structure;
|
||||
}
|
||||
StructureArrayConstPtr FieldCreate::createStructureArray(
|
||||
String fieldName,StructureConstPtr structure) const
|
||||
{
|
||||
StructureArray *structureArray = new StructureArray(fieldName,structure);
|
||||
StructureArrayConstPtr structureArray(new StructureArray(fieldName,structure), Field::Deleter());
|
||||
return structureArray;
|
||||
}
|
||||
|
||||
FieldConstPtr FieldCreate::create(String fieldName,
|
||||
FieldConstPtr pfield) const
|
||||
{
|
||||
FieldConstPtr ret;
|
||||
Type type = pfield->getType();
|
||||
switch(type) {
|
||||
case scalar: {
|
||||
ScalarConstPtr pscalar = static_cast<ScalarConstPtr>(pfield);
|
||||
ScalarConstPtr pscalar = static_pointer_cast<const Scalar>(pfield);
|
||||
return createScalar(fieldName,pscalar->getScalarType());
|
||||
}
|
||||
case scalarArray: {
|
||||
ScalarArrayConstPtr pscalarArray = static_cast<ScalarArrayConstPtr>(pfield);
|
||||
ScalarArrayConstPtr pscalarArray = static_pointer_cast<const ScalarArray>(pfield);
|
||||
return createScalarArray(fieldName,pscalarArray->getElementType());
|
||||
}
|
||||
case structure: {
|
||||
StructureConstPtr pstructure = static_cast<StructureConstPtr>(pfield);
|
||||
StructureConstPtr pstructure = static_pointer_cast<const Structure>(pfield);
|
||||
return createStructure(fieldName,pstructure->getNumberFields(),pstructure->getFields());
|
||||
}
|
||||
case structureArray: {
|
||||
StructureArrayConstPtr pstructureArray = static_cast<StructureArrayConstPtr>(pfield);
|
||||
StructureArrayConstPtr pstructureArray = static_pointer_cast<const StructureArray>(pfield);
|
||||
return createStructureArray(fieldName,pstructureArray->getStructure());
|
||||
}
|
||||
}
|
||||
String message("field ");
|
||||
message += fieldName;
|
||||
throw std::logic_error(message);
|
||||
THROW_EXCEPTION2(std::logic_error, message);
|
||||
}
|
||||
|
||||
static FieldCreate* fieldCreate = 0;
|
||||
|
||||
@@ -13,12 +13,11 @@
|
||||
#include "pvData.h"
|
||||
#include "convert.h"
|
||||
#include "factory.h"
|
||||
#include "PVField.cpp"
|
||||
#include "PVScalar.cpp"
|
||||
#include "PVArray.cpp"
|
||||
#include "PVScalarArray.cpp"
|
||||
#include "PVStructure.cpp"
|
||||
#include "DefaultPVStructureArray.cpp"
|
||||
#include "serializeHelper.h"
|
||||
#include "DefaultPVStructureArray.h"
|
||||
|
||||
using std::tr1::static_pointer_cast;
|
||||
using std::tr1::const_pointer_cast;
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
@@ -417,17 +416,22 @@ PVField *PVDataCreate::createPVField(PVStructure *parent,
|
||||
FieldConstPtr field)
|
||||
{
|
||||
switch(field->getType()) {
|
||||
case scalar:
|
||||
return createPVScalar(parent,(ScalarConstPtr)field);
|
||||
case scalarArray:
|
||||
return (PVField *)createPVScalarArray(parent,
|
||||
(ScalarArrayConstPtr)field);
|
||||
case structure:
|
||||
return (PVField *)createPVStructure(parent,
|
||||
(StructureConstPtr)field);
|
||||
case structureArray:
|
||||
return createPVStructureArray(parent,
|
||||
(StructureArrayConstPtr)field);
|
||||
case scalar: {
|
||||
ScalarConstPtr xx = static_pointer_cast<const Scalar>(field);
|
||||
return createPVScalar(parent,xx);
|
||||
}
|
||||
case scalarArray: {
|
||||
ScalarArrayConstPtr xx = static_pointer_cast<const ScalarArray>(field);
|
||||
return (PVField *)createPVScalarArray(parent,xx);
|
||||
}
|
||||
case structure: {
|
||||
StructureConstPtr xx = static_pointer_cast<const Structure>(field);
|
||||
return (PVField *)createPVStructure(parent,xx);
|
||||
}
|
||||
case structureArray: {
|
||||
StructureArrayConstPtr xx = static_pointer_cast<const StructureArray>(field);
|
||||
return createPVStructureArray(parent,xx);
|
||||
}
|
||||
}
|
||||
String message("PVDataCreate::createPVField should never get here");
|
||||
throw std::logic_error(message);
|
||||
@@ -490,7 +494,6 @@ PVScalar *PVDataCreate::createPVScalar(PVStructure *parent,
|
||||
PVScalar *PVDataCreate::createPVScalar(PVStructure *parent,
|
||||
String fieldName,PVScalar * scalarToClone)
|
||||
{
|
||||
scalarToClone->getField()->incReferenceCount();
|
||||
PVScalar *pvScalar = createPVScalar(parent,fieldName,
|
||||
scalarToClone->getScalar()->getScalarType());
|
||||
convert->copyScalar(scalarToClone, pvScalar);
|
||||
@@ -542,7 +545,6 @@ PVScalarArray *PVDataCreate::createPVScalarArray(PVStructure *parent,
|
||||
PVScalarArray *PVDataCreate::createPVScalarArray(PVStructure *parent,
|
||||
String fieldName,PVScalarArray * arrayToClone)
|
||||
{
|
||||
arrayToClone->getField()->incReferenceCount();
|
||||
PVScalarArray *pvArray = createPVScalarArray(parent,fieldName,
|
||||
arrayToClone->getScalarArray()->getElementType());
|
||||
convert->copyScalarArray(arrayToClone,0, pvArray,0,arrayToClone->getLength());
|
||||
@@ -567,7 +569,7 @@ PVStructureArray *PVDataCreate::createPVStructureArray(PVStructure *parent,
|
||||
PVStructure *PVDataCreate::createPVStructure(PVStructure *parent,
|
||||
StructureConstPtr structure)
|
||||
{
|
||||
PVStructure *pvStructure = new BasePVStructure(parent,structure);
|
||||
PVStructure *pvStructure = new PVStructure(parent,structure);
|
||||
return pvStructure;
|
||||
}
|
||||
|
||||
@@ -576,7 +578,7 @@ PVStructure *PVDataCreate::createPVStructure(PVStructure *parent,
|
||||
{
|
||||
StructureConstPtr structure = fieldCreate->createStructure(
|
||||
fieldName,numberFields, fields);
|
||||
return new BasePVStructure(parent,structure);
|
||||
return new PVStructure(parent,structure);
|
||||
}
|
||||
|
||||
PVStructure *PVDataCreate::createPVStructure(PVStructure *parent,
|
||||
@@ -588,7 +590,7 @@ PVStructure *PVDataCreate::createPVStructure(PVStructure *parent,
|
||||
}
|
||||
StructureConstPtr structure = fieldCreate->createStructure(
|
||||
fieldName,numberFields,fields);
|
||||
PVStructure *pvStructure = new BasePVStructure(parent,structure,pvFields);
|
||||
PVStructure *pvStructure = new PVStructure(parent,structure,pvFields);
|
||||
return pvStructure;
|
||||
}
|
||||
|
||||
@@ -602,11 +604,10 @@ PVStructure *PVDataCreate::createPVStructure(PVStructure *parent,
|
||||
fields = new FieldConstPtr[0];
|
||||
StructureConstPtr structure = fieldCreate->createStructure(
|
||||
fieldName,numberFields,fields);
|
||||
pvStructure = new BasePVStructure(parent,structure);
|
||||
pvStructure = new PVStructure(parent,structure);
|
||||
} else {
|
||||
StructureConstPtr structure = structToClone->getStructure();
|
||||
structure->incReferenceCount();
|
||||
pvStructure = new BasePVStructure(parent,structure);
|
||||
pvStructure = new PVStructure(parent,structure);
|
||||
convert->copyStructure(structToClone,pvStructure);
|
||||
}
|
||||
return pvStructure;
|
||||
|
||||
@@ -11,8 +11,11 @@
|
||||
#include "lock.h"
|
||||
#include "pvData.h"
|
||||
#include "factory.h"
|
||||
#include "convert.h"
|
||||
#include "CDRMonitor.h"
|
||||
|
||||
using std::tr1::const_pointer_cast;
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
static String notImplemented("not implemented");
|
||||
@@ -44,7 +47,6 @@ PVFieldPvt::PVFieldPvt(PVStructure *parent,FieldConstPtr field)
|
||||
PVFieldPvt::~PVFieldPvt()
|
||||
{
|
||||
if(pvAuxInfo!=0) delete pvAuxInfo;
|
||||
if(parent==0) field->decReferenceCount();
|
||||
}
|
||||
|
||||
|
||||
@@ -148,7 +150,7 @@ bool PVField::renameField(String newName)
|
||||
int index = structure->getFieldIndex(newName);
|
||||
if(index>=0) return false;
|
||||
}
|
||||
Field * field = const_cast<Field *>(pImpl->field);
|
||||
Field::Ptr field(const_pointer_cast<Field>(pImpl->field));
|
||||
field->renameField(newName);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#include "pvData.h"
|
||||
#include "factory.h"
|
||||
|
||||
using std::tr1::static_pointer_cast;
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
PVScalar::~PVScalar() {}
|
||||
@@ -20,7 +22,7 @@ namespace epics { namespace pvData {
|
||||
|
||||
ScalarConstPtr PVScalar::getScalar()
|
||||
{
|
||||
return (ScalarConstPtr) PVField::getField();
|
||||
return static_pointer_cast<const Scalar>(PVField::getField());
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#include "pvData.h"
|
||||
#include "factory.h"
|
||||
|
||||
using std::tr1::static_pointer_cast;using std::tr1::static_pointer_cast;
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
PVScalarArray::~PVScalarArray() {}
|
||||
@@ -21,7 +23,7 @@ namespace epics { namespace pvData {
|
||||
|
||||
ScalarArrayConstPtr PVScalarArray::getScalarArray()
|
||||
{
|
||||
return (ScalarArrayConstPtr) PVField::getField();
|
||||
return static_pointer_cast<const ScalarArray>(PVField::getField());
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
@@ -9,9 +9,14 @@
|
||||
#include <string>
|
||||
#include <cstdio>
|
||||
#include "pvData.h"
|
||||
#include "pvIntrospect.h"
|
||||
#include "convert.h"
|
||||
#include "factory.h"
|
||||
#include "bitSet.h"
|
||||
|
||||
using std::tr1::static_pointer_cast;
|
||||
using std::tr1::const_pointer_cast;
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
class PVStructurePvt {
|
||||
@@ -49,30 +54,7 @@ namespace epics { namespace pvData {
|
||||
PVFieldPtrArray pvFields = pImpl->pvFields;
|
||||
PVDataCreate *pvDataCreate = getPVDataCreate();
|
||||
for(int i=0; i<numberFields; i++) {
|
||||
FieldConstPtr field = fields[i];
|
||||
switch(field->getType()) {
|
||||
case scalar: {
|
||||
ScalarConstPtr scalar = (ScalarConstPtr)field;
|
||||
pvFields[i] = pvDataCreate->createPVScalar(this,scalar);
|
||||
break;
|
||||
}
|
||||
case scalarArray: {
|
||||
ScalarArrayConstPtr array = (ScalarArrayConstPtr)field;
|
||||
pvFields[i] = pvDataCreate->createPVScalarArray(this,array);
|
||||
break;
|
||||
}
|
||||
case structure: {
|
||||
StructureConstPtr structPtr = (StructureConstPtr)field;
|
||||
pvFields[i] = pvDataCreate->createPVStructure(this, structPtr);
|
||||
break;
|
||||
}
|
||||
case structureArray: {
|
||||
StructureArrayConstPtr structArray = (StructureArrayConstPtr)field;
|
||||
pvFields[i] = pvDataCreate->createPVStructureArray(this,
|
||||
structArray);
|
||||
break;
|
||||
}
|
||||
}
|
||||
pvFields[i] = pvDataCreate->createPVField(this,fields[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +93,7 @@ namespace epics { namespace pvData {
|
||||
|
||||
StructureConstPtr PVStructure::getStructure()
|
||||
{
|
||||
return (StructureConstPtr)PVField::getField();
|
||||
return static_pointer_cast<const Structure>(PVField::getField());
|
||||
}
|
||||
|
||||
PVFieldPtrArray PVStructure::getPVFields()
|
||||
@@ -147,7 +129,7 @@ namespace epics { namespace pvData {
|
||||
|
||||
void PVStructure::appendPVField(PVFieldPtr pvField)
|
||||
{
|
||||
Structure *structure = const_cast<Structure *>(getStructure());
|
||||
Structure::Ptr structure = const_pointer_cast<Structure>(getStructure());
|
||||
structure->appendField(pvField->getField());
|
||||
int origLength = pImpl->numberFields;
|
||||
PVFieldPtrArray oldPVFields = pImpl->pvFields;
|
||||
@@ -164,7 +146,10 @@ namespace epics { namespace pvData {
|
||||
|
||||
void PVStructure::appendPVFields(int numberNewFields,PVFieldPtrArray pvFields)
|
||||
{
|
||||
Structure *structure = const_cast<Structure *>(getStructure());
|
||||
if (numberNewFields<0)
|
||||
throw std::logic_error("Number of fields must be >=0");
|
||||
|
||||
Structure::Ptr structure = const_pointer_cast<Structure>(getStructure());
|
||||
FieldConstPtr fields[numberNewFields];
|
||||
for(int i=0; i<numberNewFields; i++) fields[i] = pvFields[i]->getField();
|
||||
structure->appendFields(numberNewFields,fields);
|
||||
@@ -205,7 +190,7 @@ namespace epics { namespace pvData {
|
||||
newPVFields[newIndex++] = origPVFields[i];
|
||||
}
|
||||
}
|
||||
Structure *structure = const_cast<Structure *>(getStructure());
|
||||
Structure *structure = const_cast<Structure *>(getStructure().get());
|
||||
structure->removeField(indRemove);
|
||||
delete[] pImpl->pvFields;
|
||||
pImpl->pvFields = newPVFields;
|
||||
@@ -222,8 +207,9 @@ namespace epics { namespace pvData {
|
||||
return 0;
|
||||
}
|
||||
if(pvField->getField()->getType()==scalar) {
|
||||
ScalarConstPtr scalar = (ScalarConstPtr)pvField->getField();
|
||||
if(scalar->getScalarType()==pvBoolean) {
|
||||
ScalarConstPtr pscalar = static_pointer_cast<const Scalar>(
|
||||
pvField->getField());
|
||||
if(pscalar->getScalarType()==pvBoolean) {
|
||||
return (PVBoolean*)pvField;
|
||||
}
|
||||
}
|
||||
@@ -243,8 +229,9 @@ namespace epics { namespace pvData {
|
||||
return 0;
|
||||
}
|
||||
if(pvField->getField()->getType()==scalar) {
|
||||
ScalarConstPtr scalar = (ScalarConstPtr)pvField->getField();
|
||||
if(scalar->getScalarType()==pvByte) {
|
||||
ScalarConstPtr pscalar = static_pointer_cast<const Scalar>(
|
||||
pvField->getField());
|
||||
if(pscalar->getScalarType()==pvByte) {
|
||||
return (PVByte*)pvField;
|
||||
}
|
||||
}
|
||||
@@ -264,8 +251,9 @@ namespace epics { namespace pvData {
|
||||
return 0;
|
||||
}
|
||||
if(pvField->getField()->getType()==scalar) {
|
||||
ScalarConstPtr scalar = (ScalarConstPtr)pvField->getField();
|
||||
if(scalar->getScalarType()==pvShort) {
|
||||
ScalarConstPtr pscalar = static_pointer_cast<const Scalar>(
|
||||
pvField->getField());
|
||||
if(pscalar->getScalarType()==pvShort) {
|
||||
return (PVShort*)pvField;
|
||||
}
|
||||
}
|
||||
@@ -285,8 +273,9 @@ namespace epics { namespace pvData {
|
||||
return 0;
|
||||
}
|
||||
if(pvField->getField()->getType()==scalar) {
|
||||
ScalarConstPtr scalar = (ScalarConstPtr)pvField->getField();
|
||||
if(scalar->getScalarType()==pvInt) {
|
||||
ScalarConstPtr pscalar = static_pointer_cast<const Scalar>(
|
||||
pvField->getField());
|
||||
if(pscalar->getScalarType()==pvInt) {
|
||||
return (PVInt*)pvField;
|
||||
}
|
||||
}
|
||||
@@ -306,8 +295,9 @@ namespace epics { namespace pvData {
|
||||
return 0;
|
||||
}
|
||||
if(pvField->getField()->getType()==scalar) {
|
||||
ScalarConstPtr scalar = (ScalarConstPtr)pvField->getField();
|
||||
if(scalar->getScalarType()==pvLong) {
|
||||
ScalarConstPtr pscalar = static_pointer_cast<const Scalar>(
|
||||
pvField->getField());
|
||||
if(pscalar->getScalarType()==pvLong) {
|
||||
return (PVLong*)pvField;
|
||||
}
|
||||
}
|
||||
@@ -327,8 +317,9 @@ namespace epics { namespace pvData {
|
||||
return 0;
|
||||
}
|
||||
if(pvField->getField()->getType()==scalar) {
|
||||
ScalarConstPtr scalar = (ScalarConstPtr)pvField->getField();
|
||||
if(scalar->getScalarType()==pvFloat) {
|
||||
ScalarConstPtr pscalar = static_pointer_cast<const Scalar>(
|
||||
pvField->getField());
|
||||
if(pscalar->getScalarType()==pvFloat) {
|
||||
return (PVFloat*)pvField;
|
||||
}
|
||||
}
|
||||
@@ -348,8 +339,9 @@ namespace epics { namespace pvData {
|
||||
return 0;
|
||||
}
|
||||
if(pvField->getField()->getType()==scalar) {
|
||||
ScalarConstPtr scalar = (ScalarConstPtr)pvField->getField();
|
||||
if(scalar->getScalarType()==pvDouble) {
|
||||
ScalarConstPtr pscalar = static_pointer_cast<const Scalar>(
|
||||
pvField->getField());
|
||||
if(pscalar->getScalarType()==pvDouble) {
|
||||
return (PVDouble*)pvField;
|
||||
}
|
||||
}
|
||||
@@ -369,8 +361,9 @@ namespace epics { namespace pvData {
|
||||
return 0;
|
||||
}
|
||||
if(pvField->getField()->getType()==scalar) {
|
||||
ScalarConstPtr scalar = (ScalarConstPtr)pvField->getField();
|
||||
if(scalar->getScalarType()==pvString) {
|
||||
ScalarConstPtr pscalar = static_pointer_cast<const Scalar>(
|
||||
pvField->getField());
|
||||
if(pscalar->getScalarType()==pvString) {
|
||||
return (PVString*)pvField;
|
||||
}
|
||||
}
|
||||
@@ -416,8 +409,9 @@ namespace epics { namespace pvData {
|
||||
this->message(message, errorMessage);
|
||||
return 0;
|
||||
}
|
||||
ScalarArrayConstPtr array = (ScalarArrayConstPtr)field;
|
||||
if(array->getElementType()!=elementType) {
|
||||
ScalarArrayConstPtr pscalarArray
|
||||
= static_pointer_cast<const ScalarArray>(pvField->getField());
|
||||
if(pscalarArray->getElementType()!=elementType) {
|
||||
String message("fieldName ");
|
||||
message += fieldName + " is array but does not have elementType ";
|
||||
ScalarTypeFunc::toString(&message,elementType);
|
||||
@@ -579,22 +573,4 @@ namespace epics { namespace pvData {
|
||||
return findSubField(restOfName,(PVStructure*)pvField);
|
||||
}
|
||||
|
||||
class BasePVStructure : public PVStructure {
|
||||
public:
|
||||
BasePVStructure(PVStructure *parent,StructureConstPtr structure);
|
||||
BasePVStructure(PVStructure *parent,StructureConstPtr structure,
|
||||
PVFieldPtrArray pvFields);
|
||||
~BasePVStructure();
|
||||
private:
|
||||
};
|
||||
|
||||
BasePVStructure::BasePVStructure(PVStructure *parent,StructureConstPtr structure)
|
||||
: PVStructure(parent,structure) {}
|
||||
|
||||
BasePVStructure::BasePVStructure(PVStructure *parent,StructureConstPtr structure,
|
||||
PVFieldPtrArray pvFields)
|
||||
: PVStructure(parent,structure,pvFields) {}
|
||||
|
||||
BasePVStructure::~BasePVStructure() {}
|
||||
|
||||
}}
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "standardField.h"
|
||||
#include "CDRMonitor.h"
|
||||
|
||||
using std::tr1::static_pointer_cast;
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
static StandardField* standardField = 0;
|
||||
@@ -24,18 +26,18 @@ static String valueFieldName("value");
|
||||
|
||||
// following are preallocated structures
|
||||
|
||||
static StructureConstPtr alarmField = 0;
|
||||
static StructureConstPtr timeStampField = 0;
|
||||
static StructureConstPtr displayField = 0;
|
||||
static StructureConstPtr controlField = 0;
|
||||
static StructureConstPtr booleanAlarmField = 0;
|
||||
static StructureConstPtr byteAlarmField = 0;
|
||||
static StructureConstPtr shortAlarmField = 0;
|
||||
static StructureConstPtr intAlarmField = 0;
|
||||
static StructureConstPtr longAlarmField = 0;
|
||||
static StructureConstPtr floatAlarmField = 0;
|
||||
static StructureConstPtr doubleAlarmField = 0;
|
||||
static StructureConstPtr enumeratedAlarmField = 0;
|
||||
static StructureConstPtr alarmField;
|
||||
static StructureConstPtr timeStampField;
|
||||
static StructureConstPtr displayField;
|
||||
static StructureConstPtr controlField;
|
||||
static StructureConstPtr booleanAlarmField;
|
||||
static StructureConstPtr byteAlarmField;
|
||||
static StructureConstPtr shortAlarmField;
|
||||
static StructureConstPtr intAlarmField;
|
||||
static StructureConstPtr longAlarmField;
|
||||
static StructureConstPtr floatAlarmField;
|
||||
static StructureConstPtr doubleAlarmField;
|
||||
static StructureConstPtr enumeratedAlarmField;
|
||||
|
||||
|
||||
static void createAlarm() {
|
||||
@@ -200,11 +202,11 @@ static StructureConstPtr createProperties(String fieldName,FieldConstPtr field,S
|
||||
if(properties.find("display")!=String::npos) { gotDisplay = true; numProp++; }
|
||||
if(properties.find("control")!=String::npos) { gotControl = true; numProp++; }
|
||||
if(properties.find("valueAlarm")!=String::npos) { gotValueAlarm = true; numProp++; }
|
||||
StructureConstPtr valueAlarm = 0;
|
||||
StructureConstPtr valueAlarm;
|
||||
Type type= field->getType();
|
||||
while(gotValueAlarm) {
|
||||
if(type==scalar) {
|
||||
ScalarConstPtr scalar = (ScalarConstPtr)field;
|
||||
ScalarConstPtr scalar = static_pointer_cast<const Scalar>(field);
|
||||
ScalarType scalarType = scalar->getScalarType();
|
||||
switch(scalarType) {
|
||||
case pvBoolean: valueAlarm = booleanAlarmField; break;
|
||||
@@ -220,7 +222,7 @@ static StructureConstPtr createProperties(String fieldName,FieldConstPtr field,S
|
||||
break;
|
||||
}
|
||||
if(type==structure) {
|
||||
StructureConstPtr structurePtr = (StructureConstPtr)field;
|
||||
StructureConstPtr structurePtr = static_pointer_cast<const Structure>(field);
|
||||
if(structurePtr->getNumberFields()==2) {
|
||||
FieldConstPtrArray fields = structurePtr->getFields();
|
||||
FieldConstPtr first = fields[0];
|
||||
@@ -232,9 +234,9 @@ static StructureConstPtr createProperties(String fieldName,FieldConstPtr field,S
|
||||
if(compareFirst==0 && compareSecond==0) {
|
||||
if(first->getType()==scalar
|
||||
&& second->getType()==scalarArray) {
|
||||
ScalarConstPtr scalarFirst = (ScalarConstPtr)first;
|
||||
ScalarConstPtr scalarFirst = static_pointer_cast<const Scalar>(first);
|
||||
ScalarArrayConstPtr scalarArraySecond =
|
||||
(ScalarArrayConstPtr)second;
|
||||
static_pointer_cast<const ScalarArray>(second);
|
||||
if(scalarFirst->getScalarType()==pvInt
|
||||
&& scalarArraySecond->getElementType()==pvString) {
|
||||
valueAlarm = enumeratedAlarmField;
|
||||
@@ -250,11 +252,11 @@ static StructureConstPtr createProperties(String fieldName,FieldConstPtr field,S
|
||||
FieldConstPtrArray fields = new FieldConstPtr[numFields];
|
||||
int next = 0;
|
||||
fields[next++] = field;
|
||||
if(gotAlarm) {fields[next++] = alarmField; alarmField->incReferenceCount();}
|
||||
if(gotTimeStamp) {fields[next++] = timeStampField; timeStampField->incReferenceCount();}
|
||||
if(gotDisplay) {fields[next++] = displayField; displayField->incReferenceCount();}
|
||||
if(gotControl) {fields[next++] = controlField; controlField->incReferenceCount();}
|
||||
if(gotValueAlarm) {fields[next++] = valueAlarm; valueAlarm->incReferenceCount();}
|
||||
if(gotAlarm) {fields[next++] = alarmField;}
|
||||
if(gotTimeStamp) {fields[next++] = timeStampField;}
|
||||
if(gotDisplay) {fields[next++] = displayField;}
|
||||
if(gotControl) {fields[next++] = controlField;}
|
||||
if(gotValueAlarm) {fields[next++] = valueAlarm;}
|
||||
return fieldCreate->createStructure(fieldName,numFields,fields);
|
||||
}
|
||||
|
||||
@@ -464,42 +466,19 @@ StandardField::~StandardField(){
|
||||
|
||||
static void myDeleteStatic(void*)
|
||||
{
|
||||
int count = alarmField->getReferenceCount();
|
||||
if(count!=1) printf("~StandardField() alarmField reference count %d\n",count);
|
||||
alarmField->decReferenceCount();
|
||||
count = timeStampField->getReferenceCount();
|
||||
if(count!=1) printf("~StandardField() timeStampField reference count %d\n",count);
|
||||
timeStampField->decReferenceCount();
|
||||
count = displayField->getReferenceCount();
|
||||
if(count!=1) printf("~StandardField() displayField reference count %d\n",count);
|
||||
displayField->decReferenceCount();
|
||||
count = controlField->getReferenceCount();
|
||||
if(count!=1) printf("~StandardField() controlField reference count %d\n",count);
|
||||
controlField->decReferenceCount();
|
||||
count = booleanAlarmField->getReferenceCount();
|
||||
if(count!=1) printf("~StandardField() booleanAlarmField reference count %d\n",count);
|
||||
booleanAlarmField->decReferenceCount();
|
||||
count = byteAlarmField->getReferenceCount();
|
||||
if(count!=1) printf("~StandardField() byteAlarmField reference count %d\n",count);
|
||||
byteAlarmField->decReferenceCount();
|
||||
count = shortAlarmField->getReferenceCount();
|
||||
if(count!=1) printf("~StandardField() shortAlarmField reference count %d\n",count);
|
||||
shortAlarmField->decReferenceCount();
|
||||
count = intAlarmField->getReferenceCount();
|
||||
if(count!=1) printf("~StandardField() intAlarmField reference count %d\n",count);
|
||||
intAlarmField->decReferenceCount();
|
||||
count = longAlarmField->getReferenceCount();
|
||||
if(count!=1) printf("~StandardField() longAlarmField reference count %d\n",count);
|
||||
longAlarmField->decReferenceCount();
|
||||
count = floatAlarmField->getReferenceCount();
|
||||
if(count!=1) printf("~StandardField() floatAlarmField reference count %d\n",count);
|
||||
floatAlarmField->decReferenceCount();
|
||||
count = doubleAlarmField->getReferenceCount();
|
||||
if(count!=1) printf("~StandardField() doubleAlarmField reference count %d\n",count);
|
||||
doubleAlarmField->decReferenceCount();
|
||||
count = enumeratedAlarmField->getReferenceCount();
|
||||
if(count!=1) printf("~StandardField() enumeratedAlarmField reference count %d\n",count);
|
||||
enumeratedAlarmField->decReferenceCount();
|
||||
alarmField.reset();
|
||||
timeStampField.reset();
|
||||
displayField.reset();
|
||||
controlField.reset();
|
||||
booleanAlarmField.reset();
|
||||
byteAlarmField.reset();
|
||||
shortAlarmField.reset();
|
||||
intAlarmField.reset();
|
||||
longAlarmField.reset();
|
||||
floatAlarmField.reset();
|
||||
doubleAlarmField.reset();
|
||||
enumeratedAlarmField.reset();
|
||||
|
||||
}
|
||||
|
||||
static void myInitStatic(void*)
|
||||
|
||||
@@ -12,19 +12,21 @@
|
||||
#include "pvIntrospect.h"
|
||||
#include "epicsException.h"
|
||||
|
||||
#include "dbDefs.h" // for NELEMENTS
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
namespace TypeFunc {
|
||||
static const char* names[] = {
|
||||
"scalar", "scalarArray", "structure", "structureArray",
|
||||
};
|
||||
const char* name(Type t) {
|
||||
if (t<int(pvBoolean) || t>int(pvString))
|
||||
THROW_EXCEPTION2(std::invalid_argument, "logic error unknown Type");
|
||||
return names[t];
|
||||
}
|
||||
void toString(StringBuilder buf,const Type type) {
|
||||
static const String unknownString("logic error unknown Type");
|
||||
switch(type) {
|
||||
case scalar : *buf += "scalar"; break;
|
||||
case scalarArray : *buf += "scalarArray"; break;
|
||||
case structure : *buf += "structure"; break;
|
||||
case structureArray : *buf += "structureArray"; break;
|
||||
default:
|
||||
THROW_EXCEPTION2(std::invalid_argument, unknownString);
|
||||
}
|
||||
*buf += name(type);
|
||||
}
|
||||
} // namespace TypeFunc
|
||||
|
||||
@@ -44,32 +46,26 @@ namespace ScalarTypeFunc {
|
||||
if(type>=pvBoolean && type<=pvDouble) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
static const char* names[] = {
|
||||
"boolean", "byte", "short", "int", "long",
|
||||
"float", "double", "string",
|
||||
};
|
||||
ScalarType getScalarType(String pvalue) {
|
||||
static const String unknownString("error unknown ScalarType");
|
||||
if(pvalue == "boolean") return pvBoolean;
|
||||
if(pvalue == "byte") return pvByte;
|
||||
if(pvalue == "short") return pvShort;
|
||||
if(pvalue == "int") return pvInt;
|
||||
if(pvalue == "long") return pvLong;
|
||||
if(pvalue == "float") return pvFloat;
|
||||
if(pvalue == "double") return pvDouble;
|
||||
if(pvalue == "string") return pvString;
|
||||
THROW_EXCEPTION2(std::invalid_argument, unknownString);
|
||||
for(size_t i=0; i<NELEMENTS(names); i++)
|
||||
if(pvalue==names[i])
|
||||
return ScalarType(i);
|
||||
THROW_EXCEPTION2(std::invalid_argument, "error unknown ScalarType");
|
||||
}
|
||||
|
||||
const char* name(ScalarType t) {
|
||||
if (t<pvBoolean || t>pvString)
|
||||
THROW_EXCEPTION2(std::invalid_argument, "error unknown ScalarType");
|
||||
return names[t];
|
||||
}
|
||||
|
||||
void toString(StringBuilder buf,const ScalarType scalarType) {
|
||||
static const String unknownString("logic error unknown ScalarType");
|
||||
switch(scalarType) {
|
||||
case pvBoolean : *buf += "boolean"; return;
|
||||
case pvByte : *buf += "byte"; return;;
|
||||
case pvShort : *buf += "short"; return;
|
||||
case pvInt : *buf += "int"; return;
|
||||
case pvLong : *buf += "long"; return;
|
||||
case pvFloat : *buf += "float"; return;
|
||||
case pvDouble : *buf += "double"; return;
|
||||
case pvString : *buf += "string"; return;
|
||||
}
|
||||
THROW_EXCEPTION2(std::invalid_argument, unknownString);
|
||||
*buf += name(scalarType);
|
||||
}
|
||||
|
||||
} // namespace ScalarTypeFunc
|
||||
|
||||
@@ -231,7 +231,6 @@ public:
|
||||
SerializableControl *pflusher,BitSet *pbitSet) const;
|
||||
virtual void deserialize(ByteBuffer *pbuffer,
|
||||
DeserializableControl*pflusher,BitSet *pbitSet);
|
||||
protected:
|
||||
PVStructure(PVStructure *parent,StructureConstPtr structure);
|
||||
PVStructure(PVStructure *parent,StructureConstPtr structure,PVFieldPtrArray pvFields);
|
||||
private:
|
||||
|
||||
@@ -4,11 +4,13 @@
|
||||
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
*/
|
||||
#include <string>
|
||||
#include <stdexcept>
|
||||
#ifndef PVINTROSPECT_H
|
||||
#define PVINTROSPECT_H
|
||||
#include <string>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "noDefaultMethods.h"
|
||||
#include "sharedPtr.h"
|
||||
#include "pvType.h"
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
@@ -18,12 +20,12 @@ class ScalarArray;
|
||||
class Structure;
|
||||
class StructureArray;
|
||||
|
||||
typedef Field const * FieldConstPtr;
|
||||
typedef std::tr1::shared_ptr<const Field> FieldConstPtr;
|
||||
typedef FieldConstPtr * FieldConstPtrArray;
|
||||
typedef Scalar const * ScalarConstPtr;
|
||||
typedef ScalarArray const * ScalarArrayConstPtr;
|
||||
typedef Structure const * StructureConstPtr;
|
||||
typedef StructureArray const * StructureArrayConstPtr;
|
||||
typedef std::tr1::shared_ptr<const Scalar> ScalarConstPtr;
|
||||
typedef std::tr1::shared_ptr<const ScalarArray> ScalarArrayConstPtr;
|
||||
typedef std::tr1::shared_ptr<const Structure> StructureConstPtr;
|
||||
typedef std::tr1::shared_ptr<const StructureArray> StructureArrayConstPtr;
|
||||
|
||||
enum Type {
|
||||
scalar,
|
||||
@@ -33,6 +35,7 @@ enum Type {
|
||||
};
|
||||
|
||||
namespace TypeFunc {
|
||||
const char* name(Type);
|
||||
void toString(StringBuilder buf,const Type type);
|
||||
};
|
||||
|
||||
@@ -52,38 +55,45 @@ namespace ScalarTypeFunc {
|
||||
bool isNumeric(ScalarType type);
|
||||
bool isPrimitive(ScalarType type);
|
||||
ScalarType getScalarType(String value);
|
||||
const char* name(ScalarType);
|
||||
void toString(StringBuilder buf,ScalarType scalarType);
|
||||
};
|
||||
|
||||
class Field : private NoDefaultMethods {
|
||||
class Field : public std::tr1::enable_shared_from_this<Field> {
|
||||
public:
|
||||
int getReferenceCount() const;
|
||||
String getFieldName() const;
|
||||
Type getType() const;
|
||||
typedef std::tr1::shared_ptr<Field> Ptr;
|
||||
typedef std::tr1::shared_ptr<const Field> ConstPtr;
|
||||
|
||||
String getFieldName() const{return m_fieldName;}
|
||||
Type getType() const{return m_type;}
|
||||
virtual void toString(StringBuilder buf) const{toString(buf,0);}
|
||||
virtual void toString(StringBuilder buf,int indentLevel) const;
|
||||
void renameField(String newName);
|
||||
void incReferenceCount() const;
|
||||
void decReferenceCount() const;
|
||||
void dumpReferenceCount(StringBuilder buf,int indentLevel) const;
|
||||
virtual bool operator==(const Field& field) const;
|
||||
virtual bool operator!=(const Field& field) const;
|
||||
protected:
|
||||
Field(String fieldName,Type type);
|
||||
virtual ~Field();
|
||||
private:
|
||||
class FieldPvt *pImpl;
|
||||
String m_fieldName;
|
||||
Type m_type;
|
||||
|
||||
friend class StructureArray;
|
||||
friend class Structure;
|
||||
friend class PVFieldPvt;
|
||||
friend class StandardField;
|
||||
friend class BasePVStructureArray;
|
||||
friend class FieldCreate;
|
||||
|
||||
struct Deleter{void operator()(Field *p){delete p;}};
|
||||
};
|
||||
|
||||
|
||||
class Scalar : public Field{
|
||||
public:
|
||||
typedef std::tr1::shared_ptr<Scalar> Ptr;
|
||||
typedef std::tr1::shared_ptr<const Scalar> ConstPtr;
|
||||
typedef Scalar& reference;
|
||||
typedef const Scalar& const_reference;
|
||||
|
||||
ScalarType getScalarType() const {return scalarType;}
|
||||
virtual void toString(StringBuilder buf) const{toString(buf,0);}
|
||||
virtual void toString(StringBuilder buf,int indentLevel) const;
|
||||
@@ -97,6 +107,11 @@ private:
|
||||
|
||||
class ScalarArray : public Field{
|
||||
public:
|
||||
typedef std::tr1::shared_ptr<ScalarArray> Ptr;
|
||||
typedef std::tr1::shared_ptr<const ScalarArray> ConstPtr;
|
||||
typedef ScalarArray& reference;
|
||||
typedef const ScalarArray& const_reference;
|
||||
|
||||
ScalarType getElementType() const {return elementType;}
|
||||
virtual void toString(StringBuilder buf) const{toString(buf,0);}
|
||||
virtual void toString(StringBuilder buf,int indentLevel) const;
|
||||
@@ -110,9 +125,15 @@ private:
|
||||
|
||||
class StructureArray : public Field{
|
||||
public:
|
||||
typedef std::tr1::shared_ptr<StructureArray> Ptr;
|
||||
typedef std::tr1::shared_ptr<const StructureArray> ConstPtr;
|
||||
typedef StructureArray& reference;
|
||||
typedef const StructureArray& const_reference;
|
||||
|
||||
const Structure& structure() const {return *pstructure;}
|
||||
StructureConstPtr getStructure() const {return pstructure;}
|
||||
virtual void toString(StringBuilder buf) const{toString(buf,0);}
|
||||
virtual void toString(StringBuilder buf,int indentLevel) const;
|
||||
|
||||
virtual void toString(StringBuilder buf,int indentLevel=0) const;
|
||||
protected:
|
||||
StructureArray(String fieldName,StructureConstPtr structure);
|
||||
virtual ~StructureArray();
|
||||
@@ -123,6 +144,11 @@ private:
|
||||
|
||||
class Structure : public Field {
|
||||
public:
|
||||
typedef std::tr1::shared_ptr<Structure> Ptr;
|
||||
typedef std::tr1::shared_ptr<const Structure> ConstPtr;
|
||||
typedef Structure& reference;
|
||||
typedef const Structure& const_reference;
|
||||
|
||||
int getNumberFields() const {return numberFields;}
|
||||
FieldConstPtr getField(String fieldName) const;
|
||||
int getFieldIndex(String fieldName) const;
|
||||
|
||||
@@ -5,7 +5,7 @@ There is a logic_error
|
||||
On line 68 of ../testBaseException.cpp
|
||||
../bin/linux-x86/testBaseException[0x80497b9]
|
||||
../bin/linux-x86/testBaseException[0x8049a54]
|
||||
/lib/libc.so.6(__libc_start_main+0xe6)[0x3ede36]
|
||||
/lib/libc.so.6(__libc_start_main+0xe6)[0x126e36]
|
||||
../bin/linux-x86/testBaseException[0x80490e1]
|
||||
To translate run 'addr2line -e execname 0xXXXXXXX ...'
|
||||
Note: Must be compiled with debug symbols
|
||||
@@ -17,7 +17,7 @@ On line 75 of ../testBaseException.cpp
|
||||
../bin/linux-x86/testBaseException() [0x8049cec]
|
||||
../bin/linux-x86/testBaseException() [0x8049923]
|
||||
../bin/linux-x86/testBaseException() [0x8049a54]
|
||||
/lib/libc.so.6(__libc_start_main+0xe6) [0x3ede36]
|
||||
/lib/libc.so.6(__libc_start_main+0xe6) [0x126e36]
|
||||
../bin/linux-x86/testBaseException() [0x80490e1]
|
||||
|
||||
testBaseException...
|
||||
@@ -26,7 +26,7 @@ all is OK
|
||||
On line 48 of ../testBaseException.cpp
|
||||
../bin/linux-x86/testBaseException() [0x8049581]
|
||||
../bin/linux-x86/testBaseException() [0x8049a5c]
|
||||
/lib/libc.so.6(__libc_start_main+0xe6) [0x3ede36]
|
||||
/lib/libc.so.6(__libc_start_main+0xe6) [0x126e36]
|
||||
../bin/linux-x86/testBaseException() [0x80490e1]
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ On line 57 of ../testBaseException.cpp
|
||||
../bin/linux-x86/testBaseException() [0x80491ec]
|
||||
../bin/linux-x86/testBaseException() [0x80496f9]
|
||||
../bin/linux-x86/testBaseException() [0x8049a5c]
|
||||
/lib/libc.so.6(__libc_start_main+0xe6) [0x3ede36]
|
||||
/lib/libc.so.6(__libc_start_main+0xe6) [0x126e36]
|
||||
../bin/linux-x86/testBaseException() [0x80490e1]
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
--- testBaseExceptionGold 2011-02-10 04:39:30.000000000 -0500
|
||||
+++ testBaseException 2011-04-15 14:18:40.000000000 -0400
|
||||
+++ testBaseException 2011-04-21 10:00:27.000000000 -0400
|
||||
@@ -1,37 +1,46 @@
|
||||
+
|
||||
+
|
||||
@@ -8,7 +8,7 @@
|
||||
+On line 68 of ../testBaseException.cpp
|
||||
+../bin/linux-x86/testBaseException[0x80497b9]
|
||||
+../bin/linux-x86/testBaseException[0x8049a54]
|
||||
+/lib/libc.so.6(__libc_start_main+0xe6)[0x3ede36]
|
||||
+/lib/libc.so.6(__libc_start_main+0xe6)[0x126e36]
|
||||
+../bin/linux-x86/testBaseException[0x80490e1]
|
||||
+To translate run 'addr2line -e execname 0xXXXXXXX ...'
|
||||
+ Note: Must be compiled with debug symbols
|
||||
@@ -20,7 +20,7 @@
|
||||
+../bin/linux-x86/testBaseException() [0x8049cec]
|
||||
+../bin/linux-x86/testBaseException() [0x8049923]
|
||||
+../bin/linux-x86/testBaseException() [0x8049a54]
|
||||
+/lib/libc.so.6(__libc_start_main+0xe6) [0x3ede36]
|
||||
+/lib/libc.so.6(__libc_start_main+0xe6) [0x126e36]
|
||||
+../bin/linux-x86/testBaseException() [0x80490e1]
|
||||
+
|
||||
testBaseException...
|
||||
@@ -34,7 +34,7 @@
|
||||
+On line 48 of ../testBaseException.cpp
|
||||
+../bin/linux-x86/testBaseException() [0x8049581]
|
||||
+../bin/linux-x86/testBaseException() [0x8049a5c]
|
||||
+/lib/libc.so.6(__libc_start_main+0xe6) [0x3ede36]
|
||||
+/lib/libc.so.6(__libc_start_main+0xe6) [0x126e36]
|
||||
+../bin/linux-x86/testBaseException() [0x80490e1]
|
||||
+
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
+../bin/linux-x86/testBaseException() [0x80491ec]
|
||||
+../bin/linux-x86/testBaseException() [0x80496f9]
|
||||
+../bin/linux-x86/testBaseException() [0x8049a5c]
|
||||
+/lib/libc.so.6(__libc_start_main+0xe6) [0x3ede36]
|
||||
+/lib/libc.so.6(__libc_start_main+0xe6) [0x126e36]
|
||||
+../bin/linux-x86/testBaseException() [0x80490e1]
|
||||
+
|
||||
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
|
||||
Time test
|
||||
diff 29.094910 milliSeconds
|
||||
time per iteration 29.094910 microseconds
|
||||
time per addTail/removeHead 0.014547 microseconds
|
||||
diff 23.497236 milliSeconds
|
||||
time per iteration 23.497236 microseconds
|
||||
time per addTail/removeHead 0.011749 microseconds
|
||||
|
||||
Time test locked
|
||||
diff 205.944899 milliSeconds
|
||||
time per iteration 205.944899 microseconds
|
||||
time per addTail/removeHead 0.102972 microseconds
|
||||
diff 206.570083 milliSeconds
|
||||
time per iteration 206.570083 microseconds
|
||||
time per addTail/removeHead 0.103285 microseconds
|
||||
|
||||
Time std::list test
|
||||
diff 656.960080 milliSeconds
|
||||
time per iteration 656.960080 microseconds
|
||||
time per addTail/removeHead 0.328480 microseconds
|
||||
diff 632.330525 milliSeconds
|
||||
time per iteration 632.330525 microseconds
|
||||
time per addTail/removeHead 0.316165 microseconds
|
||||
|
||||
Time std::list test locked
|
||||
diff 824.135585 milliSeconds
|
||||
time per iteration 824.135585 microseconds
|
||||
time per addTail/removeHead 0.412068 microseconds
|
||||
diff 783.256490 milliSeconds
|
||||
time per iteration 783.256490 microseconds
|
||||
time per addTail/removeHead 0.391628 microseconds
|
||||
|
||||
@@ -29,4 +29,4 @@ structure parent
|
||||
structure child2
|
||||
string Jane Bad Girl
|
||||
pvField: totalConstruct 15 totalDestruct 14 ACTIVE 1
|
||||
field: totalConstruct 108 totalDestruct 108
|
||||
field: totalConstruct 108 totalDestruct 107 ACTIVE 1
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
--- testPVAppendGold 2011-02-09 05:21:30.000000000 -0500
|
||||
+++ testPVAppend 2011-04-21 10:00:32.000000000 -0400
|
||||
@@ -29,4 +29,4 @@
|
||||
structure child2
|
||||
string Jane Bad Girl
|
||||
pvField: totalConstruct 15 totalDestruct 14 ACTIVE 1
|
||||
-field: totalConstruct 108 totalDestruct 108
|
||||
+field: totalConstruct 108 totalDestruct 107 ACTIVE 1
|
||||
|
||||
@@ -1 +1 @@
|
||||
2011.04.15 14:18:47 873020611 nanoSeconds isDst true
|
||||
2011.04.21 10:00:33 929776649 nanoSeconds isDst true
|
||||
|
||||
@@ -1 +1 @@
|
||||
time per call 0.007050 microseconds
|
||||
time per call 0.007064 microseconds
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
current 1302891526 884416778 milliSec 1302891526884
|
||||
2011.04.15 14:18:46 884416778 nanoSeconds isDst true
|
||||
current 1303394433 13269031 milliSec 1303394433013
|
||||
2011.04.21 10:00:33 13269031 nanoSeconds isDst true
|
||||
fromTime_t
|
||||
current 1302891526 0 milliSec 1302891526000
|
||||
2011.04.15 14:18:46 0 nanoSeconds isDst true
|
||||
current 1303394433 0 milliSec 1303394433000
|
||||
2011.04.21 10:00:33 0 nanoSeconds isDst true
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
one requested 0.400000 diff 0.400361 seconds
|
||||
two requested 0.200000 diff 0.200302 seconds
|
||||
one requested 0.200000 diff 0.200290 seconds
|
||||
two requested 0.400000 diff 0.400346 seconds
|
||||
one requested 0.000000 diff 0.000041 seconds
|
||||
two requested 0.000000 diff 0.000060 seconds
|
||||
one requested 0.400000 diff 0.400193 seconds
|
||||
two requested 0.200000 diff 0.200190 seconds
|
||||
one requested 0.200000 diff 0.200333 seconds
|
||||
two requested 0.400000 diff 0.400372 seconds
|
||||
one requested 0.000000 diff 0.000034 seconds
|
||||
two requested 0.000000 diff 0.000050 seconds
|
||||
|
||||
@@ -85,7 +85,6 @@ void serializationTest(PVField* field) {
|
||||
buffer->flip();
|
||||
|
||||
// create new instance and deserialize
|
||||
field->getField()->incReferenceCount();
|
||||
PVField* deserializedField = getPVDataCreate()->createPVField(NULL,
|
||||
field->getField());
|
||||
deserializedField->deserialize(buffer, control);
|
||||
@@ -420,7 +419,6 @@ void testScalarEquals(std::ostream& ofile) {
|
||||
fields);
|
||||
|
||||
PVStructure* pvStruct1 = factory->createPVStructure(NULL, structure);
|
||||
structure->incReferenceCount();
|
||||
PVStructure* pvStruct2 = factory->createPVStructure(NULL, structure);
|
||||
assert((*pvStruct1)==(*pvStruct2));
|
||||
delete pvStruct2;
|
||||
|
||||
@@ -130,7 +130,6 @@ static void testStructureArray(FILE * fd) {
|
||||
builder.clear();
|
||||
top->toString(&builder);
|
||||
fprintf(fd,"%s\n",builder.c_str());
|
||||
top->decReferenceCount();
|
||||
}
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
|
||||
Reference in New Issue
Block a user