Polygon Crucher SDK - Documentation
Documentation
All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
DynamicExchangeSocket.h
1#if !defined(DYNAMICEXCHANGESOCKET_H)
2#define DYNAMICEXCHANGESOCKET_H
3
4#ifdef _MSC_VER
5#pragma once
6#endif // _MSC_VER
7
8#include "XSocket.h"
9#include "DynamicExchangeCommon.h"
10
11BEGIN_MOOTOOLS_NAMESPACE
12
13// define MOOTOOLS_NO_DYNSERVER_CLASS if you don't need a complete support from a client application
14class DLL_3DFUNCTION CDynExchangeSocket : public CXSocket
15{
16public:
18 virtual ~CDynExchangeSocket();
19
20 bool SendMessageData(unsigned int message, const unsigned char *data = NULL, fileuint dataSize = 0, const CCustomData *additionalData = NULL); // Send any kind of data. data and/or additionalData can be NULL.
21
22 // send information
23 // additionalCustomData can be used to define a specific value between the caller and the client.
24 // For example you can pass a DYNAMICDATA_3DSOFTWARE that will allow to filter only data from a specific software.
25#ifndef MOOTOOLS_NO_DYN3D
26 bool SendScene(C3DScene *scene, bool deleteIt, const CCustomData *additionalCustomData = NULL); // Send a scene to an external application. If the scene is temporary, using deleteIt = true, is a good idea, so it is deleted before sending it to the external application (this limit memory consumption)
27 bool SendNode(C3DSceneNode *node, bool skipGeom = false, const CCustomData *additionalCustomData = NULL); // If skipGeom is true, then only the node (without the geometry) is sent.
28 bool SendNodes(C3DScene *scene, const C3DNodeArray& nodes, const CBitArray *skipGeoms = NULL, const CCustomData *additionalCustomData = NULL);
29#endif
30
31#if !defined(MOOTOOLS_NO_DYNBITMAP) && !defined(MOOTOOLS_NO_BITMAP)
33#endif
34
35 // Receive information
36#ifndef MOOTOOLS_NO_DYNBITMAP
37 virtual void ReceiveBitmap(const CXString& filename, CBitmap *bitmap, bool asAlpha) {};
38#endif
39
40#ifndef MOOTOOLS_NO_DYN3D
41 virtual bool ReceiveScene(C3DScene *scene, const CCustomData *additionalData = NULL) const { return false; } // Receive a scene from software. The receiver is owner of the scene if it return true and then should delete it if needed. If the receiver return false, it can't handle the scene and the caller will delete it
42 virtual bool ReceiveNode(C3DSceneNode *node, const CCustomData *additionalData = NULL) const { return false; } // Receive a node. The receiver is owner of the node if it return true and then should delete it if needed. If the receiver return false, it can't handle the node and the caller will delete it
43 virtual bool ReceiveNodes(C3DNodeArray& nodes, const CCustomData *additionalData = NULL) const { return false; } // Receive several nodes. // Receive a node. The receiver is owner of the nodes if it return true and then should delete it if needed. If the receiver return false, it can't handle the nodes and the caller will delete it
44#endif
45
46 virtual bool ReceiveMessageData(const CXSocket& clientSocket, unsigned int message, const unsigned char *data, fileuint dataSize, const CCustomData *additionalData = NULL) { return false; } // Received private data. The receiver must copy the data the owner of the data, it return true. It then should delete the data using xDeallocateArray. If the method return false, then the data is automatically freed
47
48protected:
49 virtual bool ReceiveData(CXSocket& clientSocket, unsigned int messageID, const void *memory, fileuint dataSize, const CDataBlockArray& blocks); // Called by an external thread when server receive a message and some data with SOCKET_FLAGS_POINT_TO_POINT set. Return true to confirm that you handle it. In such case, you are responsible to free the memory (with Free method). clientSocket can be used to send a confirmation to the client. It is temporary and should not be stored.
50
51#ifndef MOOTOOLS_NO_DYN3D
52 bool SendScene(unsigned int messageID, C3DScene *scene, bool deleteIt, const CCustomData *additionalCustomData = NULL);
53 C3DScene *ReceiveScene(const CDataBlockArray& blocks, CCustomData& data);
54#endif
55};
56
57class DLL_3DFUNCTION CDynServerSocket : public CDynExchangeSocket
58{
59public:
61 virtual ~CDynServerSocket();
62
63protected:
64 virtual bool ReceiveData(CXSocket& clientSocket, unsigned int messageID, const void *memory, fileuint dataSize, const CDataBlockArray& blocks); // Called by an external thread when server receive a message and some data with SOCKET_FLAGS_POINT_TO_POINT set. Return true to confirm that you handle it. In such case, you are responsible to free the memory (with Free method). clientSocket can be used to send a confirmation to the client. It is temporary and should not be stored.
65};
66
67class DLL_3DFUNCTION CDynClientSocket : public CDynExchangeSocket
68{
69public:
71 virtual ~CDynClientSocket();
72
73 #ifndef MOOTOOLS_NO_DYN3D
74 #ifdef MOOTOOLS_PRODUCT_BUILD
75 protected:
76 unsigned int lock;
77
78 public:
79 virtual void BeginSceneScan() {};
80 virtual void EndSceneScan() {};
81 virtual void ReceiveScene(const CXString& filename, C3DScene *scene, bool updateMode, bool silentMode) {};
82 virtual C3DScene *ReadScene(const CXString& filename, bool updateMode, bool silentMode) { return NULL; };
83 #endif
84 #endif
85
86protected:
87 virtual bool ReceiveData(CXSocket& clientSocket, unsigned int messageID, const void *memory, fileuint dataSize, const CDataBlockArray& blocks); // Called by an external thread when server receive a message and some data with SOCKET_FLAGS_POINT_TO_POINT set. Return true to confirm that you handle it. In such case, you are responsible to free the memory (with Free method). clientSocket can be used to send a confirmation to the client. It is temporary and should not be stored.
88};
89
90END_MOOTOOLS_NAMESPACE
91
92#endif // !defined(DYNAMICEXCHANGESOCKET_H)
The class allows to get access to the scene graph, node hierarchy, material.
Definition 3DScene.h:306
A node matches one element that is part of the C3DScene graph. It references a C3DBaseObject and has ...
Definition 3DSceneNode.h:64
The class defines an x, y, z 3D point which can use int, float or double.
Definition 3DPoint.h:27
CBitArray class for handling array of bits.
Definition BitArray.h:18
CCustomData is a handly class for storing any kind of data.
Definition CustomData.h:106
Definition DynamicExchangeSocket.h:68
Definition DynamicExchangeSocket.h:15
Definition DynamicExchangeSocket.h:58
CXArray is an array of simple data information which does not requires to call a constructor / destru...
Definition XTemplate.h:34
Definition XSocket.h:28