Main Page
Namespaces
Classes
Files
File List
File Members
include
rosbag_cloud_recorders
utils
periodic_file_deleter.h
Go to the documentation of this file.
1
/*
2
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License").
5
* You may not use this file except in compliance with the License.
6
* A copy of the License is located at
7
*
8
* http://aws.amazon.com/apache2.0
9
*
10
* or in the "license" file accompanying this file. This file is distributed
11
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12
* express or implied. See the License for the specific language governing
13
* permissions and limitations under the License.
14
*/
15
#pragma once
16
17
#include <memory>
18
#include <mutex>
19
#include <string>
20
#include <thread>
21
22
#include <boost/function.hpp>
23
#include <
ros/ros.h
>
24
25
namespace
Aws
26
{
27
namespace
Rosbag
28
{
29
namespace
Utils
30
{
31
32
class
PeriodicFileDeleter
33
{
34
public
:
35
explicit
PeriodicFileDeleter
(
36
boost::function<std::vector<std::string>()> deletion_list_callback,
37
const
int
interval_period_s=10);
38
~PeriodicFileDeleter
();
39
// Delete copy and move constructors
40
PeriodicFileDeleter
(
PeriodicFileDeleter
const
&) =
delete
;
41
PeriodicFileDeleter
&
operator =
(
PeriodicFileDeleter
const
&) =
delete
;
42
PeriodicFileDeleter
(
PeriodicFileDeleter
&&) =
delete
;
43
PeriodicFileDeleter
&
operator=
(
PeriodicFileDeleter
&&) =
delete
;
44
45
void
Start
();
46
void
Stop
();
47
bool
IsActive
()
const
;
48
private
:
49
// Whether the deleter should be deleting files now
50
bool
is_active_
;
51
// Callback function to get a list of files for deletion
52
boost::function<std::vector<std::string>()>
deletion_list_callback_
;
53
// How often the deleter should check for new files to delete
54
const
int
interval_period_s_
;
55
// Protects is_active_
56
mutable
std::mutex
mutex_
;
57
// Runs the deletion loop
58
std::thread
thread_
;
59
// Main logic for deleting a list of files
60
void
DeleteFiles
();
61
};
62
63
}
// namespace Utils
64
}
// namespace Rosbag
65
}
// namespace Aws
Aws::Rosbag::Utils::PeriodicFileDeleter::DeleteFiles
void DeleteFiles()
Definition:
periodic_file_deleter.cpp:80
Aws::Rosbag::Utils::PeriodicFileDeleter::is_active_
bool is_active_
Definition:
periodic_file_deleter.h:50
Aws
Aws::Rosbag::Utils::PeriodicFileDeleter::deletion_list_callback_
boost::function< std::vector< std::string >)> deletion_list_callback_
Definition:
periodic_file_deleter.h:52
Aws::Rosbag::Utils::PeriodicFileDeleter::mutex_
std::mutex mutex_
Definition:
periodic_file_deleter.h:56
Aws::Rosbag::Utils::PeriodicFileDeleter
Definition:
periodic_file_deleter.h:32
Aws::Rosbag::Utils::PeriodicFileDeleter::interval_period_s_
const int interval_period_s_
Definition:
periodic_file_deleter.h:54
Aws::Rosbag::Utils::PeriodicFileDeleter::~PeriodicFileDeleter
~PeriodicFileDeleter()
Definition:
periodic_file_deleter.cpp:46
Aws::Rosbag::Utils::PeriodicFileDeleter::Stop
void Stop()
Definition:
periodic_file_deleter.cpp:65
Aws::Rosbag::Utils::PeriodicFileDeleter::operator=
PeriodicFileDeleter & operator=(PeriodicFileDeleter const &)=delete
Aws::Rosbag::Utils::PeriodicFileDeleter::PeriodicFileDeleter
PeriodicFileDeleter(boost::function< std::vector< std::string >()> deletion_list_callback, const int interval_period_s=10)
Definition:
periodic_file_deleter.cpp:38
Aws::Rosbag::Utils::PeriodicFileDeleter::thread_
std::thread thread_
Definition:
periodic_file_deleter.h:58
ros.h
Aws::Rosbag::Utils::PeriodicFileDeleter::Start
void Start()
Definition:
periodic_file_deleter.cpp:51
Aws::Rosbag::Utils::PeriodicFileDeleter::IsActive
bool IsActive() const
Definition:
periodic_file_deleter.cpp:75
rosbag_cloud_recorders
Author(s): AWS RoboMaker
autogenerated on Tue Jun 1 2021 02:51:27