Last change
on this file since 35 was
22,
checked in by rings, 14 years ago
|
|
-
Property svn:executable set to
*
|
File size:
961 bytes
|
Line | |
---|
1 | /** |
---|
2 | * @file CaptureFactory.cpp |
---|
3 | * @author Tomas Urban |
---|
4 | * @version 0.1 |
---|
5 | * @date 16/07/2009 |
---|
6 | */ |
---|
7 | #include "CaptureFactory.h" |
---|
8 | #include "PCAPLiveCapture.h" |
---|
9 | #include "PCAPOfflineCapture.h" |
---|
10 | #include "Logger/Logger.h" |
---|
11 | |
---|
12 | CaptureFactory::CaptureFactory(void) |
---|
13 | { |
---|
14 | } |
---|
15 | |
---|
16 | CaptureFactory::~CaptureFactory(void) |
---|
17 | { |
---|
18 | } |
---|
19 | |
---|
20 | GenericCapture * CaptureFactory::CreateCaptureInstance(ECaptureType captureType, |
---|
21 | ECaptureMode captureMode) |
---|
22 | { |
---|
23 | GenericCapture * pInst = NULL; |
---|
24 | std::string s = "Capture instance created: "; |
---|
25 | switch (captureType) |
---|
26 | { |
---|
27 | case ECaptureType_PCAP: |
---|
28 | if (captureMode == ECaptureMode_Live) |
---|
29 | { |
---|
30 | pInst = new PCAPLiveCapture(); |
---|
31 | s += "PCAP live"; |
---|
32 | } |
---|
33 | else |
---|
34 | { |
---|
35 | pInst = new PCAPOfflineCapture(); |
---|
36 | s += "PCAP offline"; |
---|
37 | } |
---|
38 | break; |
---|
39 | } |
---|
40 | if (pInst) |
---|
41 | Logger::Instance().LogDebug(s); |
---|
42 | else |
---|
43 | Logger::Instance().LogError("Unknown capture type"); |
---|
44 | return pInst; |
---|
45 | } |
---|
46 | void CaptureFactory::DisposeCaptureInstance(GenericCapture * pInstance) |
---|
47 | { |
---|
48 | delete pInstance; |
---|
49 | } |
---|
50 | |
---|
51 | |
---|
Note: See
TracBrowser
for help on using the repository browser.