/*
 * Project: MoleCuilder
 * Description: creates and alters molecular systems
 * Copyright (C)  2013 Frederik Heber. All rights reserved.
 * 
 *
 *   This file is part of MoleCuilder.
 *
 *    MoleCuilder is free software: you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation, either version 2 of the License, or
 *    (at your option) any later version.
 *
 *    MoleCuilder is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with MoleCuilder.  If not, see .
 */
/*
 * ActionQueue.cpp
 *
 *  Created on: Aug 16, 2013
 *      Author: heber
 */
// include config.h
#ifdef HAVE_CONFIG_H
#include 
#endif
#include "CodePatterns/MemDebug.hpp"
#include "Actions/ActionQueue.hpp"
#include "CodePatterns/Assert.hpp"
#include "CodePatterns/IteratorAdaptors.hpp"
#include "CodePatterns/Singleton_impl.hpp"
#include 
using namespace MoleCuilder;
ActionQueue::ActionQueue()
{}
ActionQueue::~ActionQueue()
{}
Action* ActionQueue::getActionByName(const std::string name)
{
  return AR.getActionByName(name);
}
bool ActionQueue::isActionKnownByName(const std::string name) const
{
  return AR.isActionPresentByName(name);
}
int ActionQueue::getLastPosition(const std::string &MenuName) const
{
  return AR.getLastPosition(MenuName);
}
const ActionTrait& ActionQueue::getActionsTrait(const std::string name) const
{
  // this const_cast is just required as long as we have a non-const getActionByName
  const Action * const action = const_cast(this)->getActionByName(name);
  return action->Traits;
}
const ActionQueue::ActionTokens_t ActionQueue::getListOfActions() const
{
  ActionTokens_t returnlist;
  returnlist.insert(
      returnlist.end(),
      MapKeyConstIterator(AR.getBeginIter()),
      MapKeyConstIterator(AR.getEndIter()));
  return returnlist;
}
CONSTRUCT_SINGLETON(ActionQueue)