SingletonLifetimePolicies.h
Go to the documentation of this file.
1 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
2 
3 // -- BEGIN LICENSE BLOCK ----------------------------------------------
4 // This file is part of FZIs ic_workspace.
5 //
6 // This program is free software licensed under the LGPL
7 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3).
8 // You can find a copy of this license in LICENSE folder in the top
9 // directory of the source code.
10 //
11 // © Copyright 2016 FZI Forschungszentrum Informatik, Karlsruhe, Germany
12 //
13 // -- END LICENSE BLOCK ------------------------------------------------
14 
15 //----------------------------------------------------------------------
30 //----------------------------------------------------------------------
31 #ifndef ICL_CORE_SINGLETON_LIFETIME_POLICIES_H_INCLUDED
32 #define ICL_CORE_SINGLETON_LIFETIME_POLICIES_H_INCLUDED
33 
34 #include <stdlib.h>
35 #include <stdexcept>
36 
37 namespace icl_core {
38 
40 typedef void (*DestructionFuncPtr)();
41 
47 template
48 <class T>
50 {
51 public:
53  {
54  atexit(f);
55  }
56 
57  static void onDeadReference()
58  {
59  throw std::logic_error("attempted to access a singleton instance after its destruction");
60  }
61 };
62 
68 template
69 <class T>
71 {
72 public:
74  {
75  }
76 
77  static void onDeadReference()
78  {
79  }
80 };
81 
82 }
83 
84 #endif
void(* DestructionFuncPtr)()
Helper definition for destruction functions.
static void scheduleDestruction(DestructionFuncPtr)
static void scheduleDestruction(DestructionFuncPtr f)


fzi_icl_core
Author(s):
autogenerated on Mon Jun 10 2019 13:17:58