#ifndef DIST_TAB_H_
#define DIST_TAB_H_

#include <map>
#include <string>

class Distribution;

/** 
 * A DistTab is a table which can be used to look up distributions by
 * name.
 * @short Distribution table
 * @see Distribution
 */
class DistTab {
  std::map<const std::string, const Distribution*> _table;
public:
  /**
   * Constructor.  A newly constructed DistTab will
   * automatically contain the standard JAGS distributions
   */
  DistTab();
  /** 
   * Destructor. The memory associated with all the distributions
   * contained in the DistTab is freed.
   */
  ~DistTab();
  /**
   * Inserts a distribution into the table.  
   * @return logical value indicating success.  The insertion will
   * fail if a distribution with the same name is already in the 
   * DistTab.
   * @param dist Pointer to the distribution to insert, which should
   * be dynamically allocated. The DistTab is responsible for freeing
   * the memory allocated to dist.
   */
  bool insert(Distribution const *dist);
  /** 
   * Removes a distribution by name and frees the associated
   * memory.
   * 
   * With a combination of erase and insert calls, you can
   * replace the standard JAGS distribuutions.
   *
   * @return a logical value indicating success.  The removal
   * will fail if there is no distribution with the given name
   * in the DistTab.
   */
  bool erase(std::string const &name);
  /**
   * Finds a distribution by name 
   * @return a pointer to the distribution or 0 if it was not found.
   */
  Distribution const *find(std::string const &name) const;
};

#endif /* DIST_TAB_H_ */


syntax highlighted by Code2HTML, v. 0.9.1