PCL
ProcessParameter.h
Go to the documentation of this file.
1 // ____ ______ __
2 // / __ \ / ____// /
3 // / /_/ // / / /
4 // / ____// /___ / /___ PixInsight Class Library
5 // /_/ \____//_____/ PCL 2.6.5
6 // ----------------------------------------------------------------------------
7 // pcl/ProcessParameter.h - Released 2024-01-13T15:47:58Z
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 
293  ProcessParameter( const ProcessParameter& p );
294 
298  virtual ~ProcessParameter();
299 
306  bool IsNull() const;
307 
313  static ProcessParameter& Null();
314 
319  Process& ParentProcess() const;
320 
329  ProcessParameter ParentTable() const;
330 
340  IsoString Id() const;
341 
364  IsoStringList Aliases() const;
365 
379  bool IsRequired() const;
380 
399  bool IsReadOnly() const;
400 
405  String Description() const;
406 
413  String ScriptComment() const;
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 
528  Variant DefaultValue() const;
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 
652  enumeration_element_list EnumerationElements() const;
653 
662  String AllowedCharacters() const;
663 
670  parameter_list TableColumns() const;
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-01-13T15:47:58Z
pcl
PCL root namespace.
Definition: AbstractImage.h:76
pcl::ProcessParameter::MinimumValue
double MinimumValue() const
Definition: ProcessParameter.h:553
pcl::ProcessParameter::IsString
bool IsString() const
Definition: ProcessParameter.h:486
pcl::ImageOp::Id
String Id(value_type operation)
pcl::ProcessParameter::EnumerationElement::aliases
IsoStringList aliases
Alias identifiers.
Definition: ProcessParameter.h:215
pcl::String
Unicode (UTF-16) string.
Definition: String.h:8112
pcl::Variant
Acts like a union to store instances of different data types.
Definition: Variant.h:331
pcl::ProcessParameter::MaximumLength
size_type MaximumLength() const
Definition: ProcessParameter.h:638
pcl::ProcessParameter::MaximumValue
double MaximumValue() const
Definition: ProcessParameter.h:564
pcl::ProcessInstance
High-level interface to a process instance.
Definition: ProcessInstance.h:86
pcl::ProcessParameterType::IsInteger
bool IsInteger(int type)
Definition: ProcessParameter.h:135
pcl::IsoString
Eight-bit string (ISO/IEC-8859-1 or UTF-8 string)
Definition: String.h:5424
pcl::ProcessParameter::IsInteger
bool IsInteger() const
Definition: ProcessParameter.h:452
pcl::ProcessParameter::IsReal
bool IsReal() const
Definition: ProcessParameter.h:461
pcl::ProcessParameter::IsVariableLength
bool IsVariableLength() const
Definition: ProcessParameter.h:478
pcl::Process
High-level interface to an installed process.
Definition: Process.h:98
pcl::ProcessParameter::IsBoolean
bool IsBoolean() const
Definition: ProcessParameter.h:436
pcl::ProcessParameter::IsNumeric
bool IsNumeric() const
Definition: ProcessParameter.h:444
pcl::ProcessParameter::IsTable
bool IsTable() const
Definition: ProcessParameter.h:502
pcl::AutoPointer< ProcessParameterPrivate >
pcl::GenericString< char16_type, CharTraits, PCL_STRING_ALLOCATOR >
pcl::size_type
size_t size_type
Definition: Defs.h:612
pcl::Array
Generic dynamic array.
Definition: Array.h:99
pcl::ProcessParameter::EnumerationElement
Structure used to describe an enumeration element.
Definition: ProcessParameter.h:212
pcl::ProcessParameterType::IsReal
bool IsReal(int type)
Definition: ProcessParameter.h:145
AutoPointer.h
pcl::ProcessParameterType::IsVariableLength
bool IsVariableLength(int type)
Definition: ProcessParameter.h:155
pcl::ProcessParameterType::IsNumeric
bool IsNumeric(int type)
Definition: ProcessParameter.h:125
pcl::ProcessParameter::EnumerationElement::id
IsoString id
Element identifier.
Definition: ProcessParameter.h:214
pcl::ProcessParameter::IsEnumeration
bool IsEnumeration() const
Definition: ProcessParameter.h:469
Variant.h
IsoStringList
Dynamic list of 8-bit strings.
pcl::ProcessParameter::IsBlock
bool IsBlock() const
Definition: ProcessParameter.h:494
pcl::ProcessParameter
Identifies and describes a process parameter.
Definition: ProcessParameter.h:191
Defs.h
pcl::ProcessParameter::MinimumLength
size_type MinimumLength() const
Definition: ProcessParameter.h:627
pcl::ProcessParameter::EnumerationElement::value
int value
Element value.
Definition: ProcessParameter.h:216