forked from whitefield-framework/whitefield
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon.h
61 lines (51 loc) · 1.34 KB
/
common.h
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
* Copyright (C) 2017 Rahul Jadhav <[email protected]>
*
* This file is subject to the terms and conditions of the GNU
* General Public License v2. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup airline
* @{
*
* @file
* @brief Common/utility APIs for Airline
*
* @author Rahul Jadhav <[email protected]>
*
* @}
*/
#ifndef _COMMON_H_
#define _COMMON_H_
#include <fstream>
#include <sstream>
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <iterator>
#include <string.h>
#include <unistd.h>
#include <signal.h>
using namespace std;
#define SUCCESS 0
#define FAILURE -1
#define INFO cout
#define ERROR cerr
#define WARN cerr
string <rim(string &s, const char *t = " \t\n\r\f\v");
string &rtrim(string &s, const char *t = " \t\n\r\f\v");
string &trim(string &s, const char *t = " \t\n\r\f\v");
vector<string> split(const string &s, char delim);
//#include <Config.h>
namespace wf {
class Config;
};
extern wf::Config WF_config;
#define CFG(...) WF_config.get(__VA_ARGS__)
#define CFG_INT(STR, DEF_VAL) stoi(CFG(STR, #DEF_VAL), nullptr, 0)
#define CFG_PANID stoi(CFG("panID", "0xface"), nullptr, 0)
#define SPAWN_STACKLINE(NODEID) WF_config.spawnStackline(NODEID)
#define WF_STOP raise(SIGINT)
#endif //_COMMON_H_