Wiselib
|
00001 #ifndef UTILS_H_ 00002 #define UTILS_H_ 00003 00004 #include <stdint.h> 00005 #include <external_interface/external_interface_testing.h> 00006 00007 #define ASSERT(_X) if (!(_X)) {std::cout<<"*** ASSERTION ("<<#_X<<") FAILED AT "<<__FILE__<<":"<<__LINE__<<" ***"<<std::endl; std::cin.get();} 00008 00009 typedef wiselib::OSMODEL Os; 00010 typedef Os::Timer Timer; 00011 00012 #ifdef SHAWN 00013 typedef Os::TxRadio Radio; 00014 #else 00015 typedef Os::ExtendedRadio Radio; 00016 #endif 00017 00018 enum error_code_t 00019 { 00020 ecSuccess, 00021 ecBufferTooShort 00022 }; 00023 00024 typedef Radio::node_id_t nodeid_t; 00025 00026 #define ARRSIZE(_a) (sizeof(_a)/sizeof((_a)[0])) 00027 00028 //This struct's size must be a multiple of 4 in order for serialization to work. 00029 struct topology_record_t 00030 { 00031 nodeid_t nodeid; 00032 uint8_t distance; 00033 bool is_leader; 00034 uint8_t will_be_leader; 00035 nodeid_t leader; 00036 nodeid_t parent; 00037 }; 00038 00039 #endif /* UTILS_H_ */