mpqc::detail::ForceLink< T, A > Class Template Reference
Collaboration diagram for mpqc::detail::ForceLink< T, A >:
Documentation
template<class T, class A = const KeyVal&>
class mpqc::detail::ForceLink< T, A >
This, together with ForceLinkBase, is used to force code for particular classes to be linked into executables.
- Note
- Objects of classes derived from DescribedClass can be created from KeyVal input and/or checkpoint files by using class name lookup to find that class's entry in the constructor registry. Unfortunately, linking in a library that defines such a class doesn't cause the code for the class to be linked. To force linking of class T derived from DescribedClass create an object of class ForceLink<T> in the main executable. This is most conveniently done by having every library define such objects in its
linkage.h
file; the main executable then includes alllinkage.h
files from the libraries that it needs. -
Only a declaration of class T is needed to define an object of type ForceLink<T>; this is key to avoiding instantiation of class T in the executable. Nevertheless, it is necessary to define ForceLink<T>::create in the library somewhere, usually in a file called
linkage.cpp
; this file usually also contains constructor registration macros.
- See also
- MPQC_FORCELINK_KEYVAL_CTOR
Public Member Functions | |
ForceLink () | |
virtual | ~ForceLink () |
DescribedClass * | create (A a) |
Public Member Functions inherited from mpqc::detail::ForceLinkBase< const KeyVal & > | |
ForceLinkBase () | |
virtual | ~ForceLinkBase () |
virtual DescribedClass * | create (const KeyVal &)=0 |
Constructor & Destructor Documentation
◆ ForceLink()
template<class T , class A = const KeyVal&>
|
inline |
◆ ~ForceLink()
template<class T , class A = const KeyVal&>
|
inlinevirtual |
Member Function Documentation
◆ create()
template<class T , class A = const KeyVal&>
DescribedClass* mpqc::detail::ForceLink< T, A >::create | ( | A | a | ) |
The documentation for this class was generated from the following file:
- mpqc/util/keyval/forcelink.h