NAME

counterGetNames - retrieves a list containing all counter names.

SYNOPSIS

#include <game-carrier/server.h>

typedef GCT_CSTR (GC_CORE_API *CounterGetNames)(void);

typedef struct counterGetNames {
    /* ... Some fields ... */
    CounterGetNames counterGetNames;
    /* ... Some fields ... */
}

RETURN VALUE

On successful execution, returns a pointer to a list of counter names.

Returns NULL on failure.

DESCRIPTION

The counterGetNames function retrieves a list containing all counters names.

The list represents a null-terminated array of strings, separated by a new line character \n (code 0x0A).

The working process with counters consists of two stages. In the first stage, before all applications are initialized, the function returns only system counter names. In the second stage, after all applications are initialized, the function returns all counter names, including both system counters and application counters.

EXAMPLE

#include <game-carrier/server.h>

#include <stdlib.h>

static struct core_api api;

GC_ADAPTER_EVENT
GCT_INT adapter_initialize(
    GCT_INT adapter_id,
    struct core_api * core_api,
    GCT_CPTR load_path)
{
    api = *core_api;
    return 0;
}

GC_ADAPTER_EVENT
GCT_INT application_initialize(
    GCT_INT id,
    GCT_CSTR name,
    GCT_CSTR type_name,
    GCT_CSTR file_name)
{
    /* Get system counters name */
    GCT_CSTR counter_names = api.counterGetNames();
    if (counter_names == NULL)
    {
        return -1;
    }

    /* Dump counter names */
    api.logMessage(GCL_USER, counter_names);

    /* Continue application initialization */
    return 0;
}

SEE ALSO

counterCreate, counterCreateAtomic, counterOpen, counterAdd, counterSet