1 // Module: Log4CPLUS
2 // File: appenderattachable.h
3 // Created: 6/2001
4 // Author: Tad E. Smith
5 //
6 //
7 // Copyright (C) Tad E. Smith All rights reserved.
8 //
9 // This software is published under the terms of the Apache Software
10 // License version 1.1, a copy of which has been included with this
11 // distribution in the LICENSE.APL file.
12 //
13
14 /** @file */
15
16 #ifndef _LOG4CPLUS_SPI_APPENDER_ATTACHABLE_HEADER_
17 #define _LOG4CPLUS_SPI_APPENDER_ATTACHABLE_HEADER_
18
19 #include <log4cplus/config.h>
20 #include <log4cplus/appender.h>
21 #include <log4cplus/tstring.h>
22 #include <log4cplus/helpers/pointer.h>
23 #include <vector>
24
25 namespace log4cplus {
26 // Forward Declarations
27 typedef helpers::SharedObjectPtr<Appender> SharedAppenderPtr;
28 typedef std::vector<log4cplus::SharedAppenderPtr> SharedAppenderPtrList;
29
30 namespace spi {
31
32 /**
33 * This Interface is for attaching Appenders to objects.
34 */
35 class LOG4CPLUS_EXPORT AppenderAttachable {
36 public:
37 // Methods
38 /**
39 * Add an appender.
40 */
41 virtual void addAppender(SharedAppenderPtr newAppender) = 0;
42
43 /**
44 * Get all previously added appenders as an Enumeration.
45 */
46 virtual SharedAppenderPtrList getAllAppenders() = 0;
47
48 /**
49 * Get an appender by name.
50 */
51 virtual SharedAppenderPtr getAppender(const log4cplus::tstring& name) = 0;
52
53 /**
54 * Remove all previously added appenders.
55 */
56 virtual void removeAllAppenders() = 0;
57
58 /**
59 * Remove the appender passed as parameter from the list of appenders.
60 */
61 virtual void removeAppender(SharedAppenderPtr appender) = 0;
62
63 /**
64 * Remove the appender with the name passed as parameter from the
65 * list of appenders.
66 */
67 virtual void removeAppender(const log4cplus::tstring& name) = 0;
68
69 // Dtor
70 virtual ~AppenderAttachable(){}
71 };
72
73 } // end namespace spi
74 } // end namespace log4cplus
75
76 #endif // _LOG4CPLUS_SPI_APPENDER_ATTACHABLE_HEADER_
syntax highlighted by Code2HTML, v. 0.9.1