Logo  0.95.0-final
Finite Element Embedded Library and Language in C++
Feel++ Feel++ on Github Feel++ community
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
feelcore/policy.hpp
1 /* -*- mode: c++; coding: utf-8; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; show-trailing-whitespace: t -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2 
3  This file is part of the Feel library
4 
5  Author(s): Christophe Prud'homme <christophe.prudhomme@feelpp.org>
6  Date: 2004-09-10
7 
8  Copyright (C) 2006,2009 Université Joseph Fourier (Grenoble I)
9  Copyright (C) 2004 EPFL
10 
11  This library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU Lesser General Public
13  License as published by the Free Software Foundation; either
14  version 3.0 of the License, or (at your option) any later version.
15 
16  This library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  Lesser General Public License for more details.
20 
21  You should have received a copy of the GNU Lesser General Public
22  License along with this library; if not, write to the Free Software
23  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 */
30 #ifndef __Policy_H
31 #define __Policy_H 1
32 
33 namespace Feel
34 {
41 template <class T>
43 {
44  static T* create()
45  {
46  return new T;
47  }
48 
49  static void destroy( T* p )
50  {
51  delete p;
52  }
53 };
54 
61 template <class T>
63 {
64  static void scheduleDestruction( T*, void ( *pFun ) () )
65  {
66  std::atexit( pFun );
67  }
68 
69  static void onDeadReference()
70  {
71  throw std::logic_error( "Dead Reference Detected" );
72  }
73 };
74 
75 }
76 
77 #endif /* __Policy_H */

Generated on Sun Oct 20 2013 08:25:03 for Feel++ by doxygen 1.8.4