Use "String const &" in many more places

This commit is contained in:
Marty Kraimer
2012-08-20 09:16:43 -04:00
parent 9061e8f731
commit 8f3a1dde34
15 changed files with 156 additions and 130 deletions

View File

@@ -38,7 +38,7 @@
<h1>EPICS pvDataCPP</h1>
<!-- Maturity: Working Draft or Request for Comments, or Recommendation, and date. -->
<h2 class="nocount">EPICS v4 Working Group, Working Draft, 17-Aug-2012</h2>
<h2 class="nocount">EPICS v4 Working Group, Working Draft, 20-Aug-2012</h2>
<dl>
<dt>This version:</dt>
<dd><a
@@ -83,7 +83,7 @@ Control System.</a></p>
<h2 class="nocount">Status of this Document</h2>
<p>This is the 17-Aug-2012 version of the C++ implementation of pvData. It is a
<p>This is the 20-Aug-2012 version of the C++ implementation of pvData. It is a
complete implementation of pvData as currently defined. </p>
<h2 class="nocount">TODO</h2>
@@ -284,8 +284,7 @@ inline ByteArray const &amp; getVector(ByteArrayPtr const &amp;value);
typedef std::vector&lt;int8&gt;::iterator ByteArray_iterator;
typedef std::vector&lt;int8&gt;::const_iterator ByteArray_const_iterator;
/* similar definitions are present for ALL the primitive types */
</pre>
/* similar definitions are present for ALL the primitive types */</pre>
<p>where</p>
<dl>
@@ -363,7 +362,7 @@ public:
bool isUInteger(ScalarType type);
bool isNumeric(ScalarType type);
bool isPrimitive(ScalarType type);
ScalarType getScalarType(String value);
ScalarType getScalarType(String const &amp;value);
const char* name(ScalarType);
void toString(StringBuilder buf,ScalarType scalarType);
};</pre>
@@ -554,7 +553,7 @@ public:
std::size_t getFieldIndex(String const &amp;fieldName) const;
FieldConstPtrArray const &amp; getFields() const {return fields;}
StringArray const &amp; getFieldNames() const;
void renameField(std::size_t fieldIndex,String newName);
void renameField(std::size_t fieldIndex,String const &amp;newName);
String getFieldName(std::size_t fieldIndex);
virtual void toString(StringBuilder buf,int indentLevel) const;
virtual String getID() const;
@@ -573,12 +572,12 @@ public:
StringArray const &amp; fieldNames,
FieldConstPtrArray const &amp; fields) const;
StructureConstPtr createStructure (
String id,
String const &amp;id,
StringArray const &amp; fieldNames,
FieldConstPtrArray const &amp; fields) const;
StructureConstPtr appendField(
StructureConstPtr const &amp; structure,
String fieldName, FieldConstPtr const &amp; field) const;
String const &amp;fieldName, FieldConstPtr const &amp; field) const;
StructureConstPtr appendFields(
StructureConstPtr const &amp; structure,
StringArray const &amp; fieldNames,
@@ -716,13 +715,13 @@ class StandardField {
public:
static StandardFieldPtr getStandardField();
~StandardField();
StructureConstPtr scalar(ScalarType type,String properties);
StructureConstPtr scalar(ScalarType type,String const &amp;properties);
StructureConstPtr scalarArray(
ScalarType elementType, String properties);
ScalarType elementType, String const &amp;properties);
StructureConstPtr structureArray(
StructureConstPtr const &amp; structure,String properties);
StructureConstPtr const &amp; structure,String const &amp;properties);
StructureConstPtr enumerated();
StructureConstPtr enumerated(String properties);
StructureConstPtr enumerated(String const &amp;properties);
StructureConstPtr alarm();
StructureConstPtr timeStamp();
StructureConstPtr display();
@@ -861,7 +860,7 @@ public:
const FieldConstPtr &amp; getField() const ;
PVStructure * getParent() const
void replacePVField(const PVFieldPtr&amp; newPVField);
void renameField(String newName);
void renameField(String const &amp;newName);
void postPut() ;
void setPostHandler(PostHandlerPtr const &amp;postHandler);
virtual bool equals(PVField &amp;pv);
@@ -950,8 +949,8 @@ public:
PVAuxInfo(PVField *pvField);
~PVAuxInfo();
PVField * getPVField();
PVScalarPtr createInfo(String key,ScalarType scalarType);
PVScalarPtr getInfo(String key);
PVScalarPtr createInfo(String const &amp;key,ScalarType scalarType);
PVScalarPtr getInfo(String const &amp;key);
PVInfoMap &amp; getInfoMap();
void toString(StringBuilder buf);
void toString(StringBuilder buf,int indentLevel);
@@ -1296,34 +1295,34 @@ public:
virtual void setImmutable();
StructureConstPtr getStructure() const;
const PVFieldPtrArray &amp; getPVFields() const;
PVFieldPtr getSubField(String fieldName) const;
PVFieldPtr getSubField(String const &amp;fieldName) const;
PVFieldPtr getSubField(std::size_t fieldOffset) const;
void appendPVField(
String fieldName,
String const &amp;fieldName,
PVFieldPtr const &amp; pvField);
void appendPVFields(
StringArray const &amp; fieldNames,
PVFieldPtrArray const &amp; pvFields);
void removePVField(String fieldName);
PVBooleanPtr getBooleanField(String fieldName) ;
PVBytePtr getByteField(String fieldName) ;
PVShortPtr getShortField(String fieldName) ;
PVIntPtr getIntField(String fieldName) ;
PVLongPtr getLongField(String fieldName) ;
PVUBytePtr getUByteField(String fieldName) ;
PVUShortPtr getUShortField(String fieldName) ;
PVUIntPtr getUIntField(String fieldName) ;
PVULongPtr getULongField(String fieldName) ;
PVFloatPtr getFloatField(String fieldName) ;
PVDoublePtr getDoubleField(String fieldName) ;
PVStringPtr getStringField(String fieldName) ;
PVStructurePtr getStructureField(String fieldName) ;
void removePVField(String const &amp;fieldName);
PVBooleanPtr getBooleanField(String const &amp;fieldName) ;
PVBytePtr getByteField(String const &amp;fieldName) ;
PVShortPtr getShortField(String const &amp;fieldName) ;
PVIntPtr getIntField(String const &amp;fieldName) ;
PVLongPtr getLongField(String const &amp;fieldName) ;
PVUBytePtr getUByteField(String const &amp;fieldName) ;
PVUShortPtr getUShortField(String const &amp;fieldName) ;
PVUIntPtr getUIntField(String const &amp;fieldName) ;
PVULongPtr getULongField(String const &amp;fieldName) ;
PVFloatPtr getFloatField(String const &amp;fieldName) ;
PVDoublePtr getDoubleField(String const &amp;fieldName) ;
PVStringPtr getStringField(String const &amp;fieldName) ;
PVStructurePtr getStructureField(String const &amp;fieldName) ;
PVScalarArrayPtr getScalarArrayField(
String fieldName,ScalarType elementType) ;
PVStructureArrayPtr getStructureArrayField(String fieldName) ;
String const &amp;fieldName,ScalarType elementType) ;
PVStructureArrayPtr getStructureArrayField(String const &amp;fieldName) ;
String getExtendsStructureName() const;
bool putExtendsStructureName(
String extendsStructureName);
String const &amp;extendsStructureName);
virtual void serialize(
ByteBuffer *pbuffer,SerializableControl *pflusher) const ;
virtual void deserialize(
@@ -1573,11 +1572,11 @@ class StandardPVField : private NoDefaultMethods {
public:
static StandardPVFieldPtr getStandardPVField();
~StandardPVField();
PVStructurePtr scalar(ScalarType type,String properties);
PVStructurePtr scalarArray(ScalarType elementType, String properties);
PVStructurePtr structureArray(StructureConstPtr const &amp;structure,String properties);
PVStructurePtr scalar(ScalarType type,String const &amp;properties);
PVStructurePtr scalarArray(ScalarType elementType, String const &amp;properties);
PVStructurePtr structureArray(StructureConstPtr const &amp;structure,String const &amp;properties);
PVStructurePtr enumerated(StringArray const &amp;choices);
PVStructurePtr enumerated(StringArray const &amp;choices, String properties);
PVStructurePtr enumerated(StringArray const &amp;choices, String const &amp;properties);
...
}
@@ -1657,8 +1656,8 @@ public:
PVStructurePtr const &amp;pv,
StringArray const &amp; from,
std::size_t fromStartIndex = 0);
void fromString(PVScalarPtr const &amp; pv, String from);
std::size_t fromString(PVScalarArrayPtr const &amp; pv, String from);
void fromString(PVScalarPtr const &amp; pv, String const &amp; from);
std::size_t fromString(PVScalarArrayPtr const &amp; pv, String const &amp;from);
std::size_t fromStringArray(
PVScalarArrayPtr const &amp; pv,
std::size_t offset, std::size_t length,
@@ -2231,7 +2230,7 @@ public:
Alarm();
//default constructors and destructor are OK
String getMessage();
void setMessage(String value);
void setMessage(String const &amp;value);
AlarmSeverity getSeverity() const;
void setSeverity(AlarmSeverity value);
AlarmStatus getStatus() const;
@@ -2430,11 +2429,11 @@ public:
void setLow(double value);
void setHigh(double value);
String getDescription() const;
void setDescription(String value);
void setDescription(String const &amp;value);
String getFormat() const;
void setFormat(String value);
void setFormat(String const &amp;value);
String getUnits() const;
void setUnits(String value);
void setUnits(String const &amp;value);
};</pre>
<p>where</p>

