String -> std::string, toString methods removed

This commit is contained in:
Matej Sekoranja
2014-06-19 14:30:40 +02:00
parent 61edf17cdf
commit c39b966121
37 changed files with 284 additions and 308 deletions

View File

@@ -70,7 +70,7 @@ void PVDatabase::unlock() {
mutex.unlock();
}
PVRecordPtr PVDatabase::findRecord(String const& recordName)
PVRecordPtr PVDatabase::findRecord(string const& recordName)
{
lock();
try {
@@ -104,13 +104,13 @@ PVStringArrayPtr PVDatabase::getRecordNames()
PVStringArrayPtr pvStringArray = static_pointer_cast<PVStringArray>
(getPVDataCreate()->createPVScalarArray(pvString));
size_t len = recordMap.size();
shared_vector<String> names(len);
shared_vector<string> names(len);
PVRecordMap::iterator iter;
size_t i = 0;
for(iter = recordMap.begin(); iter!=recordMap.end(); ++iter) {
names[i++] = (*iter).first;
}
shared_vector<const String> temp(freeze(names));
shared_vector<const string> temp(freeze(names));
pvStringArray->replace(temp);
unlock();
return pvStringArray;
@@ -128,7 +128,7 @@ bool PVDatabase::addRecord(PVRecordPtr const & record)
unlock();
return false;
}
String recordName = record->getRecordName();
string recordName = record->getRecordName();
PVRecordMap::iterator iter = recordMap.find(recordName);
if(iter!=recordMap.end()) {
unlock();
@@ -152,7 +152,7 @@ bool PVDatabase::removeRecord(PVRecordPtr const & record)
unlock();
return false;
}
String recordName = record->getRecordName();
string recordName = record->getRecordName();
PVRecordMap::iterator iter = recordMap.find(recordName);
if(iter!=recordMap.end()) {
PVRecordPtr pvRecord = (*iter).second;

View File

@@ -35,7 +35,7 @@ namespace epics { namespace pvDatabase {
class PVRecord;
typedef std::tr1::shared_ptr<PVRecord> PVRecordPtr;
typedef std::map<epics::pvData::String,PVRecordPtr> PVRecordMap;
typedef std::map<std::string,PVRecordPtr> PVRecordMap;
class PVRecordField;
typedef std::tr1::shared_ptr<PVRecordField> PVRecordFieldPtr;
@@ -97,7 +97,7 @@ public:
* @return A shared pointer to the newly created record.
*/
static PVRecordPtr create(
epics::pvData::String const & recordName,
std::string const & recordName,
epics::pvData::PVStructurePtr const & pvStructure);
/**
* The Destructor. Must be virtual.
@@ -107,7 +107,7 @@ public:
* Get the name of the record.
* @return The name.
*/
epics::pvData::String getRecordName();
std::string getRecordName();
/**
* Get the top level PVStructure.
* @return The shared pointer.
@@ -187,13 +187,15 @@ public:
* Calls the next method with indentLevel = 0.
* @param buf String Builder.
*/
void toString(epics::pvData::StringBuilder buf);
// TODO
void toString(std::string* buf);
/**
* Dumps the data from the top level PVStructure.
* @param buf String Builder.
* @param indentLevel The indentation level.
*/
void toString(epics::pvData::StringBuilder buf,int indentLevel);
// TODO
void toString(std::string* buf,int indentLevel);
/**
* get trace level (0,1,2) means (nothing,lifetime,process)
* @return the level
@@ -211,7 +213,7 @@ protected:
* @param pvStructure The top level PVStructutre
*/
PVRecord(
epics::pvData::String const & recordName,
std::string const & recordName,
epics::pvData::PVStructurePtr const & pvStructure);
/**
* Initializes the base class. Must be called by derived classes.
@@ -230,7 +232,7 @@ private:
PVRecordFieldPtr findPVRecordField(
PVRecordStructurePtr const & pvrs,
epics::pvData::PVFieldPtr const & pvField);
epics::pvData::String recordName;
std::string recordName;
epics::pvData::PVStructurePtr pvStructure;
epics::pvData::ConvertPtr convert;
PVRecordStructurePtr pvRecordStructure;
@@ -284,12 +286,12 @@ public:
* Get the full name of the field, i.e. field,field,..
* @return The full name.
*/
epics::pvData::String getFullFieldName();
std::string getFullFieldName();
/**
* Get the recordName plus the full name of the field, i.e. recordName.field,field,..
* @return The name.
*/
epics::pvData::String getFullName();
std::string getFullName();
/**
* Returns the PVRecord to which this field belongs.
* @return The shared pointer,
@@ -331,8 +333,8 @@ private:
bool isStructure;
PVRecordStructurePtr parent;
PVRecordPtr pvRecord;
epics::pvData::String fullName;
epics::pvData::String fullFieldName;
std::string fullName;
std::string fullFieldName;
friend class PVRecordStructure;
friend class PVRecord;
};
@@ -481,7 +483,7 @@ public:
* @param recordName The record to find.
* @return The shared pointer.
*/
PVRecordPtr findRecord(epics::pvData::String const& recordName);
PVRecordPtr findRecord(std::string const& recordName);
/**
* Add a record.
* @param The record to add.

View File

@@ -22,7 +22,7 @@ using namespace std;
namespace epics { namespace pvDatabase {
PVRecordPtr PVRecord::create(
String const &recordName,
string const &recordName,
PVStructurePtr const & pvStructure)
{
PVRecordPtr pvRecord(new PVRecord(recordName,pvStructure));
@@ -35,7 +35,7 @@ PVRecordPtr PVRecord::create(
PVRecord::PVRecord(
String const & recordName,
string const & recordName,
PVStructurePtr const & pvStructure)
: recordName(recordName),
pvStructure(pvStructure),
@@ -103,7 +103,7 @@ void PVRecord::destroy()
}
}
String PVRecord::getRecordName() {return recordName;}
string PVRecord::getRecordName() {return recordName;}
PVRecordStructurePtr PVRecord::getPVRecordStructure() {return pvRecordStructure;}
@@ -346,15 +346,17 @@ void PVRecord::endGroupPut()
}
}
void PVRecord::toString(StringBuilder buf)
void PVRecord::toString(string* buf)
{
toString(buf,0);
}
void PVRecord::toString(StringBuilder buf,int indentLevel)
void PVRecord::toString(string* buf,int indentLevel)
{
*buf += "\nrecord " + recordName + " ";
pvRecordStructure->getPVStructure()->toString(buf, indentLevel);
std::ostringstream oss;
// TODO indent ignored
oss << endl << recordName << ' ' << *pvRecordStructure->getPVStructure();
*buf += oss.str();
}
PVRecordField::PVRecordField(
@@ -373,7 +375,7 @@ void PVRecordField::init()
fullFieldName = pvField->getFieldName();
PVRecordStructurePtr pvParent = parent;
while(pvParent.get()!= NULL) {
String parentName = pvParent->getPVField()->getFieldName();
string parentName = pvParent->getPVField()->getFieldName();
if(parentName.size()>0) {
fullFieldName = pvParent->getPVField()->getFieldName()
+ '.' + fullFieldName;
@@ -404,9 +406,9 @@ PVRecordStructurePtr PVRecordField::getParent() {return parent;}
PVFieldPtr PVRecordField::getPVField() {return pvField;}
String PVRecordField::getFullFieldName() {return fullFieldName; }
string PVRecordField::getFullFieldName() {return fullFieldName; }
String PVRecordField::getFullName() {return fullName; }
string PVRecordField::getFullName() {return fullName; }
PVRecordPtr PVRecordField::getPVRecord() {return pvRecord;}