OpenWalnut  1.5.0dev
WDataModuleInputFilter.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 WDATAMODULEINPUTFILTER_H
26 #define WDATAMODULEINPUTFILTER_H
27 
28 #include <memory>
29 #include <string>
30 
31 
32 #include "WDataModuleInput.h"
33 
34 /**
35  * This class is the abstract interface allowing \ref WDataModule to define possible supported \ref WDataModuleInput.
36  */
38 {
39 public:
40  /**
41  * Convenience typedef for a std::shared_ptr< WDataModuleInputFilter >.
42  */
43  typedef std::shared_ptr< WDataModuleInputFilter > SPtr;
44 
45  /**
46  * Convenience typedef for a std::shared_ptr< const WDataModuleInputFilter >.
47  */
48  typedef std::shared_ptr< const WDataModuleInputFilter > ConstSPtr;
49 
50  /**
51  * Default constructor. Always provide a useful description!
52  *
53  * \param description a useful description
54  */
55  explicit WDataModuleInputFilter( std::string description );
56 
57  /**
58  * Destructor.
59  */
60  virtual ~WDataModuleInputFilter();
61 
62  /**
63  * Check whether the filter matches the input or not. You can check contents of the file/stream/... if you like to be more accurate.
64  *
65  * \param input the input to check against.
66  *
67  * \return true if the filter matches.
68  */
69  virtual bool matches( WDataModuleInput::ConstSPtr input ) const = 0;
70 
71  /**
72  * Return the description of this filter.
73  *
74  * \return the description
75  */
76  const std::string& getDescription() const;
77 protected:
78 private:
79  /**
80  * The description of the filter
81  */
82  std::string m_description;
83 };
84 
85 #endif // WDATAMODULEINPUTFILTER_H
86 
This class is the abstract interface allowing WDataModule to define possible supported WDataModuleInp...
virtual bool matches(WDataModuleInput::ConstSPtr input) const =0
Check whether the filter matches the input or not.
std::string m_description
The description of the filter.
std::shared_ptr< WDataModuleInputFilter > SPtr
Convenience typedef for a std::shared_ptr< WDataModuleInputFilter >.
WDataModuleInputFilter(std::string description)
Default constructor.
std::shared_ptr< const WDataModuleInputFilter > ConstSPtr
Convenience typedef for a std::shared_ptr< const WDataModuleInputFilter >.
virtual ~WDataModuleInputFilter()
Destructor.
const std::string & getDescription() const
Return the description of this filter.
std::shared_ptr< const WDataModuleInput > ConstSPtr
Convenience typedef for a std::shared_ptr< const WDataModuleInput >.