Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

ConstExpr.cpp

Go to the documentation of this file.
00001 // ConstExpr.cpp: implementation of the CConstExpr class.
00002 
00003 /*
00004  * Copyright (c) 1996-2000 Erwin Coumans <[email protected]>

00005  *
00006  * Permission to use, copy, modify, distribute and sell this software

00007  * and its documentation for any purpose is hereby granted without fee,

00008  * provided that the above copyright notice appear in all copies and

00009  * that both that copyright notice and this permission notice appear

00010  * in supporting documentation.  Erwin Coumans makes no

00011  * representations about the suitability of this software for any

00012  * purpose.  It is provided "as is" without express or implied warranty.

00013  *
00014  */
00015 
00016 
00017 
00018 #include "Value.h" // for precompiled header
00019 
00020 #include "ConstExpr.h"
00021 #include "VectorValue.h"
00022 
00023 
00025 // Construction/Destruction
00027 
00028 
00029 CConstExpr::CConstExpr(CValue* constval) 
00030 /*
00031 pre:

00032 effect: constructs a CConstExpr cointing the value constval

00033 */
00034 {
00035         m_value = constval;
00036 //      m_bModified=true;
00037         
00038 }
00039 
00040 CConstExpr::~CConstExpr()
00041 /*
00042 pre:

00043 effect: deletes the object

00044 */
00045 {
00046         if (m_value) {
00047                 m_value->Release();
00048         }
00049 }
00050 
00051 CValue* CConstExpr::Calculate()
00052 /*
00053 pre:

00054 ret: a new object containing the value of the stored CValue

00055 */
00056 {
00057         return m_value->AddRef();
00058 }
00059 
00060 /*
00061 bool CConstExpr::IsInside(float x, float y, float z,bool bBorderInclude)

00062 {

00063         bool result;

00064         

00065         CVectorValue* vec = new CVectorValue(x,y,z);

00066         

00067         if (bBorderInclude) {

00068                 result = m_value->Query(CValue::IS_INSIDE, NULL,vec);

00069         } else {

00070                 result = m_value->Query(CValue::IS_INSIDE_EXCL_BORDER, NULL,vec);

00071         }

00072         

00073         vec->Release();

00074         return result;

00075 
00076 }

00077 */
00078 
00079 bool CConstExpr::NeedsRecalculated()

00080 {
00081         return m_value->IsAffected(); // IsAffected is m_bModified OR m_bAffected !!!
00082 }
00083 
00084 
00085 CExpression* CConstExpr::CheckLink(std::vector<CBrokenLinkInfo*>& brokenlinks) {
00086 // parent checks if child is still usefull. 
00087 // When for example it's value it's deleted flag set
00088 // then release Value, and return NULL in case of constexpression
00089 // else return this...
00090 
00091         assertd(m_value);
00092         if (m_value->IsReleaseRequested())
00093         {
00094                 AddRef(); //numchanges++;
00095                 return Release();
00096         }
00097         
00098         else return this;
00099 
00100 }
00101 
00102 
00103 void CConstExpr::BroadcastOperators(VALUE_OPERATOR op)

00104 {
00105         assertd(m_value);
00106         m_value->SetColorOperator(op);
00107 }
00108 
00109 
00110 
00111 bool CConstExpr::MergeExpression(CExpression *otherexpr)

00112 {
00113         assertd(false);
00114         return false;
00115 }

Generated at Thu Feb 1 13:03:01 2001 for Ketsji Game Engine by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000