Untitled

mail@pastecode.io avatar
unknown
c_cpp
2 years ago
1.2 kB
7
Indexable
Never
#ifndef __MANAGER_H__
#define __MANAGER_H_

#include <stdint.h>
#include <stdbool.h>

#include "Topic.h"





class Manager{

public:
    static Manager& get_instance(){

        // Singleton instantiation, guaranteed to be destroyed.
        static Manager _instance;

        // Returning instance of singleton
        return _instance;
    }

    static bool is_advertised(void * node){return get_instance()._is_advertised(node);}
    static bool copy(void *node_handle, void *dst, uint32_t &generation, bool only_if_updated){return get_instance()._copy(node_handle,dst,generation,only_if_updated);}
    static bool updates_available(const void *node_handle, uint32_t last_generation){return get_instance()._updates_available(node_handle,last_generation);}

private:
    bool _is_advertised(void * node);
    bool _copy(void *node_handle, void *dst, uint32_t &generation, bool only_if_updated);
    bool _updates_available(const void *node_handle, uint32_t last_generation);
    // Private constructor
    Manager(){}



public:
    //Delete of copy constructor and equal operator
    Manager(Manager const&) = delete;
    void operator=(Manager const&) = delete;

};






#endif //__MANAGER_H__