OnixS C++ CME iLink 3 Binary Order Entry Handler  1.9.0
API Documentation
Defines.h
Go to the documentation of this file.
1 #pragma once
2 
3 /*
4 * Copyright Onix Solutions Limited [OnixS]. All rights reserved.
5 *
6 * This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law
7 * and international copyright treaties.
8 *
9 * Access to and use of the software is governed by the terms of the applicable OnixS Software
10 * Services Agreement (the Agreement) and Customer end user license agreements granting
11 * a non-assignable, non-transferable and non-exclusive license to use the software
12 * for it's own data processing purposes under the terms defined in the Agreement.
13 *
14 * Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
15 * of this source code or associated reference material to any other location for further reproduction
16 * or redistribution, and any amendments to this copyright notice, are expressly prohibited.
17 *
18 * Any reproduction or redistribution for sale or hiring of the Software not in accordance with
19 * the terms of the Agreement is a violation of copyright law.
20 */
21 
24 
25 #include <vector>
26 #include <string>
27 #include <set>
28 #include <memory>
29 
30 #if defined(_WIN32) // Windows platform.
31 
32 #if !defined(STRICT)
33 #define STRICT
34 #endif
35 
36 #include <winsock2.h>
37 
38 #endif
39 
40 namespace OnixS {
41 namespace CME {
42 namespace iLink3 {
43 
44 typedef unsigned short Port;
45 /// Type alias for byte.
46 typedef unsigned char Byte;
47 
48 /// Sequence of bytes.
49 typedef std::vector<Byte> Bytes;
50 
51 #if defined (_WIN32)
52 /// Type alias for socket handle.
53 typedef SOCKET Handle;
54 #else
55 /// Type alias for socket handle.
56 typedef int Handle;
57 #endif
58 
59 /// Socket option.
60 struct SocketOption {
62  : level(0), optname(0), optval(ONIXS_ILINK3_NULLPTR), optlen(0) {}
63 
64  SocketOption(int optionLevel, int optionName, void* optionValue, int optionLength) ONIXS_ILINK3_NOEXCEPT
65  : level(optionLevel), optname(optionName), optval(optionValue), optlen(optionLength) {}
66 
67  int level;
68  int optname;
69  void * optval;
70  int optlen;
71 };
72 
73 typedef size_t CpuIndex;
74 typedef std::set<CpuIndex> CpuIndexes;
75 
76 /// Socket options.
77 typedef std::vector<SocketOption> SocketOptions;
78 
79 struct ThreadParams {
80  std::string name;
81  CpuIndexes affinity;
82  int priority;
83  int policy;
84 
86  : priority(0)
87  , policy(0)
88  {
89  }
90 };
91 
93  enum Enum {
94  UndefinedPriorityAndPolicy = 255
95  };
96 };
97 
98 template <typename T>
99 struct PtrTraits
100 {
101 #if defined(ONIXS_ILINK3_CXX11)
102  typedef std::unique_ptr<T> UniquePtr;
103 #else
104  typedef std::auto_ptr<T> UniquePtr;
105 #endif
106 };
107 
108 }
109 }
110 }
unsigned short Port
Definition: Defines.h:44
std::set< CpuIndex > CpuIndexes
Definition: Defines.h:74
std::auto_ptr< T > UniquePtr
Definition: Defines.h:104
Definition: Defines.h:40
unsigned char Byte
Type alias for byte.
Definition: Defines.h:46
size_t CpuIndex
Definition: Defines.h:73
SocketOption(int optionLevel, int optionName, void *optionValue, int optionLength) ONIXS_ILINK3_NOEXCEPT
Definition: Defines.h:64
int Handle
Type alias for socket handle.
Definition: Defines.h:56
std::vector< Byte > Bytes
Sequence of bytes.
Definition: Defines.h:49
std::vector< SocketOption > SocketOptions
Socket options.
Definition: Defines.h:77