00001 // Copyright (C) 1999-2003 Paul O. Lewis 00002 // 00003 // This file is part of NCL (Nexus Class Library) version 2.0. 00004 // 00005 // NCL is free software; you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation; either version 2 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // NCL is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with NCL; if not, write to the Free Software Foundation, Inc., 00017 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 // 00019 00020 #ifndef NCL_NXSDATABLOCK_H 00021 #define NCL_NXSDATABLOCK_H 00022 00023 #include "ncl/nxscharactersblock.h" 00028 class NxsDataBlock 00029 : public NxsCharactersBlock 00030 { 00031 public: 00032 NxsDataBlock(NxsTaxaBlockAPI *tb, NxsAssumptionsBlockAPI *ab); 00033 00034 /*--------------------------------------------------------------------------------------- 00035 | Results in aliasing of the taxa, assumptionsBlock blocks! 00036 */ 00037 NxsDataBlock & operator=(const NxsDataBlock &other) 00038 { 00039 Reset(); 00040 CopyBaseBlockContents(static_cast<const NxsBlock &>(other)); 00041 CopyTaxaBlockSurrogateContents(other); 00042 CopyCharactersContents(other); 00043 return *this; 00044 } 00045 00046 virtual NxsDataBlock * Clone() const 00047 { 00048 NxsDataBlock * a = new NxsDataBlock(taxa, assumptionsBlock); 00049 *a = *this; 00050 return a; 00051 } 00052 00053 void TransferTo(NxsCharactersBlock &charactersblock); 00054 void Reset(); 00055 private: 00056 friend class MultiFormatReader; 00057 00058 }; 00059 00060 typedef NxsDataBlock DataBlock; 00061 00062 class NxsDataBlockFactory 00063 :public NxsBlockFactory 00064 { 00065 public: 00066 virtual NxsDataBlock * GetBlockReaderForID(const std::string & id, NxsReader *reader, NxsToken *token); 00067 }; 00068 00069 #endif