--- trunk/OOPSE/libmdtools/OtherVisitor.cpp 2004/04/19 03:52:27 1118 +++ trunk/OOPSE/libmdtools/OtherVisitor.cpp 2004/04/19 17:44:48 1119 @@ -38,19 +38,30 @@ const string IgnoreVisitor::toString(){ const string IgnoreVisitor::toString(){ char buffer[65535]; + string result; set::iterator i; - sprintf(buffer,"------------------------------------------------------------------\n"); - sprintf(buffer,"Visitor name: %s", visitorName.c_str()); + sprintf(buffer ,"------------------------------------------------------------------\n"); + result += buffer; + sprintf(buffer ,"Visitor name: %s", visitorName.c_str()); + result += buffer; + //print the ignore type list - sprintf(buffer, "Ignore type list contains below types:\n"); - for(i = itList.begin(); i != itList.end(); ++i) - sprintf(buffer,"%s,\t", i->c_str()); - sprintf(buffer,"\n"); + sprintf(buffer , "Ignore type list contains below types:\n"); + result += buffer; - sprintf(buffer,"------------------------------------------------------------------\n"); + for(i = itList.begin(); i != itList.end(); ++i){ + sprintf(buffer ,"%s,\t", i->c_str()); + result += buffer; + } + sprintf(buffer ,"\n"); + result += buffer; + + sprintf(buffer ,"------------------------------------------------------------------\n"); + result += buffer; + return buffer; } @@ -161,20 +172,30 @@ const string ReplicateVisitor::toString(){ const string ReplicateVisitor::toString(){ char buffer[65535]; + string result; set::iterator i; - sprintf(buffer,"------------------------------------------------------------------\n"); - sprintf(buffer,"Visitor name: %s", visitorName.c_str()); + sprintf(buffer ,"------------------------------------------------------------------\n"); + result += buffer; + sprintf(buffer ,"Visitor name: %s", visitorName.c_str()); + result += buffer; + //print the replicate direction - sprintf(buffer, "repeatX = %d:\n", replicateOpt[0]); - sprintf(buffer, "repeatY = %d:\n", replicateOpt[1]); - sprintf(buffer, "repeatZ = %d:\n", replicateOpt[2]); + sprintf(buffer , "repeatX = %d:\n", replicateOpt[0]); + result += buffer; + sprintf(buffer , "repeatY = %d:\n", replicateOpt[1]); + result += buffer; + sprintf(buffer , "repeatZ = %d:\n", replicateOpt[2]); + result += buffer; + + sprintf(buffer,"------------------------------------------------------------------\n"); + result += buffer; - return buffer; + return result; } //----------------------------------------------------------------------------// @@ -210,10 +231,11 @@ void XYZVisitor::internalVisit(StuntDouble* sd){ //if there is not atom data, just skip it data = sd->getProperty("ATOMDATA"); - if(data != NULL) + if(data != NULL){ atomData = dynamic_cast(data); if(atomData == NULL) return; + } else return; @@ -221,7 +243,7 @@ void XYZVisitor::internalVisit(StuntDouble* sd){ if(printDipole) sprintf(buffer, "%s%15.8f%15.8f%15.8f%15.8f%15.8f%15.8f", - atomInfo->AtomType, + atomInfo->AtomType.c_str(), atomInfo->pos[0], atomInfo->pos[1], atomInfo->pos[2], @@ -230,7 +252,7 @@ void XYZVisitor::internalVisit(StuntDouble* sd){ atomInfo->dipole[2]); else sprintf(buffer, "%s%15.8f%15.8f%15.8f", - atomInfo->AtomType, + atomInfo->AtomType.c_str(), atomInfo->pos[0], atomInfo->pos[1], atomInfo->pos[2]); @@ -286,9 +308,11 @@ void PrepareVisitor::internalVisit(StuntDouble * sd){ //remove atomdata data = sd->getProperty("ATOMDATA"); - if(data != NULL) + if(data != NULL){ atomData = dynamic_cast(data); if(atomData != NULL) sd->removeProperty("ATOMDATA"); + } + }