public override void FinishArgument(string idlMethodName, CodeStatementCollection stmtsFinishResult, IDLArgument idlMethodArg, CodeVariableReferenceExpression varrefResultVar)
        {
            // Peek inside the stmsFinishResult and assume this function is the only one messing with the first statement...
            CodeObjectCreateExpression createArgs;

            if (stmtsFinishResult.Count == 0) // If no statements yet
            {
                // Setup everything.
                string signalEventTypeName = CodeBuilderCommon.GetSignalEventTypeName(idlMethodName);
                string signalEventName = CodeBuilderCommon.GetSignalEventName(idlMethodName);
                createArgs = new CodeObjectCreateExpression(signalEventTypeName);
                CodeVariableDeclarationStatement vardeclEventArgs = new CodeVariableDeclarationStatement(
                    signalEventTypeName
                    , SignalEventArgName
                    , createArgs
                );
                // * if (this.<signal>Event != null)
                CodeConditionStatement condGotEvent = new CodeConditionStatement(
                    new CodeBinaryOperatorExpression(
                        new CodeEventReferenceExpression(new CodeThisReferenceExpression()
                            , signalEventName
                        )
                        ,CodeBinaryOperatorType.IdentityInequality
                        , new CodePrimitiveExpression(null)
                    )
                    // * <signal>Args args = new <signal>Args(...);
                    , new CodeVariableDeclarationStatement(
                    signalEventTypeName
                        , SignalEventArgName
                        , createArgs
                    )
                    // * this.<signal>Event(this, args);
                    , new CodeExpressionStatement(new CodeMethodInvokeExpression(new CodeThisReferenceExpression(), signalEventName
                        , new CodeThisReferenceExpression()
                        , new CodeVariableReferenceExpression(SignalEventArgName)
                    ))
                );

                stmtsFinishResult.Add(condGotEvent);

            } // Ends if no statements yet
            else // Else got statements
            {
                // Find the initialiser for the Args creation.
                CodeConditionStatement condGotEvent = stmtsFinishResult[0] as CodeConditionStatement;
                CodeVariableDeclarationStatement vardeclEventArgs = condGotEvent.TrueStatements[0] as CodeVariableDeclarationStatement;
                createArgs = vardeclEventArgs.InitExpression as CodeObjectCreateExpression;

            } // Ends else got statements

            // Add result variable to list of parameters for argument.
            createArgs.Parameters.Add(varrefResultVar);
        }
 public override void AssignOutParamDefault(CodeStatementCollection statements
     , IDLArgument idlMethodArg
     , CodeTypeReference typerefParam)
 {
     // No-op since signals don't have an out param.
 }
 public override void AssignOutParamDefault(CodeStatementCollection statements
     , IDLArgument idlMethodArg
     , CodeTypeReference typerefParam)
 {
     // Properties don't take parameters, so have to declare as well as assign.
     CodeVariableDeclarationStatement vardeclParam = new CodeVariableDeclarationStatement(
         typerefParam, CodeBuilderCommon.nameReadValue, new CodeDefaultValueExpression(typerefParam)
     );
     statements.Add(vardeclParam);
 }
        public virtual void MakeOutArgument(CodeStatementCollection statements
            , CodeStatementCollection stmtsFinishResult
            , string idlMethodName
            , CodeTypeFactory codetypeFactoryOut
            , ref int nOutArgCounter
            , Udbus.Parsing.BuildContext context
            , ref CodeThrowExceptionStatement throwargOutPrev
            , IDLArgument idlMethodArg
            //, IDLMethodArgument idlMethodArg
            , Udbus.Parsing.IDLArgumentTypeNameBuilderBase nameBuilder
            , ref ParamCodeTypeHolderMarshalBase paramtypeHolder
            , ref CodeTypeReference typerefParam
            , out CodeConditionStatement condVarResult)
        {
            marshal.outward.ParamCodeTypeHolderMarshalOut paramtypeHolderOut = new marshal.outward.ParamCodeTypeHolderMarshalOut(codetypeFactoryOut);
            Udbus.Parsing.CodeBuilderHelper.BuildCodeParamType(paramtypeHolderOut, nameBuilder, idlMethodArg.Type, context);
            paramtypeHolder = paramtypeHolderOut;
            typerefParam = paramtypeHolder.paramtype.CodeType;

            // Initialise out parameter.
            this.AssignOutParamDefault(statements, idlMethodArg, typerefParam);

            // Read out parameter from message into temporary.
            string argResultVar = idlMethodArg.Name + "Result";
            CodeVariableReferenceExpression varrefResultVar = new CodeVariableReferenceExpression(argResultVar);

            condVarResult = new CodeConditionStatement(
                // * if (this.result == 0)
                exprResultOk,
                new CodeStatement[] // True statements
                {
                    // * <param_type> <arg_name>Result;
                    new CodeVariableDeclarationStatement(typerefParam, argResultVar),
                    // * this.result = reader.Marshal<type>(<marshal_function>, out <arg_name>Result);
                    new CodeAssignStatement(fieldrefResult,
                        paramtypeHolderOut.BuildReadExpression(varrefReader,
                            new CodeDirectionExpression(FieldDirection.Out, varrefResultVar)))
                }
                , new CodeStatement[] // False statements
                {
                    throwargOutPrev
                }
                );

            throwargOutPrev = this.ThrowArgOutException(idlMethodName, nOutArgCounter, idlMethodArg.Name, typerefParam);

            // * <arg_name> = <arg_name>Result;
            this.FinishArgument(idlMethodName, stmtsFinishResult, idlMethodArg, varrefResultVar);
            ++nOutArgCounter;
        }
 public virtual void FinishArgument(string idlMethodName, CodeStatementCollection stmtsFinishResult, IDLArgument idlMethodArg, CodeVariableReferenceExpression varrefResultVar)
 {
     stmtsFinishResult.Add(new CodeAssignStatement(new CodeArgumentReferenceExpression(idlMethodArg.Name), varrefResultVar));
 }
 public virtual void AssignOutParamDefault(CodeStatementCollection statements
     , IDLArgument idlMethodArg
     , CodeTypeReference typerefParam)
 {
     CodeAssignStatement assignOut = new CodeAssignStatement(new CodeArgumentReferenceExpression(idlMethodArg.Name),
         new CodeDefaultValueExpression(typerefParam));
     statements.Add(assignOut);
 }