PhoenixGenerator  2.0.4
Set of tools to generate code
Loading...
Searching...
No Matches
WrapperTraitTypeStream Class Reference

Class generator for setter trait. More...

#include <WrapperTraitTypeStream.h>

+ Inheritance diagram for WrapperTraitTypeStream:
+ Collaboration diagram for WrapperTraitTypeStream:

Public Member Functions

virtual void classMethodDeclaration (std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
 Declaration of class method.
 
virtual void classMethodImplementation (std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
 Implementation of class method.
 
virtual void headerExtraInclude (std::ofstream &fs, const GeneratorMode &mode) const
 Add extra include on the header.
 
virtual void registerClassGetterSetter (std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
 Register class getter and setter.
 
virtual void registerClassMember (std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
 Register class member.
 
virtual void registerClassMethod (std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
 Register class method.
 
virtual void setupAddDependency (std::ofstream &fs, const GeneratorMode &mode) const
 Add dependency in the setup.py.
 
virtual void testCallFunction (std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
 Call of the test function.
 
virtual void testFunction (std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
 Implementation of test function.
 
 WrapperTraitTypeStream ()
 Consctructor of WrapperTraitTypeStream.
 
virtual ~WrapperTraitTypeStream ()
 Desctructor of WrapperTraitTypeStream.
 

Detailed Description

Class generator for setter trait.

Definition at line 16 of file WrapperTraitTypeStream.h.

Constructor & Destructor Documentation

◆ WrapperTraitTypeStream()

WrapperTraitTypeStream::WrapperTraitTypeStream ( )

Consctructor of WrapperTraitTypeStream.

Definition at line 11 of file WrapperTraitTypeStream.cpp.

References PAbstractWrapperTraitBackend::PAbstractWrapperTraitBackend().

+ Here is the call graph for this function:

◆ ~WrapperTraitTypeStream()

WrapperTraitTypeStream::~WrapperTraitTypeStream ( )
virtual

Desctructor of WrapperTraitTypeStream.

Definition at line 16 of file WrapperTraitTypeStream.cpp.

16{}

Member Function Documentation

◆ classMethodDeclaration()

void WrapperTraitTypeStream::classMethodDeclaration ( std::ofstream & fs,
const PClassConfig & classConfig,
const GeneratorMode & mode ) const
virtual

Declaration of class method.

Parameters
[out]fs: file to be completed
classConfig: PClassConfig to be used
mode: mode of the generator

Reimplemented from PAbstractWrapperTraitBackend.

Definition at line 32 of file WrapperTraitTypeStream.cpp.

32 {
33 if(!mode.enableTypeStream){return;}
34 PString className(wrapper_getClassName(classConfig));
35 fs << "PyObject * "+className+"_getTypeName(PyObject *self, PyObject *args);\n\n";
36}
bool enableTypeStream
True to enable type stream interface generator.
PString wrapper_getClassName(const PClassConfig &classConfig)
Get the corresponding wrapper class name.

References GeneratorMode::enableTypeStream, and wrapper_getClassName().

+ Here is the call graph for this function:

◆ classMethodImplementation()

void WrapperTraitTypeStream::classMethodImplementation ( std::ofstream & fs,
const PClassConfig & classConfig,
const GeneratorMode & mode ) const
virtual

Implementation of class method.

Parameters
[out]fs: file to be completed
classConfig: PClassConfig to be used
mode: mode of the generator

Reimplemented from PAbstractWrapperTraitBackend.

Definition at line 43 of file WrapperTraitTypeStream.cpp.

43 {
44 if(!mode.enableTypeStream){return;}
45 PString className(wrapper_getClassName(classConfig));
46 fs << "///Get the type name of "<<className<<" for TypeStream compatibility\n";
47 fs << "/**\t@return type name of "<<className<<"\n";
48 fs << "*/\n";
49 fs << "PyObject * "<<className<<"_getTypeName(PyObject *self, PyObject *args){\n";
50 fs << "\tstd::string name(\""<<classConfig.getName()<<"\");\n";
51 fs << "\treturn Py_BuildValue(\"s\", name.c_str());\n";
52 fs << "}\n\n";
53}
const PString & getName() const
Returns the class name.

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

+ Here is the call graph for this function:

◆ headerExtraInclude()

void WrapperTraitTypeStream::headerExtraInclude ( std::ofstream & fs,
const GeneratorMode & mode ) const
virtual

Add extra include on the header.

Parameters
[out]fs: file to be completed
mode: mode of the generator

Reimplemented from PAbstractWrapperTraitBackend.

Definition at line 22 of file WrapperTraitTypeStream.cpp.

22 {
23 if(!mode.enableTypeStream){return;}
24 fs << "#include \"phoenix_type_stream.h\"" << std::endl;
25}

References GeneratorMode::enableTypeStream.

◆ registerClassGetterSetter()

void WrapperTraitTypeStream::registerClassGetterSetter ( std::ofstream & fs,
const PClassConfig & classConfig,
const GeneratorMode & mode ) const
virtual

Register class getter and setter.

Parameters
[out]fs: file to be completed
classConfig: PClassConfig to be used
mode: mode of the generator

Reimplemented from PAbstractWrapperTraitBackend.

Definition at line 70 of file WrapperTraitTypeStream.cpp.

70 {
71 if(!mode.enableTypeStream){return;}
72
73}

References GeneratorMode::enableTypeStream.

◆ registerClassMember()

void WrapperTraitTypeStream::registerClassMember ( std::ofstream & fs,
const PClassConfig & classConfig,
const GeneratorMode & mode ) const
virtual

Register class member.

Parameters
[out]fs: file to be completed
classConfig: PClassConfig to be used
mode: mode of the generator

Reimplemented from PAbstractWrapperTraitBackend.

Definition at line 60 of file WrapperTraitTypeStream.cpp.

60 {
61 if(!mode.enableTypeStream){return;}
62
63}

References GeneratorMode::enableTypeStream.

◆ registerClassMethod()

void WrapperTraitTypeStream::registerClassMethod ( std::ofstream & fs,
const PClassConfig & classConfig,
const GeneratorMode & mode ) const
virtual

Register class method.

Parameters
[out]fs: file to be completed
classConfig: PClassConfig to be used
mode: mode of the generator

Reimplemented from PAbstractWrapperTraitBackend.

Definition at line 80 of file WrapperTraitTypeStream.cpp.

80 {
81 if(!mode.enableTypeStream){return;}
82 PString className(wrapper_getClassName(classConfig));
83 fs << "\t{\"getTypeName\", (PyCFunction)"<<className<<"_getTypeName, METH_NOARGS | METH_STATIC, \"Doc : Get the type name of "<<className<<" for TypeStream compatibility\"},\n";
84}

References GeneratorMode::enableTypeStream, and wrapper_getClassName().

+ Here is the call graph for this function:

◆ setupAddDependency()

void WrapperTraitTypeStream::setupAddDependency ( std::ofstream & fs,
const GeneratorMode & mode ) const
virtual

Add dependency in the setup.py.

Parameters
[out]fs: file to be completed
mode: mode of the generator

Reimplemented from PAbstractWrapperTraitBackend.

Definition at line 114 of file WrapperTraitTypeStream.cpp.

114 {
115 if(!mode.enableTypeStream){return;}
116 fs << "addWrapperDependency(listIncludeDir, listLibDir, listLib, \"phoenixtypestream-config\", [\"phoenix_type_stream\"])" << std::endl;
117}

References GeneratorMode::enableTypeStream.

◆ testCallFunction()

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

Call of the test function.

Parameters
[out]fs: file to be completed
classConfig: PClassConfig to be used
mode: mode of the generator

Reimplemented from PAbstractWrapperTraitBackend.

Definition at line 104 of file WrapperTraitTypeStream.cpp.

104 {
105 if(!mode.enableTypeStream){return;}
106 PString className(classConfig.getName());
107 fs << "\ttest_typestream_"+className+"():\n";
108}

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

+ Here is the call graph for this function:

◆ testFunction()

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

Implementation of test function.

Parameters
[out]fs: file to be completed
classConfig: PClassConfig to be used
mode: mode of the generator

Reimplemented from PAbstractWrapperTraitBackend.

Definition at line 91 of file WrapperTraitTypeStream.cpp.

91 {
92 if(!mode.enableTypeStream){return;}
93 PString className(classConfig.getName());
94 fs << "#Unit Test for TypeStream of the " + className + "\n";
95 fs << "def test_typestream_"+className+"():\n";
96 fs << "\tassert "+className+".getTypeName() == \"" + className + "\"\n\n\n";
97}

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: