00001 /* 00002 | 00003 | $Id: plmemsink.cpp,v 1.1 2004/05/21 21:02:52 maxx Exp $ 00004 | Memory "Data Sink" Class 00005 | 00006 | This class uses memory as a destination for picture data. 00007 | 00008 | Copyright (c) 1996-1998 Ulrich von Zadow 00009 | 00010 \-------------------------------------------------------------------- 00011 */ 00012 00013 #include "plstdpch.h" 00014 00015 #include "plmemsink.h" 00016 #include "plexcept.h" 00017 #include "plpaintlibdefs.h" 00018 #include "plexcept.h" 00019 00020 PLMemSink::PLMemSink () 00021 : PLDataSink(), 00022 m_pDataBuf (NULL) 00023 { 00024 00025 } 00026 00027 PLMemSink::~PLMemSink () 00028 { 00029 Close(); 00030 } 00031 00032 int PLMemSink::Open (const char * pszFName, int MaxFileSize) 00033 { 00034 if ((m_pDataBuf = new PLBYTE [MaxFileSize])!=NULL) 00035 { 00036 PLDataSink::Open(pszFName, m_pDataBuf, MaxFileSize); 00037 return 0; 00038 } 00039 else 00040 return -1; 00041 } 00042 00043 void PLMemSink::Close () 00044 { 00045 if (m_pDataBuf) 00046 { 00047 delete [] m_pDataBuf; 00048 m_pDataBuf = NULL; 00049 } 00050 00051 PLDataSink::Close(); 00052 } 00053 00054 PLBYTE* PLMemSink::GetBytes() 00055 { 00056 if (m_pDataBuf) 00057 return m_pDataBuf; 00058 else 00059 throw PLTextException(PL_ERRINTERNAL, "Open was not called for CMemSink"); 00060 } 00061 00062 00063 /* 00064 /-------------------------------------------------------------------- 00065 | 00066 | $Log: plmemsink.cpp,v $ 00067 | Revision 1.1 2004/05/21 21:02:52 maxx 00068 | Initial Version of vuVolume, moderatly changed to make it compile on my windows and linux machine. 00069 | 00070 | Revision 1.2 2003/01/07 16:14:58 sbergner 00071 | *** empty log message *** 00072 | 00073 | Revision 1.1 2002/11/13 01:58:21 mspindle 00074 | *** empty log message *** 00075 | 00076 | Revision 1.3 2001/10/16 17:12:26 uzadow 00077 | Added support for resolution information (Luca Piergentili) 00078 | 00079 | Revision 1.2 2001/10/06 22:03:26 uzadow 00080 | Added PL prefix to basic data types. 00081 | 00082 | Revision 1.1 2001/09/16 19:03:22 uzadow 00083 | Added global name prefix PL, changed most filenames. 00084 | 00085 | Revision 1.3 2001/02/04 14:31:52 uzadow 00086 | Member initialization list cleanup (Erik Hoffmann). 00087 | 00088 | Revision 1.2 2001/01/21 14:28:21 uzadow 00089 | Changed array cleanup from delete to delete[]. 00090 | 00091 | Revision 1.1 2000/10/12 21:57:26 uzadow 00092 | no message 00093 | 00094 | 00095 | 00096 \-------------------------------------------------------------------- 00097 */