#if !defined(CIPRES_NEXUS_READER_HPP) #define CIPRES_NEXUS_READER_HPP #include "phycas/phycas.h" #include #include #include "boost/shared_ptr.hpp" #include "ncl/nxs_reader.hpp" #include "CipresCommlib/CipresNativeC.h" class PhoTaxaManager; class PhoTreesManager; class PhoCharactersManager; class FullTreeDescription; class NxsToken; class CipresNexusReader: public NxsReader { public: CipresNexusReader(const int blocksToRead); void NexusError(const std::string &msg, file_pos pos, unsigned line, unsigned col, CmdResult resCode, NxsBlock* b = NULL); void ReadNxsFilePath(NxsInFilePath & filePath); void ReadStringAsNexus(const std::string & s); void ReadFilePath(const std::string &filePath) { NxsInFilePath fp(filePath); ReadNxsFilePath(fp); } boost::shared_ptr GetTaxaManager() const { return phoTaxaMgr; } boost::shared_ptr GetTreesManager() const { return phoTreesMgr; } boost::shared_ptr GetCharactersManager() const { return phoCharactersMgr; } const std::vector & GetTrees() const; private: void ReadNxsTokenStream(NxsToken & tokenStream); boost::shared_ptr phoTaxaMgr; boost::shared_ptr phoTreesMgr; boost::shared_ptr phoCharactersMgr; std::string errorMsg; file_pos filePositionOfError; long lineOfError; long columnOfError; std::stack fileStack; }; namespace ncl { class NxsDiscreteMatrix; } namespace CipresNative { class DiscreteMatrix; } CIPR_Matrix toCIPRMatrix(const ncl::NxsDiscreteMatrix & inMatrix, const bool verbose); void freeCIPRMatrix(CIPR_Matrix & mat); CipresNative::DiscreteMatrix *createNativeDiscreteMatrix(const CipresNexusReader & nexusReader, unsigned int charBlockIndex); std::string incrementTreesTaxaIndices(const std::string & zeroBasedNewick); #endif