HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 #include "SIM_API.h"
12 
13 #include <UT/UT_Array.h>
14 #include <SYS/SYS_BoostStreams.h>
15 #include <SYS/SYS_Types.h>
16 
17 #include <iosfwd>
18 
19 class UT_IStream;
20 
21 
23 {
24 public:
27 
28  virtual bool finishLoad(UT_IStream &is) = 0;
29  virtual void finishSave(std::ostream &os) = 0;
30  virtual exint memoryEstimate() const = 0;
31 };
32 
34 {
35 public:
37  virtual ~SIM_DataThreadedIO();
38 
39  void enqueueLoad(SIM_DataThreadedIOTask *task);
40  void enqueueSave(SIM_DataThreadedIOTask *task);
41 
42  void completeAllSaves(std::ostream &os);
43  bool completeAllLoads(UT_IStream &is);
44 
45  bool anyTasks() const { return myTaskList.entries() != 0; }
46 
47  exint memoryEstimate() const;
48 
49  void setCompressedOS(bios::filtering_stream<bios::output> *compressout) { myCompressedOS = compressout; }
50  bios::filtering_stream<bios::output> *getCompressedOS() const { return myCompressedOS; }
52  {
53  if (myCompressedOS)
54  myCompressedOS->reset();
55  delete myCompressedOS;
56  myCompressedOS = 0;
57  }
58 
59 protected:
60  enum IO_MODE
61  {
64  MODE_LOAD
65  };
66 
69 
70  bios::filtering_stream<bios::output> *myCompressedOS;
71 
72 };
73 
74 #endif
int64 exint
Definition: SYS_Types.h:125
bios::filtering_stream< bios::output > * getCompressedOS() const
void setCompressedOS(bios::filtering_stream< bios::output > *compressout)
UT_Array< SIM_DataThreadedIOTask * > myTaskList
#define SIM_API
Definition: SIM_API.h:12
bios::filtering_stream< bios::output > * myCompressedOS
bool anyTasks() const