TuttleOFX
1
|
00001 #ifndef _ofxsMemory_H_ 00002 #define _ofxsMemory_H_ 00003 /* 00004 * OFX Support Library, a library that skins the OFX plug-in API with C++ classes. 00005 * Copyright (C) 2004-2005 The Open Effects Association Ltd 00006 * Author Bruno Nicoletti bruno@thefoundry.co.uk 00007 * 00008 * Redistribution and use in source and binary forms, with or without 00009 * modification, are permitted provided that the following conditions are met: 00010 * 00011 * Redistributions of source code must retain the above copyright notice, 00012 * this list of conditions and the following disclaimer. 00013 * Redistributions in binary form must reproduce the above copyright notice, 00014 * this list of conditions and the following disclaimer in the documentation 00015 * and/or other materials provided with the distribution. 00016 * Neither the name The Open Effects Association Ltd, nor the names of its 00017 * contributors may be used to endorse or promote products derived from this 00018 * software without specific prior written permission. 00019 * 00020 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 00021 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00022 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00023 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 00024 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00025 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00026 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 00027 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00028 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00029 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00030 * 00031 * The Open Effects Association Ltd 00032 * 1 Wardour St 00033 * London W1D 6PA 00034 * England 00035 * 00036 * 00037 * 00038 */ 00039 #include <cstddef> 00040 #include <new> 00041 00042 /** @file This file contains core code that wraps the ofx memory allocator with C++ functions. 00043 * 00044 * This file only holds code that is visible to a plugin implementation, and so hides much 00045 * of the direct OFX objects and any library side only functions. 00046 */ 00047 00048 /** @brief The core 'OFX Support' namespace, used by plugin implementations. All code for these are defined in the common support libraries. 00049 */ 00050 namespace OFX { 00051 00052 // forward declaration of class 00053 class ImageEffect; 00054 00055 /** @brief Namespace for general purpose memory allocation */ 00056 namespace memory { 00057 00058 /** @brief Allocate memory. 00059 * 00060 * \arg \e nBytes - the number of bytes to allocate 00061 * \arg \e handle - effect instance to assosciate with this memory allocation, or NULL 00062 * 00063 * This function has the host allocate memory using it's own memory resources 00064 * and returns that to the plugin. This memory is distinct to any image memory allocation. 00065 * 00066 * Suceeds or throws std::bad_alloc 00067 */ 00068 void* allocate( const std::size_t nBytes, 00069 ImageEffect* handle = 0 ) throw( std::bad_alloc ); 00070 00071 /** @brief release memory 00072 * 00073 * \arg \e ptr - pointer previously returned by OFX::Memory::allocate 00074 */ 00075 void free( void* ptr ) throw(); 00076 }; 00077 00078 }; 00079 00080 #endif