PCL
MetaProcess.h
Go to the documentation of this file.
1 // ____ ______ __
2 // / __ \ / ____// /
3 // / /_/ // / / /
4 // / ____// /___ / /___ PixInsight Class Library
5 // /_/ \____//_____/ PCL 2.4.1
6 // ----------------------------------------------------------------------------
7 // pcl/MetaProcess.h - Released 2020-10-12T19:24:41Z
8 // ----------------------------------------------------------------------------
9 // This file is part of the PixInsight Class Library (PCL).
10 // PCL is a multiplatform C++ framework for development of PixInsight modules.
11 //
12 // Copyright (c) 2003-2020 Pleiades Astrophoto S.L. All Rights Reserved.
13 //
14 // Redistribution and use in both source and binary forms, with or without
15 // modification, is permitted provided that the following conditions are met:
16 //
17 // 1. All redistributions of source code must retain the above copyright
18 // notice, this list of conditions and the following disclaimer.
19 //
20 // 2. All redistributions in binary form must reproduce the above copyright
21 // notice, this list of conditions and the following disclaimer in the
22 // documentation and/or other materials provided with the distribution.
23 //
24 // 3. Neither the names "PixInsight" and "Pleiades Astrophoto", nor the names
25 // of their contributors, may be used to endorse or promote products derived
26 // from this software without specific prior written permission. For written
27 // permission, please contact info@pixinsight.com.
28 //
29 // 4. All products derived from this software, in any form whatsoever, must
30 // reproduce the following acknowledgment in the end-user documentation
31 // and/or other materials provided with the product:
32 //
33 // "This product is based on software from the PixInsight project, developed
34 // by Pleiades Astrophoto and its contributors (https://pixinsight.com/)."
35 //
36 // Alternatively, if that is where third-party acknowledgments normally
37 // appear, this acknowledgment must be reproduced in the product itself.
38 //
39 // THIS SOFTWARE IS PROVIDED BY PLEIADES ASTROPHOTO AND ITS CONTRIBUTORS
40 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
41 // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PLEIADES ASTROPHOTO OR ITS
43 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
44 // EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, BUSINESS
45 // INTERRUPTION; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; AND LOSS OF USE,
46 // DATA OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
47 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
48 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
49 // POSSIBILITY OF SUCH DAMAGE.
50 // ----------------------------------------------------------------------------
51 
52 #ifndef __PCL_MetaProcess_h
53 #define __PCL_MetaProcess_h
54 
56 
57 #ifndef __PCL_BUILDING_PIXINSIGHT_APPLICATION
58 
59 #include <pcl/Defs.h>
60 #include <pcl/Diagnostics.h>
61 
62 #include <pcl/MetaObject.h>
63 #include <pcl/ProcessBase.h>
64 #include <pcl/StringList.h>
65 
66 namespace pcl
67 {
68 
69 // ----------------------------------------------------------------------------
70 
71 class View;
72 class ImageWindow;
73 class ProcessImplementation;
74 class ProcessInterface;
75 class MetaParameter;
76 
106 class PCL_CLASS MetaProcess : public MetaObject, public ProcessBase
107 {
108 public:
109 
113  MetaProcess();
114 
119  virtual ~MetaProcess() noexcept( false )
120  {
121  }
122 
127  MetaProcess( const MetaProcess& ) = delete;
128 
133  MetaProcess& operator =( const MetaProcess& ) = delete;
134 
139  MetaProcess( MetaProcess&& x ) = delete;
140 
145  MetaProcess& operator =( MetaProcess&& x ) = delete;
146 
149  virtual IsoString Id() const override = 0;
150 
175  virtual IsoString Aliases() const
176  {
177  return IsoString();
178  }
179 
205  virtual IsoString Categories() const
206  {
207  return IsoString(); // General category
208  }
209 
217  virtual IsoString Category() const // ### PCL 2.x: Remove
218  {
219  return Categories();
220  }
221 
230  uint32 Version() const override
231  {
232  return 0x100;
233  }
234 
254  String Description() const override
255  {
256  return String();
257  }
258 
270  String ScriptComment() const override
271  {
272  return String();
273  }
274 
300  virtual IsoString IconImageSVG() const
301  {
302  return IsoString();
303  }
304 
367  virtual String IconImageSVGFile() const
368  {
369  return String();
370  }
371 
398  virtual const char** IconImageXPM() const
399  {
400  return nullptr;
401  }
402 
424  virtual String IconImageFile() const
425  {
426  return String();
427  }
428 
457  virtual const char** SmallIconImageXPM() const
458  {
459  return nullptr;
460  }
461 
480  virtual String SmallIconImageFile() const
481  {
482  return String();
483  }
484 
487  Bitmap Icon() const override;
488 
491  Bitmap SmallIcon() const override;
492 
511  virtual void InitializeClass()
512  {
513  }
514 
541  {
542  return nullptr; // by default, processes have no associated interfaces.
543  }
544 
561  bool CanProcessViews() const override
562  {
563  return true;
564  }
565 
586  bool CanProcessGlobal() const override
587  {
588  return true;
589  }
590 
619  bool CanProcessImages() const override
620  {
621  return false;
622  }
623 
637  bool CanProcessCommandLines() const override
638  {
639  return false;
640  }
641 
654  bool CanEditPreferences() const override
655  {
656  return false;
657  }
658 
679  bool CanBrowseDocumentation() const override
680  {
681  return true;
682  }
683 
697  virtual ProcessImplementation* Create() const = 0;
698 
710  virtual ProcessImplementation* Clone( const ProcessImplementation& ) const = 0;
711 
738  {
739  return Clone( p );
740  }
741 
754  bool IsAssignable() const override
755  {
756  return true; // by default, processes are considered assignable.
757  }
758 
785  bool NeedsInitialization() const override
786  {
787  return false; // by default, process instances are not initialized.
788  }
789 
807  bool NeedsValidation() const override
808  {
809  return false; // by default, process instances are not validated.
810  }
811 
828  bool PrefersGlobalExecution() const override
829  {
830  return false; // by default, processes prefer execution on views.
831  }
832 
844  virtual int ProcessCommandLine( const StringList& argv ) const;
845 
863  bool EditPreferences() const override;
864 
885  bool BrowseDocumentation() const override;
886 
894  const MetaParameter* operator[]( size_type i ) const;
895 
927  virtual bool CanProcessIPCMessages() const
928  {
929  return false;
930  }
931 
951  virtual void IPCStart( int instance, const IsoString& messageUID, const String& parameters ) const;
952 
967  virtual void IPCStop( int instance, const IsoString& messageUID ) const;
968 
988  virtual void IPCSetParameters( int instance, const IsoString& messageUID, const String& parameters ) const;
989 
1014  virtual int IPCStatus( int instance, const IsoString& messageUID ) const;
1015 
1016 private:
1017 
1018  void PerformAPIDefinitions() const override;
1019 };
1020 
1021 // ----------------------------------------------------------------------------
1022 
1023 } // pcl
1024 
1025 #endif // __PCL_BUILDING_PIXINSIGHT_APPLICATION
1026 
1027 #endif // __PCL_MetaProcess_h
1028 
1029 // ----------------------------------------------------------------------------
1030 // EOF pcl/MetaProcess.h - Released 2020-10-12T19:24:41Z
Client-side interface to a PixInsight Bitmap object.
Definition: Bitmap.h:203
String ScriptComment() const override
Definition: MetaProcess.h:270
Root base class for all PixInsight module components.
Definition: MetaObject.h:85
virtual String SmallIconImageFile() const
Definition: MetaProcess.h:480
virtual ProcessInterface * DefaultInterface() const
Definition: MetaProcess.h:540
virtual const char ** IconImageXPM() const
Definition: MetaProcess.h:398
virtual String IconImageSVGFile() const
Definition: MetaProcess.h:367
PCL root namespace.
Definition: AbstractImage.h:76
bool PrefersGlobalExecution() const override
Definition: MetaProcess.h:828
bool CanProcessCommandLines() const override
Definition: MetaProcess.h:637
virtual ~MetaProcess() noexcept(false)
Definition: MetaProcess.h:119
virtual const char ** SmallIconImageXPM() const
Definition: MetaProcess.h:457
String Id(value_type operation)
String Description() const override
Definition: MetaProcess.h:254
Client-side interface to a PixInsight process interface window.
uint32 Version() const override
Definition: MetaProcess.h:230
virtual bool CanProcessIPCMessages() const
Definition: MetaProcess.h:927
Implementation of a PixInsight process instance.
bool CanProcessGlobal() const override
Definition: MetaProcess.h:586
size_t size_type
Definition: Defs.h:557
Unicode (UTF-16) string.
Definition: String.h:7916
bool NeedsInitialization() const override
Definition: MetaProcess.h:785
bool CanProcessViews() const override
Definition: MetaProcess.h:561
virtual IsoString Aliases() const
Definition: MetaProcess.h:175
bool NeedsValidation() const override
Definition: MetaProcess.h:807
Dynamic list of Unicode (UTF-16) strings.
virtual String IconImageFile() const
Definition: MetaProcess.h:424
virtual IsoString Category() const
Definition: MetaProcess.h:217
virtual ProcessImplementation * TestClone(const ProcessImplementation &p) const
Definition: MetaProcess.h:737
virtual IsoString Categories() const
Definition: MetaProcess.h:205
bool CanEditPreferences() const override
Definition: MetaProcess.h:654
Abstract base class for process descriptions.
Definition: ProcessBase.h:94
virtual void InitializeClass()
Definition: MetaProcess.h:511
virtual IsoString IconImageSVG() const
Definition: MetaProcess.h:300
bool CanProcessImages() const override
Definition: MetaProcess.h:619
unsigned int uint32
Definition: Defs.h:614
Root base class for PCL classes providing formal descriptions of process parameters.
Definition: MetaParameter.h:99
bool CanBrowseDocumentation() const override
Definition: MetaProcess.h:679
A formal description of a PixInsight process.
Definition: MetaProcess.h:106
bool IsAssignable() const override
Definition: MetaProcess.h:754
Eight-bit string (ISO/IEC-8859-1 or UTF-8 string)
Definition: String.h:5390