|
Blender
V2.59
|
00001 /* 00002 * VoidValue.h: interface for the CVoidValue class. 00003 * $Id: VoidValue.h 35063 2011-02-22 10:33:14Z jesterking $ 00004 * 00005 * ***** BEGIN GPL LICENSE BLOCK ***** 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License 00009 * as published by the Free Software Foundation; either version 2 00010 * of the License, or (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software Foundation, 00019 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00020 * 00021 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. 00022 * All rights reserved. 00023 * 00024 * The Original Code is: all of this file. 00025 * 00026 * Contributor(s): none yet. 00027 * 00028 * ***** END GPL LICENSE BLOCK ***** 00029 */ 00030 00035 #ifndef __VOIDVALUE_H__ 00036 #define __VOIDVALUE_H__ 00037 00038 #include "Value.h" 00039 00040 // 00041 // Void value, used to transport *any* type of data 00042 // 00043 class CVoidValue : public CPropValue 00044 { 00045 //PLUGIN_DECLARE_SERIAL (CVoidValue,CValue) 00046 00047 public: 00049 CVoidValue() : m_bDeleteOnDestruct(false), m_pAnything(NULL) { } 00050 CVoidValue(void * voidptr, bool bDeleteOnDestruct, AllocationTYPE alloctype) : m_bDeleteOnDestruct(bDeleteOnDestruct), m_pAnything(voidptr) { if (alloctype == STACKVALUE) CValue::DisableRefCount(); } 00051 virtual ~CVoidValue(); // Destruct void value, delete memory if we're owning it 00052 00054 virtual const STR_String & GetText(); // Get string description of void value (unimplemented) 00055 virtual double GetNumber() { return -1; } 00056 00058 virtual CValue* Calc(VALUE_OPERATOR op, CValue *val); 00059 virtual CValue* CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue* val); 00060 00062 virtual CValue* GetReplica(); 00063 00065 bool m_bDeleteOnDestruct; 00066 void* m_pAnything; 00067 00068 00069 #ifdef WITH_CXX_GUARDEDALLOC 00070 public: 00071 void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:CVoidValue"); } 00072 void operator delete( void *mem ) { MEM_freeN(mem); } 00073 #endif 00074 }; 00075 00076 #endif // !defined _VOIDVALUE_H 00077