VTK  9.2.6
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=========================================================================*/
32#ifndef vtkMultiProcessStream_h
33#define vtkMultiProcessStream_h
34
35#include "vtkObject.h"
36#include "vtkParallelCoreModule.h" // For export macro
37#include <string> // needed for string.
38#include <vector> // needed for vector.
39
40class VTKPARALLELCORE_EXPORT vtkMultiProcessStream
41{
42public:
47
49
57 vtkMultiProcessStream& operator<<(unsigned int value);
58 vtkMultiProcessStream& operator<<(unsigned char value);
59 vtkMultiProcessStream& operator<<(vtkTypeInt64 value);
60 vtkMultiProcessStream& operator<<(vtkTypeUInt64 value);
61 vtkMultiProcessStream& operator<<(const std::string& value);
62 // Without this operator, the compiler would convert
63 // a char* to a bool instead of a std::string.
64 vtkMultiProcessStream& operator<<(const char* value);
67
69
77 vtkMultiProcessStream& operator>>(unsigned int& value);
78 vtkMultiProcessStream& operator>>(unsigned char& value);
79 vtkMultiProcessStream& operator>>(vtkTypeInt64& value);
80 vtkMultiProcessStream& operator>>(vtkTypeUInt64& value);
81 vtkMultiProcessStream& operator>>(std::string& value);
84
86
89 void Push(double array[], unsigned int size);
90 void Push(float array[], unsigned int size);
91 void Push(int array[], unsigned int size);
92 void Push(char array[], unsigned int size);
93 void Push(unsigned int array[], unsigned int size);
94 void Push(unsigned char array[], unsigned int size);
95 void Push(vtkTypeInt64 array[], unsigned int size);
96 void Push(vtkTypeUInt64 array[], unsigned int size);
98
100
107 void Pop(double*& array, unsigned int& size);
108 void Pop(float*& array, unsigned int& size);
109 void Pop(int*& array, unsigned int& size);
110 void Pop(char*& array, unsigned int& size);
111 void Pop(unsigned int*& array, unsigned int& size);
112 void Pop(unsigned char*& array, unsigned int& size);
113 void Pop(vtkTypeInt64*& array, unsigned int& size);
114 void Pop(vtkTypeUInt64*& array, unsigned int& size);
116
120 void Reset();
121
125 int Size();
126
131 int RawSize() { return (this->Size() + 1); }
132
136 bool Empty();
137
139
143 void GetRawData(std::vector<unsigned char>& data) const;
144 void GetRawData(unsigned char*& data, unsigned int& size);
145 void SetRawData(const std::vector<unsigned char>& data);
146 void SetRawData(const unsigned char*, unsigned int size);
147 std::vector<unsigned char> GetRawData() const;
149
150private:
151 class vtkInternals;
152 vtkInternals* Internals;
153 unsigned char Endianness;
154 enum
155 {
156 BigEndian,
157 LittleEndian
158 };
159};
160
161#endif
162
163// VTK-HeaderTest-Exclude: vtkMultiProcessStream.h
stream used to pass data across processes using vtkMultiProcessController.
void Pop(vtkTypeUInt64 *&array, unsigned int &size)
Remove-array-to-stream methods.
vtkMultiProcessStream & operator<<(vtkTypeUInt64 value)
Add-to-stream operators.
vtkMultiProcessStream & operator<<(const vtkMultiProcessStream &)
Add-to-stream operators.
vtkMultiProcessStream & operator<<(vtkTypeInt64 value)
Add-to-stream operators.
vtkMultiProcessStream & operator<<(int value)
Add-to-stream operators.
vtkMultiProcessStream & operator>>(bool &value)
Remove-from-stream operators.
void SetRawData(const unsigned char *, unsigned int size)
Serialization methods used to save/restore the stream to/from raw data.
vtkMultiProcessStream & operator<<(unsigned int value)
Add-to-stream operators.
vtkMultiProcessStream & operator>>(unsigned int &value)
Remove-from-stream operators.
void Pop(double *&array, unsigned int &size)
Remove-array-to-stream methods.
vtkMultiProcessStream & operator>>(char &value)
Remove-from-stream operators.
std::vector< unsigned char > GetRawData() const
Serialization methods used to save/restore the stream to/from raw data.
vtkMultiProcessStream & operator=(const vtkMultiProcessStream &)
vtkMultiProcessStream & operator>>(vtkTypeUInt64 &value)
Remove-from-stream operators.
void SetRawData(const std::vector< unsigned char > &data)
Serialization methods used to save/restore the stream to/from raw data.
bool Empty()
Returns true iff the stream is empty.
vtkMultiProcessStream & operator>>(unsigned char &value)
Remove-from-stream operators.
void Push(float array[], unsigned int size)
Add-array-to-stream methods.
vtkMultiProcessStream & operator>>(int &value)
Remove-from-stream operators.
vtkMultiProcessStream & operator>>(double &value)
Remove-from-stream operators.
void GetRawData(std::vector< unsigned char > &data) const
Serialization methods used to save/restore the stream to/from raw data.
void Pop(char *&array, unsigned int &size)
Remove-array-to-stream methods.
void Push(unsigned int array[], unsigned int size)
Add-array-to-stream methods.
vtkMultiProcessStream & operator<<(const std::string &value)
Add-to-stream operators.
void Pop(unsigned char *&array, unsigned int &size)
Remove-array-to-stream methods.
void Push(int array[], unsigned int size)
Add-array-to-stream methods.
void Push(char array[], unsigned int size)
Add-array-to-stream methods.
void Reset()
Clears everything in the stream.
vtkMultiProcessStream & operator<<(float value)
Add-to-stream operators.
void Push(double array[], unsigned int size)
Add-array-to-stream methods.
vtkMultiProcessStream & operator>>(vtkTypeInt64 &value)
Remove-from-stream operators.
void Push(vtkTypeInt64 array[], unsigned int size)
Add-array-to-stream methods.
vtkMultiProcessStream & operator<<(bool value)
Add-to-stream operators.
vtkMultiProcessStream & operator>>(float &value)
Remove-from-stream operators.
void Pop(float *&array, unsigned int &size)
Remove-array-to-stream methods.
void Pop(int *&array, unsigned int &size)
Remove-array-to-stream methods.
void Pop(unsigned int *&array, unsigned int &size)
Remove-array-to-stream methods.
vtkMultiProcessStream & operator>>(vtkMultiProcessStream &)
Remove-from-stream operators.
void Push(vtkTypeUInt64 array[], unsigned int size)
Add-array-to-stream methods.
vtkMultiProcessStream & operator<<(const char *value)
Add-to-stream operators.
void Pop(vtkTypeInt64 *&array, unsigned int &size)
Remove-array-to-stream methods.
vtkMultiProcessStream & operator<<(double value)
Add-to-stream operators.
void GetRawData(unsigned char *&data, unsigned int &size)
Serialization methods used to save/restore the stream to/from raw data.
vtkMultiProcessStream & operator<<(char value)
Add-to-stream operators.
void Push(unsigned char array[], unsigned int size)
Add-array-to-stream methods.
vtkMultiProcessStream & operator>>(std::string &value)
Remove-from-stream operators.
int Size()
Returns the size of the stream.
vtkMultiProcessStream & operator<<(unsigned char value)
Add-to-stream operators.
int RawSize()
Returns the size of the raw data returned by GetRawData.
vtkMultiProcessStream(const vtkMultiProcessStream &)