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=========================================================================*/
32#ifndef vtkMultiProcessStream_h
33#define vtkMultiProcessStream_h
34
35#include "vtkParallelCoreModule.h" // For export macro
36#include "vtkObject.h"
37#include <vector> // needed for vector.
38#include <string> // needed for string.
39
40class VTKPARALLELCORE_EXPORT vtkMultiProcessStream
41{
42public:
47
49
62 // Without this operator, the compiler would convert
63 // a char* to a bool instead of a std::string.
67
69
72 vtkMultiProcessStream& operator >> (double &value);
73 vtkMultiProcessStream& operator >> (float &value);
74 vtkMultiProcessStream& operator >> (int &value);
75 vtkMultiProcessStream& operator >> (char &value);
76 vtkMultiProcessStream& operator >> (bool &value);
77 vtkMultiProcessStream& operator >> (unsigned int &value);
78 vtkMultiProcessStream& operator >> (unsigned char &value);
79 vtkMultiProcessStream& operator >> (vtkTypeInt64 &value);
80 vtkMultiProcessStream& operator >> (vtkTypeUInt64 &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
117
121 void Reset();
122
126 int Size();
127
133 {return(this->Size()+1);};
134
138 bool Empty();
139
141
145 void GetRawData(std::vector<unsigned char>& data) const;
146 void GetRawData( unsigned char*& data, unsigned int &size );
147 void SetRawData(const std::vector<unsigned char>& data);
148 void SetRawData(const unsigned char*, unsigned int size);
150
151private:
152 class vtkInternals;
153 vtkInternals* Internals;
154 unsigned char Endianness;
155 enum
156 {
157 BigEndian,
158 LittleEndian
159 };
160};
161
162#endif
163
164
165// VTK-HeaderTest-Exclude: vtkMultiProcessStream.h
stream used to pass data across processes using vtkMultiProcessController.
void Pop(vtkTypeUInt64 *&array, unsigned int &size)
void SetRawData(const unsigned char *, unsigned int size)
void Pop(double *&array, unsigned int &size)
Remove-array-to-stream methods.
vtkMultiProcessStream & operator=(const vtkMultiProcessStream &)
void SetRawData(const std::vector< unsigned char > &data)
bool Empty()
Returns true iff the stream is empty.
void Push(float array[], unsigned int size)
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)
void Push(unsigned int array[], unsigned int size)
void Pop(unsigned char *&array, unsigned int &size)
void Push(int array[], unsigned int size)
void Push(char array[], unsigned int size)
void Reset()
Clears everything in the stream.
void Push(double array[], unsigned int size)
Add-array-to-stream methods.
void Push(vtkTypeInt64 array[], unsigned int size)
void Pop(float *&array, unsigned int &size)
void Pop(int *&array, unsigned int &size)
void Pop(unsigned int *&array, unsigned int &size)
void Push(vtkTypeUInt64 array[], unsigned int size)
void Pop(vtkTypeInt64 *&array, unsigned int &size)
void GetRawData(unsigned char *&data, unsigned int &size)
void Push(unsigned char array[], unsigned int size)
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:220
@ size
Definition: vtkX3D.h:253
@ data
Definition: vtkX3D.h:315
@ string
Definition: vtkX3D.h:490
VTKCOMMONCORE_EXPORT ostream & operator<<(ostream &os, const vtkIndent &o)