#ifndef GOBJDEBUG01_H
#define GOBJDEBUG01_H

#include <string>
#include <vector>
using namespace std;

#include <typedefs.h>

class gobj;
class gobjdebug01;

/*!
\brief Log calls to gobj::draw().

Turn on and off the code by commenting in/out the header files.
See gobjdebug.h .
*/
class gobjdebug01
{
public:

  static gobjdebug01* global;

  /** Set the current debug function. */
  void set()
    { global = this; }

  virtual void eval(gobj* x) {};
  virtual ~gobjdebug01() {}

};

class gobjdebug01list;

/*!
\brief Logs calls to a vector of strings.
\verbatim
#ifdef GOBJDEBUG01_H
  vector<string> & vs(gobjdebug01list::global_list);
  cout << SHOW(vs.size()) << endl;

  for (uint i=0; i<vs.size(); ++i)
    cout << "*" << vs[i] << "*" << endl;
#endif
\endverbatim
*/
class gobjdebug01list : public gobjdebug01
{
public:

  static vector<string> global_list;
  static gobjdebug01list mylist;

  /** Get the global list as a string each entry on its own line. */
  static stringc global_list_get();

  void eval(gobj* x);
};

#undef GOBJDEBUGCODE
#define GOBJDEBUGCODE assert(gobjdebug01::global);\
  gobjdebug01::global->eval(this);

#include <message.h>


/*!
\brief Log gobj calls to gobjlog.txt. 

Uses stack unwinding/scope of variable, so put in an explicit temporary.
\verbatim
{ ...
  gobjlog log;
  x.draw();
  ...
}
*/
class gobjlog
{
public:

  /** Clears the current list. */
  gobjlog();

  /** Appends calls to gobjlog.txt. */
  ~gobjlog();

};




#endif



