libStatGen Software  1
QuickIndex.h
00001 /*
00002  *  Copyright (C) 2010  Regents of the University of Michigan
00003  *
00004  *   This program is free software: you can redistribute it and/or modify
00005  *   it under the terms of the GNU General Public License as published by
00006  *   the Free Software Foundation, either version 3 of the License, or
00007  *   (at your option) any later version.
00008  *
00009  *   This program is distributed in the hope that it will be useful,
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *   GNU General Public License for more details.
00013  *
00014  *   You should have received a copy of the GNU General Public License
00015  *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 
00018 #ifndef __QUICKINDEX_H__
00019 #define __QUICKINDEX_H__
00020 
00021 #include "MathVector.h"
00022 #include "StringArray.h"
00023 #include "StringHash.h"
00024 #include "IntArray.h"
00025 #include "StringMap.h"
00026 
00027 class QuickIndex : public IntArray
00028 {
00029 public:
00030     QuickIndex();
00031     QuickIndex(const IntArray & source_data)
00032     {
00033         Index(source_data);
00034     }
00035     QuickIndex(const StringArray & source_data)
00036     {
00037         Index(source_data);
00038     }
00039     QuickIndex(const Vector & source_data)
00040     {
00041         Index(source_data);
00042     }
00043 
00044     void Index(const IntArray & source_data);
00045     void Index(const StringArray & source_data);
00046     void Index(const Vector & source_data);
00047     void IndexCounts(const StringIntMap & source_data);
00048     void IndexCounts(const StringIntHash & source_data);
00049 
00050 private:
00051     const void * source;
00052     int    datatype;
00053 
00054     bool IsBefore(int i, int j);
00055     void Sort();
00056 };
00057 
00058 #endif
00059 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends