PhoenixGenerator  2.2.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
22 fs << std::endl << std::endl << "\t\t///Get the name of the class " << name;
23 fs << std::endl << "\t\t.def_static(\"phoenix_get_type_name\", []() {";
24 fs << std::endl << "\t\t\treturn phoenix_getTypeName<" << name << ">();}, ";
25 fs << std::endl << "\t\t\t\"Return the type name of " << name << "\")";
26}
const PString & getName() const
Returns the class name.
bool enableTypeStream
True to enable type stream interface generator.

References GeneratorMode::enableTypeStream, 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 41 of file NanobindTraitTypeStream.cpp.

41 {
42 if(!mode.enableTypeStream){return;}
43 fs << "\ttest_phoenix_type_name()" << std::endl;
44}

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 29 of file NanobindTraitTypeStream.cpp.

29 {
30 if(!mode.enableTypeStream){return;}
31 PString name(classConfig.getName());
32 PString moduleName = baseFileName.toLower() + "_module";
33 fs << "#Test Phoenix type name retrieval for " << name << std::endl;
34 fs << "def test_phoenix_type_name():" << std::endl;
35 fs << "\t\"\"\"Test Phoenix type name retrieval\"\"\"" << std::endl;
36 fs << "type_name = " << moduleName << "." << name << ".phoenix_get_type_name()" << std::endl;
37 fs << "assert type_name == \"" << name << "\"" << std::endl << std::endl;
38}

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

+ Here is the call graph for this function:

The documentation for this class was generated from the following files: