001    /*
002    // $Id: //open/mondrian-release/3.1/src/main/mondrian/olap/fun/DimensionCurrentMemberFunDef.java#2 $
003    // This software is subject to the terms of the Eclipse Public License v1.0
004    // Agreement, available at the following URL:
005    // http://www.eclipse.org/legal/epl-v10.html.
006    // Copyright (C) 2006-2009 Julian Hyde
007    // All Rights Reserved.
008    // You must accept the terms of that agreement to use this software.
009    */
010    package mondrian.olap.fun;
011    
012    import mondrian.calc.Calc;
013    import mondrian.calc.ExpCompiler;
014    import mondrian.calc.DimensionCalc;
015    import mondrian.calc.impl.AbstractExpCompiler;
016    import mondrian.mdx.ResolvedFunCall;
017    
018    /**
019     * Definition of the <code>&lt;Dimension&gt;.CurrentMember</code> MDX builtin
020     * function.
021     *
022     * <p>Syntax:
023     * <blockquote><code>&lt;Dimension&gt;.CurrentMember</code></blockquote>
024     *
025     * <p>XXX TODO: obsolete
026     *
027     * @author jhyde
028     * @version $Id: //open/mondrian-release/3.1/src/main/mondrian/olap/fun/DimensionCurrentMemberFunDef.java#2 $
029     * @since Mar 23, 2006
030     */
031    public class DimensionCurrentMemberFunDef extends FunDefBase {
032        static final DimensionCurrentMemberFunDef instance =
033                new DimensionCurrentMemberFunDef();
034    
035        private DimensionCurrentMemberFunDef() {
036            super(
037                "CurrentMember",
038                "Returns the current member along a dimension during an iteration.",
039                "pmd");
040        }
041    
042        public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) {
043            final DimensionCalc dimensionCalc =
044                    compiler.compileDimension(call.getArg(0));
045            return new AbstractExpCompiler.DimensionCurrentMemberCalc(
046                call, dimensionCalc);
047        }
048    }
049    
050    // End DimensionCurrentMemberFunDef.java