serialization_helper.h 3.2 KB
Newer Older
Pascal Palenda's avatar
Pascal Palenda committed
1
2
3
#ifndef INCLUDE_WATCHER_ITA_SIMULATION_SCHEDULER_SERIALIZATION_HELPER
#define INCLUDE_WATCHER_ITA_SIMULATION_SCHEDULER_SERIALIZATION_HELPER

Philipp Schäfer's avatar
Philipp Schäfer committed
4
5
6
7
//ITA
#include <ITASampleBuffer.h>
#include <ITASampleFrame.h>
#include <ITAThirdOctaveMagnitudeSpectrum.h>
Pascal Palenda's avatar
Pascal Palenda committed
8

Philipp Schäfer's avatar
Philipp Schäfer committed
9
10
// Vista
#include <VistaBase/VistaVector3D.h>
11
#include <VistaBase/VistaQuaternion.h>
Philipp Schäfer's avatar
Philipp Schäfer committed
12
13
#include <VistaAspects/VistaSerializer.h>
#include <VistaAspects/VistaDeSerializer.h>
Pascal Palenda's avatar
Pascal Palenda committed
14
15
16

namespace ITA
{
17
	namespace SimulationScheduler
Pascal Palenda's avatar
Pascal Palenda committed
18
19
20
21
22
23
24
25
26
27
28
	{
		struct SerializationHelper
		{
			///
			/// \brief Write an ITASampleFrame to the given IVistaSerializer.
			/// \param pSerializer the IVistaSerializer to write to.
			/// \param pSampleFrame pointer to the ITASampleFrame that shall be written.
			/// \param iLength number of samples that shall be written.
			/// \param iOffset number of samples that shall be skipped before the requested samples begin.
			/// \return the number of bytes written or -1 on failure.
			/// 
29
			static int WriteITASampleFrame ( IVistaSerializer& pSerializer, const ITASampleFrame* pSampleFrame, const int iLength, const int iOffset );
Pascal Palenda's avatar
Pascal Palenda committed
30
31
32
33
34
35
36

			///
			/// \brief Read an ITASampleFrame from the given IVistaDeSerializer.
			/// \param pDeserializer the IVistaDeSerializer to read from.
			/// \param pSampleFrame the ITASampleFrame to save into.
			/// \return the number of bytes written or -1 on failure.
			/// 
37
			static int ReadITASampleFrame ( IVistaDeSerializer& pDeserializer, ITASampleFrame& pSampleFrame );
Pascal Palenda's avatar
Pascal Palenda committed
38
39
40
41
42
43
44
45
46

			///
			/// \brief Write an ITASampleFrame to the given IVistaSerializer.
			/// \param pSerializer the IVistaSerializer to write to.
			/// \param pBuffer pointer to the ITASampleBuffer that shall be written.
			/// \param iLength number of samples that shall be written.
			/// \param iOffset number of samples that shall be skipped before the requested samples begin.
			/// \return the number of bytes written or -1 on failure.
			/// 
47
			static int WriteITASampleBuffer ( IVistaSerializer& pSerializer, const ITASampleBuffer* pBuffer, const int iLength, const int iOffset );
Pascal Palenda's avatar
Pascal Palenda committed
48
49
50
51
52
53
54

			///
			/// \brief Read an ITASampleBuffer from the given IVistaDeSerializer.
			/// \param pDeserializer the IVistaDeSerializer to read from.
			/// \param pBuffer the ITASampleBuffer to save into.
			/// \return the number of bytes written or -1 on failure.
			/// 
55
			static int ReadITASampleBuffer ( IVistaDeSerializer& pDeserializer, ITASampleBuffer& pBuffer );
Philipp Schäfer's avatar
Philipp Schäfer committed
56
57
58
59
60
61

			static int WriteITAThirdOctaveFactorMagnitudeSpectrum(IVistaSerializer& pSerializer, const ITABase::CThirdOctaveFactorMagnitudeSpectrum& oSpectrum);
			static int ReadITAThirdOctaveFactorMagnitudeSpectrum(IVistaDeSerializer& pDeserializer, ITABase::CThirdOctaveFactorMagnitudeSpectrum& oSpectrum);

			static int WriteVistaVector3D(IVistaSerializer& pSerializer, const VistaVector3D& v3Vector);
			static int ReadVistaVector3D(IVistaDeSerializer& pDeserializer, VistaVector3D& v3Vector);
62
63
64

			static int WriteVistaQuaternion ( IVistaSerializer& pSerializer, const VistaQuaternion& qQuaternion );
			static int ReadVistaQuaternion ( IVistaDeSerializer& pDeserializer, VistaQuaternion& qQuaternion );
Pascal Palenda's avatar
Pascal Palenda committed
65
		};
66
	} // namespace SimulationScheduler
Pascal Palenda's avatar
Pascal Palenda committed
67
68
69
} // namespace ITA

#endif // INCLUDE_WATCHER_ITA_SIMULATION_SCHEDULER_ROOM_ACOUSTICS_SERIALIZATION_HELPER