Rosetta 3.5
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
protocols
simple_filters
FileRemoveFilter.cc
Go to the documentation of this file.
1
// -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2
// vi: set ts=2 noet:
3
//
4
// (c) Copyright Rosetta Commons Member Institutions.
5
// (c) This file is part of the Rosetta software suite and is made available under license.
6
// (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7
// (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8
// (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9
10
/// @file protocols/simple_filters/FileRemoveFilter.cc
11
/// @brief
12
/// @author Sarel Fleishman
13
14
15
//Unit Headers
16
#include <
protocols/simple_filters/FileRemoveFilter.hh
>
17
#include <
protocols/simple_filters/FileRemoveFilterCreator.hh
>
18
#include <utility/tag/Tag.hh>
19
//Project Headers
20
#include <basic/Tracer.hh>
21
#include <utility/vector1.hh>
22
#include <utility/string_util.hh>
23
#include <boost/foreach.hpp>
24
#include <stdio.h>
25
#include <fstream>
26
27
#define foreach BOOST_FOREACH
28
29
namespace
protocols{
30
namespace
simple_filters {
31
32
using namespace
core;
33
using namespace
core::scoring;
34
35
static
basic::Tracer
TR
(
"protocols.simple_filters.FileRemoveFilter"
);
36
37
protocols::filters::FilterOP
38
FileRemoveFilterCreator::create_filter
()
const
{
return
new
FileRemoveFilter
; }
39
40
std::string
41
FileRemoveFilterCreator::keyname
()
const
{
return
"FileRemove"
; }
42
43
//default ctor
44
FileRemoveFilter::FileRemoveFilter
() :
45
protocols::filters::
Filter
(
"FileRemove"
),
46
delete_content_only_( false )
47
{
48
file_names_
.clear();
49
}
50
51
FileRemoveFilter::~FileRemoveFilter
() {}
52
53
void
54
FileRemoveFilter::parse_my_tag
(
utility::tag::TagPtr
const
tag,
moves::DataMap
&,
filters::Filters_map
const
&,
moves::Movers_map
const
&,
core::pose::Pose
const
& )
55
{
56
std::string
s;
57
s = tag->getOption<
std::string
>(
"filenames"
);
58
file_names
( utility::string_split( s,
','
) );
59
delete_content_only
( tag->getOption<
bool
>(
"delete_content_only"
,
false
) );
60
}
61
62
bool
63
FileRemoveFilter::apply
(
core::pose::Pose
const
& )
const
{
64
using namespace
std;
65
foreach
(
std::string
const
f,
file_names_
){
66
if
(
remove
( f.c_str() ) )
67
TR<<
"Successfully removed "
<<f<<std::endl;
68
else
69
TR<<
"File "
<<f<<
" not found."
<<std::endl;
70
if
(
delete_content_only
() ){
71
TR<<
"Leaving 0b placeholder for file "
<<f<<std::endl;
72
ofstream outfile;
73
outfile.open( f.c_str(), ios::trunc );
74
outfile.close();
75
}
76
}
77
return
true
;
78
}
79
80
void
81
FileRemoveFilter::report
( std::ostream & out,
core::pose::Pose
const
& pose )
const
{
82
out<<
compute
( pose )<<std::endl;
83
}
84
85
core::Real
86
FileRemoveFilter::report_sm
(
core::pose::Pose
const
& pose )
const
{
87
return
(
compute
( pose ) );
88
}
89
90
core::Real
91
FileRemoveFilter::compute
(
92
core::pose::Pose
const
&
93
)
const
{
94
return
1;
95
}
96
97
utility::vector1< std::string >
98
FileRemoveFilter::file_names
()
const
{
99
return
file_names_
;
100
}
101
102
void
103
FileRemoveFilter::file_names
(
utility::vector1< std::string >
const
f ){
104
file_names_
= f;
105
}
106
107
}
108
}
Generated on Sat Jun 1 2013 12:13:29 for Rosetta 3.5 by
1.8.4