/* ----------------------------------------------------------------------- *//** * * @file UDF_proto.hpp * *//* ----------------------------------------------------------------------- */ #ifndef MADLIB_POSTGRES_UDF_PROTO_HPP #define MADLIB_POSTGRES_UDF_PROTO_HPP namespace madlib { namespace dbconnector { namespace postgres { /** * @brief User-defined function */ class UDF : public Allocator { public: typedef AnyType (*Pointer)(AnyType&); UDF() { } template static Datum call(FunctionCallInfo fcinfo); template static AnyType invoke(AnyType& args); // FIXME: The following code until the end of this class is a dirty hack // that needs to go template static Datum SRF_invoke(FunctionCallInfo fcinfo); protected: template static FuncCallContext* SRF_percall_setup(FunctionCallInfo fcinfo); template static bool SRF_is_firstcall(FunctionCallInfo fcinfo); }; template UDF::Pointer funcPtr() { return UDF::invoke; } } // namespace postgres } // namespace dbconnector } // namespace madlib #endif // defined(MADLIB_POSTGRES_UDF_PROTO_HPP)