libStatGen Software  1
GenericSamInterface.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 __GENERIC_SAM_INTERFACE_H__
00019 #define __GENERIC_SAM_INTERFACE_H__
00020 
00021 #include "SamStatus.h"
00022 #include "InputFile.h"
00023 #include "SamFileHeader.h"
00024 #include "SamRecord.h"
00025 
00026 class GenericSamInterface
00027 {
00028 public:
00029     GenericSamInterface();
00030     virtual ~GenericSamInterface();
00031    
00032     // Pure virtual method that reads the header section from the specified file
00033     // and stores it in the passed in header, returns false and sets the status
00034     // on failure.
00035     // Will be implemented specifically for sam/bam files.
00036     virtual bool readHeader(IFILE filePtr, SamFileHeader& header,
00037                             SamStatus& status) = 0;
00038 
00039     // Pure virtual method that writes the specified header into the specified
00040     // file, returns false and sets the status on failure.
00041     // Will be implemented specifically for sam/bam files.
00042     virtual bool writeHeader(IFILE filePtr, SamFileHeader& header,
00043                              SamStatus& status) = 0;
00044 
00045     // Pure virtual method that reads the next record from the specified file 
00046     // and stores it in the passed in record.
00047     // Will be implemented specifically for sam/bam files.
00048     // TODO On error, a more detailed message is appended to statusMsg.
00049     virtual void readRecord(IFILE filePtr, SamFileHeader& header, 
00050                             SamRecord& record, 
00051                             SamStatus& samStatus) = 0;
00052    
00053     // Pure virtual method that writes the specified record into the specified
00054     // file.
00055     // Will be implemented specifically for sam/bam files.
00056     virtual SamStatus::Status writeRecord(IFILE filePtr, SamFileHeader& header,
00057                                           SamRecord& record,
00058                                           SamRecord::SequenceTranslation translation) = 0;
00059 
00060 };
00061 
00062 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends