// // ******************************************************************** // * License and Disclaimer * // * * // * The Geant4 software is copyright of the Copyright Holders of * // * the Geant4 Collaboration. It is provided under the terms and * // * conditions of the Geant4 Software License, included in the file * // * LICENSE and available at http://cern.ch/geant4/license . These * // * include a list of copyright holders. * // * * // * Neither the authors of this software system, nor their employing * // * institutes,nor the agencies providing financial support for this * // * work make any representation or warranty, express or implied, * // * regarding this software system or assume any liability for its * // * use. Please see the license in the file LICENSE and URL above * // * for the full disclaimer and the limitation of liability. * // * * // * This code implementation is the result of the scientific and * // * technical work of the GEANT4 collaboration. * // * By using, copying, modifying or distributing the software (or * // * any work based on the software) you agree to acknowledge its * // * use in resulting scientific publications, and indicate your * // * acceptance of all terms of the Geant4 Software license. * // ******************************************************************** // /** * \file c2_factory.hh * \brief Provides a factory class to avoid an infinite number of template * \brief declarations. * * \author Created by R. A. Weller and Marcus H. Mendenhall on 7/9/05. * \author 2005 Vanderbilt University. * * \version c2_factory.hh,v 1.13 2008/05/22 12:45:19 marcus Exp */ // #ifndef __has_c2_factory_hh #define __has_c2_factory_hh 1 #include "c2_function.hh" /// \brief a factory of pre-templated c2_function generators /// /// do \code /// typedef c2_ptr c2_p; /// static c2_factory c2; /// c2_p f=c2.sin(); /// \endcode /// \note The factory class doesn't contain any data. /// It can be statically instantiated at the top of a file, /// and used everywhere inside, or even instantiated in your project's top-level /// include file. /// \see c2_math_factory /// \ingroup factories template class c2_factory { public: /// make a *new object static c2_classic_function_p& classic_function(float_type (*c_func)(float_type)) { return *new c2_classic_function_p(c_func); } /// make a *new object static c2_plugin_function_p& plugin_function() { return *new c2_plugin_function_p(); } /// make a *new object static c2_plugin_function_p& plugin_function(c2_function& f) { return *new c2_plugin_function_p(f); } /// make a *new object static c2_const_plugin_function_p& const_plugin_function() { return *new c2_const_plugin_function_p(); } /// make a *new object static c2_const_plugin_function_p& const_plugin_function(const c2_function& f) { return *new c2_const_plugin_function_p(f); } /// make a *new object static c2_scaled_function_p& scaled_function(const c2_function& outer, float_type scale) { return *new c2_scaled_function_p(outer, scale); } /// make a *new object static c2_cached_function_p& cached_function(const c2_function& func) { return *new c2_cached_function_p(func); } /// make a *new object static c2_constant_p& constant(float_type x) { return *new c2_constant_p(x); } /// make a *new object static interpolating_function_p& interpolating_function() { return *new interpolating_function_p(); } /// make a *new object static lin_log_interpolating_function_p& lin_log_interpolating_function() { return *new lin_log_interpolating_function_p(); } /// make a *new object static log_lin_interpolating_function_p& log_lin_interpolating_function() { return *new log_lin_interpolating_function_p(); } /// make a *new object static log_log_interpolating_function_p& log_log_interpolating_function() { return *new log_log_interpolating_function_p(); } /// make a *new object static arrhenius_interpolating_function_p& arrhenius_interpolating_function() { return *new arrhenius_interpolating_function_p(); } /// make a *new object static c2_connector_function_p& connector_function(float_type x0, const c2_function& f0, float_type x2, const c2_function& f2, bool auto_center, float_type y1) { return *new c2_connector_function_p(x0, f0, x2, f2, auto_center, y1); } /// make a *new object static c2_connector_function_p& connector_function(const c2_fblock& fb0, const c2_fblock& fb2, bool auto_center, float_type y1) { return *new c2_connector_function_p(fb0, fb2, auto_center, y1); } /// make a *new object static c2_connector_function_p& connector_function(float_type x0, float_type y0, float_type yp0, float_type ypp0, float_type x2, float_type y2, float_type yp2, float_type ypp2, bool auto_center, float_type y1) { return *new c2_connector_function_p(x0, y0, yp0, ypp0, x2, y2, yp2, ypp2, auto_center, y1); } /// make a *new object static c2_piecewise_function_p& piecewise_function() { return *new c2_piecewise_function_p(); } /// make a *new object static c2_sin_p& sin() { return *new c2_sin_p(); } /// make a *new object static c2_cos_p& cos() { return *new c2_cos_p(); } /// make a *new object static c2_tan_p& tan() { return *new c2_tan_p(); } /// make a *new object static c2_log_p& log() { return *new c2_log_p(); } /// make a *new object static c2_exp_p& exp() { return *new c2_exp_p(); } /// make a *new object static c2_sqrt_p& sqrt() { return *new c2_sqrt_p(); } /// make a *new object static c2_recip_p& recip(float_type scale = 1) { return *new c2_recip_p(scale); } /// make a *new object static c2_identity_p& identity() { return *new c2_identity_p(); } /// make a *new object static c2_linear_p& linear(float_type x0, float_type y0, float_type slope) { return *new c2_linear_p(x0, y0, slope); } /// make a *new object static c2_quadratic_p& quadratic(float_type x0, float_type y0, float_type xcoef, float_type x2coef) { return *new c2_quadratic_p(x0, y0, xcoef, x2coef); } /// make a *new object static c2_power_law_p& power_law(float_type scale, float_type power) { return *new c2_power_law_p(scale, power); } /// make a *new object static c2_inverse_function_p& inverse_function(const c2_function& source) { return *new c2_inverse_function_p(source); } #if 0 /// \brief handle template for inverse_integrated_density_bins /// \brief >(bincenters, binheights) template