Sierra Toolkit  Version of the Day
Bootstrap.cpp
1 /*------------------------------------------------------------------------*/
2 /* Copyright 2010 Sandia Corporation. */
3 /* Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive */
4 /* license for use of this work by or on behalf of the U.S. Government. */
5 /* Export of this program may require a license from the */
6 /* United States Government. */
7 /*------------------------------------------------------------------------*/
8 
9 #include <stk_util/util/Bootstrap.hpp>
10 
11 namespace stk_classic {
12 
13 Bootstrap *
14 Bootstrap::s_front = 0;
15 
16 bool
17 Bootstrap::s_bootstrapped = false;
18 
19 
20 void
22 {
23  s_bootstrapped = true;
24  for (Bootstrap *f = s_front; f; f = f->m_next)
25  (*f->m_f)();
26 }
27 
28 
30  FunctionPtr f)
31  : m_next(s_front),
32  m_f(f)
33 {
34  s_front = this;
35 
36  // IF already bootstrapped, execute immediately
37  if (s_bootstrapped)
38  (*f)();
39 }
40 
41 } // namespace stk_classic
Bootstrap(void(*f)())
Creates a new Bootstrap instance.
Definition: Bootstrap.cpp:29
static void bootstrap()
Member function bootstrap runs through the stored bootstrap function pointers and executes each funct...
Definition: Bootstrap.cpp:21
Sierra Toolkit.
Class Bootstrap serves as a bootstrapping mechanism for products in the sierra toolkit and elsewhere...
Definition: Bootstrap.hpp:35