gwnavruntime/visualdebug/amp/Amp_Interfaces.h Source File

Amp_Interfaces.h
Go to the documentation of this file.
1 /*
2 * Copyright 2015 Autodesk, Inc. All rights reserved.
3 * Use of this software is subject to the terms of the Autodesk license agreement and any attachments or Appendices thereto provided at the time of installation or download,
4 * or which otherwise accompanies this software in either electronic or hard copy form, or which is signed by you and accepted by Autodesk.
5 */
6 
7 /**************************************************************************
8 
9 PublicHeader: AMP
10 Filename : Amp_Interfaces.h
11 Content : Interfaces for customizing the behavior of AMP
12 Created : December 2009
13 Authors : Alex Mantzaris
14 
15 **************************************************************************/
16 
17 #ifndef INC_KY_AMP_INTERFACES_H
18 #define INC_KY_AMP_INTERFACES_H
19 
24 
25 namespace Kaim {
26 namespace Net {
27 namespace AMP {
28 
29 class Message;
30 
31 //
32 // Custom AMP behavior is achieved by overriding the classes in this file
33 //
34 
35 //Interface used to handle received messages that are dispatched by the MessageTypeRegistry
36 class IMessageHandler : public RefCountBase<IMessageHandler, MemStat_VisualDebugMessage>
37 {
38 public:
39  virtual ~IMessageHandler() {};
40  virtual void Handle(Message* message) = 0;
41 
42  enum Mode
43  {
44  Handle_OnUserDemand = 0, // specify that this handler will be manually called by the user after calling ThreadMgr::GetNextReceivedMessage()
45  Handle_AfterDecompression = 1, // specify that this handler will be automatically called by the ThreadMgr in the CompressLoop after decompressing the message
46  Handle_ImmediatelyWhenRead = 2, // not recommended, used internally for specific messages, specify that this handler will be automatically called by the ThreadMgr as soon as the message is created and read from the socket
47  };
48 
49  virtual Mode HandleMode() = 0;
50 
51 };
52 
53 
54 // SendInterface::OnSendLoop is called once per "frame"
55 // from the ThreadManager send thread
56 class SendInterface
57 {
58 public:
59  virtual ~SendInterface() { }
60  virtual bool OnSendLoop() = 0;
61 };
62 
63 // ConnStatusInterface::OnStatusChanged is called by ThreadManager
64 // whenever a change in the connection status has been detected
65 class ConnStatusInterface
66 {
67 public:
68  enum StatusType
69  {
70  CS_Idle = 0x0,
71  CS_Connecting = 0x1,
72  CS_OK = 0x2,
73  CS_Failed = 0x3,
74  };
75 
76  virtual ~ConnStatusInterface() { }
77  virtual void OnStatusChanged(StatusType newStatus, StatusType oldStatus, const char* message) = 0;
78  virtual void OnMsgVersionMismatch(int peerVersion, int localVersion, const char* message) = 0;
79 };
80 
81 } // namespace AMP
82 } // namespace Net
83 } // namespace Kaim
84 
85 #endif
Definition: gamekitcrowddispersion.h:20