TransformationCDPP3DView.h 2.53 KB
#ifndef TRANSFORMATIONCDPP3DVIEW_H
#define TRANSFORMATIONCDPP3DVIEW_H

#include "../../CDPP3DViewSOAPClient/cdpp3dviewcdppBinderProxy.h"

#include "TransformationAbstract.h"

#define CDPP3DVIEW_TIME_ID  "col1"
#define CDPP3DVIEW_COMP1_ID "col2"
#define CDPP3DVIEW_COMP2_ID "col3"
#define CDPP3DVIEW_COMP3_ID "col4"

#define CDPP3DVIEW_TIME_PATTERN "[YYYY]-[MM]-[DD]T[hh]:[mm]:[ss].[mls]"

//if WITH_GETORBURL is defined, the transformation is done in two step:
//  * first we sent data through getORBUrl function to generate a VOTable
//  * then we call listNewFrameAtt function, with the previous VOTable url in arguments
//else, the transformation is done directly by a call to listNewFrameAtt function, with data sent in arguments of this function
//#define WITH_GETORBURL

namespace TREPS
{
	namespace Transformation
	{
		typedef vector<ns4__Tuple3d*> t_VectorTuple3d;
		typedef vector<time_t> t_VectorTime;

		class TransformationCDPP3DViewClass : public TransformationAbstractClass
		{
			public :
				TransformationCDPP3DViewClass(RequestAbstractClass *trepsRequest);

				~TransformationCDPP3DViewClass(void);

				//run transformation
				bool run(const char *workingDir);

				//check frame
				bool checkFrame(const char *frame);

				//get list of available frames
				t_StringList getAvailableFrameList(void);

			private :
				//pointer to the WS client
				cdppBinderProxy *client;

				t_StringList availableFrames;

				//create a vector tuple3D
				t_VectorTuple3d createVectorTuple3d(const t_Vector *vector);

				//delete a vector Tuple3d
				void deleteVectorTuple3d(t_VectorTuple3d &vT);

				//create a time list
				t_VectorTime createTimeList(void);

				//delete a time list
				void deleteTimeList(t_VectorTime &vT);

				#ifdef WITH_GETORBURL
				string callGetOrbUrlRequest(const t_Vector *crtSrcVec);

				string callNewFrameRequest(const t_Vector *crtSrcVec, const char *dataURL, vector<ns4__TimeFile*> timeFiles);
				#else
				string callNewFrameRequest(const t_Vector *crtSrcVec, vector<ns4__TimeFile*> timeFiles);
				#endif


				ns4__TimeFile* callListFilesRequest(int bodyId, time_t startTime, time_t stopTime);

				//get response
				string getURLResponse(const char *response);

				//copy 3DView result file in workind directory
				string copyFileInWorkingDir(const char *fullURL, const char *workingDir);

				//add 3DView result in result data record list
				bool addResultFileInResultVec(const char *resultFile, const t_Vector *crtSrcVec);

				//update the list of available frames
				bool updateAvailableFrameList(void);
		};
	}
}

#endif