从今天开始分析OMNET的原代码结构,首先分析一些预定的文件。
1. def.h
1. def.h
Def.h代码分析
// OPP_DLLIMPORT/EXPORT are empty if not needed
#if defined(__WIN32__)
# define OPP_DLLEXPORT __declspec(dllexport)
# if defined(WIN32_DLL)
# define OPP_DLLIMPORT __declspec(dllimport)
# else
# define OPP_DLLIMPORT
# endif
#else
# define OPP_DLLIMPORT
# define OPP_DLLEXPORT
#endif
// SIM_API, ENVIR_API etc are also empty if not needed
#ifdef BUILDING_SIM
# define SIM_API OPP_DLLEXPORT
#else
# define SIM_API OPP_DLLIMPORT
#endif
// we need this because cenvir.h is in our directory
#ifdef BUILDING_ENVIR
# define ENVIR_API OPP_DLLEXPORT
#else
# define ENVIR_API OPP_DLLIMPORT
#endif
//=== NULL的定义
#ifndef NULL
#define NULL ((void*)0)
#endif
// maximum lengths for className(), fullPath() and old info(buf) strings
#define MAX_CLASSNAME 100
#define MAX_OBJECTFULLPATH 1024
#define MAX_OBJECTINFO 500
// in case someone still needs the old name
#define FULLPATHBUF_SIZE MAX_OBJECTFULLPATH
#ifndef NDEBUG
#define ASSERT(expr) /
((void) ((expr) ? 0 : /
(opp_error("ASSERT: condition %s false, %s line %d", /
#expr, __FILE__, __LINE__), 0)))
#else
#define ASSERT(expr) ((void)0)
#endif
/**
* Modelled time.
*/
typedef double simtime_t;
#define MAXTIME
HUGE_VAL
/*HUGE_VAL是double类型所能代表的最大值,当数学函数在运行的时候发生错误的时候返回此值,有些函数返回的是-HUGE_VAL
*/
/*
这个函数的原型是用来清除用户定义的数据结构,通过调用一些对象,比如(
cPar,cLinkedList
)