Skip to main content

Server C++ API

-> -> Improvements to language bindings

This is the base class for objects that are exported via shared memory

template<class P>
class Shared
                       Shared(void* base);
    int                object_type;
    void*              base;                  //shm segment address.
    struct _container* container;
    void               announce();
    void               announce_delete();
    int                get_index();
    void               print();
    bool               verify();
    int                slot;                  //block-level index into the slot array.
    int                s1;                    //container index pointing to the blocks.
    void**             pod_table;             //pointer array to individual objects.

The ShmContainer class encapsulates a section in shared memory for one content type, eg Tracks. It handles shm memory allocation, and general object management.

template<class T>
class ShmContainer
    Shm_container(shm_seg_defn* shm_seg);
    void           init               (const char* signature);
    void           init               (struct _container* container, const char* signature);
    T*             add_item           ();
    void           remove_item        (int);
    bool           slot_is_used       (int);
    T*             next               (T*);
    T*             get_item           (int);
    void           print              ();
    int            count_items        ();
    void           erase              ();
    int            _debug;
    struct _container* container;                //shm address of encapsulated data
    shm_seg_defn*      seg;
    block*             block_new           ();
    int                next_available_slot ();
    void               set_container       ();
    void               decrement_last      ();