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

#ifndef tools_sg_action
#define tools_sg_action

#include "../S_STRING"
#include "../scast"

#include <ostream>

namespace tools {
namespace sg {

class action {
public:
  TOOLS_SCLASS(tools::sg::action)
public:
  virtual void* cast(const std::string& a_class) const {
    if(void* p = cmp_cast<action>(this,a_class)) return p;
    return 0;
  }
  virtual const std::string& s_cls() const = 0;
public:
  action(std::ostream& a_out)
  :m_out(a_out)
  {
  }
  virtual ~action(){
  }
protected:
  action(const action& a_from)
  :m_out(a_from.m_out)
  {
  }
  action& operator=(const action&){return *this;}
public:
  std::ostream& out() const {return m_out;}
protected:
  std::ostream& m_out;
};

#include "../HEADER"

#define TOOLS_ACTION(a__class,a__sclass,a__parent)\
  TOOLS_HEADER(a__class,a__sclass,a__parent)\
  virtual tools::sg::action* copy() const {return new a__class(*this);}

#define TOOLS_T_ACTION(a__T,a__class,a__sclass,a__parent)\
  TOOLS_T_HEADER(a__T,a__class,a__sclass,a__parent)\
  virtual tools::sg::action* copy() const {return new a__class(*this);}

#define TOOLS_ACTION_NO_COPY(a__class,a__sclass,a__parent)\
  TOOLS_HEADER(a__class,a__sclass,a__parent)

}}

#endif
