/* * --- GSMP-COPYRIGHT-NOTE-BEGIN --- * * This copyright note is auto-generated by ./scripts/Create-CopyPatch. * Please add additional copyright information _after_ the line containing * the GSMP-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by * the ./scripts/Create-CopyPatch script. Do not edit this copyright text! * * GSMP: dam/include/template/State.tcc * General Sound Manipulation Program is Copyright (C) 2000 - 2004 * Valentin Ziegler and René Rebe * * This program 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; version 2. A copy of the GNU General * Public License can be found in the file LICENSE. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANT- * ABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * --- GSMP-COPYRIGHT-NOTE-END --- */ #ifndef DAM__STATE_TMPL__ #error "This file is included by State.hh." #error "Include that file instead." #endif namespace DAM { template Automaton ::Automaton (Master* i_master) : m_logger (this) { m_master = i_master; current_state = STATES::start; state_changing = false; Q_LOG(m_logger) << "states from " << FilteredTypeName () << " with master " << m_master << " current is " << STATES::FullState (current_state).name << std::endl; } template Automaton ::~Automaton () { Terminated (m_master); } template void Automaton ::SetState (state_id id) { if (m_logger.DoWarn ()) if (state_changing) Q_WARN(m_logger) << "SetState ( " << STATES::FullState (id).name << " ) called while switching to state " << STATES::FullState (current_state).name << std::endl; state_changing = true; current_state = id; Q_LOG(m_logger) << "switching to state " << STATES::FullState (current_state).name << std::endl; StateChanged (m_master, current_state ); state_changing = false; } template void Automaton ::Notify (notif_id id, const NotificationData& data) { Q_LOG(m_logger)<< "sending notification " << STATES::FullNotification (id).name << std::endl; Notification (m_master, id, data); } template bool Automaton ::Ask (query_id id, const QueryData& data) { Q_LOG(m_logger) << "request for " << STATES::FullQuery (id).name << std::endl; bool result = Question (m_master, id, data); Q_LOG(m_logger) << "result for " << STATES::FullQuery (id).name << " is " << result << std::endl; return result; } } // end namespace DAM