Exemplo n.º 1
0
        public MIN_MAX minMax; /* for MIN/MAX - ID & REF*/ // made ptr stevev 21aug07
                                                           //}
                                                           //elem;

        //Element(){byElemType = 0;  elem.pSTRCNST = NULL; elem.minMax.clear();};// it's a union sjv
        public Element()
        {
            byElemType = 0;
            ulConst    = 0;
            pSTRCNST   = new List <ddpSTRING>();
            varRef     = new ddpREFERENCE();
            minMax     = new MIN_MAX();
        }// minmax 2 ptr 21aug07 sjv
Exemplo n.º 2
0
        }// minmax 2 ptr 21aug07 sjv

        /*
         * Element(Element cconst)
         * {
         *  ulConst = 0;
         *  this = (cconst);
         * }
         */
        /*
         * public static Element operator= (Element src)
         * {
         *
         *  Cleanup();// try to prevent memory leaks
         *
         *  switch (byElemType)// stevev 8au807- then modify those that need to be
         *  {
         *      case VARREF_OPCODE:
         *          if (src.elem.varRef != null)
         *          {
         *              elem.varRef = new ddpREFERENCE(*(src.elem.varRef));
         *          }
         *          break;
         *      case MAXREF_OPCODE:
         *      case MINREF_OPCODE:
         *          if (src.elem.minMax != NULL)
         *          {
         *              elem.minMax = new MIN_MAX(*(src.elem.minMax));
         *          }
         *          break;
         *      case STRCST_OPCODE:
         *          if (src.elem.pSTRCNST != NULL)
         *          {
         *              elem.pSTRCNST = new ddpSTRING(*(src.elem.pSTRCNST));
         *          }
         *          break;
         *      default:
         *          memcpy(&elem, &(src.elem), sizeof(elem));// stevev 8au807-do the rest
         *          break;
         *  }
         *  return *this;
         *
         * }
         * //void clean(){ byElemType = 0;/* elem = {0}; / elem.minMax.clear();};
         * //void clean(){ byElemType = 0; elem.minMax->clear();};
         */

        public void Cleanup()
        {
            switch (byElemType)
            {
            case VARREF_OPCODE:
                if (varRef != null)
                {    // we gave ddpREFERENCE a destructor
                    varRef.Clear();
                    varRef = null;
                }
                break;

            case MAXREF_OPCODE:
                if (minMax != null)
                {
                    minMax.Cleanup();
                    minMax = null;
                }
                break;

            case MINREF_OPCODE:
                if (minMax != null)
                {
                    minMax.Cleanup();
                    minMax = null;
                }
                break;

            case STRCST_OPCODE:
            {
                pSTRCNST.Clear();
                pSTRCNST = null;
            }
            break;

            default:
                break;
            }
            byElemType = 0;
        }