00001 // Expression.cpp: implementation of the CExpression class. 00002 /* 00003 * Copyright (c) 1996-2000 Erwin Coumans <[email protected]> 00004 * 00005 * Permission to use, copy, modify, distribute and sell this software 00006 * and its documentation for any purpose is hereby granted without fee, 00007 * provided that the above copyright notice appear in all copies and 00008 * that both that copyright notice and this permission notice appear 00009 * in supporting documentation. Erwin Coumans makes no 00010 * representations about the suitability of this software for any 00011 * purpose. It is provided "as is" without express or implied warranty. 00012 * 00013 */ 00014 00015 00016 00017 #include "Expression.h" 00018 #include "ErrorValue.h" 00019 //#include "FactoryManager.h" 00020 00022 // Construction/Destruction 00024 00025 CExpression::CExpression()// : m_cached_calculate(NULL) 00026 { 00027 m_refcount = 1; 00028 #ifdef _DEBUG 00029 //gRefCountExpr++; 00030 #endif 00031 } 00032 00033 CExpression::~CExpression() 00034 { 00035 assert (m_refcount == 0); 00036 } 00037 00038 00039 00040 // destuctor for CBrokenLinkInfo 00041 CBrokenLinkInfo::~CBrokenLinkInfo() 00042 { 00043 if (m_pExpr && !m_bRestored) 00044 m_pExpr->Release(); 00045 } 00046 00047 00048 void CBrokenLinkInfo::RestoreLink() 00049 { 00050 00051 00052 assertd(m_pExpr); 00053 00054 if (m_pExpr) 00055 { 00056 if (!m_bRestored){ 00057 m_bRestored=true; 00058 00059 } 00060 if (*m_pmemExpr) 00061 { 00062 (*m_pmemExpr)->Release(); 00063 } 00064 *m_pmemExpr = m_pExpr; 00065 00066 // m_pExpr=NULL; 00067 } 00068 } 00069 00070 void CBrokenLinkInfo::BreakLink() 00071 { 00072 m_bRestored=false; 00073 m_pExpr->AddRef(); 00074 } 00075