00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 #ifndef OSDL_BASIC_H_
00028 #define OSDL_BASIC_H_
00029 
00030 
00031 #include "OSDLException.h"  
00032 
00033 
00034 #include "Ceylan.h"         
00035 
00036 
00037 
00038 namespace OSDL
00039 {
00040 
00041 
00042 
00062     #define CHECK_OSDL_VERSIONS()                                            \
00063         Ceylan::LibtoolVersion headerVersion(                                \
00064             OSDL::actualOSDLHeaderLibtoolVersion ) ;                         \
00065         if ( !                                          \
00066                 OSDL::GetVersion().isCompatibleWith( headerVersion ) )       \
00067             Ceylan::emergencyShutdown(                                       \
00068                 "OSDL library version currently linked ("                    \
00069                 + OSDL::GetVersion().toString()                              \
00070                 + ") is not compatible with the one read from the OSDL "     \
00071                 "header files used to compile this application ("            \
00072                 + headerVersion.toString() + "), aborting." ) ;
00073 
00074 
00075     
00076     
00077     namespace Video
00078     {
00079     
00080         
00081         class VideoModule ;
00082         
00083     }
00084     
00085     
00086     
00087     namespace Events
00088     {
00089     
00090         
00091         class EventsModule ;
00092         
00093     }
00094 
00095 
00096         
00097     namespace Audio
00098     {
00099     
00100         
00101         class AudioModule ;
00102         
00103     }
00104         
00105             
00106             
00107     
00108     class CDROMDriveHandler ;
00109     
00110     
00111     
00118     OSDL_DLL const Ceylan::LibtoolVersion & GetVersion() ;
00119 
00120 
00121     
00123     OSDL_DLL void stop() ;
00124         
00125         
00126                 
00127         
00134     class OSDL_DLL CommonModule : public Ceylan::Module
00135     {
00136 
00137 
00138 
00139         
00140         
00141         
00150         OSDL_DLL friend CommonModule & getCommonModule( Ceylan::Flags flags ) ;
00151         
00152         
00153         OSDL_DLL friend bool hasExistingCommonModule() ;
00154         
00155         
00165         OSDL_DLL friend CommonModule & getExistingCommonModule() ;
00166         
00167         
00169         OSDL_DLL friend void stop() ;
00170 
00171 
00172 
00173 
00174         public:
00175         
00176         
00177         
00179             typedef Ceylan::Sint32 BackendReturnCode ;
00180 
00181 
00182 
00184             static const BackendReturnCode BackendSuccess ;
00185             
00186             
00187             
00195             static const BackendReturnCode BackendError ;
00196         
00197         
00198         
00203             Ceylan::System::Microsecond getRuntimeDuration() const ;
00204         
00205                 
00206         
00208             virtual bool hasVideoModule() const ; 
00209 
00210 
00211                     
00218             virtual Video::VideoModule & getVideoModule() const ;
00219             
00220             
00221             
00223             virtual bool hasEventsModule() const ; 
00224 
00225             
00226             
00233             virtual Events::EventsModule & getEventsModule() const ;
00234             
00235 
00236 
00238             virtual bool hasAudioModule() const ; 
00239 
00240             
00247             virtual Audio::AudioModule & getAudioModule() const ;
00248             
00249             
00256             virtual void removeAudioModule() ;
00257             
00258             
00259             
00261             virtual Ceylan::Flags getFlags() const ;
00262 
00263 
00264 
00265 
00267             virtual bool isGUIEnabled() const ;
00268 
00269 
00281             virtual void enableGUI() ;
00282 
00283 
00285             virtual void disableGUI() ;
00286 
00287 
00288 
00289 
00291             virtual bool hasCDROMDriveHandler() const ; 
00292 
00293             
00300             virtual CDROMDriveHandler & getCDROMDriveHandler() const ;
00301             
00302             
00303 
00314             virtual const std::string toString( 
00315                 Ceylan::VerbosityLevels level = Ceylan::high ) const ;
00316 
00317 
00318 
00319 
00320             
00321             
00322             
00323             
00336             static std::string InterpretFlags( Ceylan::Flags flags ) ;
00337     
00338     
00339     
00349             static std::string DescribeEnvironmentVariables() ; 
00350 
00351 
00353             static bool IsBackendInitialized() ;
00354             
00355 
00356 
00357             
00358 
00359 
00360 
00361 
00362 
00363 
00364 
00365 
00366 
00367 
00368 
00369 
00370 
00371 
00372 
00374             static const Ceylan::Flags UseTimer ;              
00375 
00376 
00378             static const Ceylan::Flags UseAudio ;
00379                 
00380                            
00382             static const Ceylan::Flags UseVideo ;
00383                 
00384                            
00386             static const Ceylan::Flags UseCDROM ;              
00387 
00388 
00389 
00395             static const Ceylan::Flags UseJoystick ;               
00396 
00397 
00403             static const Ceylan::Flags UseKeyboard ;               
00404 
00405 
00411             static const Ceylan::Flags UseMouse ;              
00412 
00413 
00422             static const Ceylan::Flags UseEvents ;             
00423 
00424 
00431             static const Ceylan::Flags UseGUI ;            
00432 
00433 
00435             static const Ceylan::Flags UseEverything ;             
00436 
00437 
00458             static const Ceylan::Flags NoParachute ;               
00459 
00460 
00462             static const Ceylan::Flags UseEventThread ;
00463 
00464 
00465 
00466 
00467 
00468         protected:
00469         
00470             
00471             
00484             static Ceylan::Flags AutoCorrectFlags( Ceylan::Flags inputFlags ) ;
00485                 
00486                     
00487                     
00489             Video::VideoModule * _video ;
00490             
00491             
00492             
00494             Events::EventsModule * _events ;            
00495             
00496             
00497             
00499             Audio::AudioModule * _audio ;
00500             
00501             
00506             bool _useGUI ;
00507             
00508             
00509             
00511             Ceylan::Flags _flags ;  
00512             
00513             
00514             
00516             CDROMDriveHandler * _cdromHandler ;
00517             
00518             
00519             
00521             Ceylan::System::Second _startingSecond ;
00522             
00523             
00525             Ceylan::System::Microsecond _startingMicrosecond ;
00526             
00527             
00528             
00529             
00530             
00531 
00532 
00533 
00535             static bool _BackendInitialized ;
00536                 
00537                 
00539             static CommonModule * _CurrentCommonModule ;
00540 
00541 
00542 
00548             static const std::string _SDLEnvironmentVariables[] ;
00549 
00550 
00551 
00552 
00553         private:        
00554         
00555         
00556         
00567             explicit CommonModule( Ceylan::Flags flags ) ;
00568     
00569     
00570     
00577             virtual ~CommonModule() throw() ;   
00578             
00579                     
00580         
00581     } ;     
00582 
00583 
00584 
00585 
00586     
00587     
00588     
00589 
00612     OSDL_DLL CommonModule & getCommonModule( Ceylan::Flags flags ) ;
00613         
00614     
00615         
00620     OSDL_DLL bool hasExistingCommonModule() ;
00621     
00622     
00623     
00640     OSDL_DLL CommonModule & getExistingCommonModule() ;
00641         
00642     
00643 }
00644 
00645 
00646 
00647 #endif // OSDL_BASIC_H_
00648