// This file is part of BULL, a program for phylogenetic simulations // most of the code was written by Mark T. Holder. // It is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. // // Some of the code is from publically available source by Paul Lewis, Ziheng Yang, // John Huelsenbeck, David Swofford , and others (as noted in the code). // In fact the main structure of the program was created by modifying Paul Lewis' // basiccmdline.cpp from his NCL // // This code was used in Mark's dissertation, some changes were made in order to // get it to compile on gcc. It is possible that this porting introduced bugs (very // little debugging has been done on UNIX platforms). I would suggest checking // the simulator by generating data on trees with short branches, etc. // This file is part of BULL, a program for phylogenetic simulations // most of the code was written by Mark T. Holder. // It is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. // // Some of the code is from publically available source by Paul Lewis, Ziheng Yang, // John Huelsenbeck, David Swofford , and others (as noted in the code). // In fact the main structure of the program was created by modifying Paul Lewis' // basiccmdline.cpp from his NCL // // This code was used in Mark's dissertation, some changes were made in order to // get it to compile on gcc. It is possible that this porting introduced bugs (very // little debugging has been done on UNIX platforms). I would suggest checking // the simulator by generating data on trees with short branches, etc. #ifndef __NEXUS_H #define __NEXUS_H #if defined HAVE_CONFIG_H && HAVE_CONFIG_H # include #endif class Nexus; // // NexusBlock class // class NexusBlock { friend class Nexus; protected: bool isEmpty; Nexus* nexus; NexusBlock* next; std::string id; virtual void Read( NexusToken& token ) = 0; virtual void Reset() = 0; public: mutable std::string errormsg; NexusBlock(); virtual ~NexusBlock(); void SetNexus( Nexus* nxsptr ); std::string GetID(); bool IsEmpty(); virtual int CharLabelToNumber( std::string s ); virtual int TaxonLabelToNumber( std::string s ); virtual void SkippingCommand( std::string commandName ); virtual void Report(std::ostream& out ) = 0; }; // // Nexus class // class Nexus { protected: NexusBlock* blockList; public: Nexus(); virtual ~Nexus(); bool BlockListEmpty(); void Add( NexusBlock* newBlock ); void Detach( NexusBlock* newBlock ); void Execute( NexusToken& token ); virtual void DebugReportBlock( NexusBlock& nexusBlock ); char* NCLNameAndVersion(); char* NCLCopyrightNotice(); char* NCLHomePageURL(); // hooks implemented as pure virtual functions virtual void ExecuteStarting() = 0; virtual void ExecuteStopping() = 0; virtual void EnteringBlock( std::string blockName ) = 0; virtual void OutputComment( std::string comment ) = 0; virtual void NexusError(const std::string& msg, std::istream::pos_type pos, long line, long col ) = 0; virtual void SkippingBlock(const std::string & blockName ) const = 0; }; #endif