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 #include "ncl/nxsdatablock.h" 00021 00025 NxsDataBlock::NxsDataBlock( 00026 NxsTaxaBlockAPI *tb, /* the taxa block object for storing taxon labels */ 00027 NxsAssumptionsBlockAPI *ab) /* the assumptions block object for storing exsets */ 00028 : NxsCharactersBlock(tb, ab) 00029 { 00030 id = "DATA"; 00031 Reset(); 00032 } 00033 00038 void NxsDataBlock::Reset() 00039 { 00040 NxsCharactersBlock::Reset(); 00041 newtaxa = true; 00042 } 00043 00048 void NxsDataBlock::TransferTo( 00049 NxsCharactersBlock &charactersblock) /* the NxsCharactersBlock object that will receive all the data from this object */ 00050 { 00051 charactersblock.Reset(); 00052 charactersblock.Consume((NxsCharactersBlock &)(*this)); 00053 } 00054 00055 NxsDataBlock *NxsDataBlockFactory::GetBlockReaderForID(const std::string & idneeded, NxsReader *reader, NxsToken *) 00056 { 00057 if (reader == NULL || idneeded != "DATA") 00058 return NULL; 00059 NxsDataBlock * nb = new NxsDataBlock(NULL, NULL); 00060 nb->SetCreateImpliedBlock(true); 00061 nb->SetImplementsLinkAPI(true); 00062 return nb; 00063 }