Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members

plExternalProbFunction.h

00001 /*=============================================================================
00002  * Product        : OpenPL 
00003  * File           : plExternalProbFunction.h
00004  * Author         : Kamel Mekhnacha
00005  * Creation       : Tue Apr  9 10:41:31 2002
00006  *
00007  *=============================================================================
00008  *     (c) Copyright 2000, Centre National de la Recherche Scientifique,
00009  *                              all rights reserved
00010  *=============================================================================
00011  *
00012  *------------------------- Description ---------------------------------------
00013  *   
00014  *   
00015  *-----------------------------------------------------------------------------
00016  */
00017 
00018 #ifndef _plExternalProbFunction_h_
00019 #define _plExternalProbFunction_h_
00020 
00021 
00022 #include <plObject.h>
00023 #include <plVariablesConjunction.h>
00024 #include <plValues.h>
00025 #include <plDataValues.h>
00026 
00027 /*****************************************************************************
00028  *                           External Classes
00029  *****************************************************************************/
00030 
00031 #include <plExternalProbMethod.h>
00032 
00033 
00034 /*****************************************************************************
00035  *                           Classes Definitions
00036  *****************************************************************************/
00037 
00038 
00041 class plExternalProbFunction : public plObject 
00042 {
00043   
00044 protected:
00045   
00047   void Output(ostream &out) const;
00048   
00050   kplExternalProbFunction *function_at_kernel;
00051   
00052 public:
00053   
00055   plProbValue operator()(const plValues &values) const;
00056 
00058   virtual ~plExternalProbFunction(){};
00059   
00063   plExternalProbFunction(const plVariablesConjunction &variables,
00064              plProbValue(*function)(const plValues &input_values));
00065   
00066   
00070   template <class T>
00071   plExternalProbFunction(const plVariablesConjunction &variables,
00072              T *obj,
00073              plProbValue (T::*method) (const plValues &input_values))
00074   {
00075     
00076     string name;
00077     
00078     /* Construct a name for the function */
00079     /* TODO Construct a method to do this operation more eficinetly */
00080     char cbuff[42] = "AnonymousProbMethod"; 
00081     name = string( cbuff );
00082     
00083     
00084     /* create the formal function at kernel level */
00085     function_at_kernel = new kplExternalProbMethod<T>(variables.get_variable_list(),
00086                               obj, method, name);
00087     
00088   }
00089   
00090   
00095   plExternalProbFunction(const plVariablesConjunction &variables,
00096              plProbValue (*function)(const plValues &input_values),
00097              const string &func_name);
00098   
00099   
00103   template <class T>
00104   plExternalProbFunction(const plVariablesConjunction &variables,
00105              T *obj,
00106              plProbValue (T::*method)(const plValues &input_values),
00107              const string &func_name)
00108   {
00109     /* create the formal function at kernel level */
00110     function_at_kernel = 
00111       new kplExternalProbMethod<T>(variables.get_variable_list(),
00112                    obj, method, func_name );
00113   }
00114   
00115   
00116   // TODO ack for MS C++
00117   void write_function_at_kernel(ostream &out) const;
00118   
00119   kplExternalProbFunction* get_function_at_kernel()const {return function_at_kernel;};
00120 
00121   void destroy();
00122   
00123 };
00124 
00125 
00126 #endif

Generated on Fri Apr 1 10:58:12 2005 for ProBT by  doxygen 1.4.1