SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
AutoInit.h
Go to the documentation of this file.
1 //=========================================================================
2 // Copyright (c) Kitware, Inc.
3 // All rights reserved.
4 // See LICENSE.txt for details.
5 //
6 // This software is distributed WITHOUT ANY WARRANTY; without even
7 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 // PURPOSE. See the above copyright notice for more information.
9 //=========================================================================
10 #ifndef smtk_AutoInit_h
11 #define smtk_AutoInit_h
12 
14 // This file contains macros used to initialize components of SMTK
15 // that may defined in separate libraries but which need to be
16 // exposed to SMTK's core components.
17 //
18 // See smtk/model/Session.h and its subclasses for an example of how
19 // these macros are used to register components with the model Manager.
20 
21 #define smtkAutoInitComponentMacro(C) \
22  void C##_AutoInit_Construct(); \
23  void C##_AutoInit_Destruct();
24 #define smtkAutoInitConstructMacro(C) C##_AutoInit_Construct();
25 #define smtkAutoInitDestructMacro(C) C##_AutoInit_Destruct();
26 
46 #define smtkComponentInitMacro(C) \
47  smtkAutoInitComponentMacro(C) static struct C##_ComponentInit \
48  { \
49  /* Call <mod>_AutoInit_Construct during initialization. */ \
50  C##_ComponentInit() { smtkAutoInitConstructMacro(C) } \
51  /* Call <mod>_AutoInit_Destruct during finalization. */ \
52  ~C##_ComponentInit() { smtkAutoInitDestructMacro(C) } \
53  } C##_ComponentInit_Instance;
54 
55 #endif // smtk_AutoInit_h