ecFlow's documentation is now on readthedocs!
python client suite navigator
#!/usr/bin/env python
import sys, os
from ecflow import *
#path = "/home/ma/emos/def/o/def"
#sys.path.append(path)
#from ecf import *
client = Client(os.getenv('ECF_HOST', "localhost"), 
                os.getenv('ECF_PORT', "31415"))
client.ch_register(False, [ "test", "suite"])
client.sync_local()
defs = client.get_defs()
def process(node):
    if isinstance(node, ecflow.Task): print "task",
    elif isinstance(node, ecflow.Family): print "family",
    elif isinstance(node, ecflow.Suite): print "suite",
    elif isinstance(node, ecflow.Alias): print "alias",
    else: print "???",
    print node.get_abs_node_path(), node.get_state(), 
        "T:", node.get_trigger(), "C:", node.get_complete()
    for item in node.nodes: process(item)

for item in defs.suites: process(item)

C++ client, suite registration and navigation
#include <ClientInvoker.hpp>
#include <Suite.hpp>
#include <Defs.hpp>
#include <string>
#include <vector>
void printer(node_ptr n, int ind = 0, int num = 0);
const char* get_var(const char* name, const char* def);

int main(int argc, char**) {
  ClientInvoker *client_ = new ClientInvoker(
      get_var("ECF_HOST", "localhost"),
      get_var("ECF_PORT", "31415"));
  client_->set_retry_connection_period(1);
  client_->set_throw_on_error(true);
  char const *x[] = {"o", "bgen"};
  std::vector<std::string> s(x, x + sizeof(x)/sizeof(*x));
  client_->ch_register(false, s);
  client_->sync_local();
  if (client_->defs()) {
    const std::vector<suite_ptr>& suites_vec = client_->defs()->suiteVec();
    for (size_t i = 0; i < suites_vec.size(); ++i) { 
        printer(suites_vec[i]); }}
  delete client_; 
}


C++ client, node navigation
#include <Node.hpp>
#include <NodeAttr.hpp>
#include <NodeContainer.hpp>
#include <Expression.hpp>
void process_ast(std::string kind, Expression* exp, int ind) {
  if (exp) std::cout << std::string(ind, ' ') 
    << kind << "... "
    << exp->expression() << "\n"; }

void printer(node_ptr n, int ind = 0, int num = 0) {
  std::string kind = n->isTask() ? "task" : n->isFamily() ? "family" :
    n->isSuite() ? "suite" : "???";
  std::cout << std::string(ind, ' ') << "node " << n->name()
    << " type " << kind << " state " 
    << NState::toString(n->state()) << "\n";
  process_ast("trigger",  n->get_trigger(),  ind);
  process_ast("complete", n->get_complete(), ind);
  NodeContainer* load = n.get()->isNodeContainer();
  if (load) {
    std::vector<node_ptr> nodes_vec;
    load->immediateChildren(nodes_vec);
    for (size_t j = 0; j < nodes_vec.size(); ++j) {
      printer(nodes_vec[j], ind, num+1); }}}


#include <string>
#include <vector>
#include <ClientInvoker.hpp>

const char* get_var(const char*name, const char* def) {
  const char * var = getenv(name);
  if (var == NULL) return def;
  return var;
}