00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef _PIP_H
00034 #define _PIP_H
00035
00036
00037 #include <string>
00038
00044 #ifdef PIP_MESSAGING
00045 #include "annotate.h"
00046 static const bool PIP = true;
00047 inline char* annotate_get_path_id_copy(int* len) {
00048 char* pid = (char *)ANNOTATE_GET_PATH_ID(len);
00049 if (pid != NULL) {
00050 char* ret = (char *)malloc(*len);
00051 memcpy(ret, pid, *len);
00052 return ret;
00053 }
00054 return NULL;
00055 }
00056
00057 #else
00058 static const bool PIP = false;
00059 inline void ANNOTATE_INIT(void) {}
00060 inline void ANNOTATE_START_TASK(const char *roles, int level, const char *name) {}
00061 inline void ANNOTATE_END_TASK(const char *roles, int level, const char *name) {}
00062 inline void ANNOTATE_SET_PATH_ID(const char *roles, int level, const void *path_id, int idsz) {}
00063 inline const void *ANNOTATE_GET_PATH_ID(int *len) { return 0; }
00064 inline void ANNOTATE_PUSH_PATH_ID(const char *roles, int level, const void *path_id, int idsz) {}
00065 inline void ANNOTATE_POP_PATH_ID(const char *roles, int level) {}
00066 inline void ANNOTATE_END_PATH_ID(const char *roles, int level, const void *path_id, int idsz) {}
00067 inline void ANNOTATE_NOTICE(const char *roles, int level, const char *fmt, ...) {}
00068 inline void ANNOTATE_SEND(const char *roles, int level, const void *msgid, int idsz, int size) {}
00069 inline void ANNOTATE_RECEIVE(const char *roles, int level, const void *msgid, int idsz, int size) {}
00070
00071 inline void ANNOTATE_SET_PATH_ID_INT(const char* roles, int level, int n) {}
00072 inline void ANNOTATE_END_PATH_ID_INT(const char* roles, int level, int n) {}
00073 inline void ANNOTATE_PUSH_PATH_ID_INT(const char* roles, int level, int n) {}
00074 inline void ANNOTATE_SEND_INT(const char* roles, int level, int n, int size) {}
00075 inline void ANNOTATE_RECEIVE_INT(const char* roles, int level, int n, int size) {}
00076 inline void ANNOTATE_SET_PATH_ID_STR(const char *roles, int level, const char *fmt, ...) {}
00077 inline void ANNOTATE_END_PATH_ID_STR(const char *roles, int level, const char *fmt, ...) {}
00078 inline void ANNOTATE_PUSH_PATH_ID_STR(const char *roles, int level, const char *fmt, ...) {}
00079 inline void ANNOTATE_SEND_STR(const char *roles, int level, int size, const char *fmt, ...) {}
00080 inline void ANNOTATE_RECEIVE_STR(const char *roles, int level, int size, const char *fmt, ...) {}
00081
00082 inline void ANNOTATE_BELIEF_FIRST(int seq, float max_fail_rate, const char *condstr, const char *file, int line) {}
00083 inline void REAL_ANNOTATE_BELIEF(const char *roles, int level, int seq, int condition) {}
00084 inline void ANNOTATE_BELIEF(const char* roles, int level, bool cond, double rate) {}
00085 inline char* annotate_get_path_id_copy(int* len) { return NULL; }
00086 #endif // PIP_MESSAGING
00087
00088 inline std::string annotate_get_path() {
00089 int length;
00090 const char* path = (const char*)ANNOTATE_GET_PATH_ID(&length);
00091 return path == NULL ? std::string("") : std::string(path, length);
00092 }
00093
00094 #endif // _PIP_H