示例#1
0
 public static Status Query(Array arr, ArrayAttribute attribute, out OpenVX.Type obj)
 {
     unsafe
     {
         fixed(OpenVX.Type *p_obj = &obj)
         {
             return(Query(arr, attribute, new IntPtr(p_obj), (UIntPtr)4));
         }
     }
 }
示例#2
0
 public static Status Query(Array arr, ArrayAttribute attribute, out UIntPtr obj)
 {
     unsafe
     {
         fixed(UIntPtr *p_obj = &obj)
         {
             return(Query(arr, attribute, new IntPtr(p_obj), (UIntPtr)UIntPtr.Size));
         }
     }
 }
示例#3
0
        /// <summary> Write a Array XML Element from attributes in a member. </summary>
        public virtual void WriteArray(System.Xml.XmlWriter writer, System.Reflection.MemberInfo member, ArrayAttribute attribute, BaseAttribute parentAttribute, System.Type mappedClass)
        {
            writer.WriteStartElement( "array" );
            // Attribute: <name>
            writer.WriteAttributeString("name", attribute.Name==null ? DefaultHelper.Get_Array_Name_DefaultValue(member) : GetAttributeValue(attribute.Name, mappedClass));
            // Attribute: <access>
            if(attribute.Access != null)
            writer.WriteAttributeString("access", GetAttributeValue(attribute.Access, mappedClass));
            // Attribute: <table>
            if(attribute.Table != null)
            writer.WriteAttributeString("table", GetAttributeValue(attribute.Table, mappedClass));
            // Attribute: <schema>
            if(attribute.Schema != null)
            writer.WriteAttributeString("schema", GetAttributeValue(attribute.Schema, mappedClass));
            // Attribute: <catalog>
            if(attribute.Catalog != null)
            writer.WriteAttributeString("catalog", GetAttributeValue(attribute.Catalog, mappedClass));
            // Attribute: <subselect>
            if(attribute.Subselect != null)
            writer.WriteAttributeString("subselect", GetAttributeValue(attribute.Subselect, mappedClass));
            // Attribute: <inverse>
            if( attribute.InverseSpecified )
            writer.WriteAttributeString("inverse", attribute.Inverse ? "true" : "false");
            // Attribute: <mutable>
            if( attribute.MutableSpecified )
            writer.WriteAttributeString("mutable", attribute.Mutable ? "true" : "false");
            // Attribute: <element-class>
            if(attribute.ElementClass != null)
            writer.WriteAttributeString("element-class", GetAttributeValue(attribute.ElementClass, mappedClass));
            // Attribute: <cascade>
            if(attribute.Cascade != null)
            writer.WriteAttributeString("cascade", GetAttributeValue(attribute.Cascade, mappedClass));
            // Attribute: <where>
            if(attribute.Where != null)
            writer.WriteAttributeString("where", GetAttributeValue(attribute.Where, mappedClass));
            // Attribute: <batch-size>
            if(attribute.BatchSize != -9223372036854775808)
            writer.WriteAttributeString("batch-size", attribute.BatchSize.ToString());
            // Attribute: <outer-join>
            if(attribute.OuterJoin != OuterJoinStrategy.Unspecified)
            writer.WriteAttributeString("outer-join", GetXmlEnumValue(typeof(OuterJoinStrategy), attribute.OuterJoin));
            // Attribute: <fetch>
            if(attribute.Fetch != CollectionFetchMode.Unspecified)
            writer.WriteAttributeString("fetch", GetXmlEnumValue(typeof(CollectionFetchMode), attribute.Fetch));
            // Attribute: <persister>
            if(attribute.Persister != null)
            writer.WriteAttributeString("persister", GetAttributeValue(attribute.Persister, mappedClass));
            // Attribute: <collection-type>
            if(attribute.CollectionType != null)
            writer.WriteAttributeString("collection-type", GetAttributeValue(attribute.CollectionType, mappedClass));
            // Attribute: <check>
            if(attribute.Check != null)
            writer.WriteAttributeString("check", GetAttributeValue(attribute.Check, mappedClass));
            // Attribute: <optimistic-lock>
            if( attribute.OptimisticLockSpecified )
            writer.WriteAttributeString("optimistic-lock", attribute.OptimisticLock ? "true" : "false");
            // Attribute: <node>
            if(attribute.Node != null)
            writer.WriteAttributeString("node", GetAttributeValue(attribute.Node, mappedClass));
            // Attribute: <embed-xml>
            if( attribute.EmbedXmlSpecified )
            writer.WriteAttributeString("embed-xml", attribute.EmbedXml ? "true" : "false");

            WriteUserDefinedContent(writer, member, null, attribute);

            System.Collections.ArrayList memberAttribs = GetSortedAttributes(member);
            int attribPos; // Find the position of the ArrayAttribute (its <sub-element>s must be after it)
            for(attribPos=0; attribPos<memberAttribs.Count; attribPos++)
                if( memberAttribs[attribPos] is ArrayAttribute
                    && ((BaseAttribute)memberAttribs[attribPos]).Position == attribute.Position )
                    break; // found
            int i = attribPos + 1;

            // Element: <meta>
            for(; i<memberAttribs.Count; i++)
            {
                BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute;
                if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType())
                    || IsNextElement(memberAttrib, attribute, typeof(MetaAttribute)) )
                    break; // next attributes are 'elements' of the same level OR for 'sub-elements'
                else
                {
                    if( memberAttrib is ArrayAttribute )
                        break; // Following attributes are for this Array
                    if( memberAttrib is MetaAttribute )
                        WriteMeta(writer, member, memberAttrib as MetaAttribute, attribute, mappedClass);
                }
            }
            WriteUserDefinedContent(writer, member, typeof(MetaAttribute), attribute);
            // Element: <subselect>
            for(; i<memberAttribs.Count; i++)
            {
                BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute;
                if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType())
                    || IsNextElement(memberAttrib, attribute, typeof(SubselectAttribute)) )
                    break; // next attributes are 'elements' of the same level OR for 'sub-elements'
                else
                {
                    if( memberAttrib is ArrayAttribute )
                        break; // Following attributes are for this Array
                    if( memberAttrib is SubselectAttribute )
                        WriteSubselect(writer, member, memberAttrib as SubselectAttribute, attribute, mappedClass);
                }
            }
            WriteUserDefinedContent(writer, member, typeof(SubselectAttribute), attribute);
            // Element: <cache>
            for(; i<memberAttribs.Count; i++)
            {
                BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute;
                if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType())
                    || IsNextElement(memberAttrib, attribute, typeof(CacheAttribute)) )
                    break; // next attributes are 'elements' of the same level OR for 'sub-elements'
                else
                {
                    if( memberAttrib is ArrayAttribute )
                        break; // Following attributes are for this Array
                    if( memberAttrib is CacheAttribute )
                        WriteCache(writer, member, memberAttrib as CacheAttribute, attribute, mappedClass);
                }
            }
            WriteUserDefinedContent(writer, member, typeof(CacheAttribute), attribute);
            // Element: <synchronize>
            for(; i<memberAttribs.Count; i++)
            {
                BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute;
                if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType())
                    || IsNextElement(memberAttrib, attribute, typeof(SynchronizeAttribute)) )
                    break; // next attributes are 'elements' of the same level OR for 'sub-elements'
                else
                {
                    if( memberAttrib is ArrayAttribute )
                        break; // Following attributes are for this Array
                    if( memberAttrib is SynchronizeAttribute )
                        WriteSynchronize(writer, member, memberAttrib as SynchronizeAttribute, attribute, mappedClass);
                }
            }
            WriteUserDefinedContent(writer, member, typeof(SynchronizeAttribute), attribute);
            // Element: <comment>
            for(; i<memberAttribs.Count; i++)
            {
                BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute;
                if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType())
                    || IsNextElement(memberAttrib, attribute, typeof(CommentAttribute)) )
                    break; // next attributes are 'elements' of the same level OR for 'sub-elements'
                else
                {
                    if( memberAttrib is ArrayAttribute )
                        break; // Following attributes are for this Array
                    if( memberAttrib is CommentAttribute )
                        WriteComment(writer, member, memberAttrib as CommentAttribute, attribute, mappedClass);
                }
            }
            WriteUserDefinedContent(writer, member, typeof(CommentAttribute), attribute);
            // Element: <key>
            for(; i<memberAttribs.Count; i++)
            {
                BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute;
                if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType())
                    || IsNextElement(memberAttrib, attribute, typeof(KeyAttribute)) )
                    break; // next attributes are 'elements' of the same level OR for 'sub-elements'
                else
                {
                    if( memberAttrib is ArrayAttribute )
                        break; // Following attributes are for this Array
                    if( memberAttrib is KeyAttribute )
                        WriteKey(writer, member, memberAttrib as KeyAttribute, attribute, mappedClass);
                }
            }
            WriteUserDefinedContent(writer, member, typeof(KeyAttribute), attribute);
            // Element: <index>
            for(; i<memberAttribs.Count; i++)
            {
                BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute;
                if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType())
                    || IsNextElement(memberAttrib, attribute, typeof(IndexAttribute)) )
                    break; // next attributes are 'elements' of the same level OR for 'sub-elements'
                else
                {
                    if( memberAttrib is ArrayAttribute )
                        break; // Following attributes are for this Array
                    if( memberAttrib is IndexAttribute )
                        WriteIndex(writer, member, memberAttrib as IndexAttribute, attribute, mappedClass);
                }
            }
            WriteUserDefinedContent(writer, member, typeof(IndexAttribute), attribute);
            // Element: <list-index>
            for(; i<memberAttribs.Count; i++)
            {
                BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute;
                if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType())
                    || IsNextElement(memberAttrib, attribute, typeof(ListIndexAttribute)) )
                    break; // next attributes are 'elements' of the same level OR for 'sub-elements'
                else
                {
                    if( memberAttrib is ArrayAttribute )
                        break; // Following attributes are for this Array
                    if( memberAttrib is ListIndexAttribute )
                        WriteListIndex(writer, member, memberAttrib as ListIndexAttribute, attribute, mappedClass);
                }
            }
            WriteUserDefinedContent(writer, member, typeof(ListIndexAttribute), attribute);
            // Element: <element>
            for(; i<memberAttribs.Count; i++)
            {
                BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute;
                if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType())
                    || IsNextElement(memberAttrib, attribute, typeof(ElementAttribute)) )
                    break; // next attributes are 'elements' of the same level OR for 'sub-elements'
                else
                {
                    if( memberAttrib is ArrayAttribute )
                        break; // Following attributes are for this Array
                    if( memberAttrib is ElementAttribute )
                        WriteElement(writer, member, memberAttrib as ElementAttribute, attribute, mappedClass);
                }
            }
            WriteUserDefinedContent(writer, member, typeof(ElementAttribute), attribute);
            // Element: <one-to-many>
            for(; i<memberAttribs.Count; i++)
            {
                BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute;
                if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType())
                    || IsNextElement(memberAttrib, attribute, typeof(OneToManyAttribute)) )
                    break; // next attributes are 'elements' of the same level OR for 'sub-elements'
                else
                {
                    if( memberAttrib is ArrayAttribute )
                        break; // Following attributes are for this Array
                    if( memberAttrib is OneToManyAttribute )
                        WriteOneToMany(writer, member, memberAttrib as OneToManyAttribute, attribute, mappedClass);
                }
            }
            WriteUserDefinedContent(writer, member, typeof(OneToManyAttribute), attribute);
            // Element: <many-to-many>
            for(; i<memberAttribs.Count; i++)
            {
                BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute;
                if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType())
                    || IsNextElement(memberAttrib, attribute, typeof(ManyToManyAttribute)) )
                    break; // next attributes are 'elements' of the same level OR for 'sub-elements'
                else
                {
                    if( memberAttrib is ArrayAttribute )
                        break; // Following attributes are for this Array
                    if( memberAttrib is ManyToManyAttribute )
                        WriteManyToMany(writer, member, memberAttrib as ManyToManyAttribute, attribute, mappedClass);
                }
            }
            WriteUserDefinedContent(writer, member, typeof(ManyToManyAttribute), attribute);
            // Element: <composite-element>
            for(; i<memberAttribs.Count; i++)
            {
                BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute;
                if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType())
                    || IsNextElement(memberAttrib, attribute, typeof(CompositeElementAttribute)) )
                    break; // next attributes are 'elements' of the same level OR for 'sub-elements'
                else
                {
                    if( memberAttrib is ArrayAttribute )
                        break; // Following attributes are for this Array
                    if( memberAttrib is CompositeElementAttribute )
                        WriteCompositeElement(writer, member, memberAttrib as CompositeElementAttribute, attribute, mappedClass);
                }
            }
            WriteUserDefinedContent(writer, member, typeof(CompositeElementAttribute), attribute);
            // Element: <many-to-any>
            for(; i<memberAttribs.Count; i++)
            {
                BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute;
                if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType())
                    || IsNextElement(memberAttrib, attribute, typeof(ManyToAnyAttribute)) )
                    break; // next attributes are 'elements' of the same level OR for 'sub-elements'
                else
                {
                    if( memberAttrib is ArrayAttribute )
                        break; // Following attributes are for this Array
                    if( memberAttrib is ManyToAnyAttribute )
                        WriteManyToAny(writer, member, memberAttrib as ManyToAnyAttribute, attribute, mappedClass);
                }
            }
            WriteUserDefinedContent(writer, member, typeof(ManyToAnyAttribute), attribute);
            // Element: <loader>
            for(; i<memberAttribs.Count; i++)
            {
                BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute;
                if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType())
                    || IsNextElement(memberAttrib, attribute, typeof(LoaderAttribute)) )
                    break; // next attributes are 'elements' of the same level OR for 'sub-elements'
                else
                {
                    if( memberAttrib is ArrayAttribute )
                        break; // Following attributes are for this Array
                    if( memberAttrib is LoaderAttribute )
                        WriteLoader(writer, member, memberAttrib as LoaderAttribute, attribute, mappedClass);
                }
            }
            WriteUserDefinedContent(writer, member, typeof(LoaderAttribute), attribute);
            // Element: <sql-insert>
            for(; i<memberAttribs.Count; i++)
            {
                BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute;
                if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType())
                    || IsNextElement(memberAttrib, attribute, typeof(SqlInsertAttribute)) )
                    break; // next attributes are 'elements' of the same level OR for 'sub-elements'
                else
                {
                    if( memberAttrib is ArrayAttribute )
                        break; // Following attributes are for this Array
                    if( memberAttrib is SqlInsertAttribute )
                        WriteSqlInsert(writer, member, memberAttrib as SqlInsertAttribute, attribute, mappedClass);
                }
            }
            WriteUserDefinedContent(writer, member, typeof(SqlInsertAttribute), attribute);
            // Element: <sql-update>
            for(; i<memberAttribs.Count; i++)
            {
                BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute;
                if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType())
                    || IsNextElement(memberAttrib, attribute, typeof(SqlUpdateAttribute)) )
                    break; // next attributes are 'elements' of the same level OR for 'sub-elements'
                else
                {
                    if( memberAttrib is ArrayAttribute )
                        break; // Following attributes are for this Array
                    if( memberAttrib is SqlUpdateAttribute )
                        WriteSqlUpdate(writer, member, memberAttrib as SqlUpdateAttribute, attribute, mappedClass);
                }
            }
            WriteUserDefinedContent(writer, member, typeof(SqlUpdateAttribute), attribute);
            // Element: <sql-delete>
            for(; i<memberAttribs.Count; i++)
            {
                BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute;
                if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType())
                    || IsNextElement(memberAttrib, attribute, typeof(SqlDeleteAttribute)) )
                    break; // next attributes are 'elements' of the same level OR for 'sub-elements'
                else
                {
                    if( memberAttrib is ArrayAttribute )
                        break; // Following attributes are for this Array
                    if( memberAttrib is SqlDeleteAttribute )
                        WriteSqlDelete(writer, member, memberAttrib as SqlDeleteAttribute, attribute, mappedClass);
                }
            }
            WriteUserDefinedContent(writer, member, typeof(SqlDeleteAttribute), attribute);
            // Element: <sql-delete-all>
            for(; i<memberAttribs.Count; i++)
            {
                BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute;
                if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType())
                    || IsNextElement(memberAttrib, attribute, typeof(SqlDeleteAllAttribute)) )
                    break; // next attributes are 'elements' of the same level OR for 'sub-elements'
                else
                {
                    if( memberAttrib is ArrayAttribute )
                        break; // Following attributes are for this Array
                    if( memberAttrib is SqlDeleteAllAttribute )
                        WriteSqlDeleteAll(writer, member, memberAttrib as SqlDeleteAllAttribute, attribute, mappedClass);
                }
            }
            WriteUserDefinedContent(writer, member, typeof(SqlDeleteAllAttribute), attribute);

            writer.WriteEndElement();
        }