コード例 #1
0
        /// <summary>
        /// Extension method to create hash of the IfcSimpleValue
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static int CreateHash(this IfcSimpleValue value)
        {
            if (value == null)
            {
                throw new ArgumentNullException();
            }

            //hash of the type
            var typeName = value.GetType().Name;
            var typeHash = typeName.GetHashCode();
            //switch(typeName)
            //{
            //    case "IfcInteger":
            //        typeHash =
            //        break;
            //    case "IfcReal":
            //        break;
            //    case "IfcBoolean":
            //        break;
            //    case "IfcIdentifier":
            //        break;
            //    case "IfcText":
            //        break;
            //    case "IfcLabel":
            //        break;
            //    case "IfcLogical":
            //        break;
            //    default:
            //        break;
            //}


            //hash of the actual value
            var valHash = value.ToString().GetHashCode();

            return(valHash + typeHash);
        }
コード例 #2
0
 public AttributeHasedRoot(IfcRoot root, IfcSimpleValue value)
 {
     _root = root;
     _val  = value;
     _hash = value.ToString().GetHashCode();
 }