Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
SetAbstraction.hpp 978 B
/*
 * SetAbstraction.hpp
 *
 *  Created on: 11. 7. 2017
 *	  Author: Jan Travnicek
 */

#ifndef _SET_ABSTRACTION_HPP_
#define _SET_ABSTRACTION_HPP_

#include <alib/memory>

#include <abstraction/AnyaryOperationAbstraction.hpp>
#include <abstraction/ValueOperationAbstraction.hpp>

namespace abstraction {

template < class ParamType >
class SetAbstraction : virtual public AnyaryOperationAbstraction < ParamType >, virtual public ValueOperationAbstraction < ext::set < ParamType > > {
public:
	std::shared_ptr < abstraction::Value > run ( ) override {
		ext::set < ParamType > theSet;
		for ( const std::pair < std::shared_ptr < abstraction::Value >, bool > & param : this->getParams ( ) ) {
			theSet.insert ( abstraction::retrieveValue < ParamType > ( param.first, param.second ) );
		}

		return std::make_shared < abstraction::ValueHolder < ext::set < ParamType > > > ( std::move ( theSet ), true );
	}

};

} /* namespace abstraction */

#endif /* _SET_ABSTRACTION_HPP_ */