|
Sierra Toolkit
Version of the Day
|
00001 /*------------------------------------------------------------------------*/ 00002 /* Copyright 2010 Sandia Corporation. */ 00003 /* Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive */ 00004 /* license for use of this work by or on behalf of the U.S. Government. */ 00005 /* Export of this program may require a license from the */ 00006 /* United States Government. */ 00007 /*------------------------------------------------------------------------*/ 00008 00009 #include <stk_util/util/Bootstrap.hpp> 00010 00011 namespace stk_classic { 00012 00013 Bootstrap * 00014 Bootstrap::s_front = 0; 00015 00016 bool 00017 Bootstrap::s_bootstrapped = false; 00018 00019 00020 void 00021 Bootstrap:: bootstrap() 00022 { 00023 s_bootstrapped = true; 00024 for (Bootstrap *f = s_front; f; f = f->m_next) 00025 (*f->m_f)(); 00026 } 00027 00028 00029 Bootstrap::Bootstrap( 00030 FunctionPtr f) 00031 : m_next(s_front), 00032 m_f(f) 00033 { 00034 s_front = this; 00035 00036 // IF already bootstrapped, execute immediately 00037 if (s_bootstrapped) 00038 (*f)(); 00039 } 00040 00041 } // namespace stk_classic