Skip to content

Commit

Permalink
remove all std::ends (#130)
Browse files Browse the repository at this point in the history
* remove all std::ends
  • Loading branch information
ggutierrez-sunbright authored Sep 5, 2024
1 parent f9e528e commit 57b6db3
Show file tree
Hide file tree
Showing 20 changed files with 38 additions and 53 deletions.
2 changes: 1 addition & 1 deletion include/GP/RbtCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class RbtCell {
evaluated = true;
constant = true;
ostringstream nm;
nm << r << ends;
nm << r;
name = nm.str();
};
void ResetConstant() {
Expand Down
1 change: 0 additions & 1 deletion include/RbtConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
using std::cerr;
using std::cout;
using std::endl;
using std::ends;
using std::ios_base;
using std::istream;
using std::istringstream;
Expand Down
2 changes: 1 addition & 1 deletion include/RbtContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class RbtCellContext: public RbtContext {
vm[key]->SetValue(val);
else {
ostringstream s;
s << val << ends;
s << val;
vm[key] = new RbtVble(s.str(), val);
}
}
Expand Down
7 changes: 0 additions & 7 deletions include/RbtVariant.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

#include <sstream>
using std::cout;
using std::ends;
using std::istringstream;
using std::ostringstream;

Expand Down Expand Up @@ -153,9 +152,6 @@ class RbtVariant {
m_d = d;
m_sl.clear();
ostringstream ostr;
// Don't need "ends" with ostringstream apparently
//(was introducing a non-ASCII \0 char into log files
// ostr << d << ends;
ostr << d;
RbtString s(ostr.str());
m_sl.push_back(s);
Expand Down Expand Up @@ -184,9 +180,6 @@ class RbtVariant {
m_d = c.Length();
m_sl.clear();
ostringstream ostr;
// Don't need "ends" with ostringstream apparently
//(was introducing a non-ASCII \0 char into log files
// ostr << c << ends;
ostr << c;
RbtString s(ostr.str());
m_sl.push_back(s);
Expand Down
2 changes: 1 addition & 1 deletion include/RbtVble.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class RbtVble {
value = val;
if (name == "") {
ostringstream s;
s << value << ends;
s << value;
name = s.str();
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/GP/RbtGPParser.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ RbtString RbtGPParser::PrintEval(RbtGPChromosomePtr chrom, RbtInt n, RbtBool num
if (numbers) {
nm << "(";
nm << n << " ";
nm << o << ") " << ends;
nm << o << ") ";
} else
nm << o << ends;
nm << o;
chrom->Cells(n)->SetName(nm.str());
return (nm.str());
} else
Expand Down
2 changes: 1 addition & 1 deletion src/exe/rbdock.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ int main(int argc, const char *argv[]) {
try {
if (bOutput) {
ostringstream histr;
histr << strRunName << "_" << strMolName << nRec << "_his_" << iRun << ".sd" << ends;
histr << strRunName << "_" << strMolName << nRec << "_his_" << iRun << ".sd";
RbtMolecularFileSinkPtr spHistoryFileSink(new RbtMdlFileSink(histr.str(), spLigand));
spWS->SetHistorySink(spHistoryFileSink);
}
Expand Down
1 change: 0 additions & 1 deletion src/exe/rbtether.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -274,5 +274,4 @@ void print_atoms(RbtAtomList &atoms, ostringstream &ost) {
else
ost << ",";
}
ost << ends;
}
2 changes: 1 addition & 1 deletion src/lib/RbtAnnotation.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ RbtString RbtAnnotation::Render() const {
}
ostr.setf(ios_base::fixed, ios_base::floatfield);
ostr.precision(2);
ostr << m_dist << "," << m_score << ends;
ostr << m_dist << "," << m_score;
RbtString retVal(ostr.str());
return retVal;
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/RbtAtom.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ RbtString Rbt::ConvertFormalChargeToString(RbtInt nCharge) {
// For higher charges, return as +3,-3 etc
ostringstream ostr;
ostr.setf(ios_base::showpos);
ostr << nCharge << ends;
ostr << nCharge;
RbtString strCharge(ostr.str());
return strCharge;
}
Expand Down
3 changes: 1 addition & 2 deletions src/lib/RbtCharmmDataSource.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
***********************************************************************/

#include <sstream>
using std::ends;
using std::ostringstream;

#include "RbtCharmmDataSource.h"
Expand Down Expand Up @@ -69,7 +68,7 @@ RbtString RbtCharmmDataSource::AtomTypeString(RbtInt nAtomType) {
return (*iter).second;
else {
ostringstream ostr;
ostr << "CHARMm atom type #" << nAtomType << " not found in CharmmDataSource" << ends;
ostr << "CHARMm atom type #" << nAtomType << " not found in CharmmDataSource";
RbtString strError(ostr.str());
throw RbtFileMissingParameter(_WHERE_, strError);
}
Expand Down
21 changes: 9 additions & 12 deletions src/lib/RbtConstraint.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

#include "RbtLigandError.h"

using std::ends;
using std::ostringstream;

// initialization of the static data of RbtConstraint
Expand Down Expand Up @@ -206,7 +205,7 @@ void RbtHeavyConstraint::AddAtomList(RbtModelPtr lig, RbtBool bCheck) {
m_atomList = Rbt::GetAtomList(lig->GetAtomList(), std::not1(Rbt::isAtomicNo_eq(1)));
if (bCheck && (m_atomList.size() < counter)) {
ostringstream ostr;
ostr << "The ligand has only " << m_atomList.size() << " heavy atom(s) (" << counter << " required)" << ends;
ostr << "The ligand has only " << m_atomList.size() << " heavy atom(s) (" << counter << " required)";
throw RbtLigandError(_WHERE_, ostr.str());
}
}
Expand All @@ -218,7 +217,7 @@ void RbtHBDConstraint::AddAtomList(RbtModelPtr lig, RbtBool bCheck) {
if (bCheck && (m_atomList.size() < counter)) {
ostringstream ostr;
ostr << "The ligand has only " << m_atomList.size() << " neutral H-bond donor hydrogens(s) (" << counter
<< " required)" << ends;
<< " required)";
throw RbtLigandError(_WHERE_, ostr.str());
}
}
Expand All @@ -230,7 +229,7 @@ void RbtHBAConstraint::AddAtomList(RbtModelPtr lig, RbtBool bCheck) {
if (bCheck && (m_atomList.size() < counter)) {
ostringstream ostr;
ostr << "The ligand has only " << m_atomList.size() << " neutral H-bond acceptor(s) (" << counter
<< " required)" << ends;
<< " required)";
throw RbtLigandError(_WHERE_, ostr.str());
}
}
Expand All @@ -239,8 +238,7 @@ void RbtHydroConstraint::AddAtomList(RbtModelPtr lig, RbtBool bCheck) {
m_atomList = Rbt::GetAtomList(lig->GetAtomList(), Rbt::isAtomLipophilic());
if (bCheck && (m_atomList.size() < counter)) {
ostringstream ostr;
ostr << "The ligand has only " << m_atomList.size() << " hydrophobic atom(s) (" << counter << " required)"
<< ends;
ostr << "The ligand has only " << m_atomList.size() << " hydrophobic atom(s) (" << counter << " required)";
throw RbtLigandError(_WHERE_, ostr.str());
}
}
Expand All @@ -251,7 +249,7 @@ void RbtHydroAliphaticConstraint::AddAtomList(RbtModelPtr lig, RbtBool bCheck) {
if (bCheck && (m_atomList.size() < counter)) {
ostringstream ostr;
ostr << "The ligand has only " << m_atomList.size() << " hydrophobic aliphatic atom(s) (" << counter
<< " required)" << ends;
<< " required)";
throw RbtLigandError(_WHERE_, ostr.str());
}
}
Expand All @@ -262,7 +260,7 @@ void RbtHydroAromaticConstraint::AddAtomList(RbtModelPtr lig, RbtBool bCheck) {
if (bCheck && (m_atomList.size() < counter)) {
ostringstream ostr;
ostr << "The ligand has only " << m_atomList.size() << " hydrophobic aromatic atom(s) (" << counter
<< " required)" << ends;
<< " required)";
throw RbtLigandError(_WHERE_, ostr.str());
}
}
Expand All @@ -272,7 +270,7 @@ void RbtNegChargeConstraint::AddAtomList(RbtModelPtr lig, RbtBool bCheck) {
if (bCheck && (m_atomList.size() < counter)) {
ostringstream ostr;
ostr << "The ligand has only " << m_atomList.size() << " negatively charged atom(s) (" << counter
<< " required)" << ends;
<< " required)";
throw RbtLigandError(_WHERE_, ostr.str());
}
}
Expand All @@ -282,7 +280,7 @@ void RbtPosChargeConstraint::AddAtomList(RbtModelPtr lig, RbtBool bCheck) {
if (bCheck && (m_atomList.size() < counter)) {
ostringstream ostr;
ostr << "The ligand has only " << m_atomList.size() << " positively charged atom(s) (" << counter
<< " required)" << ends;
<< " required)";
throw RbtLigandError(_WHERE_, ostr.str());
}
}
Expand All @@ -299,8 +297,7 @@ void RbtRingAromaticConstraint::AddAtomList(RbtModelPtr lig, RbtBool bCheck) {
}
if (bCheck && (m_atomList.size() < counter)) {
ostringstream ostr;
ostr << "The ligand has only " << m_atomList.size() << " aromatic ring(s) (" << counter << " required)"
<< ends;
ostr << "The ligand has only " << m_atomList.size() << " aromatic ring(s) (" << counter << " required)";
throw RbtLigandError(_WHERE_, ostr.str());
}
}
6 changes: 3 additions & 3 deletions src/lib/RbtCrdFileSink.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void RbtCrdFileSink::Render() {

// 2. Write number of atoms
ostringstream ostr;
ostr << setw(5) << spModel->GetNumAtoms() << ends;
ostr << setw(5) << spModel->GetNumAtoms();
AddLine(ostr.str());
// Remember the line number containing the number of atoms
// as we'll need to update the total num atoms after each Render when we are in multiconf mode
Expand Down Expand Up @@ -131,15 +131,15 @@ void RbtCrdFileSink::Render() {
ostr << setw(0) << " " << setw(4)
<< spAtom->GetSubunitId().c_str(); // This subunit ID is unique in the segment
ostr.setf(ios_base::right, ios_base::adjustfield);
ostr << setw(10) << 0.0 << ends;
ostr << setw(10) << 0.0;
AddLine(ostr.str());
}

// In multiconf mode, we need to update the total number of atoms in the cache
// then write the file without clearing the cache
if (GetMultiConf()) {
ostringstream ostr;
ostr << setw(5) << m_nAtomId << ends;
ostr << setw(5) << m_nAtomId;
ReplaceLine(ostr.str(), m_numAtomsLineRec);
Write(false);
} else
Expand Down
3 changes: 1 addition & 2 deletions src/lib/RbtElementFileSource.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
***********************************************************************/

#include <sstream>
using std::ends;
using std::istringstream;
using std::ostringstream;

Expand Down Expand Up @@ -93,7 +92,7 @@ RbtElementData RbtElementFileSource::GetElementData(RbtInt nAtomicNumber) {
return (*iter).second;
else {
ostringstream ostr;
ostr << "Atomic number " << nAtomicNumber << " not found in " << GetFileName() << ends;
ostr << "Atomic number " << nAtomicNumber << " not found in " << GetFileName();
RbtString strError(ostr.str());
throw RbtFileMissingParameter(_WHERE_, strError);
}
Expand Down
3 changes: 1 addition & 2 deletions src/lib/RbtFilter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
***********************************************************************/

#include <sstream>
using std::ends;
using std::ostringstream;

#include "RbtFilter.h"
Expand Down Expand Up @@ -202,7 +201,7 @@ RbtBool RbtFilter::Terminate() {
} else {
ostringstream error;
error << "Wrong output: " << val;
error << "; Termination filters should return 0,1 or -1" << ends;
error << "; Termination filters should return 0,1 or -1";
throw RbtError(_WHERE_, error.str());
}
} else
Expand Down
10 changes: 5 additions & 5 deletions src/lib/RbtMdlFileSink.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void RbtMdlFileSink::Render() {
ostr << setw(3) << modelAtomList.size() + solventAtomList.size() << setw(3)
<< modelBondList.size() + solventBondList.size() << setw(3) << 0 << setw(3) << 0 << setw(3) << 0
<< setw(3) << 0 << setw(3) << 0 << setw(3) << 0 << setw(3) << 0 << setw(3) << 0 << setw(3) << 999
<< " V2000" << ends;
<< " V2000";
AddLine(ostr.str());

// DM 19 June 2006 - clear the map of logical atom IDs each time
Expand Down Expand Up @@ -125,8 +125,8 @@ void RbtMdlFileSink::RenderAtomList(const RbtAtomList& atomList) {
<< setw(3) << 0 // atom stereo parity
<< setw(3) << 0 // hydrogen count+1 (query CTABs only)
<< setw(3) << 0 // stereo care box (query CTABs only)
<< setw(3) << 0 // valence (0 = no marking)
<< ends; // Mass diff, formal charge, stereo parity, num hydrogens, center
<< setw(3) << 0; // valence (0 = no marking)
// Mass diff, formal charge, stereo parity, num hydrogens, center
AddLine(ostr.str());
}
}
Expand All @@ -147,8 +147,8 @@ void RbtMdlFileSink::RenderBondList(const RbtBondList& bondList) {
ostringstream ostr;
ostr.setf(ios_base::right, ios_base::adjustfield);
ostr << setw(3) << id1 << setw(3) << id2 << setw(3) << spBond->GetFormalBondOrder() << setw(3) << 0
<< setw(3) << 0 << setw(3) << 0
<< ends; // Atom1, Atom2, bond order, stereo designator, unused, topology code
<< setw(3) << 0 << setw(3) << 0;
// Atom1, Atom2, bond order, stereo designator, unused, topology code
AddLine(ostr.str());
} else {
// Should never happen. Probably best to throw an error at this point.
Expand Down
6 changes: 3 additions & 3 deletions src/lib/RbtMdlFileSource.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ void RbtMdlFileSource::Parse() {
// Compose the atom name from element+atomID (i.e. C1, N2, C3 etc)
nAtomId++;
ostringstream ostr;
ostr << strElementName << nAtomId << ends;
ostr << strElementName << nAtomId;
RbtString strAtomName(ostr.str());

// Construct a new atom (constructor only accepts the 2D params)
Expand Down Expand Up @@ -728,7 +728,7 @@ void RbtMdlFileSource::AddHydrogen(RbtAtomPtr spAtom) {
// Construct the new hydrogen atom (constructor only accepts the 2D params)
RbtInt nAtomId = m_atomList.size() + 1;
ostringstream ostr;
ostr << "H" << nAtomId << ends;
ostr << "H" << nAtomId;
RbtString strAtomName(ostr.str());
RbtAtomPtr spHAtom(new RbtAtom(
nAtomId,
Expand Down Expand Up @@ -940,7 +940,7 @@ void RbtMdlFileSource::SetupSegmentNames() {
nSeg++, seed = Rbt::FindAtom(m_atomList, Rbt::isSegmentName_eq("H"))) {
// New segment name (H1, H2 etc)
ostringstream ostr;
ostr << "H" << nSeg << ends;
ostr << "H" << nSeg;
RbtString strSegName(ostr.str());
// Temporary atom list containing atoms to be processed
// Note: this is a true list (not a vector) as we will be making numerous insertions and deletions
Expand Down
2 changes: 1 addition & 1 deletion src/lib/RbtPRMFactory.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ RbtModelPtr RbtPRMFactory::CreateReceptor() {
}
for (RbtInt i = 1; i <= n; i++) {
ostringstream ostr;
ostr << _REC_COORD_FILE << "_" << i << ends;
ostr << _REC_COORD_FILE << "_" << i;
RbtString paramName(ostr.str());
RbtString strCoordFile = m_pParamSource->GetParameterValueAsString(paramName);
if (m_iTrace > 0) {
Expand Down
10 changes: 5 additions & 5 deletions src/lib/RbtPsfFileSink.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void RbtPsfFileSink::Render() {
AddLine("");
RbtStringList titleList(spModel->GetTitleList());
ostringstream ostr;
ostr << setw(8) << titleList.size() << setw(0) << " " << strTitleKey << ends;
ostr << setw(8) << titleList.size() << setw(0) << " " << strTitleKey;
AddLine(ostr.str());
for (RbtStringListConstIter iter = titleList.begin(); iter != titleList.end(); iter++) {
// Add an initial star if the title does not already commence with a star
Expand All @@ -68,7 +68,7 @@ void RbtPsfFileSink::Render() {

// 2. Write number of atoms
ostringstream ostr2;
ostr2 << setw(8) << spModel->GetNumAtoms() << setw(0) << " " << strAtomKey << ends;
ostr2 << setw(8) << spModel->GetNumAtoms() << setw(0) << " " << strAtomKey;
AddLine(ostr2.str());
// delete ostr2.str();

Expand Down Expand Up @@ -97,7 +97,7 @@ void RbtPsfFileSink::Render() {
delete[] line;
// 4. Write number of bonds
ostringstream ostr3;
ostr3 << setw(8) << spModel->GetNumBonds() << setw(0) << " " << strBondKey << ends;
ostr3 << setw(8) << spModel->GetNumBonds() << setw(0) << " " << strBondKey;
AddLine("");
AddLine(ostr3.str());
// delete ostr3.str();
Expand All @@ -117,7 +117,7 @@ void RbtPsfFileSink::Render() {
bIter++;
ostr << setw(8) << (*bIter)->GetAtom1Ptr()->GetAtomId() << setw(8) << (*bIter)->GetAtom2Ptr()->GetAtomId();
bIter++;
ostr << ends;
ostr;
AddLine(ostr.str());
}
// Remaining bonds on final incomplete line
Expand All @@ -127,7 +127,7 @@ void RbtPsfFileSink::Render() {
ostr << setw(8) << (*bIter)->GetAtom1Ptr()->GetAtomId() << setw(8)
<< (*bIter)->GetAtom2Ptr()->GetAtomId();
}
ostr << ends;
ostr;
AddLine(ostr.str());
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/rbcavity/rbcavity_main.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void RBCavity::RBCavity(const RBCavity::RBCavityConfig &config) {
RbtCavityList cavList = spDockSite->GetCavityList();
for (RbtUInt i = 0; i < cavList.size(); i++) {
ostringstream filename;
filename << wsName << "_cav" << i + 1 << ".grd" << ends;
filename << wsName << "_cav" << i + 1 << ".grd";
ofstream dumpFile(filename.str());
if (dumpFile) {
cavList[i]->GetGrid()->PrintInsightGrid(dumpFile);
Expand Down

0 comments on commit 57b6db3

Please sign in to comment.