Ejemplo n.º 1
0
        Node *AddNode(Node *newNode, int pos)
        {
            if (branch < 1)
            {
                children = (Node **)Memory.Alloc(sizeof(Node *));
            }
            else
            {
                Node **newChildren = (Node **)Memory.Alloc(sizeof(Node *) * (branch + 1));
                for (int i = 0; i < branch; i++)
                {
                    newChildren[i] = children[i];
                }
                Memory.Free(children);
                children = newChildren;
            }

            for (int i = branch; i > pos; --i)
            {
                children[i] = children[i - 1];
            }
            children[pos] = newNode;
            branch++;
            return(newNode);
        }
Ejemplo n.º 2
0
        public Node
        (
            AssimpString?mName = null,
            System.Numerics.Matrix4x4?mTransformation = null,
            Node *mParent       = null,
            uint?mNumChildren   = null,
            Node **mChildren    = null,
            uint?mNumMeshes     = null,
            uint *mMeshes       = null,
            Metadata *mMetaData = null
        ) : this()
        {
            if (mName is not null)
            {
                MName = mName.Value;
            }

            if (mTransformation is not null)
            {
                MTransformation = mTransformation.Value;
            }

            if (mParent is not null)
            {
                MParent = mParent;
            }

            if (mNumChildren is not null)
            {
                MNumChildren = mNumChildren.Value;
            }

            if (mChildren is not null)
            {
                MChildren = mChildren;
            }

            if (mNumMeshes is not null)
            {
                MNumMeshes = mNumMeshes.Value;
            }

            if (mMeshes is not null)
            {
                MMeshes = mMeshes;
            }

            if (mMetaData is not null)
            {
                MMetaData = mMetaData;
            }
        }
Ejemplo n.º 3
0
 private Node **GetPPNode()
 {
     if (this.freelist == null)
     {
         var n = (Node **)this.nodePtrsP + this.blocPtrs++;
         return(n);
     }
     else
     {
         Node **tppnode = this.freelist;
         this.freelist = (Node **)*tppnode;
         return(tppnode);
     }
 }
Ejemplo n.º 4
0
 public void Read(BinaryReader br)
 {
     token = br.ReadUInt16();
     branch = br.ReadUInt16();
     if (branch > 0)
     {
         children = (Node**)Memory.Alloc(sizeof(Node*) * branch);
         for (int i = 0; i < branch; i++)
         {
             Node* newNode = (Node*)Memory.Alloc(sizeof(Node));
             children[i] = newNode;
             newNode->Read(br);
         }
     }
 }
Ejemplo n.º 5
0
 public void Read(BinaryReader br)
 {
     token  = br.ReadUInt16();
     branch = br.ReadUInt16();
     if (branch > 0)
     {
         children = (Node **)Memory.Alloc(sizeof(Node *) * branch);
         for (int i = 0; i < branch; i++)
         {
             Node *newNode = (Node *)Memory.Alloc(sizeof(Node));
             children[i] = newNode;
             newNode->Read(br);
         }
     }
 }
Ejemplo n.º 6
0
 public Huffman(bool decompressor = false)
 {
     this.loc      = (Node **)Marshal.AllocHGlobal(sizeof(Node *) * (Huffman.HuffMax + 1));
     this.nodeList = (Node *)Marshal.AllocHGlobal(sizeof(Node) * Huffman.NodesMax);
     this.nodePtrs = (Node **)Marshal.AllocHGlobal(sizeof(Node *) * Huffman.NodesMax);
     Common.MemSet(this.loc, 0, sizeof(Node *) * (Huffman.HuffMax + 1));
     Common.MemSet(this.nodeList, 0, sizeof(Node) * Huffman.NodesMax);
     Common.MemSet(this.nodePtrs, 0, sizeof(Node *) * Huffman.NodesMax);
     this.tree = this.lhead = this.loc[Huffman.NotYetTransmitted] = &(this.nodeList[this.blocNode++]);
     if (decompressor)
     {
         this.ltail = this.tree;
     }
     this.tree->symbol = Huffman.NotYetTransmitted;
     this.tree->weight = 0;
     this.lhead->next  = this.lhead->prev = null;
     this.tree->parent = this.tree->left = this.tree->right = null;
     if (!decompressor)
     {
         this.loc[Huffman.NotYetTransmitted] = this.tree;
     }
 }
Ejemplo n.º 7
0
        Node* AddNode(Node* newNode, int pos)
        {
            if (branch < 1)
            {
                children = (Node**)Memory.Alloc(sizeof(Node*));
            }
            else
            {
                Node** newChildren = (Node**)Memory.Alloc(sizeof(Node*) * (branch + 1));
                for (int i = 0; i < branch; i++)
                {
                    newChildren[i] = children[i];
                }
                Memory.Free(children);
                children = newChildren;
            }

            for (int i = branch; i > pos; --i)
            {
                children[i] = children[i - 1];
            }
            children[pos] = newNode;
            branch++;
            return newNode;
        }
Ejemplo n.º 8
0
 private void FreePPNode(Node **ppnode)
 {
     *ppnode = (Node *)this.freelist;
     this.freelist = ppnode;
 }