#include <cpar.h>
Inheritance diagram for cPar::
Public Methods | |
Constructors, destructor, assignment. | |
cPar (const cPar &other) | |
cPar (const char *name=NULL) | |
cPar (const char *name, cPar &other) | |
virtual | ~cPar () |
cPar& | operator= (const cPar &otherpar) |
Redefined cObject member functions | |
virtual cObject* | dup () const |
virtual void | info (char *buf) |
virtual void | writeContents (ostream &os) |
virtual void | forEach (ForeachFunc f) |
virtual int | netPack () |
virtual int | netUnpack () |
Setter functions. Note that overloaded assignment operators also exist. | |
cPar& | setBoolValue (bool b) |
cPar& | setLongValue (long l) |
cPar& | setStringValue (const char *s) |
cPar& | setDoubleValue (double d) |
cPar& | setDoubleValue (cStatistic *res) |
cPar& | setDoubleValue (ExprElem *x, int n) |
cPar& | setDoubleValue (cDoubleExpression *expr) |
cPar& | setDoubleValue (MathFuncNoArg f) |
cPar& | setDoubleValue (MathFunc1Arg f, double p1) |
cPar& | setDoubleValue (MathFunc2Args f, double p1, double p2) |
cPar& | setDoubleValue (MathFunc3Args f, double p1, double p2, double p3) |
cPar& | setDoubleValue (MathFunc4Args f, double p1, double p2, double p3, double p4) |
cPar& | setPointerValue (void *ptr) |
cPar& | setObjectValue (cObject *obj) |
void | configPointer (VoidDelFunc delfunc, VoidDupFunc dupfunc, size_t itemsize=0) |
Getter functions. Note that overloaded conversion operators also exist. | |
bool | boolValue () |
long | longValue () |
const char* | stringValue () |
double | doubleValue () |
void* | pointerValue () |
cObject* | objectValue () |
Redirection | |
cPar& | setRedirection (cPar *par) |
bool | isRedirected () const |
cPar* | redirection () |
void | cancelRedirection () |
Type, prompt text, input flag, change flag. | |
char | type () const |
bool | isNumeric () const |
const char* | prompt () |
void | setPrompt (const char *s) |
void | setInput (bool ip) |
bool | isInput () const |
bool | changed () |
Utility functions. | |
cPar& | read () |
void | convertToConst () |
bool | equalsTo (cPar *par) |
Convert to/from text representation. | |
virtual void | getAsText (char *buf, int maxlen) |
virtual bool | setFromText (const char *text, char tp) |
Overloaded assignment and conversion operators. | |
cPar& | operator= (bool b) |
cPar& | operator= (const char *s) |
cPar& | operator= (char c) |
cPar& | operator= (unsigned char c) |
cPar& | operator= (int i) |
cPar& | operator= (unsigned int i) |
cPar& | operator= (long l) |
cPar& | operator= (unsigned long l) |
cPar& | operator= (double d) |
cPar& | operator= (long double d) |
cPar& | operator= (void *ptr) |
cPar& | operator= (cObject *obj) |
operator bool () | |
operator const char * () | |
operator char () | |
operator unsigned char () | |
operator int () | |
operator unsigned int () | |
operator long () | |
operator unsigned long () | |
operator double () | |
operator long double () | |
operator void * () | |
operator cObject * () | |
Static Public Methods | |
Compare function | |
int | cmpbyvalue (cObject *one, cObject *other) |
Protected Methods | |
Event hooks | |
virtual void | beforeChange () |
virtual void | afterChange () |
Types and type characters:
For all types, an input flag can be set. In this case, the user will be asked to enter the value when the object's value is first used. The prompt string can also be specified for cPar. If no prompt string is given, the object's name will be displayed as prompt text.
NOTE: forEach() ignores objects stored here such as cPars in eXpressions, cObject pointed to in 'P' type, cStatistic in disTribution type
|
Copy constructor, creates an exact copy of the argument. |
|
Constructor, creates a cPar with the given name and long ('L') as default type. |
|
Constructor, creates a copy of the second argument with another name. |
|
Destructor. |
|
Called each time after the value of this object changed. It can be used for tracking parameter changes. This default implementation does nothing. |
|
Called each time before the value of this object changes. It can be used for tracking parameter changes. This default implementation does nothing. |
|
Returns value as a boolean. The cPar type must be bool (B) or a numeric type. |
|
Break the redirection. The new type will be long ('L'). |
|
Returns true if the value has changed since the last changed() call. Side effect: clears the 'changed' flag, so a next call will return false. |
|
Compares two cPars by their value if they are numeric. This function can be used to sort cPar objects in a priority queue. |
|
Configures memory management for the void* pointer ('P') type. Similar to cLinkedList's configPointer() function.
|
|
Replaces the object value with its evaluation (a double). Implemented as something like setValue('D', this->doubleValue()). |
|
Returns value as double. The cPar type must be types long (L), double (D), function (F), Boolean (B), distribution (T), compiled expression (C) or expression (X). |
|
Creates and returns an exact copy of this object. See cObject for more details. Reimplemented from cObject. Reimplemented in cModulePar. |
|
Compares the stored values. The two objects must have the same type character and the same value to be equal. |
|
Calls the given function for contained object, if there's any. Reimplemented from cObject. |
|
Places the value in text format it into buffer buf which is maxlen characters long. |
|
Produces a one-line description of object contents into the buffer passed as argument. See cObject for more details. Reimplemented from cObject. |
|
Returns true if the parameter is of input type (the input flag is set). |
|
Returns true if the stored value is of a numeric type. |
|
Returns true if this object is redirected to another cPar. |
|
Returns value as long. The cPar type must be types long (L), double (D), Boolean (B), function (F), distribution (T), compiled expression (C) or expression (X). |
|
Serializes the object into a PVM or MPI send buffer. Used by the simulation kernel for parallel execution. See cObject for more details. Reimplemented from cObject. |
|
Deserializes the object from a PVM or MPI receive buffer Used by the simulation kernel for parallel execution. See cObject for more details. Reimplemented from cObject. |
|
Returns value as pointer to cObject. The cPar type must be pointer (O). |
|
Equivalent to boolValue(). |
|
Equivalent to objectValue(). |
|
Calls longValue() and converts the result to char. |
|
Equivalent to stringValue(). |
|
Equivalent to doubleValue(). |
|
Calls longValue() and converts the result to int. |
|
Equivalent to longValue(). |
|
Calls doubleValue() and converts the result to long double. |
|
Calls longValue() and converts the result to unsigned char. |
|
Calls longValue() and converts the result to unsigned int. |
|
Calls longValue() and converts the result to unsigned long. |
|
Equivalent to pointerValue(). |
|
Equivalent to setObjectValue(). |
|
Equivalent to setPointerValue(). |
|
Converts the argument to double, and calls setDoubleValue(). |
|
Equivalent to setDoubleValue(). |
|
Converts the argument to long, and calls setLongValue(). |
|
Equivalent to setLongValue(). |
|
Converts the argument to long, and calls setLongValue(). |
|
Converts the argument to long, and calls setLongValue(). |
|
Converts the argument to long, and calls setLongValue(). |
|
Converts the argument to long, and calls setLongValue(). |
|
Equivalent to setStringValue(). |
|
Equivalent to setBoolValue(). |
|
Assignment operator. The name member doesn't get copied; see cObject's operator=() for more details. The behavior with redirected cPar objects is the following. This function copies the contents of the other object (whether it is redirected or not) into this object, or, if this object is redirected, into the object this object refers to. This means that if you want to overwrite this very object (and not the one it points to), you have to use cancelRedirection() first. |
|
Returns value as a void * pointer. The cPar type must be pointer (P). |
|
Returns the prompt text or NULL. |
|
Reads the object value from the ini file or from the user. |
|
Returns NULL if the cPar's value is not redirected to another cPar; otherwise it returns the pointer of that cPar. This function and isRedirected() are the only ways to determine if an object is redirected or not (type() returns the type of the other cPar: 'D', 'L' etc). |
|
Sets the value to the given bool value. |
|
Sets the value to the given math function with four arguments. Every time the cPar's value is asked the function will be called with p1, p2, p3 and p4 as an arguments. |
|
Sets the value to the given math function with three arguments. Every time the cPar's value is asked the function will be called with p1, p2 and p3 as an arguments. |
|
Sets the value to the given math function with two arguments. Every time the cPar's value is asked the function will be called with p1 and p2 as an arguments. |
|
Sets the value to the given math function with one argument. Every time the cPar's value is asked the function will be called with p1 as an argument. |
|
Sets the value to the given math function with no arguments. Every time the cPar's value is asked the function will be called. |
|
Sets the value to the given compiled expression. Every time the cPar's value is asked, the evaluate() function of cDoubleExpression will be called. The passed object will be deallocated (using operator delete) from the cPar destructor, and also when the cPar object is assigned another value. |
|
Sets the value to the given expression. Every time the cPar's value is asked the expression will be evaluated. |
|
Sets the value to the given distribution. Every time the cPar's value is asked a random number produced by res.random() will be returned. |
|
Sets the value to the given double value. |
|
This function tries to interpret the argument text as a type typed value. type=='?' means that the type is to be auto-selected. On success, cPar is updated with the new value and true is returned, otherwise the function returns false. No error message is generated. |
|
Sets (ip=true) or clears (ip=false) the input flag. |
|
Sets the value to the given long value. |
|
Sets the value to the given object. Whether cPar will take the ownership of the object depends on the takeOwnership() flag (see cObject). |
|
Sets the value to the given pointer. The ownership of the block pointer to can be controlled using configPointer().
|
|
Sets the prompt text. |
|
Creates a redirection to another cPar. A cPar object can be set to stand for a value actually stored in another cPar object. This is called indirect or redirected value. When using redirection, every operation on the value (i.e. reading or changing it) will be actually done to the other cPar object. |
|
Sets the value to the given string value. The cPar will make its own copy of the string. NULL is also accepted and treated as an empty string. |
|
Returns value as const char *. Only for string (S) type. |
|
Returns type character. If the "real" type is 'I', it returns the type of the object it is redirected to (for example, 'D', 'L', etc.) |
|
Writes textual information about this object to the stream. See cObject for more details. Reimplemented from cObject. |