Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/molecule_graph.cpp

    r35b698 r112b09  
    1212#include "bondgraph.hpp"
    1313#include "config.hpp"
    14 #include "defs.hpp"
    1514#include "element.hpp"
    1615#include "helpers.hpp"
     
    10251024/** Storing the bond structure of a molecule to file.
    10261025 * Simply stores Atom::nr and then the Atom::nr of all bond partners per line.
    1027  * \param &filename name of file
    1028  * \param path path to file, defaults to empty
     1026 * \param *path path to file
     1027 * \param *filename name of file
    10291028 * \return true - file written successfully, false - writing failed
    10301029 */
    1031 bool molecule::StoreAdjacencyToFile(std::string &filename, std::string path)
     1030bool molecule::StoreAdjacencyToFile(char *path, char *filename)
    10321031{
    10331032  ofstream AdjacencyFile;
    1034   string line;
     1033  stringstream line;
    10351034  bool status = true;
    10361035
    1037   if (path != "")
    1038     line = path + "/" + filename;
     1036  if (path != NULL)
     1037    line << path << "/" << filename;
    10391038  else
    1040     line = filename;
    1041   AdjacencyFile.open(line.c_str(), ios::out);
     1039    line << filename;
     1040  AdjacencyFile.open(line.str().c_str(), ios::out);
    10421041  DoLog(1) && (Log() << Verbose(1) << "Saving adjacency list ... " << endl);
    1043   if (AdjacencyFile.good()) {
     1042  if (AdjacencyFile != NULL) {
    10441043    AdjacencyFile << "m\tn" << endl;
    10451044    ActOnAllAtoms(&atom::OutputAdjacency, &AdjacencyFile);
     
    10471046    DoLog(1) && (Log() << Verbose(1) << "\t... done." << endl);
    10481047  } else {
    1049     DoLog(1) && (Log() << Verbose(1) << "\t... failed to open file " << line << "." << endl);
     1048    DoLog(1) && (Log() << Verbose(1) << "\t... failed to open file " << line.str() << "." << endl);
    10501049    status = false;
    10511050  }
     
    10571056/** Storing the bond structure of a molecule to file.
    10581057 * Simply stores Atom::nr and then the Atom::nr of all bond partners, one per line.
    1059  * \param &filename name of file
    1060  * \param path path to file, defaults to empty
     1058 * \param *path path to file
     1059 * \param *filename name of file
    10611060 * \return true - file written successfully, false - writing failed
    10621061 */
    1063 bool molecule::StoreBondsToFile(std::string &filename, std::string path)
     1062bool molecule::StoreBondsToFile(char *path, char *filename)
    10641063{
    10651064  ofstream BondFile;
    1066   string line;
     1065  stringstream line;
    10671066  bool status = true;
    10681067
    1069   if (path != "")
    1070     line = path + "/" + filename;
     1068  if (path != NULL)
     1069    line << path << "/" << filename;
    10711070  else
    1072     line = filename;
    1073   BondFile.open(line.c_str(), ios::out);
     1071    line << filename;
     1072  BondFile.open(line.str().c_str(), ios::out);
    10741073  DoLog(1) && (Log() << Verbose(1) << "Saving adjacency list ... " << endl);
    1075   if (BondFile.good()) {
     1074  if (BondFile != NULL) {
    10761075    BondFile << "m\tn" << endl;
    10771076    ActOnAllAtoms(&atom::OutputBonds, &BondFile);
     
    10791078    DoLog(1) && (Log() << Verbose(1) << "\t... done." << endl);
    10801079  } else {
    1081     DoLog(1) && (Log() << Verbose(1) << "\t... failed to open file " << line << "." << endl);
     1080    DoLog(1) && (Log() << Verbose(1) << "\t... failed to open file " << line.str() << "." << endl);
    10821081    status = false;
    10831082  }
     
    10871086;
    10881087
    1089 bool CheckAdjacencyFileAgainstMolecule_Init(std::string &path, ifstream &File, int *&CurrentBonds)
    1090 {
    1091   string filename;
    1092   filename = path + ADJACENCYFILE;
    1093   File.open(filename.c_str(), ios::out);
     1088bool CheckAdjacencyFileAgainstMolecule_Init(char *path, ifstream &File, int *&CurrentBonds)
     1089{
     1090  stringstream filename;
     1091  filename << path << "/" << FRAGMENTPREFIX << ADJACENCYFILE;
     1092  File.open(filename.str().c_str(), ios::out);
    10941093  DoLog(1) && (Log() << Verbose(1) << "Looking at bond structure stored in adjacency file and comparing to present one ... " << endl);
    1095   if (File.fail())
     1094  if (File == NULL)
    10961095    return false;
    10971096
     
    11471146 * \return true - structure is equal, false - not equivalence
    11481147 */
    1149 bool molecule::CheckAdjacencyFileAgainstMolecule(std::string &path, atom **ListOfAtoms)
     1148bool molecule::CheckAdjacencyFileAgainstMolecule(char *path, atom **ListOfAtoms)
    11501149{
    11511150  ifstream File;
Note: See TracChangeset for help on using the changeset viewer.