It has been a while since I last worked on Aesalon proper.
[aesalon.git] / common / include / collector / Interface.h
blob0fdb5a86768ff5c65b33423460a970838b982b9b
1 #ifndef CollectorInterface_H
2 #define CollectorInterface_H
4 #include <stdint.h>
6 #include "DataTypes.h"
8 #if defined(__cplusplus)
9 extern "C" {
10 #endif
12 #ifdef __GNUC__
13 #define AC_GCC
14 #else
15 #error "No supported compiler found."
16 #endif
18 #ifdef AC_GCC
19 #define AC_EXPORT __attribute__((visibility("default")))
20 #define AC_CONSTRUCTOR __attribute__((constructor))
21 #define AC_DESTRUCTOR __attribute__((destructor))
22 #pragma GCC visibility push(hidden)
23 #endif
25 /* These two functions should be overloaded in all modules, but not exported under ANY circumstances. */
26 void AC_CONSTRUCTOR AC_constructor();
27 void AC_DESTRUCTOR AC_destructor();
29 uint16_t AC_EXPORT AC_registerModuleInternal(const char *name);
31 void AC_EXPORT AC_writePacket(AC_DataPacket *packet);
32 AC_Timestamp AC_EXPORT AC_timestamp();
33 uint8_t AC_EXPORT AC_hasCollectionBegun();
34 AC_Address AC_EXPORT AC_libraryOffset(const char *name);
36 char AC_EXPORT * AC_configurationString(const char *module, const char *name);
37 int AC_EXPORT AC_configurationInt(const char *module, const char *name);
38 long AC_EXPORT AC_configurationLong(const char *module, const char *name);
39 int AC_EXPORT AC_configurationBool(const char *module, const char *name);
41 uint16_t AC_moduleID();
42 void AC_setModuleID(uint16_t moduleID);
44 #define AC_moduleDefinition() \
45 static uint16_t AC_m_moduleID; \
46 uint16_t AC_moduleID() { return AC_m_moduleID; } \
47 void AC_setModuleID(uint16_t moduleID) { AC_m_moduleID = moduleID; }
49 #define AC_registerModule(name) \
50 AC_setModuleID(AC_registerModuleInternal(name))
52 /*#ifdef AC_GCC
53 #pragma GCC visibility pop
54 #endif*/
56 #if defined(__cplusplus)
57 } // extern "C"
58 #endif
60 #endif