Example #1
0
bool get_omii_gridsam_contexts(saga::session s, std::vector<saga::context>& ctxs_)
{
    std::vector<saga::context> ctxs(s.list_contexts());
    std::vector<saga::context>::iterator end = ctxs.end();
    for (std::vector<saga::context>::iterator it = ctxs.begin(); it != end; ++it) 
    {
        if (!(*it).attribute_exists(saga::attributes::context_type))
            continue;

        if ("omii_gridsam" == (*it).get_attribute(saga::attributes::context_type))
            ctxs_.push_back(*it);
    }
    return !ctxs_.empty();
}
  void filesystem_adaptor::dump_session (const std::string   & msg, 
                                         const saga::session & s)
  {
    std::cout << " ---------------------------- " << std::endl;
    std::cout << " -- " << msg << " -- "          << std::endl;
    std::cout << " ---------------------------- " << std::endl;

    std::vector <saga::context> cs = s.list_contexts ();
    std::cout << " found " << cs.size () << " contexts " << std::endl;

    for ( unsigned int i = 0; i < cs.size (); i++ )
    {
      std::cout << "  " << i << ": " << cs[i].get_attribute ("Type") << std::endl;
    }

    std::cout << " ---------------------------- " << std::endl;
  }