//////////////////////////////////////////////////////////////////////////
// ComputeTriangs.hh
// produced: 25 Nov 1999 jr
/////////////////////////////////////////////////////////////////////////
#ifndef COMPUTETRIANGS_HH
#define COMPUTETRIANGS_HH

#include <iostream>
#include <fstream>

#include "Global.hh"
#include "Message.hh"
#include "ConfData.hh"
#include "Options.hh"
#include "Cache.hh"

#include "SimplicialComplex.hh"
#include "PointConfiguration.hh"
#include "Chirotope.hh"
#include "Symmetry.hh"
#include "RegularityCheck.hh"
#include "Signal.hh"

namespace topcom {

  class ComputeTriangs {
  private:
    ConfData                       _confdata;
    Options                        _options;
    const Cache<SimplicialComplex> _global_triangcache;
    Cache<SimplicialComplex>       _local_triangcache;
  public:
    inline ComputeTriangs() :
      _confdata(Options()),
      _options(),
      _global_triangcache(),
      _local_triangcache() {
      if (CommandlineOptions::lp_solver_needed()) {
	
	// some solvers need initialization of global constants etc.:
	RegularityCheck::init();
      }
    }
    inline ComputeTriangs(const unsigned int flags) :
      _confdata(Options(flags)),
      _options(flags),
      _global_triangcache(),
      _local_triangcache() {
      if (CommandlineOptions::lp_solver_needed()) {

	// some solvers need initialization of global constants etc.:
	RegularityCheck::init();
      }
    }
    
    inline ~ComputeTriangs() {
      if (CommandlineOptions::lp_solver_needed()) {
	
	// some solvers need termination of global constants etc.:
	RegularityCheck::term();
      }
    }
    int run();
    Message& write_header(Message&) const;
    std::istream& read_input(std::istream&);
    void preprocess_data();
    const std::pair<size_type, SimplicialComplex> findmin_by_extension();
    const size_type enumerate_by_extension();
    const size_type enumerate_by_flips();
    const bool seed_is_nonsubregular();
    const bool seed_is_nonsupregular();
    const bool seed_is_nonregularcomp();
    const bool seed_heuristic_flipping_to_regular();
  };
  
}; // namespace topcom

#endif

// eof ComputeTriangs.hh
