| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /*************************************** | ||
| 2 | Auteur : Pierre Aubert | ||
| 3 | Mail : pierre.aubert@lapp.in2p3.fr | ||
| 4 | Licence : CeCILL-C | ||
| 5 | ****************************************/ | ||
| 6 | |||
| 7 | #ifndef __DATA_FUNCTION_CALL_H_IMPL__ | ||
| 8 | #define __DATA_FUNCTION_CALL_H_IMPL__ | ||
| 9 | |||
| 10 | #include "phoenix_type_stream.h" | ||
| 11 | #include "DataFunctionCall.h" | ||
| 12 | #include "phoenix_function_call.h" | ||
| 13 | |||
| 14 | ///Default constructor of DataFunctionCall | ||
| 15 | /** @param function : function to be called on a given data | ||
| 16 | * @param name : name of the function | ||
| 17 | */ | ||
| 18 | template<typename _Data> | ||
| 19 | 2 | DataFunctionCall<_Data>::DataFunctionCall(PUncastableBool (*function)(const _Data &), const PString & name) | |
| 20 | 2 | :AbstractDataFunction(name), p_function(function) | |
| 21 | { | ||
| 22 | //The prototype is compose only of the given data which is normal for dispatching | ||
| 23 |
3/3✓ Branch 0 (3→4) taken 2 times.
✓ Branch 2 (4→5) taken 2 times.
✓ Branch 4 (5→6) taken 2 times.
|
2 | setPrototype(phoenix_getTypeToStr<_Data>()); |
| 24 | 2 | initialisationDataFunctionCall(); | |
| 25 | 2 | } | |
| 26 | |||
| 27 | ///Destructor of DataFunctionCall | ||
| 28 | template<typename _Data> | ||
| 29 | ✗ | DataFunctionCall<_Data>::~DataFunctionCall(){ | |
| 30 | |||
| 31 | ✗ | } | |
| 32 | |||
| 33 | ///Call the function with parameter | ||
| 34 | /** @param[out] log : logger | ||
| 35 | * @param data : data given to the function | ||
| 36 | * @return true on success, false otherwise | ||
| 37 | */ | ||
| 38 | template<typename _Data> | ||
| 39 | 2 | bool DataFunctionCall<_Data>::call(PLog & log, const Data & data){ | |
| 40 |
1/1✓ Branch 0 (2→3) taken 2 times.
|
2 | _Data value(phoenix_getValueFromData<_Data>(data)); |
| 41 |
2/3✓ Branch 0 (3→4) taken 2 times.
✓ Branch 2 (6→7) taken 2 times.
✗ Branch 3 (6→17) not taken.
|
2 | if(p_function(value) == UNCASTABLE_TRUE){ |
| 42 |
9/9✓ Branch 0 (7→8) taken 2 times.
✓ Branch 2 (8→9) taken 2 times.
✓ Branch 4 (9→10) taken 2 times.
✓ Branch 6 (10→11) taken 2 times.
✓ Branch 8 (11→12) taken 2 times.
✓ Branch 10 (12→13) taken 2 times.
✓ Branch 12 (13→14) taken 2 times.
✓ Branch 14 (14→15) taken 2 times.
✓ Branch 16 (15→16) taken 2 times.
|
2 | log.getLogDebug() << "DataFunctionCall<_Data>::call : function 'bool '"<<getName()<<"(const "<<getPrototype()<<" &) success" << std::endl; |
| 43 | 2 | return true; | |
| 44 | }else{ | ||
| 45 | ✗ | log.getLogError() << "DataFunctionCall<_Data>::call : function 'bool '"<<getName()<<"(const "<<getPrototype()<<" &) failed" << std::endl; | |
| 46 | ✗ | return false; | |
| 47 | } | ||
| 48 | 1 | } | |
| 49 | |||
| 50 | ///Initialisation function of the class DataFunctionCall | ||
| 51 | template<typename _Data> | ||
| 52 | 2 | void DataFunctionCall<_Data>::initialisationDataFunctionCall(){ | |
| 53 | |||
| 54 | 2 | } | |
| 55 | |||
| 56 | |||
| 57 | |||
| 58 | |||
| 59 | |||
| 60 | #endif | ||
| 61 | |||
| 62 | |||
| 63 | |||
| 64 |