IModuleBase.hpp
1 #pragma once
2 
3 #include <opals/OptionsShared.hpp>
4 #include <opals/ParamList.hpp>
5 #include <opals/IControlObject.hpp>
6 
7 namespace opals {
8 
9  /// Sets the name of the embedding software package.
10  extern "C" OPALS_API void embeddingSoftware( const char *text );
11 
12  /// Abstract base class of all opals modules.
13  class OPALS_API IModuleBase
14  {
15  public:
16 
17  /// Make sure to delete instances after use with Delete()
18  virtual ~IModuleBase() {}
19 
20  /// Destroy modules allocated on the heap
21  /** Make sure to delete instances after use in order to avoid memory leaks.
22  This is done automatically when using std::shared_ptr in combination with opals::ModuleDeleter
23  to manage memory, e.g.:
24  \code
25  std::shared_ptr< opals::IModuleBase > module( opals::IImport::New(), opals::ModuleDeleter() );
26  \endcode
27  That way, Delete() is called automatically when the std::shared_ptr goes out of scope.
28  \internal
29  calling Delete() is only necessary when instantiating a module from outside that module's DLL
30  e.g. using
31  \code
32  opals::IImport::New()
33  \endcode
34  */
35  virtual void Delete() = 0;
36 
37  /// Starts the actual module execution.
38  /// \param reset if true, calls reset() right after execution has finished, thereby closing any open (file-) handles.
39  virtual ParamList run( bool reset=false ) = 0;
40 
41  /// Resets the module to the state after construction.
42  virtual void reset() = 0;
43 
44  /// \name Access global options: present in all modules.
45  ///@{
46  virtual opts::glob::Options &globals() = 0;
47  virtual const opts::glob::Options &globals() const = 0;
48  ///@}
49 
50  /// \name Access common options: present in all modules.
51  ///@{
52  virtual opts::comm::Options &commons() = 0;
53  virtual const opts::comm::Options &commons() const = 0;
54  ///@}
55 
56  /// \name Access the base type of module-specific options.
57  ///@{
58  virtual opts::IBase &optsBase() = 0;
59  virtual const opts::IBase &optsBase() const = 0;
60  ///@}
61 
62  /// Returns the module name.
63  virtual opals::String name() const = 0;
64 
65  /// Returns the module version.
66  virtual opals::String version() const = 0;
67 
68  /// Returns the special build version.
69  virtual opals::String special_build() const = 0;
70 
71  /// Returns a string representing the compilation date and time.
72  virtual opals::String compilation_date_time() const = 0;
73 
74  /// Sets module parameters from paramList according to parameter "paramMapping".
75  virtual void mapParams( const ParamList &paramList ) = 0;
76 
77  /// Sets control object for retrieving status information during processing.
78  virtual void set_controlObject( IControlObject &obj ) = 0;
79  /// remove control object from the message queue
80  virtual void unset_controlObject() = 0;
81  };
82 
83 };
@ run
The value has been set during module execution.
Contains several parameters in their string representation.
Definition: ParamList.hpp:46
void embeddingSoftware(const char *text)
Sets the name of the embedding software package.
Contains the public interface of OPALS.
Definition: AbsValueOrQuantile.hpp:8
Abstract base class of all opals modules.
Definition: IModuleBase.hpp:13
Interface for retrieving status and progress information from a module run.
Definition: c++_api/inc/opals/IControlObject.hpp:30
virtual ~IModuleBase()
Make sure to delete instances after use with Delete()
Definition: IModuleBase.hpp:18
A group of options.
Definition: IOption.hpp:108
A dynamic character string whose interface conforms to STL's std::string.
Definition: String.hpp:35
Base class of all option types.
Definition: IOption.hpp:36