PCL
ProcessParameter.h
Go to the documentation of this file.
1 // ____ ______ __
2 // / __ \ / ____// /
3 // / /_/ // / / /
4 // / ____// /___ / /___ PixInsight Class Library
5 // /_/ \____//_____/ PCL 2.7.0
6 // ----------------------------------------------------------------------------
7 // pcl/ProcessParameter.h - Released 2024-06-18T15:48:54Z
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-2024 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_ProcessParameter_h
53 #define __PCL_ProcessParameter_h
54 
56 
57 #ifndef __PCL_BUILDING_PIXINSIGHT_APPLICATION
58 
59 #include <pcl/Defs.h>
60 
61 #include <pcl/AutoPointer.h>
62 #include <pcl/Variant.h>
63 
64 namespace pcl
65 {
66 
67 // ----------------------------------------------------------------------------
68 
92 namespace ProcessParameterType
93 {
94  enum value_type
95  {
96  Invalid = -1,
97  UInt8 = 0,
98  Int8,
99  UInt16,
100  Int16,
101  UInt32,
102  Int32,
103  UInt64,
104  Int64,
105  Float,
106  Double,
107  Boolean,
108  Enumeration,
109  String,
110  Block,
111  Table,
112  NumberOfTypes
113  };
114 
125  inline bool IsNumeric( int type )
126  {
127  return type >= UInt8 && type <= Double;
128  }
129 
135  inline bool IsInteger( int type )
136  {
137  return type >= UInt8 && type <= Int64;
138  }
139 
145  inline bool IsReal( int type )
146  {
147  return type == Float || type == Double;
148  }
149 
155  inline bool IsVariableLength( int type )
156  {
157  return type == String || type == Block || type == Table;
158  }
159 }
160 
161 // ----------------------------------------------------------------------------
162 
163 class Process;
164 class ProcessParameterPrivate;
165 
191 class PCL_CLASS ProcessParameter
192 {
193 public:
194 
198  using data_type = ProcessParameterType::value_type;
199 
207 
213  {
216  int value;
217  };
218 
226 
249  ProcessParameter( const Process& process, const IsoString& paramId );
250 
251  ProcessParameter( const Process& process, const IsoString::ustring_base& paramId )
252  : ProcessParameter( process, IsoString( paramId ) )
253  {
254  }
255 
279  ProcessParameter( const ProcessParameter& table, const IsoString& colId );
280 
281  ProcessParameter( const ProcessParameter& table, const IsoString::ustring_base& colId )
282  : ProcessParameter( table, IsoString( colId ) )
283  {
284  }
285 
294 
298  virtual ~ProcessParameter();
299 
306  bool IsNull() const;
307 
314 
320 
330 
340  IsoString Id() const;
341 
365 
379  bool IsRequired() const;
380 
399  bool IsReadOnly() const;
400 
406 
414 
422  data_type Type() const;
423 
431  data_type DataInterpretation() const;
432 
436  bool IsBoolean() const
437  {
438  return Type() == ProcessParameterType::Boolean;
439  }
440 
444  bool IsNumeric() const
445  {
446  return ProcessParameterType::IsNumeric( Type() );
447  }
448 
452  bool IsInteger() const
453  {
454  return ProcessParameterType::IsInteger( Type() );
455  }
456 
461  bool IsReal() const
462  {
463  return ProcessParameterType::IsReal( Type() );
464  }
465 
469  bool IsEnumeration() const
470  {
471  return Type() == ProcessParameterType::Enumeration;
472  }
473 
478  bool IsVariableLength() const
479  {
481  }
482 
486  bool IsString() const
487  {
488  return Type() == ProcessParameterType::String;
489  }
490 
494  bool IsBlock() const
495  {
496  return Type() == ProcessParameterType::Block;
497  }
498 
502  bool IsTable() const
503  {
504  return Type() == ProcessParameterType::Table;
505  }
506 
529 
547  void GetNumericRange( double& minValue, double& maxValue ) const;
548 
553  double MinimumValue() const
554  {
555  double min, dum;
556  GetNumericRange( min, dum );
557  return min;
558  }
559 
564  double MaximumValue() const
565  {
566  double dum, max;
567  GetNumericRange( dum, max );
568  return max;
569  }
570 
592  int Precision() const;
593 
601  bool ScientificNotation() const;
602 
621  void GetLengthLimits( size_type& minLength, size_type& maxLength ) const;
622 
628  {
629  size_type min, dum;
630  GetLengthLimits( min, dum );
631  return min;
632  }
633 
639  {
640  size_type dum, max;
641  GetLengthLimits( dum, max );
642  return max;
643  }
644 
653 
663 
671 
672  // -------------------------------------------------------------------------
673 
674 private:
675 
677 
678  ProcessParameter( const void* );
679 
680  const void* Handle() const;
681 
682  friend class ProcessInstance;
683  friend class InternalParameterEnumerator;
684 };
685 
686 // ----------------------------------------------------------------------------
687 
688 } // pcl
689 
690 #endif // __PCL_BUILDING_PIXINSIGHT_APPLICATION
691 
692 #endif // __PCL_ProcessParameter_h
693 
694 // ----------------------------------------------------------------------------
695 // EOF pcl/ProcessParameter.h - Released 2024-06-18T15:48:54Z
Generic dynamic array.
Definition: Array.h:100
Eight-bit string (ISO/IEC-8859-1 or UTF-8 string)
Definition: String.h:5425
High-level interface to a process instance.
Identifies and describes a process parameter.
ProcessParameter(const ProcessParameter &table, const IsoString &colId)
Variant DefaultValue() const
Process & ParentProcess() const
data_type Type() const
data_type DataInterpretation() const
size_type MaximumLength() const
String ScriptComment() const
double MinimumValue() const
String AllowedCharacters() const
bool IsVariableLength() const
void GetLengthLimits(size_type &minLength, size_type &maxLength) const
ProcessParameter ParentTable() const
double MaximumValue() const
void GetNumericRange(double &minValue, double &maxValue) const
IsoString Id() const
virtual ~ProcessParameter()
bool IsReadOnly() const
ProcessParameter(const Process &process, const IsoString &paramId)
static ProcessParameter & Null()
size_type MinimumLength() const
parameter_list TableColumns() const
IsoStringList Aliases() const
bool IsRequired() const
bool ScientificNotation() const
enumeration_element_list EnumerationElements() const
String Description() const
ProcessParameter(const ProcessParameter &p)
High-level interface to an installed process.
Definition: Process.h:99
Unicode (UTF-16) string.
Definition: String.h:8113
Acts like a union to store instances of different data types.
Definition: Variant.h:332
size_t size_type
Definition: Defs.h:609
PCL root namespace.
Definition: AbstractImage.h:77
Structure used to describe an enumeration element.
IsoStringList aliases
Alias identifiers.