| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /*************************************** | ||
| 2 | Auteur : Thibaut Oprinsen | ||
| 3 | Mail : thibaut.oprinsen@lapp.in2p3.fr | ||
| 4 | Licence : CeCILL-C | ||
| 5 | ****************************************/ | ||
| 6 | |||
| 7 | #include "NanobindTraitTypeStream.h" | ||
| 8 | |||
| 9 | ///Constructor of NanobindTraitTypeStream | ||
| 10 | 1 | NanobindTraitTypeStream::NanobindTraitTypeStream() | |
| 11 | 1 | : PAbstractNanobindTraitBackend() | |
| 12 | 1 | {} | |
| 13 | |||
| 14 | ///Destructor of NanobindTraitTypeStream | ||
| 15 | 2 | NanobindTraitTypeStream::~NanobindTraitTypeStream(){} | |
| 16 | |||
| 17 | ///Registration of static method | ||
| 18 | 2 | void NanobindTraitTypeStream::registerStaticMethod(std::ofstream & fs, const PClassConfig & classConfig, const GeneratorMode & mode) const{ | |
| 19 |
1/2✗ Branch 0 (2→3) not taken.
✓ Branch 1 (2→4) taken 2 times.
|
2 | if(!mode.enableTypeStream){return;} |
| 20 |
2/2✓ Branch 0 (4→5) taken 2 times.
✓ Branch 2 (5→6) taken 2 times.
|
2 | PString name(classConfig.getName()); |
| 21 | |||
| 22 |
4/4✓ Branch 0 (6→7) taken 2 times.
✓ Branch 2 (7→8) taken 2 times.
✓ Branch 4 (8→9) taken 2 times.
✓ Branch 6 (9→10) taken 2 times.
|
2 | fs << std::endl << std::endl << "\t\t///Get the name of the class " << name; |
| 23 |
2/2✓ Branch 0 (10→11) taken 2 times.
✓ Branch 2 (11→12) taken 2 times.
|
2 | fs << std::endl << "\t\t.def_static(\"phoenix_get_type_name\", []() {"; |
| 24 |
4/4✓ Branch 0 (12→13) taken 2 times.
✓ Branch 2 (13→14) taken 2 times.
✓ Branch 4 (14→15) taken 2 times.
✓ Branch 6 (15→16) taken 2 times.
|
2 | fs << std::endl << "\t\t\treturn phoenix_getTypeName<" << name << ">();}, "; |
| 25 |
4/4✓ Branch 0 (16→17) taken 2 times.
✓ Branch 2 (17→18) taken 2 times.
✓ Branch 4 (18→19) taken 2 times.
✓ Branch 6 (19→20) taken 2 times.
|
2 | fs << std::endl << "\t\t\t\"Return the type name of " << name << "\")"; |
| 26 | 2 | } | |
| 27 | |||
| 28 | ///Test function for type stream trait | ||
| 29 | 2 | void NanobindTraitTypeStream::testFunction(std::ofstream & fs, const PClassConfig & classConfig, const GeneratorMode & mode, const PString & baseFileName) const{ | |
| 30 |
1/2✗ Branch 0 (2→3) not taken.
✓ Branch 1 (2→4) taken 2 times.
|
2 | if(!mode.enableTypeStream){return;} |
| 31 |
2/2✓ Branch 0 (4→5) taken 2 times.
✓ Branch 2 (5→6) taken 2 times.
|
2 | PString name(classConfig.getName()); |
| 32 |
3/3✓ Branch 0 (6→7) taken 2 times.
✓ Branch 2 (7→8) taken 2 times.
✓ Branch 4 (8→9) taken 2 times.
|
2 | PString moduleName = baseFileName.toLower() + "_module"; |
| 33 |
3/3✓ Branch 0 (11→12) taken 2 times.
✓ Branch 2 (12→13) taken 2 times.
✓ Branch 4 (13→14) taken 2 times.
|
2 | fs << "#Test Phoenix type name retrieval for " << name << std::endl; |
| 34 |
2/2✓ Branch 0 (14→15) taken 2 times.
✓ Branch 2 (15→16) taken 2 times.
|
2 | fs << "def test_phoenix_type_name():" << std::endl; |
| 35 |
2/2✓ Branch 0 (16→17) taken 2 times.
✓ Branch 2 (17→18) taken 2 times.
|
2 | fs << "\t\"\"\"Test Phoenix type name retrieval\"\"\"" << std::endl; |
| 36 |
6/6✓ Branch 0 (18→19) taken 2 times.
✓ Branch 2 (19→20) taken 2 times.
✓ Branch 4 (20→21) taken 2 times.
✓ Branch 6 (21→22) taken 2 times.
✓ Branch 8 (22→23) taken 2 times.
✓ Branch 10 (23→24) taken 2 times.
|
2 | fs << "type_name = " << moduleName << "." << name << ".phoenix_get_type_name()" << std::endl; |
| 37 |
5/5✓ Branch 0 (24→25) taken 2 times.
✓ Branch 2 (25→26) taken 2 times.
✓ Branch 4 (26→27) taken 2 times.
✓ Branch 6 (27→28) taken 2 times.
✓ Branch 8 (28→29) taken 2 times.
|
2 | fs << "assert type_name == \"" << name << "\"" << std::endl << std::endl; |
| 38 | 2 | } | |
| 39 | |||
| 40 | ///call the test function for type stream trait | ||
| 41 | ✗ | void NanobindTraitTypeStream::testCallFunction(std::ofstream & fs, const PClassConfig & classConfig, const GeneratorMode & mode) const{ | |
| 42 | ✗ | if(!mode.enableTypeStream){return;} | |
| 43 | ✗ | fs << "\ttest_phoenix_type_name()" << std::endl; | |
| 44 | } | ||
| 45 |