SST  13.1.0
Structural Simulation Toolkit
module.h
1 // Copyright 2009-2023 NTESS. Under the terms
2 // of Contract DE-NA0003525 with NTESS, the U.S.
3 // Government retains certain rights in this software.
4 //
5 // Copyright (c) 2009-2023, NTESS
6 // All rights reserved.
7 //
8 // This file is part of the SST software package. For license
9 // information, see the LICENSE file in the top level directory of the
10 // distribution.
11 
12 #ifndef SST_CORE_MODULE_H
13 #define SST_CORE_MODULE_H
14 
15 #include "sst/core/eli/elementinfo.h"
16 
17 namespace SST {
18 /**
19  Module is a tag class used with the loadModule function.
20  */
21 class Module
22 {
23 public:
24  SST_ELI_DECLARE_BASE(Module)
25  // declare extern to limit compile times
26  SST_ELI_DECLARE_CTORS(ELI_CTOR(SST::Params&), ELI_CTOR(Component*, SST::Params&))
27  SST_ELI_DECLARE_INFO_EXTERN(ELI::ProvidesParams)
28  Module() {}
29  virtual ~Module() {}
30 };
31 
32 namespace MODULE {
33 // Very hackish way to get a deprecation warning for
34 // SST_ELI_REGISTER_MODULE, but there are no standard ways to do this
36 {
37 public:
38  static constexpr int fake_deprecated_function() __attribute__((
39  deprecated("SST_ELI_REGISTER_MODULE_DERIVED is deprecated and will be removed in SST 14. Please use the "
40  "SST_ELI_REGISTER_MODULE macro")))
41  {
42  return 0;
43  }
44 };
45 
46 } // namespace MODULE
47 } // namespace SST
48 
49 #define SST_ELI_REGISTER_MODULE(cls, lib, name, version, desc, interface) \
50  SST_ELI_REGISTER_DERIVED(::interface,cls,lib,name,ELI_FORWARD_AS_ONE(version),desc) \
51  SST_ELI_INTERFACE_INFO(#interface)
52 
53 // New way to register modules. Must register an interface (API)
54 // first, then you can register a module that implements it
55 #define SST_ELI_REGISTER_MODULE_API(cls, ...) \
56  SST_ELI_DECLARE_NEW_BASE(SST::Module,::cls) \
57  SST_ELI_NEW_BASE_CTOR(SST::Params&,##__VA_ARGS__)
58 
59 #define SST_ELI_REGISTER_MODULE_DERIVED_API(cls, base, ...) \
60  SST_ELI_DECLARE_NEW_BASE(::base,::cls) \
61  SST_ELI_NEW_BASE_CTOR(SST::Params&,##__VA_ARGS__)
62 
63 #define SST_ELI_REGISTER_MODULE_DERIVED(cls, lib, name, version, desc, interface) \
64  static const int SST_ELI_FAKE_VALUE = SST::MODULE::sst_eli_fake_deprecated_class::fake_deprecated_function(); \
65  SST_ELI_REGISTER_DERIVED(::interface,cls,lib,name,ELI_FORWARD_AS_ONE(version),desc) \
66  SST_ELI_INTERFACE_INFO(#interface)
67 
68 #endif // SST_CORE_MODULE_H
Main component object for the simulation.
Definition: component.h:31
Definition: paramsInfo.h:41
Module is a tag class used with the loadModule function.
Definition: module.h:22
Parameter store.
Definition: params.h:56