ANTWAR C++ SDK
|
A module for communicating with Judger. More...
Go to the source code of this file.
Classes | |
struct | RoundInfo |
A combination of deserialized information about current round state received from judger. More... | |
Typedefs | |
using | InitInfo = std::pair< int, unsigned long long > |
Functions | |
InitInfo | read_init_info () |
Read information for initialization. | |
std::vector< Operation > | read_opponent_operations () |
Read your opponent's operations and deserialize them. The time to call this function depends on your player ID. | |
RoundInfo | read_round_info () |
Read information at the beginning of a round and deserialize. | |
std::size_t | object_length (int x) |
Calculate the length of the serialized result of a non-negative integer, without actually serializing it (i.e. no string is ever constructed). Here we convert the integer to a string of its decimal representation to serialize it. | |
std::size_t | object_length (const std::string &str) |
Calculate the length of the serialized result of a string of ASCII characters, which is just the length of the string, of course. | |
std::size_t | object_length (const Operation &op) |
Calculate the length of the serialized result of an Operation object, without actually serializing it (i.e. no string is ever constructed). The serialized result includes the type and arguments of the operation, the spaces between these integers and the trailing line break. | |
std::size_t | object_length (const std::vector< Operation > &ops) |
Calculate the length of the serialized result of some Operation objects, without actually serializing them (i.e. no string is ever constructed). the serialized result is simply the sum of each serialized Operation object. | |
void | convert_to_big_endian (const void *src, std::size_t size, void *dest) |
Convert an object into big-endian representation. | |
void | print_header (int size) |
Print the header, i.e. the total size in big-endian binary representation. | |
void | send_string (const std::string &str) |
Send raw string with header to judger. | |
void | send_operations (const std::vector< Operation > &ops) |
Send some serialized operations with header to judger. | |
A module for communicating with Judger.
|
inline |
Convert an object into big-endian representation.
src | Pointer to the memory of the object to be converted. |
size | Size of the object in bytes. |
dest | Buffer area for converted result. |
|
inline |
Calculate the length of the serialized result of an Operation object, without actually serializing it (i.e. no string is ever constructed). The serialized result includes the type and arguments of the operation, the spaces between these integers and the trailing line break.
op | The Operation object to serialize. |
|
inline |
Calculate the length of the serialized result of a string of ASCII characters, which is just the length of the string, of course.
str | The string to serialize. |
|
inline |
Calculate the length of the serialized result of some Operation objects, without actually serializing them (i.e. no string is ever constructed). the serialized result is simply the sum of each serialized Operation object.
ops | A vector of Operation objects to serialize. |
|
inline |
Calculate the length of the serialized result of a non-negative integer, without actually serializing it (i.e. no string is ever constructed). Here we convert the integer to a string of its decimal representation to serialize it.
x | The non-negative integer to serialize. |
|
inline |
Print the header, i.e. the total size in big-endian binary representation.
size | The total size of everything to be sent. |
|
inline |
Read information for initialization.
|
inline |
Read your opponent's operations and deserialize them. The time to call this function depends on your player ID.
|
inline |
Read information at the beginning of a round and deserialize.
|
inline |
Send some serialized operations with header to judger.
ops | A vector of Operation objects to be sent. |
|
inline |
Send raw string with header to judger.
str | String to be sent. |