Namespaces | |
| namespace | sort |
A range of comparison sort algorithms. | |
Classes | |
| class | ArrayIterator |
| Sequential iterator for Array. More... | |
| class | Array |
| std::vector -equivalent. More... | |
| struct | SerializedDataTypeTraits |
| A trait class used to match basic data types to their associated enum values. More... | |
| class | LSBT |
| Template-evaluated enum that gives a mask with the Bits LSB bits set. More... | |
| class | BitMaskT |
| A template-computed enum to create a mask of given amount of bits at given position of a u32 variable. More... | |
| class | Clock |
| High-resolution timing and system time. More... | |
| class | DataDeserializer |
| DataDeserializer is an utility class that walks through and deserializes data in a stream of raw bytes. More... | |
| class | DataSerializer |
| DataSerializer is a helper class that can be used to serialize data types to a stream of raw bits suitable for disk storage or network transfer. More... | |
| struct | EndPoint |
| EndPoint represents a (ip, port) source or destination of a socket. More... | |
| class | Event |
| Event is an inter-thread synchronization primitive that can be in one of two states: Set or Cleared. More... | |
| class | EventArray |
| EventArray stores a list of events and allows the application to simultaneously wait for any of them to become set. More... | |
| class | IMessageHandler |
| IMessageHandler is a callback object used by the MessageConnection to invoke the main application whenever a message has been received. More... | |
| class | INetworkServerListener |
| An interface implementable by the owner of a network server to receive notifications about connection-related events. More... | |
| class | Lockable |
| Stores an object of type T behind a mutex-locked shield. More... | |
| class | LockFreePoolAllocator |
| T must implement PoolAllocatable. More... | |
| class | EmptyLookupNotify |
| Used as a no-functionality structure to pass as the default template parameter to MaxHeap when no index update notifications are needed. More... | |
| class | MaxHeap |
| Implements a max heap data structure, see http://en.wikipedia.org/wiki/Binary_heap. More... | |
| struct | ConnectionStatistics |
| Stores information about an established MessageConnection. More... | |
| class | NetworkMessagePriorityCmp |
| Comparison object that sorts the two messages by their priority (higher priority/smaller number first). More... | |
| class | MessageConnection |
| Represents a single established network connection. More... | |
| struct | SerializedElementDesc |
| Represents a single element of data in the stream. More... | |
| struct | SerializedMessageDesc |
| Describes a whole serialized message. More... | |
| class | SerializedMessageList |
| Stores a whole list of message templates. More... | |
| class | Network |
| Provides the application an interface for both client and server networking. More... | |
| class | NetworkMessage |
| NetworkMessage stores the serialized byte data of a single outbound network message, along with fields that specify how itreated by the network connection. More... | |
| class | NetworkServer |
| Manages all low-level networking required in maintaining a network server and keeps track of all currently established connections. More... | |
| class | RingBuffer |
| Implements a byte-based ring buffer (of sorts) of raw bytes. More... | |
| class | SerializationStructCompiler |
| Generates .h files out of XML description files for serializable structs and network messages. More... | |
| class | RefCountable |
| Objects that require reference count tracking derive publicly from this. More... | |
| class | SharedPtr |
| SharedPtr is an intrusive refcount-tracked single-object lifetime-manager. More... | |
| class | Socket |
| Represents a low-level network socket. More... | |
| class | StdCAlloc |
| Allocates raw memory using the std C malloc and free. More... | |
| class | VLEType2 |
| VLEPacker performs variable-length encoding of unsigned integer values by omitting leading zeroes from big numbers. More... | |
| class | VLEType3 |
| VLEPacker performs variable-length encoding of unsigned integer values by omitting leading zeroes from big numbers. More... | |
| class | WaitFreeQueue |
| A wait-free queue for communication unidirectionally between two threads. More... | |
Typedefs | |
| typedef bool | bit |
| A single 0|1 value that is serialized as just one bit, *without padding*. | |
| typedef unsigned long long | tick_t |
| A tick is the basic unit of the high-resolution timer. | |
| typedef unsigned int | LogChannel |
| A bitfield type that describes single or multiple log channels (each bit represents a channel). | |
| typedef unsigned long | packet_id_t |
| Contains 22 actual bits of data. | |
Enumerations | |
| enum | { AFAllocLow = 0x1, AFAllocHigh = 0x2 } |
| enum | BasicSerializedDataType { SerialInvalid = 0, SerialBit, SerialU8, SerialS8, SerialU16, SerialS16, SerialU32, SerialS32, SerialU64, SerialS64, SerialFloat, SerialDouble, SerialString, SerialStruct, SerialDynamicCount, NumSerialTypes } |
Defines the basic data types that are the building blocks of every other serializable data type. More... | |
| enum | EventWaitType { EventWaitDummy, EventWaitSignal, EventWaitRead, EventWaitWrite } |
| enum | ConnectionState { ConnectionPending, ConnectionOK, ConnectionDisconnecting, ConnectionPeerClosed, ConnectionClosed } |
Represents the current state of the connection. More... | |
| enum | SocketTransportLayer { InvalidTransportLayer = 0 } |
Identifiers for the possible bottom-level tranport layers. More... | |
| enum | SocketType { InvalidSocketType = 0, ServerListenSocket, ServerClientSocket, ClientSocket } |
Functions | |
| std::string | ConnectionStateToString (ConnectionState state) |
| Returns a textual representation of a ConnectionState. | |
| BasicSerializedDataType | StringToSerialType (const char *type) |
| Tries to parse a BasicSerializedDataType out of a string, or returns SerialInvalid if no match. | |
| const char * | SerialTypeToString (BasicSerializedDataType type) |
| Converts a give BasicSerializedDataType to a readable string representation. | |
| size_t | SerialTypeSize (BasicSerializedDataType type) |
| Returns the number of bytes the passed BasicSerializedDataType requires for serialization. | |
| std::string | FormatBytes (size_t numBytes) |
| Outputs the given number of bytes formatted to KB or MB suffix for readability. | |
| void | PrintLocalIP () |
| void | TimeOutputDebugStringVariadic (LogChannel logChannel, const char *filename, int lineNumber, const char *msg,...) |
| Prints a variadic line to log. | |
| void | TimeOutputDebugString (LogChannel logChannel, const char *filename, int lineNumber, const char *msg) |
| Prints a message to the log. Same as kNet::TimeOutputDebugStringVariadic, but does not use printf formatting. | |
| void | SetLogChannels (LogChannel logChannel) |
| Sets the currently enabled log channels. | |
| LogChannel | GetLogChannels () |
| Returns the currently active log channels. | |
| void | SetLogFile (const char *filename) |
| Sets the output for log messages. | |
| void | EnableMemoryLeakLoggingAtExit () |
| When called, sets the runtime to print out all memory leaks at program exit time. | |
| Event | CreateNewEvent (EventWaitType type) |
| Creates and returns a new event. | |
| bool | IsPow2Aligned (uintptr_t pointer, u32 alignment) |
| Is the given pointer aligned to the pow2-boundary specified by alignment? | |
| uintptr_t | AlignUpPow2 (uintptr_t pointer, u32 alignment) |
| uintptr_t | AlignDownPow2 (uintptr_t pointer, u32 alignment) |
| template<typename Object , typename Allocator > | |
| Object * | New (Allocator *allocator, size_t alignment, const char *nameTag=0, AllocFlags flags=AFAllocLow) |
| The global memory/object allocation function. | |
| template<typename Object , typename Allocator > | |
| Object * | NewArray (size_t numObjects, Allocator *allocator, size_t alignment, const char *nameTag=0, AllocFlags flags=AFAllocLow) |
| Allocates an array of objects. | |
| template<typename Object , typename Allocator > | |
| void | Delete (Object *ptr, Allocator *allocator) |
| Object deletion function. | |
| template<typename Object , typename Allocator > | |
| void | DeleteArray (Object *ptr, Allocator *allocator) |
| Array of objects deletion function. | |
| u32 | BinaryStringToValue (const char *str) |
| Returns the u32 representation of the given string that consists only of characters '0' and '1'. | |
| int | CountBitsSet (u32 value) |
| Returns the number of bits that are set (ones) in the given value. | |
| u32 | LSB (u32 bits) |
| u32 | BitMask (u32 pos, u32 bits) |
| template<typename ResultType , typename InputType , int APos, int ABits, int RPos, int RBits, int GPos, int GBits, int BPos, int BBits> | |
| ResultType | PackBits (InputType a, InputType r, InputType g, InputType b) |
| template<typename ResultType , typename InputType > | |
| ResultType | PackBits (int APos, int ABits, int RPos, int RBits, int GPos, int GBits, int BPos, int BBits, InputType a, InputType r, InputType g, InputType b) |
| template<typename ResultType , typename InputType , int Pos, int Bits> | |
| void | ExtractBits (ResultType &out, const InputType &in) |
| Extracts the given adjacent bits from a larger bitfield. | |
| template<typename ResultType , typename InputType > | |
| void | ExtractBits (int pos, int bits, ResultType &out, const InputType &in) |
| Extracts the given adjacent bits from a larger bitfield. | |
| template<typename T > | |
| size_t | SumArray (const T &data, size_t numElems) |
| Sums up the sizes of each element of an array. | |
| bool | PacketIDIsNewerThan (packet_id_t newID, packet_id_t oldID) |
| Performs modular arithmetic comparison to see if newID refers to a PacketID newer than oldID. | |
| packet_id_t | AddPacketID (packet_id_t id, int increment) |
| Computes the PacketID for the packet (id + increment). | |
| packet_id_t | SubPacketID (packet_id_t id, int sub) |
| Computes the PacketID for the packet (id - sub). | |
| template<typename T > | |
| bool | operator== (const SharedPtr< T > &a, const SharedPtr< T > &b) |
| Equality comparison for two SharedPtr. | |
| anonymous enum |
Defines the basic data types that are the building blocks of every other serializable data type.
| enum kNet::EventWaitType |
Represents the current state of the connection.
| ConnectionPending |
Waiting for the other end to send an acknowledgement packet to form the connection. No messages may yet be sent or received at this state. |
| ConnectionOK |
The connection is bidirectionally open, for both reading and writing. (readOpen=true, writeOpen=true). |
| ConnectionDisconnecting |
We are closing the connection down. Cannot send any more messages, but can still receive. (readOpen=true, writeOpen=false). |
| ConnectionPeerClosed |
The other end has closed the connection. No new messages will be received, but can still send messages. (readOpen=false, writeOpen=true). |
| ConnectionClosed |
The socket is no longer open. A MessageConnection object in this state cannot be reused to open a new connection, but a new connection object must be created. |
| enum kNet::SocketType |
| InvalidSocketType |
A default invalid value for uninitialized sockets. |
| ServerListenSocket |
For TCP: a listen socket. For UDP: the single master socket handle that is used to send & receive all data. |
| ServerClientSocket |
For TCP: a client data socket. For UDP: a slave-mode Socket object that shares the underlying socket handle with the UDP master Socket. |
| ClientSocket |
A client-side socket. |
| void kNet::TimeOutputDebugStringVariadic | ( | LogChannel | logChannel, | |
| const char * | filename, | |||
| int | lineNumber, | |||
| const char * | msg, | |||
| ... | ||||
| ) |
Prints a variadic line to log.
| logChannel | The log channel to print to. This variable must have exactly one bit set, and is ANDed against the currently active channels that can be set with a call to kNet::SetLogChannels. | |
| filename | The C++ file from which the log message occurs, pass in __FILE__. | |
| lineNumber | Pass in __LINE__. | |
| msg | The printf-style message format specifier for the text to print. |
| void kNet::SetLogChannels | ( | LogChannel | logChannel | ) |
Sets the currently enabled log channels.
Pass in a bitwise OR of the log channels you want to enable. If you pass in 0, all logging is disabled. By default, only the channel LogChannelUser is enabled.
| void kNet::SetLogFile | ( | const char * | filename | ) |
Sets the output for log messages.
By default all logging is output to std::cout. Setting a log file redirects all logging to that file. Calling this function with a null filename pointer restores logging to target std::cout.
| void kNet::EnableMemoryLeakLoggingAtExit | ( | ) |
When called, sets the runtime to print out all memory leaks at program exit time.
Win32-only. On linux, this is a no-op.
| uintptr_t kNet::AlignUpPow2 | ( | uintptr_t | pointer, | |
| u32 | alignment | |||
| ) | [inline] |
References IS_POW2.
| uintptr_t kNet::AlignDownPow2 | ( | uintptr_t | pointer, | |
| u32 | alignment | |||
| ) | [inline] |
References IS_POW2.
| Object* kNet::New | ( | Allocator * | allocator, | |
| size_t | alignment, | |||
| const char * | nameTag = 0, |
|||
| AllocFlags | flags = AFAllocLow | |||
| ) | [inline] |
The global memory/object allocation function.
Allocates sizeof(Object) bytes of memory using the allocator and uses placement new to construct an object of type Object to that memory area. (calls the ctor of Object).
| allocator | The allocator object to allocate data from. Null may be passed in if the Allocator type is a class-based allocator. |
| Object* kNet::NewArray | ( | size_t | numObjects, | |
| Allocator * | allocator, | |||
| size_t | alignment, | |||
| const char * | nameTag = 0, |
|||
| AllocFlags | flags = AFAllocLow | |||
| ) | [inline] |
| void kNet::Delete | ( | Object * | ptr, | |
| Allocator * | allocator | |||
| ) | [inline] |
Object deletion function.
Destroys the given object (calls dtor) and returns the used memory back to the allocator.
| allocator | The allocator object to allocate data from. Null may be passed in if the Allocator type is a class-based allocator. |
| void kNet::DeleteArray | ( | Object * | ptr, | |
| Allocator * | allocator | |||
| ) | [inline] |
Array of objects deletion function.
Destroys all objects (calls dtors for each) and returns the used memory back to the allocator.
| allocator | The allocator object to allocate data from. Null may be passed in if the Allocator type is a class-based allocator. |
Referenced by kNet::Array< NetworkMessage * >::reserve().
Referenced by kNet::DataSerializer::AppendBits(), and BitMask().
References LSB().
Referenced by ExtractBits(), and PackBits().
| ResultType kNet::PackBits | ( | InputType | a, | |
| InputType | r, | |||
| InputType | g, | |||
| InputType | b | |||
| ) |
| ResultType kNet::PackBits | ( | int | APos, | |
| int | ABits, | |||
| int | RPos, | |||
| int | RBits, | |||
| int | GPos, | |||
| int | GBits, | |||
| int | BPos, | |||
| int | BBits, | |||
| InputType | a, | |||
| InputType | r, | |||
| InputType | g, | |||
| InputType | b | |||
| ) |
References BitMask().
| void kNet::ExtractBits | ( | ResultType & | out, | |
| const InputType & | in | |||
| ) |
Extracts the given adjacent bits from a larger bitfield.
Aggressively templatized version. For example, ExtractBits<u8, u8, 4, 2> gets the bits 00110000 from a byte, shifts them right 4 places and returns the two bits.
| void kNet::ExtractBits | ( | int | pos, | |
| int | bits, | |||
| ResultType & | out, | |||
| const InputType & | in | |||
| ) |
Extracts the given adjacent bits from a larger bitfield.
For example, ExtractBits<u8, u8>(3, 4) gets the bits 01111000 from a byte, shifts them right 3 places and returns the four bits.
References BitMask().
| bool kNet::PacketIDIsNewerThan | ( | packet_id_t | newID, | |
| packet_id_t | oldID | |||
| ) | [inline] |
Performs modular arithmetic comparison to see if newID refers to a PacketID newer than oldID.
Referenced by kNet::MessageConnection::CheckAndSaveContentIDStamp().
| bool kNet::operator== | ( | const SharedPtr< T > & | a, | |
| const SharedPtr< T > & | b | |||
| ) |
Equality comparison for two SharedPtr.
Note that the types must match.
| a | First operand | |
| b | Second operand |
References kNet::SharedPtr< T >::ptr().
1.7.1