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