00001 /* --------------------------------------------------------------------------- 00002 Phission : 00003 Realtime Vision Processing System 00004 00005 Copyright (C) 2003-2006 Philip D.S. Thoren (pthoren@cs.uml.edu) 00006 University of Massachusetts at Lowell, 00007 Laboratory for Artificial Intelligence and Robotics 00008 00009 This file is part of Phission. 00010 00011 Phission is free software; you can redistribute it and/or modify 00012 it under the terms of the GNU Lesser General Public License as published by 00013 the Free Software Foundation; either version 2 of the License, or 00014 (at your option) any later version. 00015 00016 Phission is distributed in the hope that it will be useful, 00017 but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 GNU Lesser General Public License for more details. 00020 00021 You should have received a copy of the GNU Lesser General Public License 00022 along with Phission; if not, write to the Free Software 00023 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00024 00025 ---------------------------------------------------------------------------*/ 00026 #ifndef _PHSYSTEM_H 00027 #define _PHSYSTEM_H 00028 00029 #include <phStandard.h> 00030 #include <phObject.h> 00031 #include <phObjectList.h> 00032 #include <phPipeline.h> 00033 #include <phDisplayInterface.h> 00034 #include <phCaptureInterface.h> 00035 00036 /* ---------------------------------------------------------------------- */ 00041 /* ---------------------------------------------------------------------- */ 00048 /* ------------------------------------------------------------------------ */ 00049 #define phAUTO_MODE 1 00050 #define phMANUAL_MODE 2 00051 00052 #define phSystem_DISPLAY 0 00053 #define phSystem_PIPELINE 1 00054 #define phSystem_CAPTURE 2 00055 #define phSystem_THREAD 3 00056 00057 #define phSystem_NCOMPONENTS 4 00058 /* end addtogroup PhissionSystem */ 00060 00061 /* ------------------------------------------------------------------------ */ 00067 PHAPI(class) phSystem : public phMutex 00068 { 00069 protected: 00070 int m_use [phSystem_NCOMPONENTS]; 00071 int m_active[phSystem_NCOMPONENTS]; 00072 00073 phObjectList m_captures; 00074 phObjectList m_displays; 00075 phObjectList m_pipelines; 00076 phObjectList m_threads; 00077 00078 int m_is_active; 00079 00080 int m_autoMode; 00081 00082 public: 00083 phSystem(); 00084 ~phSystem(); 00085 00086 int32_t displaysOpen (); 00087 int32_t displaysActive (); 00088 int32_t pipelinesActive (); 00089 int32_t capturesActive (); 00090 int32_t threadsActive (); 00091 00092 int32_t displayCount (); 00093 int32_t pipelineCount (); 00094 int32_t captureCount (); 00095 int32_t threadCount (); 00096 00097 /* This allows toggling of the auto mode; whether an object added after 00098 * system startup is to be automatically started or not; also, whether 00099 * an object removed (while the system is active) is to be automatically 00100 * stopped or not */ 00101 int setAutoMode ( int mode = phAUTO_MODE ); /* phMANUAL_MODE */ 00102 int getAutoMode (); 00103 00104 int addDisplay ( phDisplayInterface *display, int autoStart = 1 ); 00105 int addPipeline ( phPipeline *pipeline, int autoStart = 1 ); 00106 int addCapture ( phCaptureInterface *capture, int autoStart = 1 ); 00107 int addThread ( phThread *thread, int autoStart = 1 ); 00108 int add ( phObject *obj, int autoStart = 1 ); 00109 00110 int removeDisplay ( phDisplayInterface *display, int autoStop = 1 ); 00111 int removePipeline ( phPipeline *pipeline, int autoStop = 1 ); 00112 int removeCapture ( phCaptureInterface *capture, int autoStop = 1 ); 00113 int removeThread ( phThread *thread, int autoStop = 1 ); 00114 int remove ( phObject *obj, int autoStop = 1 ); 00115 00116 int removeDisplays (); 00117 int removePipelines (); 00118 int removeCaptures (); 00119 int removeThreads (); 00120 int removeAll (); 00121 00122 int startDisplays (); 00123 int startPipelines (); 00124 int startCaptures (); 00125 int startThreads (); 00126 00127 int startup (); 00128 00129 int haltThreads (); 00130 int haltCaptures (); 00131 int haltPipelines (); 00132 int haltDisplays (); 00133 00134 int halt (); 00135 00136 int stopThreads (); 00137 int stopCaptures (); 00138 int stopPipelines (); 00139 int stopDisplays (); 00140 00141 int shutdown (); 00142 00143 /* These are more utility functions than anything else; 00144 * They don't require locking of the object */ 00145 static int startDisplay ( phDisplayInterface *display ); 00146 static int startPipeline ( phPipeline *pipeline ); 00147 static int startCapture ( phCaptureInterface *capture ); 00148 static int startThread ( phThread *thread ); 00149 00150 static int haltDisplay ( phDisplayInterface *display ); 00151 static int haltPipeline ( phPipeline *pipeline ); 00152 static int haltCapture ( phCaptureInterface *capture ); 00153 static int haltThread ( phThread *thread ); 00154 00155 static int stopDisplay ( phDisplayInterface *display ); 00156 static int stopPipeline ( phPipeline *pipeline ); 00157 static int stopCapture ( phCaptureInterface *capture ); 00158 static int stopThread ( phThread *thread ); 00159 }; 00160 00161 #endif /* #ifndef _PHSYSTEM_H */
Copyright (C) 2002 - 2007 |
Philip D.S. Thoren ( pthoren@users.sourceforge.net ) University Of Massachusetts at Lowell Robotics Lab |