Patch from GSR that a) fixes a whole bunch of GPL/BL license
[blender.git] / source / gameengine / Expressions / VoidValue.h
1 /**
2  * VoidValue.h: interface for the CVoidValue class.
3  * $Id$
4  *
5  * ***** BEGIN GPL LICENSE BLOCK *****
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software Foundation,
19  * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20  *
21  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
22  * All rights reserved.
23  *
24  * The Original Code is: all of this file.
25  *
26  * Contributor(s): none yet.
27  *
28  * ***** END GPL LICENSE BLOCK *****
29  */
30 #ifndef __VOIDVALUE_H__
31 #define __VOIDVALUE_H__
32
33 #include "Value.h"
34
35 //
36 // Void value, used to transport *any* type of data
37 //
38 class CVoidValue : public CPropValue  
39 {
40         //PLUGIN_DECLARE_SERIAL (CVoidValue,CValue)
41
42 public:
43         /// Construction/destruction
44         CVoidValue()                                                                                                                            : m_bDeleteOnDestruct(false), m_pAnything(NULL)  { }
45         CVoidValue(void * voidptr, bool bDeleteOnDestruct, AllocationTYPE alloctype)    : m_bDeleteOnDestruct(bDeleteOnDestruct), m_pAnything(voidptr)  { if (alloctype == STACKVALUE) CValue::DisableRefCount(); }
46         virtual                         ~CVoidValue();                                                                                  // Destruct void value, delete memory if we're owning it
47
48         /// Value -> String or number
49         virtual const STR_String &      GetText();                                                                                              // Get string description of void value (unimplemented)
50         virtual float           GetNumber()                                                                                             { return -1; }
51
52         /// Value calculation
53         virtual CValue*         Calc(VALUE_OPERATOR op, CValue *val);
54         virtual CValue*         CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue* val);
55
56         /// Value replication
57         virtual CValue*         GetReplica();
58         
59         /// Data members
60         bool                            m_bDeleteOnDestruct;
61         void*                           m_pAnything;
62 };
63
64 #endif // !defined _VOIDVALUE_H
65