KiCad PCB EDA Suite
Loading...
Searching...
No Matches
jobset.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2024 Mark Roszko <[email protected]>
5 * Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef JOBS_FILE_H
22#define JOBS_FILE_H
23
24#include <jobs/job.h>
25#include <jobs/jobs_output.h>
27#include <settings/parameters.h>
28#include <ctime>
29#include <memory>
30
32{
33 JOBSET_JOB() : m_job( nullptr ) {}
34
35 JOBSET_JOB( wxString id, wxString type, JOB* job ) : m_id( id ), m_type( type ), m_job( job ) {}
36
37 wxString m_id;
38 wxString m_type;
39 std::shared_ptr<JOB> m_job;
40
41 bool operator==( const JOBSET_JOB& rhs ) const;
42};
43
45{
46 FOLDER,
48};
49
51{
53 m_type( JOBSET_OUTPUT_TYPE::FOLDER ), m_outputHandler( nullptr )
54 {}
55
56 JOBSET_OUTPUT( wxString id, JOBSET_OUTPUT_TYPE type, JOBS_OUTPUT_HANDLER* outputHandler ) :
57 m_id( id ), m_type( type ), m_outputHandler( outputHandler )
58 {
59 }
60
61 wxString m_id;
64 std::vector<wxString> m_only;
65
66 bool operator==( const JOBSET_OUTPUT& rhs ) const;
67};
68
70{
71public:
72 JOBSET( const wxString& aFilename );
73
74 virtual ~JOBSET() {}
75
76 std::vector<JOBSET_JOB>& GetJobs()
77 {
78 return m_jobs;
79 }
80
81 std::vector<JOBSET_JOB> GetJobsForOutput( JOBSET_OUTPUT* aOutput );
82
83 std::vector<JOBSET_OUTPUT>& GetOutputs() { return m_outputs; }
84
85 JOBSET_OUTPUT* GetOutput( wxString& aOutput );
86
87 bool SaveToFile( const wxString& aDirectory = "", bool aForce = false ) override;
88
89 void SetDirty() { m_dirty = true; }
90 bool GetDirty() const { return m_dirty; }
91
92 wxString GetFullName() const { return m_fileNameWithoutPath; }
93
94 void AddNewJob( wxString aType, JOB* aJob );
95 JOBSET_OUTPUT AddNewJobOutput( JOBSET_OUTPUT_TYPE aType,
96 JOBS_OUTPUT_HANDLER* aJobOutput );
97
98 void RemoveOutput( JOBSET_OUTPUT* aOutput );
99 void MoveJobUp( size_t aJobIdx );
100 void MoveJobDown( size_t aJobIdx );
101 void RemoveJob( size_t aJobIdx );
102
103protected:
104 wxString getFileExt() const override;
105
106private:
107 std::vector<JOBSET_JOB> m_jobs;
108 std::vector<JOBSET_OUTPUT> m_outputs;
109
112};
113
114KICOMMON_API void to_json( nlohmann::json& j, const JOBSET_JOB& f );
115KICOMMON_API void from_json( const nlohmann::json& j, JOBSET_JOB& f );
116
117KICOMMON_API void to_json( nlohmann::json& j, const JOBSET_OUTPUT& f );
118KICOMMON_API void from_json( const nlohmann::json& j, JOBSET_OUTPUT& f );
119
120#if defined( __MINGW32__ )
123#else
124extern template class APIVISIBLE PARAM_LIST<JOBSET_JOB>;
125extern template class APIVISIBLE PARAM_LIST<JOBSET_OUTPUT>;
126#endif
127
128#endif
bool operator==(const wxAuiPaneInfo &aLhs, const wxAuiPaneInfo &aRhs)
Definition: jobset.h:70
wxString m_fileNameWithoutPath
Definition: jobset.h:111
bool GetDirty() const
Definition: jobset.h:90
void SetDirty()
Definition: jobset.h:89
std::vector< JOBSET_JOB > m_jobs
Definition: jobset.h:107
std::vector< JOBSET_OUTPUT > m_outputs
Definition: jobset.h:108
std::vector< JOBSET_JOB > & GetJobs()
Definition: jobset.h:76
bool m_dirty
Definition: jobset.h:110
std::vector< JOBSET_OUTPUT > & GetOutputs()
Definition: jobset.h:83
wxString GetFullName() const
Definition: jobset.h:92
virtual ~JOBSET()
Definition: jobset.h:74
An simple container class that lets us dispatch output jobs to kifaces.
Definition: job.h:79
#define APIVISIBLE
Definition: import_export.h:55
JOBSET_OUTPUT_TYPE
Definition: jobset.h:45
KICOMMON_API void from_json(const nlohmann::json &j, JOBSET_JOB &f)
Definition: jobset.cpp:53
KICOMMON_API void to_json(nlohmann::json &j, const JOBSET_JOB &f)
#define KICOMMON_API
Definition: kicommon.h:28
wxString m_id
Definition: jobset.h:37
std::shared_ptr< JOB > m_job
Definition: jobset.h:39
JOBSET_JOB(wxString id, wxString type, JOB *job)
Definition: jobset.h:35
wxString m_type
Definition: jobset.h:38
JOBSET_JOB()
Definition: jobset.h:33
std::vector< wxString > m_only
Definition: jobset.h:64
wxString m_id
Definition: jobset.h:61
JOBS_OUTPUT_HANDLER * m_outputHandler
Definition: jobset.h:63
JOBSET_OUTPUT()
Definition: jobset.h:52
JOBSET_OUTPUT(wxString id, JOBSET_OUTPUT_TYPE type, JOBS_OUTPUT_HANDLER *outputHandler)
Definition: jobset.h:56
JOBSET_OUTPUT_TYPE m_type
Definition: jobset.h:62