remove commented out string conversion
authorDiane Trout <diane@caltech.edu>
Thu, 7 Sep 2006 22:49:26 +0000 (22:49 +0000)
committerDiane Trout <diane@caltech.edu>
Thu, 7 Sep 2006 22:49:26 +0000 (22:49 +0000)
and prevet a possible shared_ptr dereference in c_str()

alg/sequence.cpp
alg/sequence.hpp

index e318207e93b06c31e6d86ca6095dd5b66b0724f1..787f2a9dae0849c13c9224db1f5bfa9549344ba7 100644 (file)
@@ -126,20 +126,6 @@ Sequence &Sequence::operator=(const Sequence& s)
   return *this;
 }
 
-/*
-Sequence::operator std::string()
-{
-  std::string s(seq.begin(), seq.end());
-  return s;
-}
-
-Sequence::operator std::string() const
-{
-  std::string s(seq.begin(), seq.end());
-  return s;
-}
-*/
-
 static void multiplatform_getline(std::istream& in, std::string& line)
 {
   line.clear();
@@ -247,7 +233,7 @@ Sequence::load_fasta(std::iostream& data_file, int seq_num,
 }
 
 void Sequence::set_filtered_sequence(const std::string &old_seq, 
-                                     std::string::size_type start, 
+                                     std::string::size_type start,
                                      std::string::size_type count)
 {
   char conversionTable[257];
@@ -612,7 +598,10 @@ Sequence::clear()
 
 const char *Sequence::c_str() const
 {
-  return seq->c_str();
+  if (seq) 
+    return seq->c_str();
+  else 
+    return 0;
 }
 
 Sequence::const_iterator Sequence::begin() const
index 6c5b3b62018ce87f100c0a66ee78d80922f4b6ff..b335dcd1dfac1401ce473ef22258334b705d0cd5 100644 (file)
@@ -129,10 +129,6 @@ public:
   //! assignment to constant sequences
   Sequence &operator=(const Sequence&);
 
-  // dangerous since they create large copies
-  //operator std::string();
-  //operator std::string() const;
-
   friend std::ostream& operator<<(std::ostream&, const Sequence&);
   friend bool operator<(const Sequence&, const Sequence&);
   friend bool operator==(const Sequence&, const Sequence&);
@@ -229,8 +225,10 @@ public:
 private:
   boost::shared_ptr<seq_string> seq;
   std::string header;
+  //! species name
   std::string species;
 
+  //! store our oldstyle annotations
   std::list<annot> annots;
   //! a seperate list for motifs since we're currently not saving them
   std::list<motif> motif_list;