Пример #1
0
 internal virtual FSM CreateFSM(StateNameSource stateNames) {
     throw new InvalidOperationException();
 }
Пример #2
0
 internal override FSM CreateFSM(StateNameSource stateNames) {//Should have only one top-level grouping content info
     foreach(ContentInfo content in Content) {
         GroupingInfo group = content as GroupingInfo;
         if (group!=null) {
             FSM fsm = group.MakeFSM(stateNames);
             return fsm;
         }
     }
     return null;
     
 }
Пример #3
0
         protected override void ImplementFSMMetaData() {
                        
            Debug.Assert(clrTypeInfo.HasElementWildCard);

            if (fsmNameSource == null) fsmNameSource = new StateNameSource();
            else fsmNameSource.Reset();

            FSM fsm = clrTypeInfo.CreateFSM(fsmNameSource);
        
            //Add a member field: private static FSM fsm;
            decl.Members.Add(CodeDomHelper.CreateMemberField(Constants.FSMMember, Constants.FSMClass, MemberAttributes.Private | MemberAttributes.Static, false));

            //Add a function: FSM  FSM IXMetaData.GetFSM() {return fsm}
            CodeMemberMethod getFSM =
                CodeDomHelper.CreateInterfaceImplMethod(Constants.GetFSM, Constants.IXMetaData, new CodeTypeReference(Constants.FSMClass));
                
            getFSM.Statements.Add(new CodeMethodReturnStatement(new CodeFieldReferenceExpression(null, Constants.FSMMember)));
            decl.Members.Add(getFSM);

            //Add InitFSM() and construct the FSM
            CodeMemberMethod initFSM =
                CodeDomHelper.CreateMethod(Constants.InitFSM, MemberAttributes.Private | MemberAttributes.Static, new CodeTypeReference());
            FSMCodeDomHelper.CreateFSMStmt(fsm, initFSM.Statements);
            decl.Members.Add(initFSM);

            CreateStaticConstructor();
            declItemsInfo.staticConstructor.Statements.Add(CodeDomHelper.CreateMethodCall(null, Constants.InitFSM, null));
            
            
        }