HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NET_InfoCallback.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: NET_InfoCallback.h
7  *
8  * COMMENTS:
9  *
10  *
11  */
12 
13 #ifndef __NET_INFOCALLBACK_H__
14 #define __NET_INFOCALLBACK_H__
15 
16 #include "NET_API.h"
17 
18 #include <UT/UT_NonCopyable.h>
19 #include <UT/UT_UniquePtr.h>
20 
22 
24 {
25 public:
26  virtual ~NET_InfoCallback() = default;
28 
29  virtual void onConnectionStart() = 0;
30  virtual void onConnectionStop() = 0;
31  virtual void onRequest() = 0;
32  virtual void onStartReading() = 0;
33  virtual void onReadBytes(std::size_t bytes) = 0;
34  virtual void onEndReading() = 0;
35  virtual void onStartWriting() = 0;
36  virtual void onEndWriting() = 0;
37 protected:
38  NET_InfoCallback() = default;
39 };
40 
42 {
43 public:
44  virtual ~NET_IInfoCallbackFactory() = default;
45 
47 
48  virtual UT_UniquePtr<NET_InfoCallback> create() = 0;
49 protected:
50  NET_IInfoCallbackFactory() = default;
51 };
52 
54 {
55 public:
58  myStatsMgr(stats_mgr),
59  myReading(false),
60  myWriting(false),
61  myWaiting(false),
62  myActiveConnection(false)
63  {}
64 
65  void onConnectionStart() override;
66  void onConnectionStop() override;
67  void onRequest() override;
68  void onStartReading() override;
69  void onReadBytes(std::size_t bytes) override;
70  void onEndReading() override;
71  void onStartWriting() override;
72  void onEndWriting() override;
73 protected:
75  unsigned myReading : 1;
76  unsigned myWriting : 1;
77  unsigned myWaiting : 1;
78  unsigned myActiveConnection : 1;
79 };
80 
82 {
83 public:
85  : myStatsManager(stats_mgr)
86  {
87  }
88 
90 
91 private:
92  NET_WebStatsManager& myStatsManager;
93 };
94 
95 #endif // __NET_INFOCALLBACK_H__
96 
virtual void onConnectionStop()=0
virtual void onEndReading()=0
virtual void onConnectionStart()=0
virtual void onReadBytes(std::size_t bytes)=0
NET_StatsInfoCallback(NET_WebStatsManager &stats_mgr)
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39
#define NET_API
Definition: NET_API.h:9
virtual void onEndWriting()=0
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
Simple holder for statistics relating to the web server.
virtual void onStartReading()=0
virtual void onRequest()=0
virtual UT_UniquePtr< NET_InfoCallback > create()=0
NET_WebStatsManager & myStatsMgr
NET_StatsInfoCallbackFactory(NET_WebStatsManager &stats_mgr)
Definition: format.h:2459
virtual void onStartWriting()=0