#include "phycas/phycas.h" #if defined(ALL_BIND_USING_CPPS_IN_ONE_FILE) # define INCLUDED_FROM_OTHER_BIND_USING_FILE # if defined(_MSC_VER) //#warning not allowed in VC7 # include "ncl/characters/nxs_characters_block.cpp" # include "ncl/command/nxs_command_output.cpp" # else # warning using macro to include nxs_charcters_block.cpp TEMPORARY HACK! # include "ncl/characters/nxs_characters_block.cpp" # warning using macro to include nxs_command_output.cpp TEMPORARY HACK! # include "ncl/command/nxs_command_output.cpp" # endif #endif #include "phycas/modules/scm/scm.hpp" #include "cipres_services/tree_merge/tree_merge_i.hpp" #if ! defined(NDEBUG) # include using std::cout; using std::endl; #endif using std::string; ::CipresIDL_api1::Tree * CipresIDL_api1_TreeMerge_i::mergeTrees (const CipresIDL_api1::TreeSeq & trees) ACE_THROW_SPEC ((CORBA::SystemException)) { typedef std::set SetCorbaLong; SetCorbaLong indices; VecString strVec; const UInt nTrees = trees.length(); strVec.reserve(nTrees); for (UInt i = 0; i < nTrees; ++i) { const CipresIDL_api1::Tree & treeI = trees[i]; string tree_i(treeI.m_newick.in()); strVec.push_back(tree_i); //shouldn't need to copy strings here const UInt nLeaves = treeI.m_leafSet.length(); for (UInt j = 0; j < nLeaves; ++j) indices.insert(treeI.m_leafSet[j]); # if ! defined(NDEBUG) cout << "Tree " << i << ' '<< tree_i << endl; # endif } const std::string & s = NewickSCM(strVec); CipresIDL_api1::Tree_var t = new CipresIDL_api1::Tree; t->m_newick = CORBA::string_dup(s.c_str()); t->m_name = CORBA::string_dup("MergedTree"); t->m_score.noScore(0.0); t->m_leafSet.length(indices.size()); SetCorbaLong::const_iterator indIt = indices.begin(); for (UInt k = 0; indIt != indices.end(); ++k, ++indIt) t->m_leafSet[k] = *indIt; return t._retn(); } char * CipresIDL_api1_TreeMerge_i::getUIXml() ACE_THROW_SPEC ((CORBA::SystemException)) { return CORBA::string_dup(""); } CORBA::Boolean CipresIDL_api1_TreeMerge_i::execute (const char * command, CORBA::String_out display) ACE_THROW_SPEC ((CORBA::SystemException)) { return CORBA::Boolean(true); } // -*- C++ -*- // // $Id: tree_merge_i.cpp,v 1.2 2005/06/22 20:31:30 mholder Exp $ // **** Code generated by the The ACE ORB (TAO) IDL Compiler **** // TAO and the TAO IDL Compiler have been developed by: // Center for Distributed Object Computing // Washington University // St. Louis, MO // USA // http://www.cs.wustl.edu/~schmidt/doc-center.html // and // Distributed Object Computing Laboratory // University of California at Irvine // Irvine, CA // USA // http://doc.ece.uci.edu/ // and // Institute for Software Integrated Systems // Vanderbilt University // Nashville, TN // USA // http://www.isis.vanderbilt.edu/ // // Information about TAO is available at: // http://www.cs.wustl.edu/~schmidt/TAO.html