| 26 | == Motivation == |
| 27 | |
| 28 | The Unmanaged FDO Expression Engine has a set of unmanaged interfaces but does not have a corresponding managed set of interfaces. The general rule has been that if an unmanaged component of the API is released in the SDK for external use, it should have a corresponding managed API as well. |
| 29 | |
| 30 | == Proposed Solution == |
| 31 | |
| 32 | The following shows the proposed additions for the Managed API |
| 33 | |
| 34 | === FDO Expression Engine === |
| 35 | |
| 36 | {{{ |
| 37 | |
| 38 | public __gc class ExpressionEngine : public NAMESPACE_OSGEO_RUNTIME::Disposable |
| 39 | { |
| 40 | public: |
| 41 | /// \brief |
| 42 | /// Constructs an instance of an ExpressionEngine |
| 43 | /// |
| 44 | /// \param reader |
| 45 | /// Input FDO feature reader |
| 46 | /// |
| 47 | /// \param classDef |
| 48 | /// Input FDO class definition |
| 49 | /// |
| 50 | /// \param userDefinedFunctions |
| 51 | /// Input User defined functions |
| 52 | /// |
| 53 | ExpressionEngine(OSGEO_FDO_COMMANDS_FEATURE::IReader* reader, |
| 54 | OSGEO_FDO_SCHEMA::ClassDefinition* classDef, |
| 55 | OSGEO_FDO_UTILITIES_EXPRESSIONENGINE::FunctionCollection *userDefinedFunctions); |
| 56 | |
| 57 | /// \brief |
| 58 | /// Constructs an instance of an ExpressionException. |
| 59 | /// |
| 60 | /// \param reader |
| 61 | /// Input reader |
| 62 | /// |
| 63 | /// \param classDef |
| 64 | /// Input class definition |
| 65 | /// |
| 66 | /// \param classDef |
| 67 | /// Input identifiers |
| 68 | /// |
| 69 | /// \param userDefinedFunctions |
| 70 | /// Input user defined functions |
| 71 | /// |
| 72 | /// \return |
| 73 | /// Returns ExpressionEngine |
| 74 | /// |
| 75 | ExpressionEngine(OSGEO_FDO_COMMANDS_FEATURE::IReader* reader, |
| 76 | OSGEO_FDO_SCHEMA::ClassDefinition* classDef, |
| 77 | OSGEO_FDO_COMMANDS::IdentifierCollection* identifiers, |
| 78 | OSGEO_FDO_UTILITIES_EXPRESSIONENGINE::FunctionCollection *userDefinedFunctions); |
| 79 | |
| 80 | /// \brief |
| 81 | /// Evaluates an expression |
| 82 | /// |
| 83 | /// \param expression |
| 84 | /// Input expression |
| 85 | /// |
| 86 | /// \return |
| 87 | /// Returns a literal value. This value is valid until the next Evaluate call |
| 88 | /// |
| 89 | FdoLiteralValue* Evaluate(OSGEO_FDO_EXPRESSION::Expression *expression); |
| 90 | |
| 91 | /// \brief |
| 92 | /// Evaluates a name |
| 93 | /// |
| 94 | /// \param name |
| 95 | /// Input identifier |
| 96 | /// |
| 97 | /// \return |
| 98 | /// Returns a literal value. This value is valid until the next Evaluate call |
| 99 | /// |
| 100 | FdoLiteralValue* Evaluate(System::String* name); |
| 101 | |
| 102 | /// \brief |
| 103 | /// Evaluates an identifier |
| 104 | /// |
| 105 | /// \param identifier |
| 106 | /// Input identifier |
| 107 | /// |
| 108 | /// \return |
| 109 | /// Returns a literal value. This value is valid until the next Evaluate call |
| 110 | /// |
| 111 | FdoLiteralValue* Evaluate(OSGEO_FDO_EXPRESSION::Identifier* expr); |
| 112 | |
| 113 | |
| 114 | /// \brief |
| 115 | /// Evaluates an aggregate functions |
| 116 | /// |
| 117 | /// \return |
| 118 | /// Returns the aggragate results |
| 119 | /// |
| 120 | FdoPropertyValueCollection* RunQuery(); |
| 121 | |
| 122 | /// \brief |
| 123 | /// Checks if passes the filter |
| 124 | /// |
| 125 | /// \param filter |
| 126 | /// Input filter |
| 127 | /// |
| 128 | /// \return |
| 129 | /// Returns true id passes the filter, otherwise false |
| 130 | /// |
| 131 | bool ProcessFilter(OSGEO_FDO_FILTER::Filter *filter); |
| 132 | |
| 133 | /// \brief |
| 134 | /// Returns the default functions plus the user defined functions |
| 135 | /// |
| 136 | /// \return |
| 137 | /// Returns the functions |
| 138 | /// |
| 139 | OSGEO_FDO_CONNECTIONS_CAPABILITIES::FunctionDefinitionCollection *GetAllFunctions(); |
| 140 | |
| 141 | /// \brief |
| 142 | /// Returns the default functions the expression engine supports |
| 143 | /// |
| 144 | /// \return |
| 145 | /// Returns the functions |
| 146 | /// |
| 147 | static OSGEO_FDO_CONNECTIONS_CAPABILITIES::FunctionDefinitionCollection *GetStandardFunctions(); |
| 148 | |
| 149 | /// \brief |
| 150 | /// Checks if the filter is valid |
| 151 | /// |
| 152 | /// \param cls |
| 153 | /// Input class definition |
| 154 | /// |
| 155 | /// \param filter |
| 156 | /// Input filter |
| 157 | /// |
| 158 | /// \param selIds |
| 159 | /// Input identifier collection |
| 160 | /// |
| 161 | /// \param filterCapabilities |
| 162 | /// Input filter capabilities |
| 163 | /// |
| 164 | /// \return |
| 165 | /// Throws an exception is filter is not valid |
| 166 | /// |
| 167 | static System::Void ValidateFilter(OSGEO_FDO_SCHEMA::ClassDefinition *cls, |
| 168 | OSGEO_FDO_FILTER::Filter *filter, |
| 169 | OSGEO_FDO_COMMANDS::IdentifierCollection *selIds = NULL, |
| 170 | OSGEO_FDO_CONNECTIONS_CAPABILITIES::IFilterCapabilities *filterCapabilities = NULL); |
| 171 | |
| 172 | /// \brief |
| 173 | /// Optimizes the filter |
| 174 | /// |
| 175 | /// \param filter |
| 176 | /// Input the filter |
| 177 | /// |
| 178 | /// \return |
| 179 | /// The optimized filter |
| 180 | /// |
| 181 | static OSGEO_FDO_FILTER::Filter* OptimizeFilter( OSGEO_FDO_FILTER::Filter *filter ); |
| 182 | |
| 183 | /// \brief |
| 184 | /// Checks if the function name is a aggregate function |
| 185 | /// |
| 186 | /// \param funcDefs |
| 187 | /// Input the list of functions |
| 188 | /// |
| 189 | /// \param name |
| 190 | /// Input the function name |
| 191 | /// |
| 192 | /// \return |
| 193 | /// True if the function is an aggregate function otherwise false |
| 194 | /// |
| 195 | static bool IsAggregateFunction(OSGEO_FDO_CONNECTIONS_CAPABILITIES::FunctionDefinitionCollection *funcDefs, |
| 196 | System::String *name); |
| 197 | |
| 198 | /// \brief |
| 199 | /// Returns the type of expression |
| 200 | /// |
| 201 | /// \param functions |
| 202 | /// Input the list of functions |
| 203 | /// |
| 204 | /// \param originalClassDef |
| 205 | /// Input the class definition |
| 206 | /// |
| 207 | /// \param propType |
| 208 | /// Output the property type |
| 209 | /// |
| 210 | /// \param dataType |
| 211 | /// Output the data type |
| 212 | /// |
| 213 | /// \return |
| 214 | /// Returns nothing |
| 215 | /// |
| 216 | static System::Void GetExpressionType(OSGEO_FDO_CONNECTIONS_CAPABILITIES::FunctionDefinitionCollection *functionDefinitions, |
| 217 | OSGEO_FDO_SCHEMA::ClassDefinition* originalClassDef, |
| 218 | OSGEO_FDO_EXPRESSION::Expression *expr, |
| 219 | OSGEO_FDO_SCHEMA::PropertyType &retPropType, |
| 220 | OSGEO_FDO_SCHEMA::DataType &retDataType); |
| 221 | |
| 222 | /// \brief |
| 223 | /// Returns the type of expression |
| 224 | /// |
| 225 | /// \param originalClassDef |
| 226 | /// Input the class definition |
| 227 | /// |
| 228 | /// \param propType |
| 229 | /// Output the property type |
| 230 | /// |
| 231 | /// \param dataType |
| 232 | /// Output the data type |
| 233 | /// |
| 234 | /// \return |
| 235 | /// Returns nothing |
| 236 | /// |
| 237 | static System::Void GetExpressionType(OSGEO_FDO_SCHEMA::ClassDefinition* originalClassDef, |
| 238 | OSGEO_FDO_EXPRESSION::Expression *expr, |
| 239 | OSGEO_FDO_SCHEMA::PropertyType &retPropType, |
| 240 | OSGEO_FDO_SCHEMA::DataType &retDataType); |
| 241 | |
| 242 | /// \brief |
| 243 | /// Registers the user-defined functions |
| 244 | /// |
| 245 | /// \param userDefinedFunctions |
| 246 | /// Input the user-defined functions |
| 247 | /// |
| 248 | /// \return |
| 249 | /// Returns nothing |
| 250 | /// |
| 251 | static System::Void RegisterFunctions(OSGEO_FDO_UTILITIES_EXPRESSIONENGINE::FunctionCollection *userDefinedFunctions); |
| 252 | |
| 253 | }; |
| 254 | |
| 255 | }}} |