Apache Log4cxx  Version 1.4.0
Loading...
Searching...
No Matches
filewatchdog.h
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef _LOG4CXX_HELPERS_FILEWATCHDOG_H
19#define _LOG4CXX_HELPERS_FILEWATCHDOG_H
20
21#include <log4cxx/logstring.h>
22#include <time.h>
24#include <log4cxx/file.h>
25
26namespace LOG4CXX_NS
27{
28namespace helpers
29{
30
35class LOG4CXX_EXPORT FileWatchdog
36{
37 public:
38 virtual ~FileWatchdog();
42 static long DEFAULT_DELAY /*= 60000 ms*/;
43
44 protected:
45 FileWatchdog(const File& filename);
46 virtual void doOnChange() = 0;
48 const File& file();
49
50 public:
54 void setDelay(long delay);
55
59 void start();
60
64 void stop();
65
69 bool is_active();
70
74 static void stopAll();
75 private:
76
78 FileWatchdog& operator=(const FileWatchdog&);
79
80 LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(FileWatchdogPrivate, m_priv)
81};
82} // namespace helpers
83} // namespace log4cxx
84
85
86#endif // _LOG4CXX_HELPERS_FILEWATCHDOG_H
An abstract representation of file and directory path names.
Definition: file.h:41
Check every now and then that a certain file has not changed.
Definition: filewatchdog.h:36
void setDelay(long delay)
Use delay as the number of milliseconds to wait between each check for file changes.
bool is_active()
Is the task that periodically checks for a file change running?
void start()
Create an asynchronous task that periodically checks for a file change after first calling doOnChange...
void stop()
Stop the task that periodically checks for a file change.
FileWatchdog(const File &filename)
static void stopAll()
Stop all tasks that periodically check for a file change.