📄 main.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>OMNeT++/OMNEST Simulation Library: API Changes</title><link href="tree_data/doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.3.6 --><div class="qindex"><a class="qindex" href="http://www.omnetpp.org/doc/api/main.html">Main Page</a> | <a class="qindex" href="http://www.omnetpp.org/doc/api/modules.html">Modules</a> | <a class="qindex" href="http://www.omnetpp.org/doc/api/hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="http://www.omnetpp.org/doc/api/annotated.html">Class List</a> | <a class="qindex" href="http://www.omnetpp.org/doc/api/files.html">File List</a> | <a class="qindex" href="http://www.omnetpp.org/doc/api/functions.html">Class Members</a> | <a class="qindex" href="http://www.omnetpp.org/doc/api/pages.html">Related Pages</a></div><h1><a class="anchor" name="APIChanges">API Changes</a></h1><div class="fragment"><pre>API-Changes===========This file summarizes the changes in OMNeT++ across releases that affectbackwards compatibility, to help you port models to more recent versionsof OMNeT++.This file only describes changes that affect compiling and running models;for other changes or new features see WhatsNew.Legend:(+) new feature(!!!) incompatible change (old code will not compile or work as previously)(!) incompatible but minor change (change on a rarely used feature)(-) method/class became deprecated (possibly with a better replacement feature becoming available), or a method/class was renamed and a corresponding compatibility #define was added ('#define oldname newname')(x) removed a deprecated method, class or compatibility #define(i) informationOMNeT++ 3.1 (Mar 2005)~~~~~~~~~~~~~~~~~~~~~~Simulation library:(+) added cStringTokenizer class(+) extended cScheduler interface, added cRealTimeScheduler class(!) cDisplayString's getTagArg() method now never return NULLs (returns empty string "" instead)(+) added getBaseDirectoryFor() and getLocation() to cConfiguration(+) introduced cRuntimeError class, a subclass of cExceptionOMNeT++ 3.0 (Dec 2004)~~~~~~~~~~~~~~~~~~~~~~Simulation library:(x) removed setOwner() with no replacement. Use take() from within objects, e.g. foo->setOwner(this) should be replaced with this->take(foo) or just take(foo). Some existing simulation models used setOwner() to "work around" (hack) message ownership problems instead of tracking them down and fixing them properly -- the intent of removing setOwner() is to close this backdoor.(x) removed putAsideQueue, receiveOn(), receiveNewOn(), receiveNew(); only receive() remained.(!!!) wait() throws an exception if a message arrives during the hold period. If messages should be allowed, use waitAndEnqueue().(!!!) fullPath() return value changed from const char * to std::string. If it occurs in a printf-like function as "%s" (sprintf, ev.printf,...) it has to be changed to fullPath().c_str(), otherwise printf may crash.(!) signature of info(char buf, int buflen) changed to std::string info().(!) cSimpleModule::recordScalar() for writing const char* data removed, with no replacement.(!) cSimpleModule::recordStats(cStatistic *x) was removed. Replacement is x->recordScalar().(+) added setControlInfo(), controlInfo(), removeControlInfo() methods to cMessage. Control info is the preferred way of passing info (additional to the packet itself) between protocol layers.(!) cMessage default length changed from 1 to 0 (bits).(!) NED: default gate vector size (e.g. if gatesizes is omitted) changed from 1 to 0(x) removed cGate::link()(+) added cChannelType class and findChannelType() function(+) added cGate::disconnect()(!) cGate::connect() semantics slightly changed (see API documentation)(+) added cModule::gateSize()(+) added cModule::changeParentTo()(+) added cSimulation::getUniqueNumber(). Useful in models for ID generation, and (unlike incrementing global vars) it also works with parallel execution(-) cDisplayStringParser renamed to cDisplayString (compatibility typedef exists)(+) displayString() methods of cModule and cGate return reference to internally stored cDisplayString objects which can now be manipu- lated directly (no need for setDisplayString(const char *)).(+) ev.isGUI() added. Returns true if simulation runs under Tkenv. Display string updates and bubble() calls can be made conditional on this.(+) added method bool disabled() to cEnvir (to ev object); returns true when ev<< output is disabled, such as in Express mode in Tkenv and Cmdenv.(+) cModule::bubble() added. It displays a transient "bubble" over the module icon in Tkenv, does nothing in Cmdenv.(-) discouraged use of classes cBag and cLinkedList. STL classes such as std::vector, std::list or std::deque should be used instead.(+) cStatistic::recordScalar() added(+) New random number architecture: added cRNG interface and subclasses cMersenneTwister and cLCG32; added cRNG *cEnvir::rng(k) and cRNG *Module::rng(k)(!) New random number architecture. Following symbols/functions fell victim: #define NUM_RANDOM_GENERATORS -- this is now in omnetpp.ini #define INTRAND_MAX -- different for every RNG class; cRNG::intRandMax() returns it int testrand() -- see cRNG::selfTest() long opp_nextrand(long& seed) -- no replacement void opp_randomize() -- no replacement long randseed() -- no replacement (Mersenne Twister state doesn't fit in 32 bits!) long randseed(long seed) -- no replacement (seeding from C++ not supported) long intrand() -- see cRNG::intRand() void genk_opp_randomize(int gen_nr) -- no replacement (see above) long genk_randseed(int gen_nr) -- no replacement (see above) long genk_randseed(int gen_nr, long seed) -- no replacement (see above) long genk_intrand(int gen_nr) -- see cRNG::intRand()(+) added two utility functions to cTopology: void extractByModuleType(const char **types) void extractByModuleType(const std::vector<std::string> types)(+) added class cXMLElement, to support NED's new XML parameter type(+) added methods to cPar: setXMLValue(cXMLElement*), cXMLElement *xmlValue(), op=(cXMLElement*), op cXMLElement*().(+) added cConfiguration class, an abstract base class for configuration managers (generalization of omnetpp.ini). cConfiguration makes it possible to use different sources than omnetpp.ini, e.g. database or XML.(+) added method cConfiguration *config() to cEnvir (i.e. ev object)(-) deprecated classes cBag and cLinkedList. STL classes such as std::vector, std::list or std::deque are recommended instead.OMNeT++ 2.3 (June 16, 2003)~~~~~~~~~~~~~~~~~~~~~~~~~~~Simulation library:(-) deprecated cPacket. Please do not use it in new models. Protocol should be represented in the message subclass (i.e. instances of class IPv6Packet represent IPv6 packets, and/or in the message kind value. PDU is usually represented as a field inside the message class (a protocol header field). See rationale in User Manual.(-) deprecated setOwner(). In constructors of new classes, use take(obj) to take ownership of a member/contained object. Other than that, there should be no reason to use setOwner()! setOwner() will probably be removed as early as the next release of OMNeT++.(+) message subclassing: generated message classes now accept message kind in the constructor.OMNeT++ 2.3b1 (Jan 13, 2003)~~~~~~~~~~~~~~~~~~~~~~~~~~~~Simulation library:(+) new distributions: continuous distributions gamma_d(), beta(), erlang_k(), chi_square(), student_t(), cauchy(), triang(), lognormal(), weibull(), pareto_shifted(); discrete distributions bernoulli(), binomial(), geometric(), negbinomial(), poisson(). [contributed by Werner Sandmann](+) exceptions are used throughout the simulation library to signal errors. You can also use try...catch in your code.(+) RTTI (Run-time Type Information) is also turned on, so you can use dynamic_cast in your code.(+) added check_and_cast<T>(cObject *p) template function -- it can be used to assert that a pointer is of the given T type. It does dynamic_cast<T> and throws exception if the result is NULL (ie. pointer types are incompatible). Useful with message subclassing.(!!!) MSVC compile flags change: exception handling and RTTI MUST be ON from now. You must compile EVERY source flie using /GR, otherwise simulations will crash with RTTI exception!(!) redefining className() in your classes is now not necessary (because the simulation kernel can figure it out in cObject::className()).(+) because of the introduction of C++ exception handling, methods like end(), endSimulation() and deleteModule() as well as any runtime error cause handleMessage() to exit immediately. (In earlier versions, handleMessage() went through in any case.)(-) deprecated genk_* functions. The RNG should be given as an extra optional attribute of "genk"-less functions instead.(-) rarely-used methods cSimpleModule::error(), opp_error() and opp_warning() were deprecated; they will be removed at some point in the future.(+) cWatch now supports 'bool'(+) new method waitAndEnqueue() added to cSimpleModule -- this function should be used instead of wait() in places where messages may arrive at the module during the wait interval. (see next items)(!) use wait() ONLY where you do NOT expect other messages to arrive at the module, and receiveOn() only where you expect the mext message to arrive on the specified gate. In a later release, wait() will throw an error if a message arrives to it (or, with receiveOn(),
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -