SCIRun  5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ArrayMathFunctionCatalog.h
Go to the documentation of this file.
1 //
2 // For more information, please see: http://software.sci.utah.edu
3 //
4 // The MIT License
5 //
6 // Copyright (c) 2009 Scientific Computing and Imaging Institute,
7 // University of Utah.
8 //
9 //
10 // Permission is hereby granted, free of charge, to any person obtaining a
11 // copy of this software and associated documentation files (the "Software"),
12 // to deal in the Software without restriction, including without limitation
13 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 // and/or sell copies of the Software, and to permit persons to whom the
15 // Software is furnished to do so, subject to the following conditions:
16 //
17 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
19 //
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26 // DEALINGS IN THE SOFTWARE.
27 //
28 
29 #ifndef CORE_PARSER_ARRAYMATHFUNCTIONCATALOG_H
30 #define CORE_PARSER_ARRAYMATHFUNCTIONCATALOG_H 1
31 
32 #include <Core/Parser/Parser.h>
34 
35 #include <Core/Thread/Mutex.h>
36 
37 // Include files needed for Windows
38 #include <Core/Parser/share.h>
39 
40 namespace SCIRun {
41 
42 //-----------------------------------------------------------------------------
43 // The ArrayMathFunctionCatalog classes are a base class for a
44 // series of classes that define basic functionality for the parser
45 // These classes house the main functions.
46 // The base class provides functionality for registering the functions
47 // to the main ParserCatalog, which is used by the parser to look up
48 // functions
49 
51 
52  public:
54 
55  public:
56  // Add a function to the general database
57  void add_function(ArrayMathFunctionPtr function,
58  const std::string& function_id,
59  const std::string& return_type);
60 
61  // Add a function whose input variables can be in any particular order,
62  // e.g. addition, this will allow the optimizer to recognize that two pieces
63  // of the parser tree are equal e.g A+B equals B+A
64  void add_sym_function(ArrayMathFunctionPtr function,
65  const std::string& function_id,
66  const std::string& return_type);
67 
68  // Add a function that independently of the input will output a sequence
69  // e.g. the rand function, will always generate a sequence
70  void add_seq_function(ArrayMathFunctionPtr function,
71  const std::string& function_id,
72  const std::string& return_type);
73 
74  // Add a function that will always output a single
75  void add_sgl_function(ArrayMathFunctionPtr function,
76  const std::string& function_id,
77  const std::string& return_type);
78 
79  // Add a function that is always a constant
80  void add_cst_function(ArrayMathFunctionPtr function,
81  const std::string& function_id,
82  const std::string& return_type);
83 
84  static ParserFunctionCatalogHandle get_catalog();
85 };
86 
87 typedef boost::shared_ptr<ArrayMathFunctionCatalog> ArrayMathFunctionCatalogHandle;
88 
89 //-----------------------------------------------------------------------------
90 // Functions for adding Functions to the ArrayMathFunctionCatalog
91 
92 // Insert the basic functions into the database
99 
100 }
101 
102 #endif
void SCISHARE InsertSourceSinkArrayMathFunctionCatalog(ArrayMathFunctionCatalogHandle &catalog)
Definition: ArrayMathFunctionSourceSink.cc:757
void SCISHARE InsertScalarArrayMathFunctionCatalog(ArrayMathFunctionCatalogHandle &catalog)
Definition: ArrayMathFunctionScalar.cc:792
void SCISHARE InsertTensorArrayMathFunctionCatalog(ArrayMathFunctionCatalogHandle &catalog)
Definition: ArrayMathFunctionTensor.cc:1294
boost::shared_ptr< ArrayMathFunctionCatalog > ArrayMathFunctionCatalogHandle
Definition: ArrayMathFunctionCatalog.h:87
boost::shared_ptr< ParserFunctionCatalog > ParserFunctionCatalogHandle
Definition: Parser.h:72
boost::function< bool(ArrayMathProgramCode &)> ArrayMathFunctionPtr
Definition: ArrayMathInterpreter.h:75
#define SCISHARE
Definition: share.h:39
ArrayMathFunctionCatalog()
Definition: ArrayMathFunctionCatalog.h:53
void SCISHARE InsertVectorArrayMathFunctionCatalog(ArrayMathFunctionCatalogHandle &catalog)
Definition: ArrayMathFunctionVector.cc:812
Definition: Parser.h:460
void SCISHARE InsertElementArrayMathFunctionCatalog(ArrayMathFunctionCatalogHandle &catalog)
Definition: ArrayMathFunctionElement.cc:239
void InsertBasicArrayMathFunctionCatalog(ArrayMathFunctionCatalogHandle &catalog)
Definition: ArrayMathFunctionBasic.cc:857
Definition: ArrayMathFunctionCatalog.h:50