OpenWalnut  1.5.0dev
WDataModuleInputFilterFile.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #ifndef WDATAMODULEINPUTFILTERFILE_H
26 #define WDATAMODULEINPUTFILTERFILE_H
27 
28 #include <memory>
29 #include <string>
30 
31 
32 #include "WDataModuleInputFilter.h"
33 
34 /**
35  * Checks a given \ref WDataModuleInput against a file type.
36  */
38 {
39 public:
40  /**
41  * Convenience typedef for a std::shared_ptr< WDataModuleInputFilterFile >.
42  */
43  typedef std::shared_ptr< WDataModuleInputFilterFile > SPtr;
44 
45  /**
46  * Convenience typedef for a std::shared_ptr< const WDataModuleInputFilterFile >.
47  */
48  typedef std::shared_ptr< const WDataModuleInputFilterFile > ConstSPtr;
49 
50  /**
51  * Default constructor. Provide an extension and description for it.
52  *
53  * \param extension the extension, without "." (i.e. "nii.gz")
54  * \param description the description for this kind of file.
55  */
56  WDataModuleInputFilterFile( std::string extension, std::string description );
57 
58  /**
59  * Destructor.
60  */
62 
63  /**
64  * Get the defined extension.
65  *
66  * \return the extension
67  */
68  const std::string& getExtension() const;
69 
70  /**
71  * Check whether the filter matches the input or not. This filter requires the input to be a file with a certain extension.
72  *
73  * \param input the input to check against.
74  *
75  * \return true if the last extension of the file matches.
76  */
77  bool virtual matches( WDataModuleInput::ConstSPtr input ) const;
78 protected:
79 private:
80  /**
81  * Extension to check against
82  */
83  std::string m_extension;
84 };
85 
86 #endif // WDATAMODULEINPUTFILTERFILE_H
87 
Checks a given WDataModuleInput against a file type.
const std::string & getExtension() const
Get the defined extension.
std::shared_ptr< const WDataModuleInputFilterFile > ConstSPtr
Convenience typedef for a std::shared_ptr< const WDataModuleInputFilterFile >.
virtual ~WDataModuleInputFilterFile()
Destructor.
std::shared_ptr< WDataModuleInputFilterFile > SPtr
Convenience typedef for a std::shared_ptr< WDataModuleInputFilterFile >.
std::string m_extension
Extension to check against.
virtual bool matches(WDataModuleInput::ConstSPtr input) const
Check whether the filter matches the input or not.
WDataModuleInputFilterFile(std::string extension, std::string description)
Default constructor.
This class is the abstract interface allowing WDataModule to define possible supported WDataModuleInp...
std::shared_ptr< const WDataModuleInput > ConstSPtr
Convenience typedef for a std::shared_ptr< const WDataModuleInput >.