versadac  1
versadac - Scalable Recorder Firmware
uhh_filelist.h
1 /*****************************************************************************
2 FILE : U H H _ F I L E L I S T . H
3 VERSION : $Id: uhh_filelist.h 4938 2006-10-10 14:20:18Z martinto $
4 AUTHOR : Dave Storey
5 SYSTEM : Gnu C++
6 DESCRIPTION : UHH file list class
7 *****************************************************************************/
8 
9 
10 #if !defined __UHH_FILELIST_H
11 #define __UHH_FILELIST_H
12 
13 #include "uhh_heap.h"
14 
15 // File name components
16 #define UHH_FILENAME_INSTR_COMPONENT 0
17 #define UHH_FILENAME_UHHSN_COMPONENT 1
18 #define UHH_FILENAME_GROUP_COMPONENT 2
19 #define UHH_FILENAME_SEQNO_COMPONENT 3
20 #define UHH_FILENAME_NUM_COMPONENTS 4
21 
22 // The maximum sequence number (corresponding to SEQNO_COMPONENT)
23 #define UHH_FILENAME_SEQNO_MAX 0xffffff
24 
25 
26 struct UhhFileName {
27  UhhFileName *pNext;
28  char *szName;
29  char *szSubdir;
30  sint32 anNumbers[UHH_FILENAME_NUM_COMPONENTS];
31 };
32 
33 
34 class UhhFileList : public UhhHeap
35 {
36 public:
37  UhhFileList(char *z_szDirectory, sint32 *z_pnMatchMin, sint32 *z_pnMatchMax,
38  sint32 z_nMatch);
39  ~UhhFileList();
40  sint32 *numbers(sint32 z_nComponent);
41  sint32 sort(sint32 z_nComponent, UhhFileName ***z_pppSort,
42  bool z_bLargestGap = FALSE);
43 
44 private:
45  UhhFileName *m_pList;
46  sint32 m_nList;
47  sint32 *m_anNumbers;
48  UhhFileName **m_apSort;
49 
50  // Members used transiently during search to reduce method argument lists
51  sint32 *m_pnMatchMin; // Array of name component minima to match
52  sint32 *m_pnMatchMax; // Array of name component maxima to match
53  sint32 m_nMatch; // Number of name components to match
54  char *m_szSubdir;
55 
56  // PRIVATE METHODS
57  void matchFile(char *z_szFile);
58  void searchDir(char *z_szDirectory);
59 };
60 
61 
62 
63 #endif
Definition: uhh_heap.h:31
Definition: uhh_filelist.h:34
Definition: uhh_filelist.h:26