Statistics
| Branch: | Revision:

root / src / sim / sim_std.msg @ 08285dff

History | View | Annotate | Download (20.9 KB)

1
//==============================================================
2
//   SIM_STD.MSG  - part of
3
//                     OMNeT++/OMNEST
4
//            Discrete System Simulation in C++
5
//
6
//  Author: Andras Varga
7
//
8
//==============================================================
9

    
10
//--------------------------------------------------------------
11
// Copyright (C) 1992-2005 Andras Varga
12
//
13
//  This file is distributed WITHOUT ANY WARRANTY. See the file
14
//  `license' for details on this and other legal matters.
15
//--------------------------------------------------------------
16

    
17

    
18
//
19
// Property descriptors for the simkernel classes.
20
// Usage: opp_msgc -Xnc -Xns sim_std.msg
21
//
22

    
23
cplusplus
24
{{
25

    
26
#ifdef _MSC_VER
27
#  pragma warning(disable:4996)  // deprecation (cLinkedList)
28
#endif
29

    
30
USING_NAMESPACE
31

    
32
//
33
// Register enums from the sim. kernel
34
//
35
typedef cPar::Type   cPar_Type;
36
typedef cGate::Type  cGate_Type;
37

    
38
Register_Enum(cPar_Type,  (cPar::BOOL, cPar::DOUBLE, cPar::LONG, cPar::STRING, cPar::XML));
39
Register_Enum(cGate_Type, (cGate::INPUT, cGate::OUTPUT, cGate::INOUT));
40

    
41

    
42
//
43
// Define operator<< for some classes
44
//
45
std::ostream& operator<<(std::ostream& os, const cDisplayString& d) {
46
    return os << "\"" << d.str() << "\"";
47
}
48

    
49
typedef cDensityEstBase::Cell cDensityEstBase_Cell;
50
std::ostream& operator<<(std::ostream& os, const cDensityEstBase::Cell& cell) {
51
    return os << "[" << cell.lower << ", " << cell.upper << ")  ==>  " << cell.value << " (" << cell.relativeFreq << ")";
52
}
53

    
54
//
55
// This function is to be referenced from sim. kernel classes, to force the
56
// linker to include this file in executables
57
//
58
void std_sim_descriptor_dummy() {}
59

    
60
}}
61

    
62
enum cPar_Type;
63
enum cGate_Type;
64

    
65
struct cDensityEstBase_Cell;
66

    
67
class cObject
68
{
69
    @icon(cogwheel);
70
    string className @group(base) @hint("C++ class name") @eventlog(skip);
71
    string fullName @group(base) @hint("If object is part of a module/gate vector: name with index");
72
    string fullPath @group(base) @hint("Hierarchical name, composed of full names of this object and its owners/parents") @eventlog(skip);
73
    string info @getter(info) @group(base) @hint("Text provided by the object's \"info\" method") @eventlog(skip);
74
    string detailedInfo @getter(detailedInfo) @group(base) @hint("Text provided by the object's \"detailedInfo\" method") @eventlog(skip);
75
}
76

    
77
class cNamedObject extends cObject
78
{
79
    string name @group(base) @editable @hint("An editable string attribute of the object, also used for fullName and fullPath");
80
}
81

    
82
class cOwnedObject extends cNamedObject
83
{
84
    cObject *owner @group(base) @hint("Module or container this object belongs to") @eventlog(skip);
85
}
86

    
87
class cNoncopyableOwnedObject extends cOwnedObject
88
{
89
}
90

    
91
class cDefaultList extends cNoncopyableOwnedObject
92
{
93
    cOwnedObject *defaultList[] @getter(defaultListGet) @sizeGetter(defaultListSize) @group(owned objects) @hint("List of objects directly held by this component");
94
}
95

    
96
class cDisplayString extends void
97
{
98
    string value @getter(str) @setter(parse) @editable @hint("The editable display string itself");
99
}
100

    
101
class cProperty extends cObject
102
{
103
    bool isImplicit @getter(isImplicit) @group(fields);
104
    string index @group(fields);
105
    string value @getter(info) @hint("Name and value");
106
}
107

    
108
class cProperties
109
{
110
    cProperty *contents[] @getter(get) @sizeGetter(getNumProperties) @hint("The property list");
111
}
112

    
113
class cPar extends cObject;
114
class cComponentType extends cOwnedObject;
115

    
116
class cComponent extends cDefaultList
117
{
118
    bool isModule @getter(isModule) @group(fields) @hint("Whether this component is a module or a channel");
119
    cComponentType *componentType @group(fields) @hint("The object that represents the type declaration for this component");
120
    cPar par[] @getter(par) @sizeGetter(getNumParams) @label(parameters) @group(parameters, gates) @hint("Parameters");
121
    cProperties *props @getter(getProperties) @label("properties") @group(parameters, gates) @hint("Properties");
122
}
123

    
124
class cChannel extends cComponent
125
{
126
    @icon(channel);
127
    cDisplayString displayString @group(fields) @hint("Controls appearance of this channel in the GUI");
128
}
129

    
130
class cIdealChannel extends cChannel
131
{
132
    // nothing special
133
}
134

    
135
class cDelayChannel extends cChannel
136
{
137
    // nothing special
138
}
139

    
140
class cDatarateChannel extends cChannel
141
{
142
    // Note: no need to spell out delay etc, they come from cComponent parameters
143
    bool isBusy @getter(isBusy) @group(fields) @hint("If channel is currently transmitting");
144
    simtime_t transmissionFinishTime @group(fields) @hint("If busy: when currently active transmissions will finish");
145
}
146

    
147
class cGate extends cObject;
148

    
149
class cModule extends cComponent
150
{
151
    int id @group(fields) @hint("Unique module ID -- IDs of deleted modules are not issued again");
152
    bool isSimple @getter(isSimple) @group(fields) @hint("Whether this is a simple module");
153
    bool isVector @getter(isVector) @group(fields) @hint("Whether this module is part of a module vector");
154
    int index @group(fields) @hint("If vector: index of this module in its module vector");
155
    int size @getter(size) @group(fields) @hint("If vector: size of module vector this module belongs to");
156
    cDisplayString displayString @group(fields) @hint("Controls appearance of this module in the GUI");
157
    cGate *gate[] @getter(getGateCount) @sizeGetter(gateCount) @getter(gateByOrdinal) @group(parameters, gates) @label(gates) @hint("Module gates");
158
}
159

    
160
class cSimpleModule extends cModule
161
{
162
    @icon(simple);
163
    bool isTerminated @getter(isTerminated) @group(fields) @hint("Whether this module has terminated");
164
    bool usesActivity @getter(usesActivity) @group(activity) @hint("Whether this simple module was programmed using the \"activity\" or the \"handleMessage\" C++ method");
165
    unsigned int stackSize @group(activity) @hint("If module uses \"activity\": stack size allocated for this module -- zero means info not available");
166
    unsigned int stackUsage @group(activity) @hint("If module uses \"activity\": stack actually used by this module -- zero means info not available");
167
}
168

    
169
class cCompoundModule extends cModule
170
{
171
    @icon(compound);
172
}
173

    
174
//TODO: use @icon(placeholder) for cPlaceholderModule
175

    
176
//----
177

    
178
class cComponentType extends cNoncopyableOwnedObject
179
{
180
}
181

    
182
class cModuleType extends cComponentType
183
{
184
    bool isNetwork @getter(isNetwork) @group(fields) @hint("Whether this module type can be used as toplevel module");
185
}
186

    
187
class cChannelType extends cComponentType
188
{
189
}
190

    
191
class cRegistrationList extends cNamedObject
192
{
193
    cObject *contents[] @getter(get) @sizeGetter(size) @hint("Contained objects");
194
}
195

    
196
//----
197

    
198
class cGate extends cObject
199
{
200
    @icon(gate);
201
    char type @group(fields) @enum(cGate_Type) @hint("Gate type");
202
    int id @group(fields) @hint("Gate id, unique within this module");
203
    bool isVector @getter(isVector) @group(fields) @hint("Whether this gate is part of a gate vector");
204
    int index @group(fields) @hint("If vector: index of this gate within its gate vector");
205
    bool deliverOnReceptionStart @group(fields) @hint("Only for simple module input gates, and if message transmission duration is nonzero: whether messages arriving on this gate will be given to the module at the start or the end of the reception");
206

    
207
    cChannel *channel @group(connection) @hint("Channel object associated with the connection");
208
    cGate *previousGate @group(connection) @hint("The gate this one is connected to -- for output gates this points out of this module, and for input gates it points inside");
209
    cGate *nextGate @group(connection) @hint("The gate whose \"previousGate\" is this gate -- note that \"previous\" and \"next\" correspond to the direction of messages");
210
    cGate *pathStartGate @group(connection) @hint("The last gate in the \"previousGate->previousGate->previousGate...\" chain");
211
    cGate *pathEndGate @group(connection) @hint("The last gate in the \"nextGate->nextGate->nextGate...\" chain");
212
    bool isConnectedOutside @getter(isConnectedOutside) @group(connection) @hint("For an output gate this checks nextGate, and previousGate for an input gate");
213
    bool isConnectedInside @getter(isConnectedInside) @group(connection) @hint("For an input gate this checks nextGate, and previousGate for an output gate");
214
    bool isConnected @getter(isConnected) @group(connection) @hint("Whether the gate is fully connected -- both inside and outside for a compound module gate, and outside for a simple module gate");
215
    bool isPathOK @getter(isPathOK) @group(connection) @hint("The chain of connections is OK if it starts and ends at a simple module");
216
}
217

    
218
//----
219

    
220
class cArray extends cOwnedObject
221
{
222
    @icon(container);
223
    bool takeOwnership @group(fields) @editable @hint("Whether the array should own the objects inserted into it");
224
    cOwnedObject *contents[] @getter(get) @sizeGetter(size) @hint("Objects contained in the array");
225
}
226

    
227
class cMessage extends cOwnedObject
228
{
229
    @icon("message");
230
    long id @group("message") @hint("Automatically assigned unique identifier");
231
    long treeId @group("message") @hint("Identifier shared between the message and its copies");
232
    short kind @group("message") @editable @hint("Generic user-settable attribute, usually carries \"type\" or \"role\" or \"category\" of message");
233
    short schedulingPriority @group("message") @editable @hint("Controls order of messages with equal timestamps in FES");
234
    string displayString @group("message") @hint("Controls appearance of the message in GUI");
235
    cObject *controlInfo @group("message") @hint("Used with protocol stacks: carries extra information when a packet is sent between protocol layers");
236
    cArray parList @group("message") @hint("OBSOLETE: use of \"parList\" should be replaced with message subclassing in the few models that still use it");
237

    
238
    bool isScheduled @getter(isScheduled) @group(sending) @hint("Whether message is currently scheduled/in transit or not");
239
    bool isSelfMessage @getter(isSelfMessage) @group(sending) @hint("Whether message is a self-message, scheduled to be delivered back to the same module at a later time");
240
    simtime_t creationTime @group(sending) @hint("Simulation time the message was created");
241
    simtime_t sendingTime @group(sending) @hint("Simulation time of the current or last sending/scheduling of the message");
242
    simtime_t arrivalTime @group(sending) @hint("Simulation time the message will be/was delivered to the destination module");
243
    simtime_t timestamp @group(sending) @editable @hint("User-settable timestamp for generic use");
244

    
245
    int senderModuleId @group(sending) @hint("ID of the module performing the current or last send/schedule operation");
246
    int senderGateId @group(sending) @hint("Module-local ID of the gate on which the message was sent out -- -1==none for self-messages and after \"sendDirect\"");
247
    cModule *senderModule @group(sending) @hint("ID of the module performing the current or last send/schedule operation") @eventlog(fullPath);
248
    cGate *senderGate @group(sending) @hint("The gate on which the message was sent out -- NULL for self-messages and after \"sendDirect\"") @eventlog(fullName);
249

    
250
    int arrivalModuleId @group(sending) @hint("ID of the arrival module of the current or last sending/scheduling");
251
    int arrivalGateId @group(sending) @hint("Module-local ID of arrival gate for current or last sending -- -1==none for self-messages");
252
    cModule *arrivalModule @group(sending) @hint("Arrival module for current or last sending/scheduling") @eventlog(fullPath);
253
    cGate *arrivalGate @group(sending) @hint("Arrival gate for current or last sending -- NULL for self-messages") @eventlog(fullName);
254

    
255
    //XXX various IDs
256
}
257

    
258
class cPacket extends cMessage
259
{
260
    @icon("packet");
261
    int64 bitLength @group("message") @editable @hint("Simulated length of the message in bits, affects transmission time and probability of bit errors when sent through a channel");
262
    int64 byteLength @group("message") @editable @hint("Length in bytes, i.e. length in bits divided by eight");
263
    bool hasBitError @getter(hasBitError) @group("message") @setter(setBitError) @editable @hint("Indicates that a bit error occurred when the message was sent through a channel with nonzero bit error rate");
264
    cPacket *encapsulatedPacket @hint("Used with protocol stacks: stores an encapsulated higher-layer packet");
265
    bool isReceptionStart @getter(isReceptionStart) @group(sending) @hint("When duration is nonzero: whether this message represents the start or the end of the frame reception");
266
    simtime_t duration @group(sending) @hint("Transmission time over a channel with datarate");
267
}
268

    
269
//----
270

    
271
class cStatistic extends cOwnedObject
272
{
273
    @icon(statistic);
274
    long count @hint("Number of observations collected so far");
275
    double weights @hint("Sum of weights, which equals the number of observations in the unweighted case");
276
    double sum @hint("Sum of observations");
277
    double sqrSum @hint("Sum of squares of the observations");
278
    double min @hint("Minimum of the observations");
279
    double max @hint("Maximum of the observations");
280
    double mean @hint("Mean of the observations");
281
    double stddev @hint("Standard deviation of the observations");
282
    double variance @hint("Variance of the observations");
283
}
284

    
285
class cStdDev extends cStatistic
286
{
287
}
288

    
289
class cWeightedStdDev extends cStdDev
290
{
291
}
292

    
293
class cDensityEstBase extends cStdDev
294
{
295
    bool isTransformed @getter(isTransformed) @group(histogram) @hint("If false, the object is still collecting initial observations to be used for laying out histogram cells");
296
    unsigned long underflowCell @group(histogram) @hint("Number of observations below the first histogram cell");
297
    unsigned long overflowCell @group(histogram) @hint("Number of observations above the last histogram cell");
298
    int numCells @group(histogram) @hint("Number of cells in the histogram");
299
    cDensityEstBase_Cell cellInfo[] @getter(internalGetCellInfo) @sizeGetter(getNumCells) @group(histogram) @hint("Histogram cell bounds, observation count in the cell, and density estimate in the cell");
300
}
301

    
302
class cHistogramBase extends cDensityEstBase
303
{
304
}
305

    
306
class cHistogram extends cHistogramBase
307
{
308
}
309

    
310
class cVarHistogram extends cHistogramBase
311
{
312
}
313

    
314
class cLongHistogram extends cHistogram
315
{
316
}
317

    
318
class cDoubleHistogram extends cHistogram
319
{
320
}
321

    
322
class cKSplit extends cDensityEstBase
323
{
324
}
325

    
326
class cPSquare extends cDensityEstBase
327
{
328
}
329

    
330
class cTransientDetection extends cOwnedObject
331
{
332
}
333

    
334
class cAccuracyDetection extends cOwnedObject
335
{
336
}
337

    
338
class cTDExpandingWindows extends cTransientDetection
339
{
340
}
341

    
342
class cADByStddev extends cAccuracyDetection
343
{
344
}
345

    
346
//----
347

    
348
class cExpression extends cObject
349
{
350
    string str @getter(str);
351
}
352

    
353
class cFSM extends cOwnedObject
354
{
355
    int state @hint("Numeric code of the state the FSM is currently in");
356
    string stateName @hint("Name of the current FSM state");
357
}
358

    
359
class cMathFunction extends cNoncopyableOwnedObject
360
{
361
    string category @hint("Function category");
362
    string description;
363
    int numArgs @hint("Number of \"double\" parameters this function takes");
364
}
365

    
366
class cNEDFunction extends cNoncopyableOwnedObject
367
{
368
    string signature @hint("Argument types and return value");
369
    string category @hint("Function category");
370
    string description;
371
    char returnType;
372
    char argType[] @sizeGetter(getMaxArgs);
373
    int minArgs @hint("Number of mandatory arguments");
374
    int maxArgs @hint("Maximum number of arguments");
375
}
376

    
377
class cOutVector extends cNoncopyableOwnedObject
378
{
379
    @icon(outvector);
380
    bool isEnabled @getter(isEnabled) @setter(setEnabled) @editable @hint("If disabled, values passed to this object to record are simply discarded");
381
    long valuesReceived @hint("Number of values passed to this object to record");
382
    long valuesStored @hint("Number of values actually stored on the disk");
383
}
384

    
385
class cPar extends cObject
386
{
387
    @icon(param);
388
    string value @getter(str) @setter(parse) @editable;
389
    char type @enum(cPar_Type) @hint("Parameter type");
390
    string unit @hint("For long and double types only");
391
    bool isNumeric @getter(isNumeric) @group(flags) @hint("Whether parameter type is numeric, i.e. double or long");
392
    bool isVolatile @getter(isVolatile) @group(flags) @hint("Whether parameter was declared volatile in the NED file");
393
    bool isExpression @getter(isExpression)@group(flags) @hint("Whether parameter value is a constant or an expression");
394
    bool isShared @getter(isShared) @group(flags) @hint("Whether storage could be optimized by several modules sharing the same parameter value object");
395
}
396

    
397
class cMsgPar extends cOwnedObject
398
{
399
    string value @getter(str) @setter(parse) @editable @hint("Parameter value");
400
    char type @enum(cPar_Type) @hint("Parameter type");
401
    bool isNumeric @getter(isNumeric) @group(flags) @hint("Whether parameter is of numeric type");
402
    bool isConstant @getter(isConstant) @group(flags) @hint("Whether the parameter has a constant value");
403
}
404

    
405
class cLinkedList extends cOwnedObject
406
{
407
    @icon(queue);
408
    int length @hint("Number of items contained");
409
}
410

    
411
class cMessageHeap extends cOwnedObject
412
{
413
    @icon(container);
414
    int length @hint("Number of items contained");
415
    cMessage *messages[] @getter(peek) @sizeGetter(getLength) @hint("Self-messages currently scheduled and messages currently in transit");
416
}
417

    
418
class cQueue extends cOwnedObject
419
{
420
    @icon(queue);
421
    bool takeOwnership @group(fields) @editable @hint("Whether the queue should own the objects inserted into it");
422
    int length @hint("Number of items in the queue");
423
    cOwnedObject *contents[] @getter(get) @sizeGetter(getLength) @hint("Queue contents");
424
}
425

    
426
class cPacketQueue extends cQueue
427
{
428
    int64 bitLength @hint("Total size of messages in the queue");
429
    int64 byteLength @hint("Total size of messages in the queue, in bytes");
430
}
431

    
432
class cHasher extends void
433
{
434
   string hash @getter(str) @hint("The current hash value");
435
}
436

    
437
class cSimulation extends cNoncopyableOwnedObject
438
{
439
    @icon(container);
440
    simtime_t simTime @hint("The current simulation time in seconds");
441
    int64 eventNumber @hint("The current event number -- counts from 0 up");
442
    cMessageHeap messageQueue @label(futureEvents) @hint("Self-messages scheduled, and messages in transit");
443
    int lastModuleId @group(modules) @hint("The largest module ID issued so far");
444
    cModule *systemModule @group(modules) @hint("The top-level module");
445
    cModule *module[] @sizeGetter(getLastModuleId) @group(modules) @label(modules) @hint("List of modules, indexed with module ID");
446
    cHasher *hasher @hint("Used for fingerprint calculation");
447
}
448

    
449
class cScheduler extends cObject
450
{
451
}
452

    
453
class cSequentialScheduler extends cScheduler
454
{
455
}
456

    
457
class cRealTimeScheduler extends cScheduler
458
{
459
}
460

    
461
cplusplus {{
462
typedef cTopology::Node cTopology_Node;
463
typedef cTopology::Link cTopology_Link;
464
typedef cTopology::LinkIn cTopology_LinkIn;
465
typedef cTopology::LinkOut cTopology_LinkOut;
466
}}
467

    
468
class cTopology_Link extends void;
469
class cTopology_LinkIn extends cTopology_Link;
470
class cTopology_LinkOut extends cTopology_Link;
471

    
472
class cTopology_Node extends void
473
{
474
    int moduleId @hint("ID of the module this node corresponds to");
475
    cModule *module @hint("The module this node corresponds to");
476
    double weight @hint("Node weight -- affects graph algorithms such as shortest path");
477
    bool enabled @getter(isEnabled) @hint("Node state -- affects graph algorithms such as shortest path");
478

    
479
    cTopology_LinkIn *inLink[] @getter(getLinkIn) @sizeGetter(getNumInLinks) @hint("Incoming links of this graph node");
480
    cTopology_LinkIn *outLink[] @getter(getLinkOut) @sizeGetter(getNumOutLinks) @hint("Outgoing links of this graph node");
481

    
482
    double distanceToTarget @group(shortest path) @hint("After running a shortest path algorithm: distance to the target node");
483
    cTopology_LinkOut *path[] @sizeGetter(getNumPaths) @group(shortest path) @hint("The next link of the shortest path or paths towards the target node");
484
}
485

    
486
class cTopology_Link extends void
487
{
488
    double weight @hint("Link weight -- affects graph algorithms such as shortest path");
489
    bool enabled @getter(isEnabled) @hint("Link state -- affects graph algorithms such as shortest path");
490
}
491

    
492
class cTopology_LinkIn extends cTopology_Link
493
{
494
    cTopology_Node *remoteNode @hint("The node at the remote end of this connection");
495
    cGate *remoteGate @hint("The gate at the remote end of this connection");
496
    cGate *localGate @hint("The gate at the local end of this connection");
497
}
498

    
499
class cTopology_LinkOut extends cTopology_Link
500
{
501
    cTopology_Node *remoteNode @hint("The node at the remote end of this connection");
502
    cGate *remoteGate @hint("The gate at the remote end of this connection");
503
    cGate *localGate @hint("The gate at the local end of this connection");
504
}
505

    
506
class cTopology extends cOwnedObject
507
{
508
    int numNodes @group(fields) @hint("Number of nodes in this topology object");
509
    cTopology_Node *node[] @sizeGetter(getNumNodes) @hint("List of nodes in this topology object");
510
}
511

    
512
class cXMLElement
513
{
514
    string tagName @hint("XML element tag");
515
    string nodeValue @hint("Contents of text node inside this XML element");
516
    string sourceLocation @hint("Location this XML element was parsed from");
517
    bool hasAttributes @getter(hasAttributes) @hint("Whether this XML element has attributes");
518
    bool hasChildren @getter(hasChildren) @hint("Whether this XML element has child elements");
519
    string detailedInfo @getter(detailedInfo) @label(contents);
520
}
521

    
522

    
523