zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Resource.h
Go to the documentation of this file.
1 /* This file is part of the Zenipex Library (zenilib).
2  * Copyright (C) 2011 Mitchell Keith Bloch (bazald).
3  *
4  * zenilib is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * zenilib is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with zenilib. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
32 #ifndef ZENI_RESOURCE_H
33 #define ZENI_RESOURCE_H
34 
35 #include <Zeni/Error.h>
36 #include <Zeni/Hash_Map.h>
37 #include <Zeni/Singleton.h>
38 #include <Zeni/String.h>
39 
40 namespace Zeni {
41 
42  class Resource;
43 
44 #ifdef _WINDOWS
45  ZENI_EXT template class ZENI_DLL Singleton<Resource>;
46 #endif
47 
48  class ZENI_DLL Resource : public Singleton<Resource> {
49  friend class Singleton<Resource>;
50 
51  static Resource * create();
52 
53  Resource() {}
54  ~Resource() {}
55 
56  // Undefined
57  Resource(const Resource &);
58  Resource & operator=(const Resource &);
59 
60  public:
61  inline unsigned long assign();
62 
63  private:
64  //Mutex m_mutex;
65  static unsigned long m_current;
66  };
67 
68  ZENI_DLL Resource & get_Resource();
69 
70  struct ZENI_DLL Resource_Init_Failure : public Error {
71  Resource_Init_Failure() : Error("Zeni Resource Failed to Initialize Correctly") {}
72  };
73 
74 }
75 
76 #endif
Resource & get_Resource()
Get access to the singleton.
Definition: Resource.cpp:35
A Resource Assignement Singleton.
Definition: Resource.h:48
The Error Class.
Definition: Error.h:52