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