VTK
vtkMultiProcessStream.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkMultiProcessStream.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
31 #ifndef vtkMultiProcessStream_h
32 #define vtkMultiProcessStream_h
33 
34 #include "vtkParallelCoreModule.h" // For export macro
35 #include "vtkObject.h"
36 #include <vector> // needed for vector.
37 #include <string> // needed for string.
38 
40 {
41 public:
46 
48 
50  vtkMultiProcessStream& operator << (float value);
54  vtkMultiProcessStream& operator << (unsigned int value);
55  vtkMultiProcessStream& operator << (unsigned char value);
56  vtkMultiProcessStream& operator << (vtkTypeInt64 value);
57  vtkMultiProcessStream& operator << (vtkTypeUInt64 value);
59  // Without this operator, the compiler would convert
60  // a char* to a bool instead of a std::string.
61  vtkMultiProcessStream& operator << (const char* value);
64 
66 
67  vtkMultiProcessStream& operator >> (double &value);
68  vtkMultiProcessStream& operator >> (float &value);
69  vtkMultiProcessStream& operator >> (int &value);
70  vtkMultiProcessStream& operator >> (char &value);
71  vtkMultiProcessStream& operator >> (bool &value);
72  vtkMultiProcessStream& operator >> (unsigned int &value);
73  vtkMultiProcessStream& operator >> (unsigned char &value);
74  vtkMultiProcessStream& operator >> (vtkTypeInt64 &value);
75  vtkMultiProcessStream& operator >> (vtkTypeUInt64 &value);
76  vtkMultiProcessStream& operator >> (std::string &value);
79 
81 
82  void Push(double array[], unsigned int size);
83  void Push(float array[], unsigned int size);
84  void Push(int array[], unsigned int size);
85  void Push(char array[], unsigned int size);
86  void Push(unsigned int array[], unsigned int size );
87  void Push(unsigned char array[], unsigned int size );
88  void Push(vtkTypeInt64 array[], unsigned int size );
89  void Push(vtkTypeUInt64 array[], unsigned int size );
91 
93 
99  void Pop(double*& array, unsigned int& size);
100  void Pop(float*& array, unsigned int& size);
101  void Pop(int*& array, unsigned int& size);
102  void Pop(char*& array, unsigned int& size);
103  void Pop(unsigned int*& array, unsigned int& size );
104  void Pop(unsigned char*& array, unsigned int& size );
105  void Pop(vtkTypeInt64*& array, unsigned int& size );
106  void Pop(vtkTypeUInt64*& array, unsigned int& size );
108 
109 
111  void Reset();
112 
114  int Size();
115 
117 
119  int RawSize()
120  {return(this->Size()+1);};
122 
124  bool Empty();
125 
127 
130  void GetRawData(std::vector<unsigned char>& data) const;
131  void GetRawData( unsigned char*& data, unsigned int &size );
132  void SetRawData(const std::vector<unsigned char>& data);
133  void SetRawData(const unsigned char*, unsigned int size);
135 
136 private:
137  class vtkInternals;
138  vtkInternals* Internals;
139  unsigned char Endianness;
140  enum
141  {
142  BigEndian,
143  LittleEndian
144  };
145 };
146 
147 #endif
148 
149 
150 // VTK-HeaderTest-Exclude: vtkMultiProcessStream.h
stream used to pass data across processes using vtkMultiProcessController.
#define VTKPARALLELCORE_EXPORT
VTKCOMMONCORE_EXPORT ostream & operator<<(ostream &os, const vtkIndent &o)