Blender V2.61 - r43446

Expression.cpp

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