nodes_db.h 586 Bytes
Newer Older
Jean-Benoist Leger's avatar
Jean-Benoist Leger committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
#ifndef H_NODES_DB
#define H_NODES_DB 1

#include "conv_functions.h"
#include <lmdb.h>
#include "elevation.h"
#include "types.h"

class nodes_db_t
{
    public:
        bool rw;
        MDB_env* env;
        MDB_dbi dbi;
        MDB_txn* txn;

    nodes_db_t(const char* db_location, bool rwi = false);
    ~nodes_db_t();
    void commit();

    int get_node(nid_t & id, node_info_t* pni);
    
    int write_node(
            nid_t & id,
            double & lon,
            double & lat,
            elevation_value & elev,
            std::list<neighbor_t> & neighbors);
};

#endif