PhoenixGenerator  2.8.0
Set of tools to generate code
Loading...
Searching...
No Matches
NanobindTraitTypeStream Class Reference

Class generator for Nanobind property trait. More...

#include <NanobindTraitTypeStream.h>

Inheritance diagram for NanobindTraitTypeStream:
Collaboration diagram for NanobindTraitTypeStream:

Public Member Functions

virtual void headerExtraInclude (std::set< std::string > &includes, const PClassConfig &classConfig, const GeneratorMode &mode) const
virtual void headerTestInclude (std::ofstream &fs, const GeneratorMode &mode, const PString &baseFileName) const
 NanobindTraitTypeStream ()
 Constructor of NanobindTraitTypeStream.
virtual void registerConstructor (std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
virtual void registerMethod (std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
virtual void registerProperty (std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
virtual void registerStaticMethod (std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
 Registration of static method.
virtual void testCallFunction (std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
 call the test function for type stream trait
virtual void testFunction (std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode, const PString &baseFileName) const
 Test function for type stream trait.
virtual ~NanobindTraitTypeStream ()
 Destructor of NanobindTraitTypeStream.

Detailed Description

Class generator for Nanobind property trait.

Definition at line 15 of file NanobindTraitTypeStream.h.

Constructor & Destructor Documentation

◆ NanobindTraitTypeStream()

NanobindTraitTypeStream::NanobindTraitTypeStream ( )

Constructor of NanobindTraitTypeStream.

Definition at line 10 of file NanobindTraitTypeStream.cpp.

References PAbstractNanobindTraitBackend::PAbstractNanobindTraitBackend().

Here is the call graph for this function:

◆ ~NanobindTraitTypeStream()

NanobindTraitTypeStream::~NanobindTraitTypeStream ( )
virtual

Destructor of NanobindTraitTypeStream.

Definition at line 15 of file NanobindTraitTypeStream.cpp.

15{}

Member Function Documentation

◆ headerExtraInclude()

virtual void PAbstractNanobindTraitBackend::headerExtraInclude ( std::set< std::string > & includes,
const PClassConfig & classConfig,
const GeneratorMode & mode ) const
inlinevirtualinherited

Reimplemented in NanobindTraitInclude.

Definition at line 70 of file PAbstractTraitBackend.h.

70{}

◆ headerTestInclude()

virtual void PAbstractNanobindTraitBackend::headerTestInclude ( std::ofstream & fs,
const GeneratorMode & mode,
const PString & baseFileName ) const
inlinevirtualinherited

Reimplemented in NanobindTraitTestSetup.

Definition at line 71 of file PAbstractTraitBackend.h.

71{}

◆ registerConstructor()

virtual void PAbstractNanobindTraitBackend::registerConstructor ( std::ofstream & fs,
const PClassConfig & classConfig,
const GeneratorMode & mode ) const
inlinevirtualinherited

Reimplemented in NanobindTraitMethod.

Definition at line 76 of file PAbstractTraitBackend.h.

76{}

◆ registerMethod()

virtual void PAbstractNanobindTraitBackend::registerMethod ( std::ofstream & fs,
const PClassConfig & classConfig,
const GeneratorMode & mode ) const
inlinevirtualinherited

Reimplemented in NanobindTraitDataStream.

Definition at line 75 of file PAbstractTraitBackend.h.

75{}

◆ registerProperty()

virtual void PAbstractNanobindTraitBackend::registerProperty ( std::ofstream & fs,
const PClassConfig & classConfig,
const GeneratorMode & mode ) const
inlinevirtualinherited

Reimplemented in NanobindTraitProperty.

Definition at line 73 of file PAbstractTraitBackend.h.

73{}

◆ registerStaticMethod()

void NanobindTraitTypeStream::registerStaticMethod ( std::ofstream & fs,
const PClassConfig & classConfig,
const GeneratorMode & mode ) const
virtual

Registration of static method.

Reimplemented from PAbstractNanobindTraitBackend.

Definition at line 18 of file NanobindTraitTypeStream.cpp.

18 {
19 if(!mode.enableTypeStream){return;}
20 PString name(classConfig.getName());
21 if(classConfig.getIsEnum()){
22 name = name + "::" + name;
23 }
24 fs << std::endl << std::endl << "\t\t///Get the name of the class " << name;
25 fs << std::endl << "\t\t.def_static(\"phoenix_get_type_name\", []() {";
26 fs << std::endl << "\t\t\treturn phoenix_getTypeName<" << name << ">();}, ";
27 fs << std::endl << "\t\t\t\"Return the type name of " << name << "\")";
28}
const PString & getName() const
Returns the class name.
bool getIsEnum() const
Say if the current PClassConfig is an enum.
bool enableTypeStream
True to enable type stream interface generator.

References GeneratorMode::enableTypeStream, PClassConfig::getIsEnum(), and PClassConfig::getName().

Here is the call graph for this function:

◆ testCallFunction()

void NanobindTraitTypeStream::testCallFunction ( std::ofstream & fs,
const PClassConfig & classConfig,
const GeneratorMode & mode ) const
virtual

call the test function for type stream trait

Reimplemented from PAbstractNanobindTraitBackend.

Definition at line 46 of file NanobindTraitTypeStream.cpp.

46 {
47 if(!mode.enableTypeStream){return;}
48 fs << "\ttest_phoenix_type_name()" << std::endl;
49}

References GeneratorMode::enableTypeStream.

◆ testFunction()

void NanobindTraitTypeStream::testFunction ( std::ofstream & fs,
const PClassConfig & classConfig,
const GeneratorMode & mode,
const PString & baseFileName ) const
virtual

Test function for type stream trait.

Reimplemented from PAbstractNanobindTraitBackend.

Definition at line 31 of file NanobindTraitTypeStream.cpp.

31 {
32 if(!mode.enableTypeStream){return;}
33 PString name(classConfig.getName());
34 PString moduleName = baseFileName.toLower();
35 fs << "#Test Phoenix type name retrieval for " << name << std::endl;
36 fs << "def test_phoenix_type_name():" << std::endl;
37 fs << "\t\"\"\"Test Phoenix type name retrieval\"\"\"" << std::endl;
38 fs << "\ttype_name = " << moduleName << "." << name << ".phoenix_get_type_name()" << std::endl;
39 if(classConfig.getIsEnum()){
40 name = name + "::" + name;
41 }
42 fs << "\tassert type_name == \"" << name << "\"" << std::endl << std::endl;
43}

References GeneratorMode::enableTypeStream, PClassConfig::getIsEnum(), and PClassConfig::getName().

Here is the call graph for this function:

The documentation for this class was generated from the following files:
  • /builds/CTA-LAPP/PHOENIX_LIBS2/code-generator/PhoenixGenerator/src/TraitBackEnd/Nanobind/NanobindTraitTypeStream/NanobindTraitTypeStream.h
  • /builds/CTA-LAPP/PHOENIX_LIBS2/code-generator/PhoenixGenerator/src/TraitBackEnd/Nanobind/NanobindTraitTypeStream/NanobindTraitTypeStream.cpp