VTK  9.1.0
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 =========================================================================*/
29 #ifndef vtkMultiProcessStream_h
30 #define vtkMultiProcessStream_h
31 
32 #include "vtkObject.h"
33 #include "vtkParallelCoreModule.h" // For export macro
34 #include <string> // needed for string.
35 #include <vector> // needed for vector.
36 
37 class VTKPARALLELCORE_EXPORT vtkMultiProcessStream
38 {
39 public:
44 
46 
59  // Without this operator, the compiler would convert
60  // a char* to a bool instead of a std::string.
64 
66 
81 
83 
86  void Push(double array[], unsigned int size);
87  void Push(float array[], unsigned int size);
88  void Push(int array[], unsigned int size);
89  void Push(char array[], unsigned int size);
90  void Push(unsigned int array[], unsigned int size);
91  void Push(unsigned char array[], unsigned int size);
92  void Push(vtkTypeInt64 array[], unsigned int size);
93  void Push(vtkTypeUInt64 array[], unsigned int size);
95 
97 
104  void Pop(double*& array, unsigned int& size);
105  void Pop(float*& array, unsigned int& size);
106  void Pop(int*& array, unsigned int& size);
107  void Pop(char*& array, unsigned int& size);
108  void Pop(unsigned int*& array, unsigned int& size);
109  void Pop(unsigned char*& array, unsigned int& size);
110  void Pop(vtkTypeInt64*& array, unsigned int& size);
111  void Pop(vtkTypeUInt64*& array, unsigned int& size);
113 
117  void Reset();
118 
122  int Size();
123 
128  int RawSize() { return (this->Size() + 1); }
129 
133  bool Empty();
134 
136 
140  void GetRawData(std::vector<unsigned char>& data) const;
141  void GetRawData(unsigned char*& data, unsigned int& size);
142  void SetRawData(const std::vector<unsigned char>& data);
143  void SetRawData(const unsigned char*, unsigned int size);
144  std::vector<unsigned char> GetRawData() const;
146 
147 private:
148  class vtkInternals;
149  vtkInternals* Internals;
150  unsigned char Endianness;
151  enum
152  {
153  BigEndian,
154  LittleEndian
155  };
156 };
157 
158 #endif
159 
160 // 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.
void SetRawData(const unsigned char *, unsigned int size)
Serialization methods used to save/restore the stream to/from raw data.
vtkMultiProcessStream & operator<<(char value)
Add-to-stream operators.
vtkMultiProcessStream & operator>>(bool &value)
Remove-from-stream operators.
vtkMultiProcessStream & operator>>(std::string &value)
Remove-from-stream operators.
void Pop(double *&array, unsigned int &size)
Remove-array-to-stream methods.
vtkMultiProcessStream & operator<<(unsigned char value)
Add-to-stream operators.
void SetRawData(const std::vector< unsigned char > &data)
Serialization methods used to save/restore the stream to/from raw data.
vtkMultiProcessStream & operator>>(vtkTypeInt64 &value)
Remove-from-stream operators.
vtkMultiProcessStream & operator>>(char &value)
Remove-from-stream operators.
bool Empty()
Returns true iff the stream is empty.
vtkMultiProcessStream & operator>>(unsigned int &value)
Remove-from-stream operators.
void Push(float array[], unsigned int size)
Add-array-to-stream methods.
vtkMultiProcessStream & operator>>(float &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.
vtkMultiProcessStream & operator<<(int value)
Add-to-stream operators.
void Pop(char *&array, unsigned int &size)
Remove-array-to-stream methods.
vtkMultiProcessStream & operator>>(vtkTypeUInt64 &value)
Remove-from-stream operators.
void Push(unsigned int array[], unsigned int size)
Add-array-to-stream methods.
vtkMultiProcessStream & operator>>(int &value)
Remove-from-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.
vtkMultiProcessStream & operator<<(float value)
Add-to-stream operators.
vtkMultiProcessStream & operator<<(vtkTypeUInt64 value)
Add-to-stream operators.
void Push(char array[], unsigned int size)
Add-array-to-stream methods.
vtkMultiProcessStream & operator>>(double &value)
Remove-from-stream operators.
vtkMultiProcessStream & operator<<(const vtkMultiProcessStream &)
Add-to-stream operators.
void Reset()
Clears everything in the stream.
void Push(double array[], unsigned int size)
Add-array-to-stream methods.
vtkMultiProcessStream & operator<<(double value)
Add-to-stream operators.
void Push(vtkTypeInt64 array[], unsigned int size)
Add-array-to-stream methods.
vtkMultiProcessStream & operator<<(unsigned int value)
Add-to-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<<(const char *value)
Add-to-stream operators.
vtkMultiProcessStream & operator>>(unsigned char &value)
Remove-from-stream operators.
void Push(vtkTypeUInt64 array[], unsigned int size)
Add-array-to-stream methods.
vtkMultiProcessStream & operator=(const vtkMultiProcessStream &)
void Pop(vtkTypeInt64 *&array, unsigned int &size)
Remove-array-to-stream methods.
vtkMultiProcessStream & operator<<(const std::string &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>>(vtkMultiProcessStream &)
Remove-from-stream operators.
std::vector< unsigned char > GetRawData() const
Serialization methods used to save/restore the stream to/from raw data.
vtkMultiProcessStream & operator<<(vtkTypeInt64 value)
Add-to-stream operators.
void Push(unsigned char array[], unsigned int size)
Add-array-to-stream methods.
vtkMultiProcessStream & operator<<(bool value)
Add-to-stream operators.
int Size()
Returns the size of the stream.
int RawSize()
Returns the size of the raw data returned by GetRawData.
vtkMultiProcessStream(const vtkMultiProcessStream &)
@ value
Definition: vtkX3D.h:226
@ size
Definition: vtkX3D.h:259
@ data
Definition: vtkX3D.h:321
@ string
Definition: vtkX3D.h:496