svn-gvsig-desktop / trunk / libraries / libjni-mrsid / include / base / lti_delegates.h @ 3539
History | View | Annotate | Download (3.32 KB)
1 |
/* $Id: lti_delegates.h 3539 2006-01-09 12:23:20Z nacho $ */
|
---|---|
2 |
/* //////////////////////////////////////////////////////////////////////////
|
3 |
// //
|
4 |
// This code is Copyright (c) 2004 LizardTech, Inc, 1008 Western Avenue, //
|
5 |
// Suite 200, Seattle, WA 98104. Unauthorized use or distribution //
|
6 |
// prohibited. Access to and use of this code is permitted only under //
|
7 |
// license from LizardTech, Inc. Portions of the code are protected by //
|
8 |
// US and foreign patents and other filings. All Rights Reserved. //
|
9 |
// //
|
10 |
////////////////////////////////////////////////////////////////////////// */
|
11 |
/* PUBLIC */
|
12 |
|
13 |
#ifndef LTI_DELEGATES_H
|
14 |
#define LTI_DELEGATES_H
|
15 |
|
16 |
// lt_lib_base
|
17 |
#include "lt_base.h" |
18 |
|
19 |
|
20 |
LT_BEGIN_NAMESPACE(LizardTech) |
21 |
|
22 |
#if defined(LT_COMPILER_MS)
|
23 |
#pragma warning(push,4) |
24 |
#endif
|
25 |
|
26 |
|
27 |
/**
|
28 |
* interrupt delegate (callback) base class
|
29 |
*
|
30 |
* This abstract class is used for implementing a mechanism to determine if
|
31 |
* a potentially long-running operation is to be interrupted, such as
|
32 |
* LTIImageStage::read() or LTIImageWriter::write(). During these sorts of
|
33 |
* operations, an object which has an interrupt delegate may periodically
|
34 |
* call the delegate's getInterruptStatus() method to determine if the
|
35 |
* operation should be aborted. If this function returns a value other than
|
36 |
* LT_STS_Success, then the object will abort the operation and return that
|
37 |
* status value.
|
38 |
*
|
39 |
* Interrupt delegates are typically used in environments such as GUI encoders.
|
40 |
*
|
41 |
* A "delegate" is simply an object-oriented version of a callback function.
|
42 |
*/
|
43 |
class LTIInterruptDelegate |
44 |
{ |
45 |
public:
|
46 |
/**
|
47 |
* check for interrupt
|
48 |
*
|
49 |
* This function should be implemented to indicate whether some user-defined
|
50 |
* event indicates that the operation should be terminated. If an interrupt
|
51 |
* is requested, a value other than LT_STS_Success should be returned.
|
52 |
*
|
53 |
* @return LT_STS_Success if no interrupt requested; any other (nonzero)
|
54 |
* value if an interrupt is requested
|
55 |
*/
|
56 |
virtual LT_STATUS getInterruptStatus() const = 0; |
57 |
}; |
58 |
|
59 |
|
60 |
/**
|
61 |
* progress delegate (callback) base class
|
62 |
*
|
63 |
* This abstract class is used for implementing a mechanism to report the
|
64 |
* progress (percent complete) of a potentially long-running operation.
|
65 |
* During these sorts of operations, an object which has a progress delegate
|
66 |
* may periodically call the delegate's setProgressStatus() method to report
|
67 |
* the percent of the operation completed.
|
68 |
*
|
69 |
* Progress delegates are typically used in GUI environments as a means of
|
70 |
* displaying percent-complete or time-remaining.
|
71 |
*
|
72 |
* A "delegate" is simply an object-oriented version of a callback function.
|
73 |
*/
|
74 |
class LTIProgressDelegate |
75 |
{ |
76 |
public:
|
77 |
/**
|
78 |
* set percent completed
|
79 |
*
|
80 |
* This function should be implemented to report to the client application
|
81 |
* the progress of a long-running operation.
|
82 |
*
|
83 |
* @param percentComplete the percent complete; this must be a value in the
|
84 |
* range 0.0 to 1.0 inclusive
|
85 |
* @return LT_STS_Success if function succeeded, nonzero if some error occurred
|
86 |
*/
|
87 |
virtual LT_STATUS setProgressStatus(float percentComplete) = 0; |
88 |
}; |
89 |
|
90 |
|
91 |
LT_END_NAMESPACE(LizardTech) |
92 |
|
93 |
#if defined(LT_COMPILER_MS)
|
94 |
#pragma warning(pop)
|
95 |
#endif
|
96 |
|
97 |
#endif // LTI_DELEGATES_H |