MASA-Core
FirstRow.hpp
Go to the documentation of this file.
00001 /*******************************************************************************
00002  *
00003  * Copyright (c) 2010-2015   Edans Sandes
00004  *
00005  * This file is part of MASA-Core.
00006  * 
00007  * MASA-Core is free software: you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation, either version 3 of the License, or
00010  * (at your option) any later version.
00011  * 
00012  * MASA-Core is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License
00018  * along with MASA-Core.  If not, see <http://www.gnu.org/licenses/>.
00019  *
00020  ******************************************************************************/
00021 
00022 #ifndef FIRSTROW_HPP_
00023 #define FIRSTROW_HPP_
00024 
00025 #include "SpecialRow.hpp"
00026 #include "../io/SeekableCellsReader.hpp"
00027 
00028 /** @brief Class that reads and stores an Special Row considering a the
00029  * affine gap formula in the first row.
00030  *
00031  * This class is the implementation of a SpecialRow that considers the formula
00032  * of the affine gap function in the first row. It does not need to store the
00033  * cells in memory, since it can reproduce the cells using the
00034  * affine gap formula.
00035  *
00036  * This class works only in read mode. Thus, it contains many methods that
00037  * does nothing, but we need to implement them since the abstract SpecialRow
00038  * superclass contains virtual methods.
00039  *
00040  */
00041 class FirstRow : public SpecialRow {
00042 public:
00043         /**
00044          * Default contructor.
00045          */
00046         FirstRow();
00047 
00048         /**
00049          * Destructor.
00050          */
00051         virtual ~FirstRow();
00052 
00053         /**
00054          * This method does nothing, but we need to implement it since the
00055          * abstract SpecialRow superclass contains this virtual method.
00056          */
00057         virtual void close();
00058 
00059         /**
00060          * This method does nothing, but we need to implement it since the
00061          * abstract SpecialRow superclass contains this virtual method.
00062          */
00063         virtual void truncateRow(int size);
00064 
00065         /**
00066          * Defines the affine gap function parameters.
00067          *
00068          * @param score_params the affine gap function parameters.
00069          * @param firstRowGapped If true, the affine gap is used in the entire row
00070          *              (global or semi-global alignment scenarios). Otherwise, we consider
00071          *              that the first row if filled with zeroes (local alignment scenario).
00072          */
00073         //void setParams(const score_params_t* score_params,    bool firstRowGapped);
00074         void setCellsReader(SeekableCellsReader* reader);
00075 
00076 private:
00077         /** the affine gap function parameters */
00078 //      const score_params_t* score_params;
00079 //
00080 //      /** indicates if the first row considers the affine gap function or not */
00081 //      bool firstRowGapped;
00082         SeekableCellsReader* reader;
00083 
00084 
00085         /**
00086          * This method does nothing, but we need to implement it since the
00087          * abstract SpecialRow superclass contains this virtual method.
00088          */
00089         virtual void initialize(bool readOnly, int length);
00090 
00091         /**
00092          * This method does nothing, but we need to implement it since the
00093          * abstract SpecialRow superclass contains this virtual method.
00094          * @return always zero.
00095          */
00096         virtual int write(const cell_t* buf, int offset, int len);
00097 
00098         /**
00099          * This method does nothing, but we need to implement it since the
00100          * abstract SpecialRow superclass contains this virtual method.
00101          */
00102         virtual int read(cell_t* buf, int offset, int len);
00103 };
00104 
00105 #endif /* FIRSTROW_HPP_ */