HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SIM_DataThreadedIO.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  */
7 
8 #ifndef __SIM_DataThreadedIO_h__
9 #define __SIM_DataThreadedIO_h__
10 
11 
12 #include "SIM_API.h"
13 
14 #include <UT/UT_IStream.h>
15 #include <UT/UT_Array.h>
16 #include <SYS/SYS_BoostStreams.h>
17 
19 {
20 public:
23 
24  virtual bool finishLoad(UT_IStream &is) = 0;
25  virtual void finishSave(std::ostream &os) = 0;
26  virtual exint memoryEstimate() const = 0;
27 };
28 
30 {
31 public:
33  virtual ~SIM_DataThreadedIO();
34 
35  void enqueueLoad(SIM_DataThreadedIOTask *task);
36  void enqueueSave(SIM_DataThreadedIOTask *task);
37 
38  void completeAllSaves(std::ostream &os);
39  bool completeAllLoads(UT_IStream &is);
40 
41  bool anyTasks() const { return myTaskList.entries() != 0; }
42 
43  exint memoryEstimate() const;
44 
45  void setCompressedOS(bios::filtering_stream<bios::output> *compressout) { myCompressedOS = compressout; }
46  bios::filtering_stream<bios::output> *getCompressedOS() const { return myCompressedOS; }
48  {
49  if (myCompressedOS)
50  myCompressedOS->reset();
51  delete myCompressedOS;
52  myCompressedOS = 0;
53  }
54 
55 protected:
56  enum IO_MODE
57  {
60  MODE_LOAD
61  };
62 
65 
66  bios::filtering_stream<bios::output> *myCompressedOS;
67 
68 };
69 
70 #endif
bios::filtering_stream< bios::output > * getCompressedOS() const
void setCompressedOS(bios::filtering_stream< bios::output > *compressout)
int64 exint
Definition: SYS_Types.h:109
UT_Array< SIM_DataThreadedIOTask * > myTaskList
#define SIM_API
Definition: SIM_API.h:10
bios::filtering_stream< bios::output > * myCompressedOS
bool anyTasks() const