00001 /* --------------------------------------------------------------------------- 00002 Phission : 00003 Realtime Vision Processing System 00004 00005 Copyright (C) 2003-2006 Philip D.S. Thoren (pthoren@cs.uml.edu) 00006 University of Massachusetts at Lowell, 00007 Laboratory for Artificial Intelligence and Robotics 00008 00009 This file is part of Phission. 00010 00011 Phission is free software; you can redistribute it and/or modify 00012 it under the terms of the GNU Lesser General Public License as published by 00013 the Free Software Foundation; either version 2 of the License, or 00014 (at your option) any later version. 00015 00016 Phission is distributed in the hope that it will be useful, 00017 but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 GNU Lesser General Public License for more details. 00020 00021 You should have received a copy of the GNU Lesser General Public License 00022 along with Phission; if not, write to the Free Software 00023 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00024 00025 ---------------------------------------------------------------------------*/ 00026 #ifndef _PHDATAOBJECT_H 00027 #define _PHDATAOBJECT_H 00028 00029 #include <phStandard.h> 00030 #include <phStdint.h> 00031 #include <phLiveObject.h> 00032 00033 /* ---------------------------------------------------------------------- */ 00039 PHAPI(class) phDataObject : public phLiveObject 00040 { 00041 private: 00042 uint8_t *m_temp; 00043 uint32_t m_temp_size; 00044 00045 protected: 00046 void *m_data; 00047 uint32_t m_size; 00048 00049 public: 00050 phDataObject(); 00051 virtual ~phDataObject(); 00052 00053 uint32_t getSize(); 00054 const void *getData(); 00055 00056 int copy( phObject *copyto_obj ); 00057 int swap( phObject *obj ); 00058 00059 int getCopy( phDataObject &object ); 00060 00061 /* disable_notify is a feature switch for the live object calls. 00062 * disable_notify==1 disables notification of a data update so 00063 * client objects won't get data before it's ready or get two copies */ 00064 int setData( phDataObject ©from, 00065 int disable_notify = 0 ); 00066 int setData( uint32_t newsize, 00067 const void *newdata, /* pointer to buffer to copy from */ 00068 int disable_notify = 0 ); 00069 int setData( uint32_t newsize, 00070 const uint8_t newdata[], /* Data copied from buffer */ 00071 int disable_notify = 0 ); 00072 00073 int swapData( phDataObject &object, 00074 int disable_notify = 0 ); 00075 /* Data copied into newdata buffer, may be alloced/pointer may change */ 00076 int swapData( uint32_t *newsize, 00077 void **newdata, 00078 int disable_notify = 0); 00079 /* Data copied into buffer, buffer memory not changed; 00080 * return value: phFAIL or # of bytes copied into newdata */ 00081 int swapData( uint32_t size, 00082 uint8_t databuf[], 00083 int disable_notify = 0 ); 00084 00085 /* Allocate a buffer */ 00086 int allocate( uint32_t size ); 00087 int allocate( uint32_t nelems, uint32_t elemsize ); 00088 00089 /* Frees the memory and sets size to 0 */ 00090 int reset(); 00091 00092 /* Clears the image data */ 00093 int erase(); 00094 00095 /* returns whether the data pointer is NULL */ 00096 int isNull(); 00097 00098 phDataObject& operator= ( phDataObject &rightHand ); 00099 }; 00100 00101 #endif /* _PHDATAOBJECT_H */
Copyright (C) 2002 - 2007 |
Philip D.S. Thoren ( pthoren@users.sourceforge.net ) University Of Massachusetts at Lowell Robotics Lab |