gwnavruntime/visualdebug/amp/Amp_Interfaces.h Source File

Amp_Interfaces.h
Go to the documentation of this file.
1 /*
2 * Copyright 2016 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 #pragma once
18 
23 
24 namespace Kaim {
25 namespace Net {
26 namespace AMP {
27 
28 class Message;
29 
30 //
31 // Custom AMP behavior is achieved by overriding the classes in this file
32 //
33 
34 //Interface used to handle received messages that are dispatched by the MessageTypeRegistry
35 class IMessageHandler : public RefCountBase<IMessageHandler, MemStat_VisualDebugMessage>
36 {
37 public:
38  virtual ~IMessageHandler() {};
39  virtual void Handle(Message* message) = 0;
40 
41  enum Mode
42  {
43  Handle_OnUserDemand = 0, // specify that this handler will be manually called by the user after calling ThreadMgr::GetNextReceivedMessage()
44  Handle_AfterDecompression = 1, // specify that this handler will be automatically called by the ThreadMgr in the CompressLoop after decompressing the message
45  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
46  };
47 
48  virtual Mode HandleMode() = 0;
49 
50 };
51 
52 
53 // SendInterface::OnSendLoop is called once per "frame"
54 // from the ThreadManager send thread
55 class SendInterface
56 {
57 public:
58  virtual ~SendInterface() { }
59  virtual bool OnSendLoop() = 0;
60 };
61 
62 // ConnStatusInterface::OnStatusChanged is called by ThreadManager
63 // whenever a change in the connection status has been detected
64 class ConnStatusInterface
65 {
66 public:
67  enum StatusType
68  {
69  CS_Idle = 0x0,
70  CS_Connecting = 0x1,
71  CS_OK = 0x2,
72  CS_Failed = 0x3,
73  };
74 
75  virtual ~ConnStatusInterface() { }
76  virtual void OnStatusChanged(StatusType newStatus, StatusType oldStatus, const char* message) = 0;
77  virtual void OnMsgVersionMismatch(int peerVersion, int localVersion, const char* message) = 0;
78 };
79 
80 } // namespace AMP
81 } // namespace Net
82 } // namespace Kaim
83 
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17