= FDO RFC 5 - Modify Fdo API FdoFunctionDefinition = This page contains a request for comments document (RFC) for the FDO Open Source project. More FDO RFCs can be found on the [wiki:FDORfcs RFCs] page. == Status == ||RFC Template Version||(1.0)|| ||Submission Date||Jul 16, 2007|| ||Last Modified||Thomas Knoell [[Timestamp]]|| ||Author||Thomas Knoell|| ||RFC Status||draft|| ||Implementation Status ||under development|| ||Proposed Milestone|||| ||Assigned PSC guide(s)||Greg Boone|| ||'''Voting History'''||TBD|| ||||Mateusz|| ||||Frank|| ||||Orest|| ||||Greg || == Overview == The purpose of this RFC is to add a new property to the class ''FdoFunctionDefinition'' allowing the specification of the function class a given function belongs to. The valid function types will be defined in an enumeration and initially contain values to indicate aggregate, conversion, date, mathematical, numeric and string functions. The enumeration will also include a value to indicate an unknown function class. This function class will represent the default value. The following shows examples of functions listed with their corresponding function class: AGGREGATE:: ''Avg'', ''Max'', ''Min'', ''Sum'' CONVERSION:: ''ToDate'', ''ToDouble'', ''ToFloat'', ''ToInt32'', ''ToInt64'' DATE:: ''AddMonths'', ''CurrentDate'', ''ToString'' MATH:: ''Asin'', ''Atan'', ''Cos'', ''Exp'', ''Ln'', ''Log'', ''Sqrt'' NUMERIC:: ''Ceil'', ''Floor'', ''Round'', ''Sign'' STRING:: ''Concat'', ''Instr'', ''Lower'', ''Lpad'', ''Ltrim'', ''Upper'' The function class will be set via the currently available interfaces (''create'' method). To allow this the interfaces will be enhanced with an optional function class parameter which will be set to the default value. == Proposed Solution == The following shows the new enumeration. {{{ enum FdoFunctionClass { FdoFunctionClass_Aggregate, FdoFunctionClass_Conversion, FdoFunctionClass_Date, FdoFunctionClass_Math, FdoFunctionClass_Numeric, FdoFunctionClass_String, FdoFunctionClass_Unknown } // enum FdoFunctionClass }}} The following shows the required changes to the class ''FdoFunctionDefinition''. Note that the listing only shows the modified or added specifications. {{{ class FdoFunctionDefinition : public FdoIDisposable { ... protected: FdoFunctionDefinition (FdoString *name, FdoString *description, FdoDataType returnType, FdoArgumentDefinitionCollection *arguments, FdoFunctionClass functionClass); FdoFunctionDefinition (FdoString *name, FdoString *description, FdoPropertyType returnPropertyType, FdoDataType returnType, FdoArgumentDefinitionCollection *arguments, FdoFunctionClass functionClass); FdoFunctionDefinition (FdoString *name, FdoString *description, bool isAggregate, FdoSignatureDefinitionCollection *signatures, FdoFunctionClass functionClass); ... public: ... /// \brief /// Returns the function class for the current function definition. /// /// \return /// Returns FdoFunctionClass /// FDO_API FdoFunctionClass GetFunctionClass(); /// Various public Constructors FDO_API static FdoFunctionDefinition *Create (FdoString *name, FdoString *description, FdoDataType returnType, FdoArgumentDefinitionCollection *arguments, FdoFunctionClass functionClass = FdoFunctionClass_Unknown); FDO_API static FdoFunctionDefinition *Create (FdoString *name, FdoString *description, FdoPropertyType returnPropertyType, FdoDataType returnType, FdoArgumentDefinitionCollection *arguments, FdoFunctionClass functionClass = FdoFunctionClass_Unknown); FDO_API static FdoFunctionDefinition *Create (FdoString *name, FdoString *description, bool isAggregate, FdoSignatureDefinitionCollection *signatures, FdoFunctionClass functionClass = FdoFunctionClass_Unknown); ... protected: ... FdoFunctionClass m_functionClass; ... } }}} == Implications == This change will not cause any side-effects, nor any compatibility problems. == Test Plan == Existing unit tests will be expanded to test those changes. == Funding/Resources == Autodesk to provide resources / funding to update FDO core.