PureMVC PureMVC

include/PureMVC/PureMVC.hpp

Go to the documentation of this file.
00001 //  pure_mvc.hpp
00002 //  PureMVC_C++
00003 //
00004 //  PureMVC Port to C++ by Tang Khai Phuong <phuong.tang@puremvc.org>
00005 //  PureMVC - Copyright(c) 2006-2011 Futurescale, Inc., Some rights reserved.
00006 //  Your reuse is governed by the Creative Commons Attribution 3.0 License
00007 //
00008 
00009 #if !defined(__PUREMVC_HPP__)
00010 #define __PUREMVC_HPP__
00011 
00012 #if (defined(_WIN32) || defined(_WIN64)) && (defined(_DLL) || defined(USE_DLL))
00013     #if defined(PUREMVC_API_EXPORT)
00014         #define PUREMVC_API __declspec(dllexport)
00015     #elif !defined(PUREMVC_NO_IMPORT)
00016         #define PUREMVC_API __declspec(dllimport)
00017     #endif
00018 #else
00019     #if defined(__GNUC__) || defined(__MINGW32__)
00020         #define PUREMVC_API
00021     #else
00022         #define PUREMVC_API
00023     #endif
00024 #endif
00025 
00026 //
00027 // Automatically link PureMVC library.
00028 //
00029 #if defined(_MSC_VER) || defined(__CODEGEARC__) || defined(__BORLANDC__) || defined(__INTEL_COMPILER) || defined(__DMC__)
00030     #if !defined(PUREMVC_API_EXPORT)
00031         #if defined(__MSVC_RUNTIME_CHECKS) && !defined(_DEBUG) && !defined(DEBUG)
00032         #pragma message("Using the /RTC option without specifying a debug runtime will lead to linker errors")
00033         #pragma message("Hint: go to the code generation options and switch to one of the debugging runtimes")
00034         #error "Incompatible build options"
00035         #endif
00036         #if !defined(PUREMVC_NO_AUTO_IMPORT)
00037             #if defined(_DLL) || defined(USE_DLL)
00038                 #if defined(_DEBUG) || defined(DEBUG)
00039                     #pragma comment(lib, "PureMVCddll.lib")
00040                 #else
00041                     #pragma comment(lib, "PureMVCdll.lib")
00042                 #endif
00043             #else
00044                 #if defined(_DEBUG) || defined(DEBUG)
00045                     #pragma comment(lib, "PureMVCd.lib")
00046                 #else
00047                     #pragma comment(lib, "PureMVC.lib")
00048                 #endif
00049             #endif
00050         #endif
00051     #endif
00052 #endif
00053 
00054 // Macro support R-Value for C++0x
00055 #if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2)) && defined(__GXX_EXPERIMENTAL_CXX0X__)
00056 #define PUREMVC_HAS_RVALUE
00057 #endif 
00058 
00059 #if (__BORLANDC__ >= 0x599)
00060 #pragma defineonoption PUREMVC_CODEGEAR_0X_SUPPORT -Ax
00061 #endif
00062 
00063 #if defined( PUREMVC_CODEGEAR_0X_SUPPORT ) && (__BORLANDC__ >= 0x610)
00064 #define PUREMVC_HAS_RVALUE
00065 #endif
00066 
00067 #if _MSC_VER >= 1600
00068 #define PUREMVC_HAS_RVALUE
00069 #endif
00070 
00071 #if (!(defined(_WIN32) || defined(_WIN64)) && defined(__STDC_HOSTED__) && __STDC_HOSTED__) || defined(__GXX_EXPERIMENTAL_CPP0X__)
00072 #define PUREMVC_INTEL_STDCXX0X
00073 #endif
00074 #if defined(_MSC_VER) && (_MSC_VER >= 1600)
00075 #define PUREMVC_INTEL_STDCXX0X
00076 #endif
00077 
00078 #if defined(__INTEL_COMPILER)
00079 #  define PUREMVC_INTEL_CXX_VERSION __INTEL_COMPILER
00080 #elif defined(__ICL)
00081 #  define PUREMVC_INTEL_CXX_VERSION __ICL
00082 #elif defined(__ICC)
00083 #  define PUREMVC_INTEL_CXX_VERSION __ICC
00084 #elif defined(__ECC)
00085 #  define PUREMVC_INTEL_CXX_VERSION __ECC
00086 #endif
00087 
00088 #if defined(PUREMVC_INTEL_STDCXX0X) && (PUREMVC_INTEL_CXX_VERSION >= 1200)
00089 #define PUREMVC_HAS_RVALUE
00090 #endif
00091 
00092 namespace PureMVC
00093 {
00097     class PUREMVC_API Mutex
00098     {
00099     private:
00100         void* _mutex;
00101     public:
00105         explicit Mutex(void);
00106     public:
00110         void lock(void);
00114         bool tryLock(void);
00118         void unlock(void);
00119     public:
00120         ~Mutex(void);
00121     };
00122 
00126     class PUREMVC_API ScopedLock
00127     {
00128     private:
00129         Mutex& _mutex;
00130     public:
00136         explicit ScopedLock(Mutex& mutex);
00137     private:
00138         ScopedLock(ScopedLock const&);
00139         ScopedLock& operator=(ScopedLock const&);
00140     public:
00141         ~ScopedLock(void);
00142     };
00143 }
00144 
00145 #if !defined(__PUREMVC_INCLUDE__)
00146 #define __PUREMVC_INCLUDE__
00147 #include "Interfaces/INotifier.hpp"
00148 #include "Interfaces/IProxy.hpp"
00149 #include "Interfaces/INotification.hpp"
00150 #include "Interfaces/IObserver.hpp"
00151 #include "Interfaces/ICommand.hpp"
00152 #include "Interfaces/IController.hpp"
00153 #include "Interfaces/IModel.hpp"
00154 #include "Interfaces/IMediator.hpp"
00155 #include "Interfaces/IFacade.hpp"
00156 #include "Interfaces/IView.hpp"
00157 #include "Interfaces/IAggregate.hpp"
00158 #include "Interfaces/IIterator.hpp"
00159 #include "Patterns/Observer/Notification.hpp"
00160 #include "Patterns/Observer/Notifier.hpp"
00161 #include "Patterns/Observer/Observer.hpp"
00162 #include "Patterns/Command/SimpleCommand.hpp"
00163 #include "Patterns/Command/MacroCommand.hpp"
00164 #include "Patterns/Proxy/Proxy.hpp"
00165 #include "Patterns/Mediator/Mediator.hpp"
00166 #include "Patterns/Facade/Facade.hpp"
00167 #include "Patterns/Iterator/Iterator.hpp"
00168 #include "Core/Model.hpp"
00169 #include "Core/View.hpp"
00170 #include "Core/Controller.hpp"
00171 #endif
00172 
00173 namespace PureMVC
00174 {
00178     PUREMVC_API void createCache(void);
00179 
00183     PUREMVC_API void cleanCache(void);
00184 }
00185 
00186 #endif /* __PUREMVC_HPP__ */