OnixS C++ FIX Engine  4.7.0
API Documentation
TcpStandardStack.h
Go to the documentation of this file.
1 /*
2 * Copyright Onix Solutions Limited [OnixS]. All rights reserved.
3 *
4 * This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law
5 * and international copyright treaties.
6 *
7 * Access to and use of the software is governed by the terms of the applicable OnixS Software
8 * Services Agreement (the Agreement) and Customer end user license agreements granting
9 * a non-assignable, non-transferable and non-exclusive license to use the software
10 * for it's own data processing purposes under the terms defined in the Agreement.
11 *
12 * Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
13 * of this source code or associated reference material to any other location for further reproduction
14 * or redistribution, and any amendments to this copyright notice, are expressly prohibited.
15 *
16 * Any reproduction or redistribution for sale or hiring of the Software not in accordance with
17 * the terms of the Agreement is a violation of copyright law.
18 */
19 #pragma once
20 
23 
24 namespace OnixS {
25 namespace FIX {
26 class ReactorOperator;
27 namespace TCPStandard {
28 
29 /**
30  * A high-level wrapper over the TCP standard stack.
31  */
33 {
34 public:
35  /**
36  * Allocates a TCP stack.
37  */
38  Stack();
39 
40 #ifdef ONIXS_FIXENGINE_CXX11
41  Stack(const Stack &) = delete;
42  Stack(Stack &&) = delete;
43 
44  Stack & operator=(const Stack &) = delete;
45  Stack & operator=(Stack &&) = delete;
46 #endif
47 
48  ~Stack();
49 
50  /**
51  * Processes events on a stack and performs the necessary handling.
52  *
53  * These events include transmit and receive events raised by the hardware,
54  * and also software events such as TCP and FIX protocol timers.
55  *
56  */
57  void dispatchEvents() ONIXS_FIXENGINE_OVERRIDE {
58  dispatchEventsImpl();
59  }
60 
61  /**
62  * \return a boolean value indicating whether a stack is quiescent.
63  *
64  * This can be used to ensure that all connections have been closed gracefully before destroying a stack
65  * (or exiting the application). Destroying a stack while it is not quiescent is permitted by the API,
66  * but when doing so there is no guarantee that sent data has been acknowledged by the peer or even transmitted,
67  * and there is the possibility that peers' connections will be reset.
68  */
69  bool isQuiescent() const ONIXS_FIXENGINE_OVERRIDE {
70  return isQuiescentImpl();
71  }
72 
73  /**
74  * \return the ID of the thread that created the stack.
75  */
76  Threading::ThreadId threadId() const ONIXS_FIXENGINE_OVERRIDE {
77  return threadId_;
78  }
79 
80  ReactorType::Enum type() const ONIXS_FIXENGINE_OVERRIDE {
82  }
83 
84 private:
85  void dispatchEventsImpl();
86 
87  bool isQuiescentImpl() const;
88 
89  class Impl;
90  Impl * const impl_;
91 
92  Threading::ThreadId const threadId_;
93 
94 #ifndef ONIXS_FIXENGINE_CXX11
95  Stack(const Stack &);
96  Stack & operator=(const Stack &);
97 #endif
98 
99  friend class FIX::ReactorOperator;
100 };
101 
102 }}}
Threading::ThreadId threadId() const ONIXS_FIXENGINE_OVERRIDE
A high-level wrapper over the TCP standard stack.
ReactorType::Enum type() const ONIXS_FIXENGINE_OVERRIDE
void dispatchEvents() ONIXS_FIXENGINE_OVERRIDE
Processes events on a stack and performs the necessary handling.
#define ONIXS_FIXENGINE_API
Definition: ABI.h:45
pthread_t ThreadId
Type alias for thread identifier.
Definition: Definitions.h:51
bool isQuiescent() const ONIXS_FIXENGINE_OVERRIDE
Session's network stack reactor interface.