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
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104 #ifndef INC_MI32_MIJOB_H
00105 #define INC_MI32_MIJOB_H
00106
00107 #ifndef INC_MI32_XML_H
00108 #include <mi32/xml.h>
00109 #endif
00110
00111 #ifndef INC_MI32_FILEPATH_H
00112 #include <mi32/filepath.h>
00113 #endif
00114
00115 class FILEPATHLIST;
00116 class MIJOBSTATUS;
00117 namespace RVC {
00118 class OBJITEM;
00119 }
00120
00121 class MIJOB {
00122 public:
00123
00125 static ERRVALUE CreateGroup (
00126 const MISTRING& description,
00127 MISTRING& GroupID,
00128 INT32 priority = -1,
00129 bool bCreateAsTemp = false
00130 );
00131
00133 static ERRVALUE CreateGroup (
00134 const FILEPATH& directory,
00135 const MISTRING& description,
00136 MISTRING& GroupID,
00137 INT32 priority = -1,
00138 bool bCreateAsTemp = false
00139 );
00140
00142 static ERRVALUE ResolveTempJobs (
00143 );
00144
00145 MIJOB ();
00146 virtual ~MIJOB ();
00147
00149 XMLNODE* AddBinary (
00150 const char *name,
00151 const SIMPLE_ARRAY<UINT8>& data,
00152 XMLNODE *node = 0
00153 );
00154
00157 XMLNODE* AddNode (
00158 const char *name,
00159 XMLNODE *node = 0
00160 );
00161
00163 XMLNODE* AddValue (
00164 const char *name,
00165 const MISTRING& value,
00166 XMLNODE *node = 0
00167 );
00168
00170 XMLNODE* AddValue (
00171 const char *name,
00172 const char* value,
00173 XMLNODE *node = 0
00174 );
00175
00177 XMLNODE* AddValue (
00178 const char *name,
00179 UINT32 value,
00180 XMLNODE *node = 0
00181 );
00182
00184 XMLNODE* AddValue (
00185 const char *name,
00186 INT32 value,
00187 XMLNODE *node = 0
00188 );
00189
00191 XMLNODE* AddValue (
00192 const char *name,
00193 UINT16 value,
00194 XMLNODE *node = 0
00195 );
00196
00198 XMLNODE* AddValue (
00199 const char *name,
00200 INT16 value,
00201 XMLNODE *node = 0
00202 );
00203
00205 XMLNODE* AddValue (
00206 const char *name,
00207 UINT8 value,
00208 XMLNODE *node = 0
00209 );
00210
00212 XMLNODE* AddValue (
00213 const char *name,
00214 INT8 value,
00215 XMLNODE *node = 0
00216 );
00217
00219 XMLNODE* AddValue (
00220 const char *name,
00221 double value,
00222 XMLNODE *node = 0
00223 );
00224
00226 XMLNODE* AddValue (
00227 const char *name,
00228 bool value,
00229 XMLNODE *node = 0
00230 );
00231
00233 XMLNODE* AddInputObject (
00234 const char* id,
00235 const RVC::OBJITEM& objitem,
00236 XMLNODE *node = 0,
00237 bool IgnoreForBlocking = false,
00238 bool BlockIfExist = false,
00239 bool BlockIfNotExist = false
00240 );
00241
00243 XMLNODE* AddInputPath (
00244 const char* id,
00245 const MISTRING& path,
00246 XMLNODE *node = 0,
00247 bool IgnoreForBlocking = false,
00248 bool BlockIfExist = false,
00249 bool BlockIfNotExist = false
00250 );
00251
00253 XMLNODE* AddInputPath (
00254 const char* id,
00255 const char* path,
00256 XMLNODE *node = 0,
00257 bool IgnoreForBlocking = false,
00258 bool BlockIfExist = false,
00259 bool BlockIfNotExist = false
00260 );
00261
00263 XMLNODE* AddInputPath (
00264 const char* id,
00265 const FILEPATH& path,
00266 XMLNODE *node = 0,
00267 bool IgnoreForBlocking = false,
00268 bool BlockIfExist = false,
00269 bool BlockIfNotExist = false
00270 );
00271
00273 XMLNODE* AddOutputObject (
00274 const char* id,
00275 const RVC::OBJITEM& objitem,
00276 XMLNODE *node = 0,
00277 bool IgnoreForBlocking = false
00278 );
00279
00281 XMLNODE* AddOutputPath (
00282 const char* id,
00283 const MISTRING& path,
00284 XMLNODE *node = 0,
00285 bool IgnoreForBlocking = false
00286 );
00287
00289 XMLNODE* AddOutputPath (
00290 const char* id,
00291 const char* path,
00292 XMLNODE *node = 0,
00293 bool IgnoreForBlocking = false
00294 );
00295
00297 XMLNODE* AddOutputPath (
00298 const char* id,
00299 const FILEPATH& path,
00300 XMLNODE *node = 0,
00301 bool IgnoreForBlocking = false
00302 );
00303
00307 ERRVALUE CreateJob (
00308 const MISTRING& description,
00309 const MISTRING& process,
00310 INT32 priority = -1
00311 );
00312
00315 XMLNODE* FindBinary (
00316 const char *name,
00317 SIMPLE_ARRAY<UINT8>& data,
00318 const XMLNODE *node = 0
00319 ) const;
00320
00324 template <typename _ENUMTYPE> XMLNODE* FindEnum (
00325 const char *name,
00326 _ENUMTYPE& value,
00327 const XMLNODE *node = 0
00328 ) const { INT32 temp; XMLNODE *noderet = FindValue(name,temp,node); if (noderet != 0) value = static_cast<_ENUMTYPE>(temp); return (noderet); }
00329
00332 XMLNODE* FindNode (
00333 const char *name,
00334 const XMLNODE *node = 0
00335 ) const;
00336
00338 XMLNODE* FindObject (
00339 const char* id,
00340 RVC::OBJITEM& objitem,
00341 const XMLNODE *node = 0
00342 ) const;
00343
00345 XMLNODE* FindPath (
00346 const char* id,
00347 MISTRING& pathstr,
00348 const XMLNODE *node = 0
00349 ) const;
00350
00352 XMLNODE* FindPath (
00353 const char* id,
00354 FILEPATH& path,
00355 const XMLNODE *node = 0
00356 ) const;
00357
00361 XMLNODE* FindValue (
00362 const char *name,
00363 MISTRING& value,
00364 const XMLNODE *node = 0
00365 ) const;
00366
00370 XMLNODE* FindValue (
00371 const char *name,
00372 char*& value,
00373 const XMLNODE *node = 0
00374 ) const;
00375
00379 XMLNODE* FindValue (
00380 const char *name,
00381 unsigned long& value,
00382 const XMLNODE *node = 0
00383 ) const;
00384
00388 XMLNODE* FindValue (
00389 const char *name,
00390 long& value,
00391 const XMLNODE *node = 0
00392 ) const;
00393
00397 XMLNODE* FindValue (
00398 const char *name,
00399 unsigned int& value,
00400 const XMLNODE *node = 0
00401 ) const;
00402
00406 XMLNODE* FindValue (
00407 const char *name,
00408 int& value,
00409 const XMLNODE *node = 0
00410 ) const;
00411
00415 XMLNODE* FindValue (
00416 const char *name,
00417 UINT16& value,
00418 const XMLNODE *node = 0
00419 ) const;
00420
00424 XMLNODE* FindValue (
00425 const char *name,
00426 INT16& value,
00427 const XMLNODE *node = 0
00428 ) const;
00429
00433 XMLNODE* FindValue (
00434 const char *name,
00435 UINT8& value,
00436 const XMLNODE *node = 0
00437 ) const;
00438
00442 XMLNODE* FindValue (
00443 const char *name,
00444 INT8& value,
00445 const XMLNODE *node = 0
00446 ) const;
00447
00451 XMLNODE* FindValue (
00452 const char *name,
00453 double& value,
00454 const XMLNODE *node = 0
00455 ) const;
00456
00460 XMLNODE* FindValue (
00461 const char *name,
00462 float& value,
00463 const XMLNODE *node = 0
00464 ) const;
00465
00469 XMLNODE* FindValue (
00470 const char *name,
00471 bool& value,
00472 const XMLNODE *node = 0
00473 ) const;
00474
00476 void GetDescription (
00477 MISTRING& desc
00478 ) const;
00479
00482 template <typename _ENUMTYPE> bool GetEnum (
00483 const char *name,
00484 _ENUMTYPE& value,
00485 const XMLNODE *node = 0
00486 ) const { INT32 temp; if (FindValue(name,temp,node) == 0) return (false); value = static_cast<_ENUMTYPE>(temp); return (true); }
00487
00490 template <typename _ENUMTYPE> _ENUMTYPE GetEnumDefaulted (
00491 const char *name,
00492 _ENUMTYPE dft,
00493 const XMLNODE *node = 0
00494 ) const { INT32 temp; if (!FindValue(name,temp,node)) return (dft); else return (static_cast<_ENUMTYPE>(temp)); }
00495
00497 void GetBlockingInputList (
00498 FILEPATHLIST& list
00499 ) const;
00500
00502 void GetBlockingOutputList (
00503 FILEPATHLIST& list
00504 ) const;
00505
00507 void GetBlockingIfExistList (
00508 FILEPATHLIST& list
00509 ) const;
00510
00512 void GetBlockingIfNotExistList (
00513 FILEPATHLIST& list
00514 ) const;
00515
00517 void GetGroupID (
00518 MISTRING& GroupID
00519 );
00520
00522 void GetInputList (
00523 FILEPATHLIST& list
00524 ) const;
00525
00527 void GetOutputList (
00528 FILEPATHLIST& list
00529 ) const;
00530
00532 const FILEPATH& GetPath () const {return m_path;}
00533
00535 INT32 GetPriority () const;
00536
00538 void GetProcess (
00539 MISTRING& process
00540 ) const;
00541
00543 XMLNODE* GetRunParmsNode () {return m_runparmsnode;}
00544
00546 XMLNODE* GetRootNode () {return m_rootnode;}
00547
00550 template <typename _NUMTYPE> _NUMTYPE GetValueDefaulted (
00551 const char *name,
00552 _NUMTYPE value
00553 ) const { FindValue(name,value); return (value); }
00554
00556 bool IsTimeToRun();
00557
00559 bool IsVersionMatch();
00560
00562 ERRVALUE ReadJob (
00563 const FILEPATH& path
00564 );
00565
00567 ERRVALUE ReadJobNoStatus (
00568 const FILEPATH& path
00569 );
00570
00572 bool SetGroupID (
00573 const MISTRING& GroupID
00574 );
00575
00577 ERRVALUE SetNextTime ();
00578
00581 void SetReady (
00582 ) { m_IsJobRead = true; }
00583
00585 ERRVALUE Write (
00586 bool held = false,
00587 FILEPATH* path = 0,
00588 bool bCreateAsTemp = false
00589 );
00590
00592 ERRVALUE Write (
00593 const FILEPATH& directory,
00594 bool held = false,
00595 FILEPATH* path = 0,
00596 bool bCreateAsTemp = false
00597 );
00598
00600 ERRVALUE WriteScheduled (
00601 FILEPATH* path = 0
00602 );
00603
00605 ERRVALUE WriteDoc () {return m_doc.Write(m_path);}
00606
00607 private:
00608 #ifndef GENERATING_DOXYGEN_OUTPUT
00609 bool m_IsJobRead;
00610 XMLDOC m_doc;
00611 XMLNODE *m_rootnode;
00612 XMLNODE *m_runparmsnode;
00613 MIJOBSTATUS *m_pStatusMgr;
00614 FILEPATH m_path;
00615
00616 XMLNODE *FindValueNode (const char *name, const XMLNODE *node) const;
00617 #endif
00618 };
00619
00620 #endif // INC_MI32_MIJOB_H