libpsynth 0.2.1
/home/raskolnikov/dev/psynth/trunk/src/psynth/sound/apply_operation.hpp
Go to the documentation of this file.
00001 
00012 /*
00013  *  Copyright (C) 2010 Juan Pedro Bolivar Puente
00014  *
00015  *  This file is part of Psychosynth.
00016  *   
00017  *  Psychosynth is free software: you can redistribute it and/or modify
00018  *  it under the terms of the GNU General Public License as published by
00019  *  the Free Software Foundation, either version 3 of the License, or
00020  *  (at your option) any later version.
00021  *
00022  *  Psychosynth is distributed in the hope that it will be useful,
00023  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00024  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00025  *  GNU General Public License for more details.
00026  *
00027  *  You should have received a copy of the GNU General Public License
00028  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
00029  *
00030  */
00031 
00032 /*
00033  *  Copyright 2005-2007 Adobe Systems Incorporated
00034  * 
00035  *  Use, modification and distribution are subject to the Boost
00036  *  Software License, Version 1.0. (See accompanying file
00037  *  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt).
00038  */
00039 
00040 #ifndef PSYNTH_SOUND_APPLY_OPERATION_HPP
00041 #define PSYNTH_SOUND_APPLY_OPERATION_HPP
00042 
00043 #include <psynth/sound/apply_operation_base.hpp>
00044 #include <psynth/sound/variant.hpp>
00045 
00046 #ifndef PSYNTH_REDUCE_CODE_BLOAT
00047 
00048 namespace psynth
00049 {
00050 namespace sound
00051 {
00052 
00058 template <typename Types, typename UnaryOp> PSYNTH_FORCEINLINE
00059 typename UnaryOp::result_type apply_operation (variant<Types>& arg, UnaryOp op)
00060 {
00061     return apply_operation_base<Types>(arg._bits, arg._index ,op);
00062 }
00063 
00069 template <typename Types, typename UnaryOp> PSYNTH_FORCEINLINE
00070 typename UnaryOp::result_type apply_operation (
00071     const variant<Types>& arg, UnaryOp op)
00072 {
00073     return apply_operation_basec<Types>(arg._bits, arg._index ,op);
00074 }
00075 
00081 template <typename Types1, typename Types2, typename BinaryOp> PSYNTH_FORCEINLINE
00082 typename BinaryOp::result_type apply_operation (
00083     const variant<Types1>& arg1, const variant<Types2>& arg2, BinaryOp op)
00084 {    
00085     return apply_operation_base<Types1,Types2>(
00086         arg1._bits, arg1._index, arg2._bits, arg2._index, op);
00087 }
00088 
00089 } /* namespace sound */
00090 } /* namespace psynth */
00091 
00092 #else
00093    
00094 #include "reduce.hpp"
00095 
00096 #endif
00097 
00098 #endif /* PSYNTH_SOUND_APPLY_OPERATION */