00001 /*======================================================================= 00002 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00003 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00004 *** *** 00005 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00006 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00007 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00008 *** *** 00009 *** RESTRICTED RIGHTS LEGEND *** 00010 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00011 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00012 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00013 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00014 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00015 *** *** 00016 *** COPYRIGHT (C) 1996-2023 BY FEI S.A.S, *** 00017 *** BORDEAUX, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 00021 #pragma once 00022 00023 #include <Inventor/devices/SoBufferObject.h> 00024 #include <Inventor/devices/SoCpuContext.h> 00025 00026 SO_PIMPL_PUBLIC_DECLARATION(SoCpuBufferObject) 00027 00028 00150 class SoCpuBufferObject : public SoBufferObject 00151 { 00152 SO_TYPED_CLASS_HEADER(); 00153 SO_PIMPL_PUBLIC_HEADER(SoCpuBufferObject) 00154 00155 public: 00156 00161 SoCpuBufferObject(); 00162 00185 SoCpuBufferObject(void *buffer, size_t size); 00186 00213 void setBuffer(void *buffer, size_t size); 00214 00220 virtual SoBufferObject* createInstance() const; 00221 00226 virtual void clearInstance(); 00227 00228 private: 00229 00231 const void* getReadOnlyPointer() const; 00232 00236 virtual void copyToCpuBuffer( SoCpuBufferObject* targetBufferObject, size_t destOffset = 0, size_t sourceOffset = 0, size_t copySize = SO_BUFFER_SIZE_ALL ); 00237 00242 bool isBufferOwner() const; 00243 00244 static void memcpyPtr2Ptr(void* dest, void* data, size_t dataSize, size_t count); 00245 00246 private: 00251 virtual ~SoCpuBufferObject(); 00252 00253 }; 00254