Adun  0.83
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
AdunIOManager.h
1 /*
2  Project: Adun
3 
4  Copyright (C) 2005 Michael Johnston & Jordi Villą--Freixa
5 
6  Author: Michael Johnston
7 
8  This application is free software; you can redistribute it and/or
9  modify it under the terms of the GNU General Public
10  License as published by the Free Software Foundation; either
11  version 2 of the License, or (at your option) any later version.
12 
13  This application is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Library General Public License for more details.
17 
18  You should have received a copy of the GNU General Public
19  License along with this library; if not, write to the Free
20  Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
21 */
22 #ifndef _ADUN_IOMANAGER_
23 #define _ADUN_IOMANAGER_
24 
25 #include <sys/types.h>
26 #include <sys/stat.h>
27 #include <unistd.h>
28 #include "AdunKernel/AdCommandInterface.h"
29 #include "AdunKernel/AdCoreCommand.h"
30 #include "AdunKernel/AdServerInterface.h"
32 #include "AdunKernel/AdFrameworkFunctions.h"
33 #include "AdunKernel/AdunSimulationData.h"
34 #include "AdunKernel/AdunFileSystemSimulationStorage.h"
35 #include "AdunKernel/AdCoreAdditions.h"
36 
42 typedef enum
43 {
47 }
49 
76 @interface AdIOManager: NSObject
77 {
78  @private
79  id fileManager;
80  BOOL restartRequested;
81  BOOL processedArgs;
82  BOOL simulationDataSent;
84  NSMutableDictionary* fileStreams;
85  NSString* adunDir;
86  NSString* pluginDir;
87  NSMutableArray* pluginsPaths;
88  NSString *controllerDir;
89  NSString *extensionDir;
90  NSString* outputDir;
91  NSString* controllerOutputDir;
92  NSString* logFile; //Where stdout goes
93  NSString* errorFile; //Where stderr goes
94  NSProcessInfo *adunInfo;
95  NSArray* validArgs;
96  id serverProxy;
97  id core;
98  id serverConnection;
99  id simulatorTemplate;
100  NSDictionary* externalObjects;
101  NSProtocolChecker* checkerInterface;
102  AdSimulationData* simulationData;
103 }
107 + (id) appIOManager;
115 - (BOOL) processCommandLine: (NSError**) error;
119 - (AdCoreRunMode) runMode;
124 - (BOOL) restartRequested;
130 - (void) saveResults: (NSArray*) anArray;
137 - (void) setSimulationReferences: (NSDictionary*) inputObjects;
141 - (void) setCore: (id) core;
145 - (NSMutableArray*) pluginsPaths;
149 - (NSString*) simulationOutputDirectory;
153 - (NSString*) controllerOutputDirectory;
157 - (NSString*) controllerDirectory;
161 - (NSString*) adunDirectory;
166 - (NSDictionary*) template;
171 - (NSDictionary*) externalObjects;
181 - (FILE*) openFile: (NSString*) file usingName: (NSString*) name flag: (NSString*) fileFlag;
188 - (FILE*) getStreamForName: (NSString*) name;
193 - (void) closeStreamWithName: (NSString*) name;
197 - (void) closeAllStreams;
198 @end
199 
200 
212 @interface AdIOManager (ServerCommunication) <AdCommandInterface>
219 - (BOOL) connectToServer: (NSError**) error;
223 - (BOOL) isConnected;
229 - (void) acceptRequests;
234 - (void) sendControllerResults: (NSArray*) anArray;
241 - (void) closeConnection: (NSError*) error;
242 @end
243 
249 @interface AdIOManager (SimulationDataLoading)
260 - (BOOL) loadData: (NSError**) error;
261 @end
262 
267 @interface AdIOManager (LogFileMaintenance)
274 - (BOOL) createLogFiles: (NSError**) error;
280 - (BOOL) moveLogFilesTo: (NSString*) dataDirectory error: (NSError**) error;
281 
282 @end
283 
289 @interface AdIOManager (DirectoryMaintenance)
297 - (BOOL) checkProgramDirectories: (NSError**) error;
301 - (BOOL) createSimulationOutputDirectory: (NSError**) error;
305 - (BOOL) createControllerOutputDirectory: (NSError**) error;
306 @end
307 
308 
309 
310 
311 #endif
312