Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
ValuePrinterAbstraction.hpp
Go to the documentation of this file.
1
6#pragma once
7
8#include <memory>
9
12
13#include <ext/ostream>
14
15namespace abstraction {
16
17template < class ParamType >
18class ValuePrinterAbstraction : virtual public NaryOperationAbstraction < ParamType, ext::ostream & >, virtual public ValueOperationAbstraction < void > {
19public:
21
22 std::shared_ptr < abstraction::Value > run ( ) const override {
23 const std::shared_ptr < abstraction::Value > & firstParam = std::get < 0 > ( this->getParams ( ) );
24 const std::shared_ptr < abstraction::Value > & secondParam = std::get < 1 > ( this->getParams ( ) );
25
26 retrieveValue < ext::ostream & > ( secondParam ) << retrieveValue < const ParamType & > ( firstParam ) << std::endl;
27 return std::make_shared < abstraction::Void > ( );
28 }
29};
30
31template < >
32class ValuePrinterAbstraction < void > : virtual public NaryOperationAbstraction < >, virtual public ValueOperationAbstraction < void > {
33public:
35
36 std::shared_ptr < abstraction::Value > run ( ) const override {
37 return std::make_shared < abstraction::Void > ( );
38 }
39};
40
41} /* namespace abstraction */
42
const ext::array< std::shared_ptr< abstraction::Value >, NumberOfParams > & getParams() const
Definition: NaryOperationAbstraction.hpp:21
Definition: NaryOperationAbstraction.hpp:77
Definition: ValueOperationAbstraction.hpp:19
std::shared_ptr< abstraction::Value > run() const override
Definition: ValuePrinterAbstraction.hpp:36
Definition: ValuePrinterAbstraction.hpp:18
std::shared_ptr< abstraction::Value > run() const override
Definition: ValuePrinterAbstraction.hpp:22
Definition: AlgorithmAbstraction.hpp:11