TuttleOFX  1
FileStrings.hpp
Go to the documentation of this file.
00001 #ifndef _SEQUENCE_PARSER_FILE_STRINGS_HPP_
00002 #define _SEQUENCE_PARSER_FILE_STRINGS_HPP_
00003 
00004 #include <boost/lambda/lambda.hpp>
00005 #include <boost/filesystem.hpp>
00006 #include <boost/foreach.hpp>
00007 #include <vector>
00008 
00009 namespace sequenceParser {
00010 namespace detail {
00011 
00012 /**
00013  * @brief Unique identification for a sequence.
00014  * Internal structures to detect sequence inside a directory.
00015  */
00016 class FileStrings
00017 {
00018 
00019 public:
00020         typedef FileStrings This;
00021         typedef std::vector<std::string> Vec;
00022 
00023 public:
00024 
00025         Vec& getId()
00026         {
00027                 return _id;
00028         }
00029 
00030         const Vec& getId() const
00031         {
00032                 return _id;
00033         }
00034 
00035         void clear()
00036         {
00037                 _id.clear();
00038         }
00039 
00040         bool operator==( const This& v ) const
00041         {
00042                 if( _id.size() != v._id.size() )
00043                 {
00044                         return false;
00045                 }
00046                 for( Vec::const_iterator i = _id.begin(), iEnd = _id.end(), vi = v._id.begin(); i != iEnd; ++i, ++vi )
00047                 {
00048                         if( *i != *vi )
00049                         {
00050                                 return false;
00051                         }
00052                 }
00053                 return true;
00054         }
00055 
00056         const std::string& operator[]( const std::size_t i ) const
00057         {
00058                 return _id[i];
00059         }
00060 
00061         std::size_t getHash() const;
00062 
00063         friend std::ostream& operator<<( std::ostream& os, const This& p );
00064 
00065 private:
00066         Vec _id;
00067 };
00068 
00069 
00070 }
00071 }
00072 
00073 #endif