Sleipnir
src/seekmap.h
00001 /*****************************************************************************
00002 * This file is provided under the Creative Commons Attribution 3.0 license.
00003 *
00004 * You are free to share, copy, distribute, transmit, or adapt this work
00005 * PROVIDED THAT you attribute the work to the authors listed below.
00006 * For more information, please see the following web page:
00007 * http://creativecommons.org/licenses/by/3.0/
00008 *
00009 * This file is a component of the Sleipnir library for functional genomics,
00010 * authored by:
00011 * Curtis Huttenhower (chuttenh@princeton.edu)
00012 * Mark Schroeder
00013 * Maria D. Chikina
00014 * Olga G. Troyanskaya (ogt@princeton.edu, primary contact)
00015 *
00016 * If you use this library, the included executable tools, or any related
00017 * code in your work, please cite the following publication:
00018 * Curtis Huttenhower, Mark Schroeder, Maria D. Chikina, and
00019 * Olga G. Troyanskaya.
00020 * "The Sleipnir library for computational functional genomics"
00021 *****************************************************************************/
00022 #ifndef SEEKMAP_H
00023 #define SEEKMAP_H
00024 
00025 #include "seekbasic.h"
00026 
00027 namespace Sleipnir {
00028 
00064 class CSeekIntIntMap{
00065 public:
00070     CSeekIntIntMap(const utype&);
00071 
00081     CSeekIntIntMap(const vector<char>&, const bool=false);
00082 
00093     CSeekIntIntMap(const char*, const utype &, const bool=false);
00094 
00099     CSeekIntIntMap(CSeekIntIntMap*);
00100 
00105     void Initialize(const utype&);
00106 
00110     ~CSeekIntIntMap();
00111 
00117     utype GetForward(const utype &) const;
00118 
00124     utype GetReverse(const utype &) const;
00125 
00130     const vector<utype>& GetAllForward() const;
00131 
00136     const vector<utype>& GetAllReverse() const;
00137 
00144     void Add(const utype&);
00145 
00151     void Clear();
00152 
00156     void Reset(const vector<char>&, const bool=false);
00157 
00161     void Reset(const char*, const bool=false);
00162 
00167     utype GetNumSet() const;
00168 
00173     utype GetSize() const;
00174 
00175 private:
00176     vector<utype> m_iF;
00177     vector<utype> m_iR;
00178     vector<utype>::iterator m_iterR;
00179     utype m_iSize;
00180     utype m_iNumSet;
00181 };
00182 
00194 class CSeekStrIntMap{
00195 public:
00199     CSeekStrIntMap();
00203     ~CSeekStrIntMap();
00207     void Clear();
00213     void Set(const string&, const utype&);
00220     void SetAll(const vector<string>&);
00224     utype Get(const string&) const;
00228     map<string, utype>& GetMapForward();
00232     map<utype, string>& GetMapReverse();
00236     utype GetSize() const;
00240     string Get(const utype &) const;
00244     vector<string> GetAllString() const;
00248     vector<utype> GetAllInteger() const;
00249 private:
00250     map<string, utype> m_mapstrint;
00251     map<utype, string> m_mapintstr;
00252 };
00253 
00254 }
00255 #endif