// Copyright (C) 2010, Guy Barrand. All rights reserved.
// See the file tools.license for terms.

#ifndef tools_rroot_ifac
#define tools_rroot_ifac

#include <string>
#include <map>
#include <ostream>

namespace tools {
namespace rroot {
  class iro;
}}

namespace tools {
namespace rroot {

class ifac {
public:
  typedef std::map<char,void*> args;
public:
  virtual ~ifac(){}
public:
  virtual std::ostream& out() const = 0;
  virtual iro* create(const std::string& a_class,const args&) = 0;
public:
  static void* find_args(const args& a_args,char a_key) {
    std::map<char,void*>::const_iterator it = a_args.find(a_key);
    if(it==a_args.end()) return 0;
    return (*it).second;
  }
  static char arg_class() {return 'C';}

  static std::string* arg_class(const args& a_args) {
    void* p = ifac::find_args(a_args,ifac::arg_class());
    if(!p) return 0;
    return (std::string*)p;
  }
};

}}

#endif
