| 1 | // **************************************************************************** |
| 2 | // Project: libguytools |
| 3 | // **************************************************************************** |
| 4 | // Programmer: Guy Voncken |
| 5 | // Police Grand-Ducale |
| 6 | // Service de Police Judiciaire |
| 7 | // Section Nouvelles Technologies |
| 8 | // **************************************************************************** |
| 9 | // Module: Unique IDs for tools and applications |
| 10 | // **************************************************************************** |
| 11 | |
| 12 | // Copyright 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, |
| 13 | // 2018, 2019 |
| 14 | // Guy Voncken |
| 15 | // |
| 16 | // This file is part of libguytools. |
| 17 | // |
| 18 | // libguytools is free software: you can redistribute it and/or modify |
| 19 | // it under the terms of the GNU General Public License as published by |
| 20 | // the Free Software Foundation, either version 2 of the License, or |
| 21 | // (at your option) any later version. |
| 22 | // |
| 23 | // libguytools is distributed in the hope that it will be useful, |
| 24 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 25 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 26 | // GNU General Public License for more details. |
| 27 | // |
| 28 | // You should have received a copy of the GNU General Public License |
| 29 | // along with libguytools. If not, see <http://www.gnu.org/licenses/>. |
| 30 | |
| 31 | |
| 32 | #ifndef __TOOLGLOBALID_H__ |
| 33 | #define __TOOLGLOBALID_H__ |
| 34 | |
| 35 | |
| 36 | /* ------------------------------- */ |
| 37 | /* Constants */ |
| 38 | /* ------------------------------- */ |
| 39 | |
| 40 | /* ------------------------------- */ |
| 41 | /* Base id's */ |
| 42 | /* ------------------------------- */ |
| 43 | |
| 44 | const unsigned int ID_BASE = 0; |
| 45 | const unsigned int ID_OFFSET_PROJECT =10000000; /* 100 projects */ |
| 46 | const unsigned int ID_OFFSET_SUBPROJECT = 100000; /* 100 subprojects */ |
| 47 | const unsigned int ID_OFFSET_SUBSUBPROJECT = 1000; /* 1st possibility -- 100 subsubprojects (=100 C-files with max. 1000 IDs) */ |
| 48 | const unsigned int ID_OFFSET_SUBSUBSUBPROJECT = 100; /* 2nd possibility -- 100 subsubprojects (=100 subdir's) */ |
| 49 | /* each of the 100 subsubprojects has max. 10 subsubsubprojects (=10 C-files with max. 100 IDs) */ |
| 50 | |
| 51 | #define CREATE_BASE_ID(ProjectName, x) \ |
| 52 | const unsigned int ID_BASE_ ## ProjectName = x; |
| 53 | |
| 54 | #define CREATE_IDS(ModulName, x) \ |
| 55 | const unsigned int ERROR_BASE_ ## ModulName = x; \ |
| 56 | const unsigned int MEMID_BASE_ ## ModulName = x; |
| 57 | |
| 58 | /* ========================== TOOLS ================================ */ |
| 59 | |
| 60 | CREATE_BASE_ID (TOOLS, ID_BASE + 0*ID_OFFSET_PROJECT) |
| 61 | CREATE_IDS (TOOL_CFG , ID_BASE_TOOLS + 0*ID_OFFSET_SUBPROJECT) |
| 62 | CREATE_IDS (TOOL_ERROR , ID_BASE_TOOLS + 1*ID_OFFSET_SUBPROJECT) |
| 63 | CREATE_IDS (TOOL_LOG , ID_BASE_TOOLS + 2*ID_OFFSET_SUBPROJECT) |
| 64 | CREATE_IDS (TOOL_SIGNAL , ID_BASE_TOOLS + 3*ID_OFFSET_SUBPROJECT) |
| 65 | CREATE_IDS (TOOL_SYSINFO , ID_BASE_TOOLS + 4*ID_OFFSET_SUBPROJECT) |
| 66 | |
| 67 | |
| 68 | /* ========================= GUYMAGER ============================== */ |
| 69 | |
| 70 | CREATE_BASE_ID (GUYMAGER, ID_BASE + 1*ID_OFFSET_PROJECT) |
| 71 | CREATE_IDS (GUYMAGER_MAIN , ID_BASE_GUYMAGER + 0*ID_OFFSET_SUBPROJECT) |
| 72 | |
| 73 | #endif |
| 74 |