/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 * 
 * transformation.cpp
 *
 * Author: pgess <v.melnychenko@xreate.org>
 * Created on March 27, 2017, 4:04 PM
 */

#include "transformations.h"

namespace xreate {    namespace compilation {

std::list<Transformer*>
TransformationsManager::getRelevantTransformers(const Expression& expression){
    std::list<Transformer*> result;

    for (auto tag: expression.tags) {
        if (__subscriptions.count(tag.first)){
            auto handlers = __subscriptions.equal_range(tag.first);

            for (auto handler = handlers.first; handler != handlers.second; ++handler){
                result.push_back(__transformers[handler->second]);
            }
        }
    }

    return result;
}

} } //namespace xreate
