コード例 #1
0
        /// <summary>
        /// Create an instance of the specified type, adding it to the Instances collection.
        /// </summary>
        public IRuntimeSemanticType Create(string typeName, IRuntimeSemanticType parent = null)
        {
            Assert.That(SemanticTypes.ContainsKey(typeName), "The semantic type " + typeName + " has not been declared.");
            IRuntimeSemanticType t = (IRuntimeSemanticType)CompiledAssembly.CreateInstance("SemanticTypes." + typeName);

            t.Initialize(this);
            Guid guid = Guid.NewGuid();                                 // We create a unique key for this instance.

            Instances[guid] = (new SemanticTypeInstance()
            {
                Name = typeName, Instance = t, Parent = parent, Key = guid, Definition = SemanticTypes[typeName]
            });

            NewSemanticType.Fire(this, new NewSemanticTypeEventArgs(t));

            return(t);
        }
コード例 #2
0
 public bool VerifyProtocolExists(string protocol)
 {
     return(SemanticTypes.ContainsKey(protocol));
 }
コード例 #3
0
        public ISemanticTypeStruct GetSemanticTypeStruct(string typeName)
        {
            Assert.That(SemanticTypes.ContainsKey(typeName), "The semantic type " + typeName + " has not been declared.");

            return(SemanticTypes[typeName].Struct);
        }