CppADCodeGen  HEAD
A C++ Algorithmic Differentiation Package with Source Code Generation
CppAD::cg::DynamicModelLibraryProcessor< Base > Class Template Reference
Inheritance diagram for CppAD::cg::DynamicModelLibraryProcessor< Base >:
Inheritance graph
Collaboration diagram for CppAD::cg::DynamicModelLibraryProcessor< Base >:
Collaboration graph

Public Member Functions

 DynamicModelLibraryProcessor (ModelLibraryCSourceGen< Base > &modelLibGen, std::string libraryName="cppad_cg_model")
 
const std::string & getLibraryName () const
 
void setLibraryName (const std::string &libraryName)
 
const std::string * getCustomLibraryExtension () const
 
void setCustomLibraryExtension (const std::string &libraryExtension)
 
void removeCustomLibraryExtension ()
 
std::map< std::string, std::string > & getOptions ()
 
const std::map< std::string, std::string > & getOptions () const
 
std::unique_ptr< DynamicLib< Base > > createDynamicLibrary (CCompiler< Base > &compiler, bool loadLib=true)
 
void createStaticLibrary (CCompiler< Base > &compiler, Archiver &ar, bool posIndepCode)
 

Protected Member Functions

virtual std::unique_ptr< DynamicLib< Base > > loadDynamicLibrary ()
 
const std::map< std::string, std::string > & getLibrarySources ()
 
const std::map< std::string, std::string > & getSources (ModelCSourceGen< Base > &model)
 

Protected Attributes

std::string _libraryName
 
std::unique_ptr< const std::string > _customLibExtension
 
std::map< std::string, std::string > _options
 
ModelLibraryCSourceGen< Base > * modelLibraryHelper_
 

Detailed Description

template<class Base>
class CppAD::cg::DynamicModelLibraryProcessor< Base >

Useful class for generating source code for the creation of a dynamic or a static library.

Author
Joao Leal

Definition at line 29 of file dynamic_library_processor.hpp.

Constructor & Destructor Documentation

◆ DynamicModelLibraryProcessor()

template<class Base >
CppAD::cg::DynamicModelLibraryProcessor< Base >::DynamicModelLibraryProcessor ( ModelLibraryCSourceGen< Base > &  modelLibGen,
std::string  libraryName = "cppad_cg_model" 
)
inlineexplicit

Creates a new helper class for the generation of dynamic or static libraries using the C language.

Parameters
modelLibGen
libraryNameThe path of the dynamic or static library to be created (without the extension)

Definition at line 53 of file dynamic_library_processor.hpp.

Member Function Documentation

◆ createDynamicLibrary()

template<class Base >
std::unique_ptr<DynamicLib<Base> > CppAD::cg::DynamicModelLibraryProcessor< Base >::createDynamicLibrary ( CCompiler< Base > &  compiler,
bool  loadLib = true 
)
inline

Compiles all models and generates a dynamic library.

Parameters
compilerThe compiler used to compile the sources and create the dynamic library
loadLibWhether or not to load the dynamic library
Returns
The dynamic library if loadLib is true, nullptr otherwise

Definition at line 125 of file dynamic_library_processor.hpp.

◆ createStaticLibrary()

template<class Base >
void CppAD::cg::DynamicModelLibraryProcessor< Base >::createStaticLibrary ( CCompiler< Base > &  compiler,
Archiver ar,
bool  posIndepCode 
)
inline

Compiles all models and generates a static library.

Parameters
compilerThe compiler used to compile the sources
arThe archiver used to assemble the compiled source into a static library
posIndepCodeWhether or not to compile the source with position independent code (static libraries typically do not use this feature)

Definition at line 181 of file dynamic_library_processor.hpp.

◆ getCustomLibraryExtension()

template<class Base >
const std::string* CppAD::cg::DynamicModelLibraryProcessor< Base >::getCustomLibraryExtension ( ) const
inline

Provides a custom library extension defined by the user

Returns
a custom library extension

Definition at line 83 of file dynamic_library_processor.hpp.

◆ getLibraryName()

template<class Base >
const std::string& CppAD::cg::DynamicModelLibraryProcessor< Base >::getLibraryName ( ) const
inline
Returns
the path of the dynamic or static library (without the extension)

Definition at line 64 of file dynamic_library_processor.hpp.

◆ getOptions() [1/2]

template<class Base >
std::map<std::string, std::string>& CppAD::cg::DynamicModelLibraryProcessor< Base >::getOptions ( )
inline

System dependent custom options

Definition at line 106 of file dynamic_library_processor.hpp.

◆ getOptions() [2/2]

template<class Base >
const std::map<std::string, std::string>& CppAD::cg::DynamicModelLibraryProcessor< Base >::getOptions ( ) const
inline

System dependent custom options

Definition at line 113 of file dynamic_library_processor.hpp.

◆ removeCustomLibraryExtension()

template<class Base >
void CppAD::cg::DynamicModelLibraryProcessor< Base >::removeCustomLibraryExtension ( )
inline

Resets the library extension to the default

Definition at line 99 of file dynamic_library_processor.hpp.

◆ setCustomLibraryExtension()

template<class Base >
void CppAD::cg::DynamicModelLibraryProcessor< Base >::setCustomLibraryExtension ( const std::string &  libraryExtension)
inline

Defines a custom extension for the library that will be created

Parameters
libraryExtensionthe custom extension name

Definition at line 92 of file dynamic_library_processor.hpp.

◆ setLibraryName()

template<class Base >
void CppAD::cg::DynamicModelLibraryProcessor< Base >::setLibraryName ( const std::string &  libraryName)
inline
Parameters
libraryNamethe path of the dynamic or static library (without the extension)

Definition at line 72 of file dynamic_library_processor.hpp.

Member Data Documentation

◆ _customLibExtension

template<class Base >
std::unique_ptr<const std::string> CppAD::cg::DynamicModelLibraryProcessor< Base >::_customLibExtension
protected

a custom extension for the dynamic or static library (e.g. ".so.1")

Definition at line 38 of file dynamic_library_processor.hpp.

Referenced by CppAD::cg::DynamicModelLibraryProcessor< Base >::createDynamicLibrary(), and CppAD::cg::DynamicModelLibraryProcessor< Base >::createStaticLibrary().

◆ _libraryName

◆ _options

template<class Base >
std::map<std::string, std::string> CppAD::cg::DynamicModelLibraryProcessor< Base >::_options
protected

System dependent custom options

Definition at line 42 of file dynamic_library_processor.hpp.

Referenced by CppAD::cg::DynamicModelLibraryProcessor< Base >::getOptions().


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