You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
658 B
43 lines
658 B
|
|
#ifndef _BLOCK_H_
|
|
#define _BLOCK_H_
|
|
|
|
#include "modelbahn.h"
|
|
#include "server.h"
|
|
|
|
#define BLOCKF_SHORTTRAIN 0x0001
|
|
|
|
struct s_Block {
|
|
char name[REFERENCENAME_LEN];
|
|
int flags;
|
|
} typedef Block;
|
|
|
|
class Blocks {
|
|
private:
|
|
Block *blocks;
|
|
int max;
|
|
int changed;
|
|
|
|
pthread_mutex_t mtx;
|
|
int Lock();
|
|
int UnLock();
|
|
|
|
// not thread safe
|
|
JSONParse _GetJSON(int idx);
|
|
public:
|
|
Blocks();
|
|
~Blocks();
|
|
|
|
bool IsChanged() { return changed; }
|
|
void ClearChanged() { changed = 0; };
|
|
|
|
int Change(Block *se);
|
|
int Delete(string name);
|
|
|
|
JSONParse GetJSON(string name);
|
|
void GetJSONAll(JSONParse *json);
|
|
Block GetBlockFromJSON(JSONParse *j);
|
|
};
|
|
|
|
#endif
|