xref: /glogg/src/viewinterface.h (revision d96f3f211e1e2a3a5b219145986c18e10b0f96aa)
1 /*
2  * Copyright (C) 2013 Nicolas Bonnefon and other contributors
3  *
4  * This file is part of glogg.
5  *
6  * glogg is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * glogg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with glogg.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef VIEWINTERFACE_H
21 #define VIEWINTERFACE_H
22 
23 #include <memory>
24 
25 class LogData;
26 class LogFilteredData;
27 
28 // ViewInterface represents a high-level view on a log file.
29 class ViewInterface {
30   public:
31     // Set the log data to associate to this view
32     // Ownership stay with the caller but is shared
33     void setLogData( std::shared_ptr<LogData> log_data )
34     { doSetLogData( log_data ); }
35     // Set the Filetered log data to associate to this view
36     // Ownership stay with the caller but is shared
37     void setLogFilteredData( std::shared_ptr<LogFilteredData> filtered_data )
38     { doSetLogFilteredData( filtered_data ); }
39 
40     // For save/restore of the context
41     /*
42     virtual void setViewContext( const ViewContextInterface& view_context ) = 0;
43     virtual ViewContextInterface& getViewContext( void ) = 0;
44     */
45 
46     // No polymorphic destruction please...
47     ~ViewInterface() = delete;
48 
49   protected:
50     // Virtual functions (using NVI)
51     virtual void doSetLogData( std::shared_ptr<LogData> log_data ) = 0;
52     virtual void doSetLogFilteredData( std::shared_ptr<LogFilteredData> filtered_data ) = 0;
53 };
54 #endif
55