1) implemented noDefaultMethods. See effective C++ Item 6. There it is called Uncopyable
2) implemented Lock. See effective C++ item 14.
This is as easy to use as Java synchronize.
3) wrapper on top of std::string. All usage of string in pvData is one of:
String - Just a std::string
StringBuilder - Used where StringBuilder is used in Java
StringConst - Just a "std::string const". This is used wherever String is used in Java
StringConstArray - Just like a String[] in Java.
4) The reference counting (incReferenceCount and decReferenceCount) are now private. It is completely handled by the implenentaion.
NO code that uses pvData needs even know about reference counting.
This commit is contained in:
@@ -30,11 +30,11 @@ namespace epics { namespace pvData {
|
||||
|
||||
int PVArray::getLength() const {return pImpl->length;}
|
||||
|
||||
static std::string fieldImmutable("field is immutable");
|
||||
static StringConst fieldImmutable("field is immutable");
|
||||
|
||||
void PVArray::setLength(int length) {
|
||||
if(PVField::isImmutable()) {
|
||||
PVField::message(&fieldImmutable,errorMessage);
|
||||
PVField::message(fieldImmutable,errorMessage);
|
||||
return;
|
||||
}
|
||||
if(length>pImpl->capacity) this->setCapacity(length);
|
||||
@@ -54,29 +54,29 @@ namespace epics { namespace pvData {
|
||||
void PVArray::setCapacityImmutable(epicsBoolean isMutable)
|
||||
{
|
||||
if(isMutable && PVField::isImmutable()) {
|
||||
PVField::message(&fieldImmutable,errorMessage);
|
||||
PVField::message(fieldImmutable,errorMessage);
|
||||
return;
|
||||
}
|
||||
pImpl->capacityMutable = isMutable;
|
||||
}
|
||||
|
||||
static std::string capacityImmutable("capacity is immutable");
|
||||
static StringConst capacityImmutable("capacity is immutable");
|
||||
|
||||
void PVArray::setCapacity(int capacity) {
|
||||
if(PVField::isImmutable()) {
|
||||
PVField::message(&fieldImmutable,errorMessage);
|
||||
PVField::message(fieldImmutable,errorMessage);
|
||||
return;
|
||||
}
|
||||
if(pImpl->capacityMutable==epicsFalse) {
|
||||
PVField::message(&capacityImmutable,errorMessage);
|
||||
PVField::message(capacityImmutable,errorMessage);
|
||||
return;
|
||||
}
|
||||
pImpl->capacity = capacity;
|
||||
}
|
||||
|
||||
void PVArray::toString(StringPtr buf) const {toString(buf,0);}
|
||||
void PVArray::toString(StringBuilder buf) const {toString(buf,0);}
|
||||
|
||||
void PVArray::toString(StringPtr buf, int indentLevel) const
|
||||
void PVArray::toString(StringBuilder buf, int indentLevel) const
|
||||
{
|
||||
throw std::logic_error(notImplemented);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user