View File

@@ -499,7 +499,7 @@ size_t Convert::fromString(PVStructurePtr const &pvStructure, StringArray const
}
void Convert::fromString(PVScalarPtr const &pvScalar, String from)
void Convert::fromString(PVScalarPtr const &pvScalar, String const & from)
{
ScalarConstPtr scalar = pvScalar->getScalar();
ScalarType scalarType = scalar->getScalarType();

View File

@@ -213,7 +213,10 @@ void StructureArray::deserialize(ByteBuffer *buffer, DeserializableControl *cont
throw std::runtime_error("not valid operation, use FieldCreate::deserialize instead");
}
Structure::Structure (StringArray const & fieldNames,FieldConstPtrArray const & infields, String inid)
Structure::Structure (
StringArray const & fieldNames,
FieldConstPtrArray const & infields,
String const & inid)
: Field(structure),
fieldNames(fieldNames),
fields(infields),
@@ -333,7 +336,9 @@ StructureConstPtr FieldCreate::createStructure (
}
StructureConstPtr FieldCreate::createStructure (
String id, StringArray const & fieldNames,FieldConstPtrArray const & fields) const
String const & id,
StringArray const & fieldNames,
FieldConstPtrArray const & fields) const
{
StructureConstPtr structure(
new Structure(fieldNames,fields,id), Field::Deleter());
@@ -349,7 +354,9 @@ StructureArrayConstPtr FieldCreate::createStructureArray(
}
StructureConstPtr FieldCreate::appendField(
StructureConstPtr const & structure,String fieldName, FieldConstPtr const & field) const
StructureConstPtr const & structure,
String const & fieldName,
FieldConstPtr const & field) const
{
StringArray oldNames = structure->getFieldNames();
FieldConstPtrArray oldFields = structure->getFields();

View File

@@ -35,7 +35,7 @@ PVField * PVAuxInfo::getPVField() {
}
PVScalarPtr PVAuxInfo::createInfo(String key,ScalarType scalarType)
PVScalarPtr PVAuxInfo::createInfo(String const & key,ScalarType scalarType)
{
PVInfoIter iter = pvInfos.find(key);
if(iter!=pvInfos.end()) {
@@ -49,7 +49,7 @@ PVScalarPtr PVAuxInfo::createInfo(String key,ScalarType scalarType)
return pvScalar;
}
PVScalarPtr PVAuxInfo::getInfo(String key)
PVScalarPtr PVAuxInfo::getInfo(String const & key)
{
PVInfoIter iter;
iter = pvInfos.find(key);

View File

@@ -32,7 +32,10 @@ PVField::PVField(FieldConstPtr field)
PVField::~PVField()
{ }
void PVField::message(String message,MessageType messageType,String fullFieldName)
void PVField::message(
String message,
MessageType messageType,
String fullFieldName)
{
if(parent!=NULL) {
if(fullFieldName.length()>0) {
@@ -133,7 +136,7 @@ void PVField::replaceField(FieldConstPtr &xxx)
field = xxx;
}
void PVField::renameField(String newName)
void PVField::renameField(String const & newName)
{
if(parent==NULL) {
throw std::logic_error("no parent");
@@ -167,7 +170,7 @@ void PVField::setPostHandler(PostHandlerPtr const &handler)
postHandler = handler;
}
void PVField::setParentAndName(PVStructure * xxx,String & name)
void PVField::setParentAndName(PVStructure * xxx,String const & name)
{
parent = xxx;
fieldName = name;

View File

@@ -37,7 +37,9 @@ static PVStructurePtr nullPVStructure;
static PVStructureArrayPtr nullPVStructureArray;
static PVScalarArrayPtr nullPVScalarArray;
static PVFieldPtr findSubField(String fieldName,const PVStructure *pvStructure);
static PVFieldPtr findSubField(
String const &fieldName,
const PVStructure *pvStructure);
PVStructure::PVStructure(StructureConstPtr const & structurePtr)
: PVField(structurePtr),
@@ -102,7 +104,7 @@ const PVFieldPtrArray & PVStructure::getPVFields() const
return pvFields;
}
PVFieldPtr PVStructure::getSubField(String fieldName) const
PVFieldPtr PVStructure::getSubField(String const &fieldName) const
{
return findSubField(fieldName,this);
}
@@ -127,13 +129,16 @@ PVFieldPtr PVStructure::getSubField(size_t fieldOffset) const
throw std::logic_error("PVStructure.getSubField: Logic error");
}
void PVStructure::appendPVField(String fieldName, PVFieldPtr const & pvField)
void PVStructure::appendPVField(
String const &fieldName,
PVFieldPtr const & pvField)
{
size_t origLength = pvFields.size();
size_t newLength = origLength+1;
PVFieldPtrArray * xxx = const_cast<PVFieldPtrArray *>(&pvFields);
xxx->push_back(pvField);
FieldConstPtr field = getFieldCreate()->appendField(structurePtr,fieldName,pvField->getField());
FieldConstPtr field = getFieldCreate()->appendField(
structurePtr,fieldName,pvField->getField());
replaceField(field);
structurePtr = static_pointer_cast<const Structure>(field);
StringArray fieldNames = structurePtr->getFieldNames();
@@ -142,7 +147,9 @@ void PVStructure::appendPVField(String fieldName, PVFieldPtr const & pvField)
}
}
void PVStructure::appendPVFields(StringArray const & fieldNames, PVFieldPtrArray const & pvFields)
void PVStructure::appendPVFields(
StringArray const & fieldNames,
PVFieldPtrArray const & pvFields)
{
size_t origLength = this->pvFields.size();
size_t extra = fieldNames.size();
@@ -156,7 +163,8 @@ void PVStructure::appendPVFields(StringArray const & fieldNames, PVFieldPtrArray
FieldConstPtrArray fields;
fields.reserve(extra);
for(size_t i=0; i<extra; i++) fields.push_back(pvFields[i]->getField());
FieldConstPtr field = getFieldCreate()->appendFields(structurePtr,fieldNames,fields);
FieldConstPtr field = getFieldCreate()->appendFields(
structurePtr,fieldNames,fields);
replaceField(field);
structurePtr = static_pointer_cast<const Structure>(field);
StringArray names = structurePtr->getFieldNames();
@@ -165,7 +173,7 @@ void PVStructure::appendPVFields(StringArray const & fieldNames, PVFieldPtrArray
}
}
void PVStructure::removePVField(String fieldName)
void PVStructure::removePVField(String const &fieldName)
{
PVFieldPtr pvField = getSubField(fieldName);
if(pvField.get()==NULL) {
@@ -193,7 +201,8 @@ void PVStructure::removePVField(String fieldName)
}
PVFieldPtrArray * xxx = const_cast<PVFieldPtrArray *>(&pvFields);
xxx->swap(newPVFields);
FieldConstPtr field = getFieldCreate()->createStructure(structurePtr->getID(),newFieldNames,fields);
FieldConstPtr field = getFieldCreate()->createStructure(
structurePtr->getID(),newFieldNames,fields);
replaceField(field);
structurePtr = static_pointer_cast<const Structure>(field);
StringArray fieldNames = structurePtr->getFieldNames();
@@ -202,7 +211,7 @@ void PVStructure::removePVField(String fieldName)
}
}
PVBooleanPtr PVStructure::getBooleanField(String fieldName)
PVBooleanPtr PVStructure::getBooleanField(String const &fieldName)
{
PVFieldPtr pvField = findSubField(fieldName,this);
if(pvField.get()==NULL) {
@@ -224,7 +233,7 @@ PVBooleanPtr PVStructure::getBooleanField(String fieldName)
return nullPVBoolean;
}
PVBytePtr PVStructure::getByteField(String fieldName)
PVBytePtr PVStructure::getByteField(String const &fieldName)
{
PVFieldPtr pvField = findSubField(fieldName,this);
if(pvField.get()==NULL) {
@@ -246,7 +255,7 @@ PVBytePtr PVStructure::getByteField(String fieldName)
return nullPVByte;
}
PVShortPtr PVStructure::getShortField(String fieldName)
PVShortPtr PVStructure::getShortField(String const &fieldName)
{
PVFieldPtr pvField = findSubField(fieldName,this);
if(pvField.get()==NULL) {
@@ -268,7 +277,7 @@ PVShortPtr PVStructure::getShortField(String fieldName)
return nullPVShort;
}
PVIntPtr PVStructure::getIntField(String fieldName)
PVIntPtr PVStructure::getIntField(String const &fieldName)
{
PVFieldPtr pvField = findSubField(fieldName,this);
if(pvField.get()==NULL) {
@@ -290,7 +299,7 @@ PVIntPtr PVStructure::getIntField(String fieldName)
return nullPVInt;
}
PVLongPtr PVStructure::getLongField(String fieldName)
PVLongPtr PVStructure::getLongField(String const &fieldName)
{
PVFieldPtr pvField = findSubField(fieldName,this);
if(pvField.get()==NULL) {
@@ -312,7 +321,7 @@ PVLongPtr PVStructure::getLongField(String fieldName)
return nullPVLong;
}
PVUBytePtr PVStructure::getUByteField(String fieldName)
PVUBytePtr PVStructure::getUByteField(String const &fieldName)
{
PVFieldPtr pvField = findSubField(fieldName,this);
if(pvField.get()==NULL) {
@@ -334,7 +343,7 @@ PVUBytePtr PVStructure::getUByteField(String fieldName)
return nullPVUByte;
}
PVUShortPtr PVStructure::getUShortField(String fieldName)
PVUShortPtr PVStructure::getUShortField(String const &fieldName)
{
PVFieldPtr pvField = findSubField(fieldName,this);
if(pvField.get()==NULL) {
@@ -356,7 +365,7 @@ PVUShortPtr PVStructure::getUShortField(String fieldName)
return nullPVUShort;
}
PVUIntPtr PVStructure::getUIntField(String fieldName)
PVUIntPtr PVStructure::getUIntField(String const &fieldName)
{
PVFieldPtr pvField = findSubField(fieldName,this);
if(pvField.get()==NULL) {
@@ -378,7 +387,7 @@ PVUIntPtr PVStructure::getUIntField(String fieldName)
return nullPVUInt;
}
PVULongPtr PVStructure::getULongField(String fieldName)
PVULongPtr PVStructure::getULongField(String const &fieldName)
{
PVFieldPtr pvField = findSubField(fieldName,this);
if(pvField.get()==NULL) {
@@ -400,7 +409,7 @@ PVULongPtr PVStructure::getULongField(String fieldName)
return nullPVULong;
}
PVFloatPtr PVStructure::getFloatField(String fieldName)
PVFloatPtr PVStructure::getFloatField(String const &fieldName)
{
PVFieldPtr pvField = findSubField(fieldName,this);
if(pvField.get()==NULL) {
@@ -422,7 +431,7 @@ PVFloatPtr PVStructure::getFloatField(String fieldName)
return nullPVFloat;
}
PVDoublePtr PVStructure::getDoubleField(String fieldName)
PVDoublePtr PVStructure::getDoubleField(String const &fieldName)
{
PVFieldPtr pvField = findSubField(fieldName,this);
if(pvField.get()==NULL) {
@@ -444,7 +453,7 @@ PVDoublePtr PVStructure::getDoubleField(String fieldName)
return nullPVDouble;
}
PVStringPtr PVStructure::getStringField(String fieldName)
PVStringPtr PVStructure::getStringField(String const &fieldName)
{
PVFieldPtr pvField = findSubField(fieldName,this);
if(pvField.get()==NULL) {
@@ -466,7 +475,7 @@ PVStringPtr PVStructure::getStringField(String fieldName)
return nullPVString;
}
PVStructurePtr PVStructure::getStructureField(String fieldName)
PVStructurePtr PVStructure::getStructureField(String const &fieldName)
{
PVFieldPtr pvField = findSubField(fieldName,this);
if(pvField.get()==NULL) {
@@ -485,7 +494,7 @@ PVStructurePtr PVStructure::getStructureField(String fieldName)
}
PVScalarArrayPtr PVStructure::getScalarArrayField(
String fieldName,ScalarType elementType)
String const &fieldName,ScalarType elementType)
{
PVFieldPtr pvField = findSubField(fieldName,this);
if(pvField.get()==NULL) {
@@ -515,7 +524,7 @@ PVScalarArrayPtr PVStructure::getScalarArrayField(
}
PVStructureArrayPtr PVStructure::getStructureArrayField(
String fieldName)
String const &fieldName)
{
PVFieldPtr pvField = findSubField(fieldName,this);
if(pvField.get()==NULL) {
@@ -539,10 +548,10 @@ String PVStructure::getExtendsStructureName() const
}
bool PVStructure::putExtendsStructureName(
String extendsStructureName)
String const &xxx)
{
if(extendsStructureName.length()!=0) return false;
extendsStructureName = extendsStructureName;
extendsStructureName = xxx;
return true;
}
@@ -629,7 +638,10 @@ void PVStructure::deserialize(ByteBuffer *pbuffer,
}
}
static PVFieldPtr findSubField(String fieldName,PVStructure const *pvStructure) {
static PVFieldPtr findSubField(
String const & fieldName,
PVStructure const *pvStructure)
{
if( fieldName.length()<1) return nullPVField;
String::size_type index = fieldName.find('.');
String name = fieldName;

View File

@@ -490,14 +490,14 @@ static StructureConstPtr createProperties(String id,FieldConstPtr field,String p
StructureConstPtr StandardField::scalar(
ScalarType type,String properties)
ScalarType type,String const &properties)
{
ScalarConstPtr field = fieldCreate->createScalar(type);
return createProperties("scalar_t",field,properties);
}
StructureConstPtr StandardField::scalarArray(
ScalarType elementType, String properties)
ScalarType elementType, String const &properties)
{
ScalarArrayConstPtr field = fieldCreate->createScalarArray(elementType);
return createProperties("scalarArray_t",field,properties);
@@ -505,7 +505,7 @@ StructureConstPtr StandardField::scalarArray(
StructureConstPtr StandardField::structureArray(
StructureConstPtr const & structure,String properties)
StructureConstPtr const & structure,String const &properties)
{
StructureArrayConstPtr field = fieldCreate->createStructureArray(
structure);
@@ -524,7 +524,7 @@ StructureConstPtr StandardField::enumerated()
return fieldCreate->createStructure("enumerated_t",names,fields);
}
StructureConstPtr StandardField::enumerated(String properties)
StructureConstPtr StandardField::enumerated(String const &properties)
{
StructureConstPtr field = enumerated();
return createProperties("enumerated_t",field,properties);

View File

@@ -28,21 +28,24 @@ StandardPVField::StandardPVField(){}
StandardPVField::~StandardPVField(){}
PVStructurePtr StandardPVField::scalar(ScalarType type,String properties)
PVStructurePtr StandardPVField::scalar(
ScalarType type,String const & properties)
{
StructureConstPtr field = standardField->scalar(type,properties);
PVStructurePtr pvStructure = pvDataCreate->createPVStructure(field);
return pvStructure;
}
PVStructurePtr StandardPVField::scalarArray(ScalarType elementType, String properties)
PVStructurePtr StandardPVField::scalarArray(
ScalarType elementType, String const & properties)
{
StructureConstPtr field = standardField->scalarArray(elementType,properties);
PVStructurePtr pvStructure = pvDataCreate->createPVStructure(field);
return pvStructure;
}
PVStructurePtr StandardPVField::structureArray(StructureConstPtr const & structure,String properties)
PVStructurePtr StandardPVField::structureArray(
StructureConstPtr const & structure,String const & properties)
{
StructureConstPtr field = standardField->structureArray(structure,properties);
PVStructurePtr pvStructure = pvDataCreate->createPVStructure(field);
@@ -63,11 +66,13 @@ PVStructurePtr StandardPVField::enumerated(StringArray const &choices)
return pvStructure;
}
PVStructurePtr StandardPVField::enumerated(StringArray const &choices,String properties)
PVStructurePtr StandardPVField::enumerated(
StringArray const &choices,String const & properties)
{
StructureConstPtr field = standardField->enumerated(properties);
PVStructurePtr pvStructure = pvDataCreate->createPVStructure(field);
PVScalarArrayPtr pvScalarArray = pvStructure->getScalarArrayField("value.choices",pvString);
PVScalarArrayPtr pvScalarArray = pvStructure->getScalarArrayField(
"value.choices",pvString);
if(pvScalarArray.get()==NULL) {
throw std::logic_error(String("StandardPVField::enumerated"));
}

View File

@@ -39,7 +39,7 @@ public:
Alarm() : severity(0),status(0), message(String("")) {}
//default constructors and destructor are OK
String getMessage() const {return message;}
void setMessage(String value) {message = value;}
void setMessage(String const &value) {message = value;}
AlarmSeverity getSeverity() const;
void setSeverity(AlarmSeverity value) {severity = value;}
AlarmStatus getStatus() const;

View File

@@ -22,11 +22,11 @@ public:
void setLow(double value){low = value;}
void setHigh(double value){high = value;}
String getDescription() const {return description;}
void setDescription(String value) {description = value;}
void setDescription(String const & value) {description = value;}
String getFormat() const {return format;}
void setFormat(String value) {format = value;}
void setFormat(String const & value) {format = value;}
String getUnits() const {return units;}
void setUnits(String value) {units = value;}
void setUnits(String const & value) {units = value;}
private:
String description;
String format;

View File

@@ -138,7 +138,7 @@ public:
* @param from The String value to convert and put into a PV.
* @throws std::logic_error if the String does not have a valid value.
*/
void fromString(PVScalarPtr const & pv, String from);
void fromString(PVScalarPtr const & pv, String const & from);
/**
* Convert from a String to a PVScalarArray.
* The String must be a comma separated set of values optionally enclosed in []

View File

@@ -104,12 +104,12 @@ public:
* @param scalarType The scalarType for the new item being added/
* @return The new PVScalar that has been added to the Auxinfo.
*/
PVScalarPtr createInfo(String key,ScalarType scalarType);
PVScalarPtr createInfo(String const & key,ScalarType scalarType);
/**
* Get the Auxinfo with the specified key.
* @return The PVScalar or null if it does not exist.
*/
PVScalarPtr getInfo(String key);
PVScalarPtr getInfo(String const & key);
/**
* Get the map for the info.
* @return The map;
@@ -236,7 +236,7 @@ public:
* Rename the field name.
* @param newName The new name.
*/
void renameField(String newName);
void renameField(String const & newName);
/**
* postPut. Called when the field is updated by the implementation.
*/
@@ -271,10 +271,10 @@ protected:
return shared_from_this();
}
PVField(FieldConstPtr field);
void setParentAndName(PVStructure *parent, String & fieldName);
void setParentAndName(PVStructure *parent, String const & fieldName);
void replaceField(FieldConstPtr &field);
private:
void message(String message,MessageType messageType,String fullFieldName);
void message(String message,MessageType messageType,String fullFieldName);
static void computeOffset(const PVField *pvField);
static void computeOffset(const PVField *pvField,std::size_t offset);
PVAuxInfoPtr pvAuxInfo;
@@ -622,7 +622,7 @@ public:
* @param fieldName The name of the field.
* @return Pointer to the field or null if field does not exist.
*/
PVFieldPtr getSubField(String fieldName) const;
PVFieldPtr getSubField(String const &fieldName) const;
/**
* Get the subfield with the specified offset.
* @param fieldOffset The offset.
@@ -634,7 +634,7 @@ public:
* @param fieldName The name of the field to append.
* @param pvField The field to append.
*/
void appendPVField(String fieldName,PVFieldPtr const & pvField);
void appendPVField(String const &fieldName,PVFieldPtr const & pvField);
/**
* Append fields to the structure.
* @param fieldNames The names of the fields to add.
@@ -646,85 +646,85 @@ public:
* Remove a field from the structure.
* @param fieldName The name of the field to remove.
*/
void removePVField(String fieldName);
void removePVField(String const &fieldName);
/**
* Get a boolean field with the specified name.
* @param fieldName The name of the field to get.
* @return Pointer to the field of null if a field with that name and type does not exist.
*/
PVBooleanPtr getBooleanField(String fieldName) ;
PVBooleanPtr getBooleanField(String const &fieldName) ;
/**
* Get a byte field with the specified name.
* @param fieldName The name of the field to get.
* @return Pointer to the field of null if a field with that name and type does not exist.
*/
PVBytePtr getByteField(String fieldName) ;
PVBytePtr getByteField(String const &fieldName) ;
/**
* Get a short field with the specified name.
* @param fieldName The name of the field to get.
* @return Pointer to the field of null if a field with that name and type does not exist.
*/
PVShortPtr getShortField(String fieldName) ;
PVShortPtr getShortField(String const &fieldName) ;
/**
* Get a int field with the specified name.
* @param fieldName The name of the field to get.
* @return Pointer to the field of null if a field with that name and type does not exist.
*/
PVIntPtr getIntField(String fieldName) ;
PVIntPtr getIntField(String const &fieldName) ;
/**
* Get a long field with the specified name.
* @param fieldName The name of the field to get.
* @return Pointer to the field of null if a field with that name and type does not exist.
*/
PVLongPtr getLongField(String fieldName) ;
PVLongPtr getLongField(String const &fieldName) ;
/**
* Get an unsigned byte field with the specified name.
* @param fieldName The name of the field to get.
* @return Pointer to the field of null if a field with that name and type does not exist.
*/
PVUBytePtr getUByteField(String fieldName) ;
PVUBytePtr getUByteField(String const &fieldName) ;
/**
* Get an unsigned short field with the specified name.
* @param fieldName The name of the field to get.
* @return Pointer to the field of null if a field with that name and type does not exist.
*/
PVUShortPtr getUShortField(String fieldName) ;
PVUShortPtr getUShortField(String const &fieldName) ;
/**
* Get an unsigned int field with the specified name.
* @param fieldName The name of the field to get.
* @return Pointer to the field of null if a field with that name and type does not exist.
*/
PVUIntPtr getUIntField(String fieldName) ;
PVUIntPtr getUIntField(String const &fieldName) ;
/**
* Get an unsigned long field with the specified name.
* @param fieldName The name of the field to get.
* @return Pointer to the field of null if a field with that name and type does not exist.
*/
PVULongPtr getULongField(String fieldName) ;
PVULongPtr getULongField(String const &fieldName) ;
/**
* Get a float field with the specified name.
* @param fieldName The name of the field to get.
* @return Pointer to the field of null if a field with that name and type does not exist.
*/
PVFloatPtr getFloatField(String fieldName) ;
PVFloatPtr getFloatField(String const &fieldName) ;
/**
* Get a double field with the specified name.
* @param fieldName The name of the field to get.
* @return Pointer to the field of null if a field with that name and type does not exist.
*/
PVDoublePtr getDoubleField(String fieldName) ;
PVDoublePtr getDoubleField(String const &fieldName) ;
/**
* Get a string field with the specified name.
* @param fieldName The name of the field to get.
* @return Pointer to the field of null if a field with that name and type does not exist.
*/
PVStringPtr getStringField(String fieldName) ;
PVStringPtr getStringField(String const &fieldName) ;
/**
* Get a structure field with the specified name.
* @param fieldName The name of the field to get.
* @return Pointer to the field of null if a field with that name and type does not exist.
*/
PVStructurePtr getStructureField(String fieldName) ;
PVStructurePtr getStructureField(String const &fieldName) ;
/**
* Get a scalarArray field with the specified name.
* @param fieldName The name of the field to get.
@@ -732,13 +732,13 @@ public:
* @return Pointer to the field of null if a field with that name and type does not exist.
*/
PVScalarArrayPtr getScalarArrayField(
String fieldName,ScalarType elementType) ;
String const &fieldName,ScalarType elementType) ;
/**
* Get a structureArray field with the specified name.
* @param fieldName The name of the field to get.
* @return Pointer to the field of null if a field with that name and type does not exist.
*/
PVStructureArrayPtr getStructureArrayField(String fieldName) ;
PVStructureArrayPtr getStructureArrayField(String const &fieldName) ;
/**
* Get the name if this structure extends another structure.
* @return The string which may be null.
@@ -749,7 +749,7 @@ public:
* @param extendsStructureName The name.
*/
bool putExtendsStructureName(
String extendsStructureName);
String const &extendsStructureName);
/**
* Serialize.
* @param pbuffer The byte buffer.

View File

@@ -176,7 +176,7 @@ namespace ScalarTypeFunc {
* @return The scalarType.
* An exception is thrown if the name is not the name of a scalar type.
*/
ScalarType getScalarType(String value);
ScalarType getScalarType(String const &value);
/**
* Get a name for the scalarType.
* @param scalarType The type.
@@ -421,7 +421,7 @@ public:
* @return The array of fieldNames.
*/
StringArray const & getFieldNames() const {return fieldNames;}
void renameField(std::size_t fieldIndex,String newName)
void renameField(std::size_t fieldIndex,String const & newName)
{fieldNames[fieldIndex] = newName;}
/**
* Get the name of the field with the specified index;
@@ -447,7 +447,7 @@ public:
virtual void deserialize(ByteBuffer *buffer, DeserializableControl *control);
protected:
Structure(StringArray const & fieldNames, FieldConstPtrArray const & fields, String id = "");
Structure(StringArray const & fieldNames, FieldConstPtrArray const & fields, String const & id = "");
private:
void toStringCommon(StringBuilder buf,int indentLevel) const;
StringArray fieldNames;
@@ -502,7 +502,7 @@ public:
* @return a {@code Structure} interface for the newly created object.
*/
StructureConstPtr createStructure (
String id,
String const & id,
StringArray const & fieldNames,
FieldConstPtrArray const & fields) const;
/**
@@ -514,7 +514,7 @@ public:
*/
StructureConstPtr appendField(
StructureConstPtr const & structure,
String fieldName, FieldConstPtr const & field) const;
String const & fieldName, FieldConstPtr const & field) const;
/**
* Append fields to a structure.
* @param structure The structure to which the fields appended.

View File

@@ -58,11 +58,11 @@ class StandardField {
public:
static StandardFieldPtr getStandardField();
~StandardField();
StructureConstPtr scalar(ScalarType type,String properties);
StructureConstPtr scalarArray(ScalarType elementType, String properties);
StructureConstPtr structureArray(StructureConstPtr const & structure,String properties);
StructureConstPtr scalar(ScalarType type,String const & properties);
StructureConstPtr scalarArray(ScalarType elementType, String const & properties);
StructureConstPtr structureArray(StructureConstPtr const & structure,String const & properties);
StructureConstPtr enumerated();
StructureConstPtr enumerated(String properties);
StructureConstPtr enumerated(String const & properties);
StructureConstPtr alarm();
StructureConstPtr timeStamp();
StructureConstPtr display();

View File

@@ -32,11 +32,11 @@ class StandardPVField : private NoDefaultMethods {
public:
static StandardPVFieldPtr getStandardPVField();
~StandardPVField();
PVStructurePtr scalar(ScalarType type,String properties);
PVStructurePtr scalarArray(ScalarType elementType, String properties);
PVStructurePtr structureArray(StructureConstPtr const &structure,String properties);
PVStructurePtr scalar(ScalarType type,String const & properties);
PVStructurePtr scalarArray(ScalarType elementType, String const & properties);
PVStructurePtr structureArray(StructureConstPtr const &structure,String const & properties);
PVStructurePtr enumerated(StringArray const &choices);
PVStructurePtr enumerated(StringArray const &choices, String properties);
PVStructurePtr enumerated(StringArray const &choices, String const & properties);
private:
StandardPVField();
};