sipxportlib  Version 3.3
OsProcessIterator.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2004-2006 SIPfoundry Inc.
3 // Licensed by SIPfoundry under the LGPL license.
4 //
5 // Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
6 // Licensed to SIPfoundry under a Contributor Agreement.
7 //
8 // $$
10 
11 
12 #ifndef _OsProcessIteratorBase_h_
13 #define _OsProcessIteratorBase_h_
14 
15 // SYSTEM INCLUDES
16 // APPLICATION INCLUDES
17 #include "os/OsDefs.h"
18 #include "os/OsStatus.h"
19 #include "os/OsProcess.h"
20 
21 // DEFINES
22 // MACROS
23 // EXTERNAL FUNCTIONS
24 // EXTERNAL VARIABLES
25 // CONSTANTS
26 // STRUCTS
27 // TYPEDEFS
28 // FORWARD DECLARATIONS
29 
30 //: Used to enumerate running processes
31 
33 {
34 
35 /* //////////////////////////// PUBLIC //////////////////////////////////// */
36 public:
37 
38 /* ============================ CREATORS ================================== */
40  //:Default constructor
41 
42  OsProcessIteratorBase(const char* filterExp);
43  //:Return processes filtered by name
44 
45 /* ============================ MANIPULATORS ============================== */
46 
47 /* ============================ ACCESSORS ================================= */
48 
49  virtual OsStatus findFirst(OsProcess &rProcess) = 0;
50  //: Start enumeration of running processes
51  //: Returns OS_SUCCESS if found
52  //: Returns OS_FAILED if none found.
53 
54  virtual OsStatus findNext(OsProcess &rProcess) = 0;
55  //: Continues enumeration of running processes
56  //: Returns OS_SUCCESS if found
57  //: Returns OS_FAILED if none found.
58 
59 
60 /* ============================ INQUIRY =================================== */
61 
62 
63 /* //////////////////////////// PROTECTED ///////////////////////////////// */
64 protected:
65 
66  virtual ~OsProcessIteratorBase();
67  //:Destructor
68 
69 /* //////////////////////////// PRIVATE /////////////////////////////////// */
70 private:
71 
72  OsProcess mProcess;
73  //:Last process found by this class
74 
75  UtlString mProcessNameFilter;
76  //: Used to match enumerated files for filtering
77 
78  OsProcess::OsProcessPriorityClass prioFilterClass;
79  //: Used to match enumerated files for filtering
80 
81 };
82 
83 /* ============================ INLINE METHODS ============================ */
84 
85 // Depending on the native OS that we are running on, we include the class
86 // declaration for the appropriate lower level implementation and use a
87 // "typedef" statement to associate the OS-independent class name (OsProcess)
88 // with the OS-dependent realization of that type (e.g., OsMutexWnt).
89 #if defined(_WIN32)
90 # include "os/Wnt/OsProcessIteratorWnt.h"
91  typedef class OsProcessIteratorWnt OsProcessIterator;
92 #elif defined(_VXWORKS)
93 # include "os/Vxw/OsProcessIteratorVxw.h"
94  typedef class OsProcessIteratorVxw OsProcessIterator;
95 #elif defined(__pingtel_on_posix__)
97  typedef class OsProcessIteratorLinux OsProcessIterator;
98 #else
99 # error Unsupported target platform.
100 #endif
101 
102 
103 #endif // _OsProcessIteratorBase_h_
104 
105 
106 
virtual OsStatus findFirst(OsProcess &rProcess)=0
Definition: OsProcessIteratorLinux.h:36
OsStatus
Definition: OsStatus.h:27
Definition: OsProcessIteratorWnt.h:38
Definition: UtlString.h:48
virtual OsStatus findNext(OsProcess &rProcess)=0
OsProcessIteratorBase()
Definition: OsProcessIteratorBase.cpp:30
virtual ~OsProcessIteratorBase()
Definition: OsProcessIteratorBase.cpp:35
Definition: OsProcessIterator.h:32