#ifndef __cmt_database_h__
#define __cmt_database_h__

#include "cmt_vector.h"

#include "cmt_branch.h"
#include "cmt_constituent.h"
#include "cmt_fragment.h"
#include "cmt_group.h"
#include "cmt_language.h"
#include "cmt_pattern.h"
#include "cmt_tag.h"
#include "cmt_use.h"
#include "cmt_symbol.h"

class Database
{
public:

  typedef enum
  {
    key_branch      = 0x1,
    key_constituent = 0x2,
    key_fragment    = 0x4,
    key_group       = 0x8,
    key_language    = 0x10,
    key_pattern     = 0x20,
    key_selector    = 0x40,    // obsolete
    key_tag         = 0x80,
    key_use         = 0x100,
    key_symbol      = 0x200,
    key_all         = 0xFFFF
  } keys;

  static Database& instance ();

  static void dump (const cmt_string& title, keys key_set = key_all);
  static void clear ();

  static Branch::BranchVector& branches ();
  static Constituent::ConstituentVector& constituents ();
  static Fragment::FragmentVector& fragments ();
  static Group::GroupVector& groups ();
  static Language::LanguageVector& languages ();
  static Pattern::PatternVector& patterns ();
  static Tag::TagVector& all_tags ();
  static Tag::TagPtrVector& tags ();
  static Use::UseVector& all_uses ();
  static Use::UsePtrVector& uses ();
  static Symbol::SymbolVector& symbols ();

private:

  Database ();

  Branch::BranchVector m_branches;
  Constituent::ConstituentVector m_constituents;
  Fragment::FragmentVector m_fragments;
  Group::GroupVector m_groups;
  Language::LanguageVector m_languages;
  Pattern::PatternVector m_patterns;
  Tag::TagVector m_all_tags;
  Tag::TagPtrVector m_tags;
  Use::UseVector m_all_uses;
  Use::UsePtrVector m_uses;
  Symbol::SymbolVector m_symbols;

};

#endif
