OpenWalnut  1.5.0dev
WDataModuleInput.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 WDATAMODULEINPUT_H
26 #define WDATAMODULEINPUT_H
27 
28 #include <memory>
29 #include <ostream>
30 #include <string>
31 
32 
33 /**
34  * This class is the abstract interface to all the possible inputs a \ref WDataModule might handle. The classes can be specialized into streamed
35  * inputs, file inputs and similar.
36  */
38 {
39 public:
40  /**
41  * Convenience typedef for a std::shared_ptr< WDataModuleInput >.
42  */
43  typedef std::shared_ptr< WDataModuleInput > SPtr;
44 
45  /**
46  * Convenience typedef for a std::shared_ptr< const WDataModuleInput >.
47  */
48  typedef std::shared_ptr< const WDataModuleInput > ConstSPtr;
49 
50  /**
51  * Default constructor.
52  */
54 
55  /**
56  * Destructor.
57  */
58  virtual ~WDataModuleInput();
59 
60  /**
61  * Return a unique name for this input type. This is used to identify a certain input later.
62  *
63  * \return the name.
64  */
65  virtual std::string getName() const = 0;
66 
67  /**
68  * Return a human-readable form of the input. Like filenames, server names and similar.
69  *
70  * \return the input as string
71  */
72  virtual std::string asString() const = 0;
73 
74  /**
75  * Return some extend information for the input, like complete path, server data (username, subject name, ...). It is up to you.
76  *
77  * \return some extended information as string.
78  */
79  virtual std::string getExtendedInfo() const;
80 
81  /**
82  * Write a machine-readable string which allows to restore your specific input later. No line-breaks, no ":" and it must not be empty.
83  *
84  * \param out the stream to serialize to
85  *
86  * \return the stream
87  */
88  virtual std::ostream& serialize( std::ostream& out ) const = 0; // NOLINT: yes, it is an intended non-const ref
89 
90  /**
91  * Create an instance by using a parameter string. This is the string you define by the \ref serialize() call.
92  *
93  * \param parameter the parameter string
94  * \param name the name string
95  *
96  * \return an instance of WDataModuleInput
97  */
98  static SPtr create( std::string name, std::string parameter );
99 protected:
100 private:
101 };
102 
103 #endif // WDATAMODULEINPUT_H
104 
This class is the abstract interface to all the possible inputs a WDataModule might handle.
virtual std::string getExtendedInfo() const
Return some extend information for the input, like complete path, server data (username,...
virtual ~WDataModuleInput()
Destructor.
virtual std::string asString() const =0
Return a human-readable form of the input.
std::shared_ptr< WDataModuleInput > SPtr
Convenience typedef for a std::shared_ptr< WDataModuleInput >.
virtual std::string getName() const =0
Return a unique name for this input type.
static SPtr create(std::string name, std::string parameter)
Create an instance by using a parameter string.
virtual std::ostream & serialize(std::ostream &out) const =0
Write a machine-readable string which allows to restore your specific input later.
WDataModuleInput()
Default constructor.
std::shared_ptr< const WDataModuleInput > ConstSPtr
Convenience typedef for a std::shared_ptr< const WDataModuleInput >.