Server
API Reference Guide
Product Documentation:

Rogue Wave Server
Documentation Home
List of all members

This class encapsulates the value of the runtime attributes attached to representation objects. More...

#include <ilserver/mvvalue.h>

Public Member Functions

Constructors/Destructors
 IlsMvValue ()
 This default constructor creates an instance of IlsMvValue that contains no value.
 
 IlsMvValue (IlsBoolean val)
 This constructor creates an instance of IlsMvValue that contains the IlsBoolean value val.
 
 IlsMvValue (char val)
 This constructor creates an instance of IlsMvValue that contains the value val of type char.
 
 IlsMvValue (int val)
 This constructor creates an instance of IlsMvValue that contains the integer val, which was first converted to a long integer.
 
 IlsMvValue (short val)
 This constructor creates an instance of IlsMvValue that contains the short integer val, which was first converted to a long integer.
 
 IlsMvValue (long val)
 This constructor creates an instance of IlsMvValue that contains the value val of type long.
 
 IlsMvValue (float val)
 This constructor creates an instance of IlsMvValue that contains the value val of type float.
 
 IlsMvValue (double val)
 This constructor creates an instance of IlsMvValue that contains the value val of type double.
 
 IlsMvValue (const char *val)
 This constructor creates an instance of IlsMvValue that contains an IlsString whose value is a copy of the string provided as its argument.
 
 IlsMvValue (const IlsString &sharedStr)
 This constructor creates an instance of IlsMvValue that contains an IlsString whose value is shared with sharedStr.
 
 IlsMvValue (IlsSvRef)
 This constructor creates an instance of IlsMvValue that contains a copy of the val object, which references a server object.
 
 IlsMvValue (IlsMvRef val)
 This constructor creates an instance of IlsMvValue that contains a copy of the val object, which references a representation object.
 
 IlsMvValue (const IlsMvUserType &val)
 This constructor creates an instance of IlsMvValue that contains a pointer to the user value whose real type derives from IlsMvUserType.
 
 IlsMvValue (const IlsMvValue &val)
 Copy constructor. More...
 
 IlsMvValue (const IlsMvFile &val)
 This constructor creates an instance of IlsMvValue that contains a copy of the val object, which represents a file.
 
 ~IlsMvValue ()
 If the object contains a pointer to an IlsMvUserType, the destructor of the pointed object is invoked.
 
Assignment Operators
IlsMvValueoperator= (const IlsMvValue &val)
 This operator assigns the value val to the object. More...
 
IlsMvValueoperator= (IlsBoolean val)
 This operator assigns the IlsBoolean value val to the value contained in the object.
 
IlsMvValueoperator= (char val)
 This operator assigns the value val of type char to the value contained in the object.
 
IlsMvValueoperator= (short val)
 This operator assigns the value val of type short to the value contained in the object after it was converted to a long integer.
 
IlsMvValueoperator= (int val)
 This operator assigns the value val of type int to the value contained in the object after it was converted to a long integer.
 
IlsMvValueoperator= (long val)
 This operator assigns the value val of type long to the value contained in the object.
 
IlsMvValueoperator= (float val)
 This operator assigns the value val of type float to the value contained in the object.
 
IlsMvValueoperator= (double val)
 This operator assigns the value val of type double to the value contained in the object.
 
IlsMvValueoperator= (const IlsString &)
 This operator assigns the string passed as its argument to the value contained in the object.
 
IlsMvValueoperator= (const char *)
 This operator assigns a copy of the string passed as its parameter to the value contained in the object.
 
IlsMvValueoperator= (IlsSvRef)
 This operator assigns the server object reference passed as its parameter to the value contained in the object.
 
IlsMvValueoperator= (IlsMvRef)
 This operator assigns the object reference passed as its parameter to the value contained in the object.
 
IlsMvValueoperator= (const IlsMvUserType &)
 This operator assigns the pointer to the value contained in the object.
 
IlsMvValueoperator= (const IlsMvFile &)
 This operator assigns the file passed as its argument to the value contained in the object.
 
Conversion Operators
 operator IlsBoolean () const
 Returns the result of asBoolean(IlsFalse, IlsFalse).
 
 operator char () const
 Returns the result of asChar(IlsFalse, 0).
 
 operator short () const
 Returns the result of asLong(IlsFalse, 0) after it was converted to a short.
 
 operator int () const
 Returns the result of asLong(IlsFalse, 0) after it was converted to an integer.
 
 operator long () const
 Returns the result of asLong(IlsFalse, 0).
 
 operator float () const
 Returns the result of asFloat(IlsFalse, 0.0).
 
 operator double () const
 Returns the result of asDouble(IlsFalse, 0.0).
 
 operator IlsString () const
 Returns the result of asString(IlsFalse, 0).
 
 operator IlsMvRef () const
 Returns the result of asObjectRef(IlsFalse, 0).
 
 operator IlsSvRef () const
 Returns the result of the conversion operator asSvObjectRef().
 
 operator IlsMvFile () const
 Returns the result of the conversion operator asFile(IlsFalse, 0).
 
 operator IlsMvUserType * () const
 Returns the pointer IlsMvUserType* if the value is of that type. Otherwise, it returns 0.
 
Controlled Conversion
IlsBoolean asBoolean (IlsBoolean direct=IlsFalse, IlsBoolean defaultVal=0) const
 Returns the value contained in the object if that value is a IlsBoolean type. More...
 
char asChar (IlsBoolean direct=IlsFalse, char defaultVal=0) const
 Returns the value contained in the object if that value is a character. More...
 
long asLong (IlsBoolean direct=IlsFalse, long defaultVal=0) const
 Returns the value contained in the object if that value is a long integer. More...
 
float asFloat (IlsBoolean direct=IlsFalse, float defaultVal=0.0) const
 Returns the value contained in the object if that value is of type float. More...
 
double asDouble (IlsBoolean direct=IlsFalse, double defaultVal=0.0) const
 Returns the value contained in the object if that value is of type double. More...
 
IlsString asString (IlsBoolean direct=IlsFalse, IlsString defaultVal=(char *) 0) const
 Returns the value contained in the object if that value is a character string. More...
 
IlsMvRef asObjectRef (IlsBoolean direct=IlsFalse, IlsMvRef defaultVal=IlsMvRef()) const
 Returns the value contained in the object if that value is of type IlsMvRef. More...
 
IlsMvFile asFile (IlsBoolean direct=IlsFalse, IlsMvFile defaultVal=IlsMvFile()) const
 Returns the value contained in the object if that value is of type IlsMvFile. More...
 
IlsSvRef asSvObjectRef (IlsBoolean direct=IlsFalse, IlsSvRef defaultVal=IlsSvRef()) const
 Returns the server object reference contained in the object if that value is of type IlsSvRef. More...
 
Comparison Operators
IlsBoolean operator== (const IlsMvValue &) const
 Compares whether the value contained in the current object is equal to the value contained in the object passed as its parameter once this value has been converted to the current type. More...
 
IlsBoolean operator!= (const IlsMvValue &) const
 Returns the inverse of the equality operator documented above.
 
IlsBoolean operator< (const IlsMvValue &) const
 Compares whether the value contained in the current object is smaller than the value contained in the object passed as its parameter once converted to the current type. More...
 
IlsBoolean operator> (const IlsMvValue &) const
 Compares whether the value contained in the current object is greater than the value contained in the object passed as its parameter once that value has been converted to the current type. More...
 
IlsBoolean operator<= (const IlsMvValue &) const
 Compares whether the value contained in the current object is smaller than or equal to the value contained in the object passed as its parameter once that value has been converted to the current type. More...
 
IlsBoolean operator>= (const IlsMvValue &) const
 Compares whether the value contained in the current object is greater than or equal to the value contained in the object passed as its parameter once converted to the current type. More...
 
IlsBoolean operator! () const
 Negation operator. More...
 
Accessors and Tests
IlsBoolean isVoid () const
 Returns IlsTrue if there is no value contained.
 
IlsBoolean isBoolean () const
 Returns IlsTrue if no value is contained in the object.
 
IlsBoolean isChar () const
 Returns IlsTrue if the value contained in the object is of type char.
 
IlsBoolean isLong () const
 Returns IlsTrue if the value contained in the object is of type long.
 
IlsBoolean isFloat () const
 Returns IlsTrue if the value contained in the object is of type float.
 
IlsBoolean isDouble () const
 Returns IlsTrue if the value contained in the object is of type double.
 
IlsBoolean isString () const
 Returns IlsTrue if the value contained in the object is a character string.
 
IlsBoolean isSvRef () const
 Returns IlsTrue if the value contained in the object is a reference to a server object.
 
IlsBoolean isRef () const
 Returns IlsTrue if the value contained in the object is a reference to a representation object.
 
IlsBoolean isHRef () const
 Returns IlsTrue if the value contained in the object is a hyper reference to a representation object.
 
IlsBoolean isUserValue () const
 Returns IlsTrue if the value contained in the object is a pointer to an object that derives from IlsMvUserType.
 
IlsBoolean isFile () const
 Returns IlsTrue if the value contained in the object is a file.
 
IlsMvDataType getType () const
 Returns the type of the value contained in the object.
 

Friends

Insertion and Extraction Operators
ILSIMPORT_MVSVR IlsMvMessageoperator<< (IlsMvMessage &, const IlsMvValue &)
 Inserts an IlsMvValue into an IlsMvMessage used to exchange information between the server and the application components. More...
 
ILSIMPORT_MVSVR IlsMvMessageoperator>> (IlsMvMessage &, IlsMvValue &)
 Extracts an IlsMvValue from an IlsMvMessage. More...
 

Detailed Description

This class encapsulates the value of the runtime attributes attached to representation objects.

Library: mvserver
and mvcomp

The Rogue Wave Server internal protocol uses this class to transmit attribute values between an object server and an application component. Values of type IlsMvValue are also passed as parameters to the virtual callbacks to member functions in class IlsRpObject and to the function IlsMvComponent::execUserAsyncCallback().

See also
IlsMvComponent, IlsMvUserType, IlsRpAttrModel, IlsRpObject.

Constructor & Destructor Documentation

◆ IlsMvValue()

IlsMvValue::IlsMvValue ( const IlsMvValue val)

Copy constructor.

If the object contains a pointer to an IlsMvUserType, the IlsMvUserType instance is shared between the two IlsMvValues and its reference counter is increased.

Member Function Documentation

◆ asBoolean()

IlsBoolean IlsMvValue::asBoolean ( IlsBoolean  direct = IlsFalse,
IlsBoolean  defaultVal = 0 
) const

Returns the value contained in the object if that value is a IlsBoolean type.

Otherwise, it returns defaultVal if the direct argument is set to IlsTrue. If this argument is set to IlsFalse, the operator returns IlsTrue if:

  • The value is numeric and different from 0.
  • The value is a character different from 0.
  • The value is of type IlsAny and different from 0.
  • The value is of type IlsMvRef and different from 0.
  • The value is a non-null character string.

If the value is of type IlsMvUserType*, it returns:

  • defaultVal if there is no value contained in the object.
  • the result of the virtual function IlsMvUserType::asBoolean() applied to the pointed object.

◆ asChar()

char IlsMvValue::asChar ( IlsBoolean  direct = IlsFalse,
char  defaultVal = 0 
) const

Returns the value contained in the object if that value is a character.

Otherwise, if the direct argument is set to IlsTrue, it returns defaultVal. If this argument is set to IlsFalse, the operator returns:

  • the result of the conversion of the value to a char if it is a Boolean or a numeric value.
  • the first character in the string if the value is a non-null and non-empty character string.

If the value is of type IlsMvUserType*, it returns:

  • defaultVal if there is no value contained in the object.
  • the result of the virtual function IlsMvUserType::asChar applied to the pointed object.
  • Otherwise, it returns defaultVal.

◆ asDouble()

double IlsMvValue::asDouble ( IlsBoolean  direct = IlsFalse,
double  defaultVal = 0.0 
) const

Returns the value contained in the object if that value is of type double.

Otherwise, if the direct argument is set to IlsTrue, it returns defaultVal. If this argument is set to IlsFalse, the operator returns:

  • the result of the conversion of the value to float if it is a Boolean, a character or a numeric value.
  • the result of the extraction of a double precision floating point value if the value is a non-null and non-empty character string.

If the value is of type IlsMvUserType*, it returns:

  • defaultVal if there is no value contained in the object.
  • the result of the virtual function IlsMvUserType::asDouble applied to the pointed object.
  • Otherwise, it returns defaultVal.

◆ asFile()

IlsMvFile IlsMvValue::asFile ( IlsBoolean  direct = IlsFalse,
IlsMvFile  defaultVal = IlsMvFile() 
) const

Returns the value contained in the object if that value is of type IlsMvFile.

The value returned by this conversion operator varies as follows:

  • The operator returns the value contained in the object if that value is of type IlsMvFile.
  • If that value is not of type IlsMvFile, the operator returns:
    • defaultVal if the direct argument is set to IlsTrue, or
    • one of the following values if the direct argument is set to IlsFalse:
      • a new instance of IlsMvFile if the value contained in the object is a string, the contents of the string are passed to the constructor of IlsMvFile.
      • defaultVal in any other case.

◆ asFloat()

float IlsMvValue::asFloat ( IlsBoolean  direct = IlsFalse,
float  defaultVal = 0.0 
) const

Returns the value contained in the object if that value is of type float.

Otherwise, if the direct argument is set to IlsTrue, it returns defaultVal. If this argument is set to IlsFalse, the operator returns:

  • the result of the conversion of the value to float if it is a Boolean, a character or a numeric value.
  • the result of the extraction of a floating point value from the sting if the value is a non-null and non-empty character string.

If the value is of type IlsMvUserType*, it returns:

  • defaultVal if there is no value contained in the object.
  • the result of the virtual function IlsMvUserType::asFloat applied to the pointed object.
  • Otherwise, it returns defaultVal.

◆ asLong()

long IlsMvValue::asLong ( IlsBoolean  direct = IlsFalse,
long  defaultVal = 0 
) const

Returns the value contained in the object if that value is a long integer.

Otherwise, if the direct argument is set to IlsTrue, it returns defaultVal. If this argument is set to IlsFalse, the operator returns:

  • the result of the conversion of the value to a long if it is a Boolean or numeric value to a character.
  • the result of the extraction of a decimal value from the string if the value is a non-null and non-empty character string.

If the value is of type IlsMvUserType*, it returns:

  • defaultVal if there is no value contained in the object.
  • the result of the virtual function IlsMvUserType::asLong applied to the pointed object.
  • Otherwise, it returns defaultVal.

◆ asObjectRef()

IlsMvRef IlsMvValue::asObjectRef ( IlsBoolean  direct = IlsFalse,
IlsMvRef  defaultVal = IlsMvRef() 
) const

Returns the value contained in the object if that value is of type IlsMvRef.

Otherwise, if the direct argument is set to IlsTrue, it returns defaultVal. If this argument is set to IlsFalse, the operator returns:

  • the result of the virtual function IlsMvUserType::asObjectRef() applied to the pointed object.
  • defaultVal in any other case and especially if there is no value contained in the object.

◆ asString()

IlsString IlsMvValue::asString ( IlsBoolean  direct = IlsFalse,
IlsString  defaultVal = (char *) 0 
) const

Returns the value contained in the object if that value is a character string.

Otherwise, if the direct argument is set to IlsTrue, it returns defaultVal. If this argument is set to IlsFalse, the operator returns:

  • if the value is Boolean, IlsTrue or IlsFalse depending on the value;
  • the result of the insertion of the value into a string using sprintf() with the following formats:
    • d if it is an integer,
    • l if it a long,
    • f if it is a float or a double,
    • xl if it is an IlsAny,
  • if the value is a character, a string containing only this character;
  • If the value is of type IlsMvUserType, it returns:
    • defaultVal if there is no value contained in the object;
    • the result of the virtual function IlsMvUserType::asString() applied to the pointed object.
  • Otherwise, it returns defaultVal.

◆ asSvObjectRef()

IlsSvRef IlsMvValue::asSvObjectRef ( IlsBoolean  direct = IlsFalse,
IlsSvRef  defaultVal = IlsSvRef() 
) const

Returns the server object reference contained in the object if that value is of type IlsSvRef.

Otherwise, if the direct argument is set to IlsTrue, it returns defaultVal. If this argument is set to IlsFalse, the operator returns:

  • the result of the virtual function IlsMvUserType::asObjectRef() applied to the pointed object.
  • defaultVal in any other case and especially if there is no value contained in the object.

◆ operator!()

IlsBoolean IlsMvValue::operator! ( ) const

Negation operator.

This operator returns IlsTrue if the value contained in the object is different from 0. If the value is of type IlsMvUserType*, the test returns IlsFalse if the pointer is null. Otherwise, it returns the result of the operator IlsMvUserType::operator!() that is applied to the pointed object.

◆ operator<()

IlsBoolean IlsMvValue::operator< ( const IlsMvValue ) const

Compares whether the value contained in the current object is smaller than the value contained in the object passed as its parameter once converted to the current type.

Character strings are compared according to the alphabetical order.

If both values are of type IlsMvUserType*, the test returns IlsTrue if both pointers are null or IlsFalse if one of the two pointers is null. Otherwise, it returns the result of the operator IlsMvUserType::operator<() that is applied to the pointed objects.

◆ operator<=()

IlsBoolean IlsMvValue::operator<= ( const IlsMvValue ) const

Compares whether the value contained in the current object is smaller than or equal to the value contained in the object passed as its parameter once that value has been converted to the current type.

Character strings are compared according to the alphabetical order.

If both values are of type IlsMvUserType*, the test returns IlsTrue if both pointers are null or IlsFalse if one of the two pointers is null. Otherwise, it returns the result of the operator IlsMvUserType::operator <=() that is applied to the pointed objects.

◆ operator=()

IlsMvValue& IlsMvValue::operator= ( const IlsMvValue val)

This operator assigns the value val to the object.

If the object contains a pointer to an IlsMvUserType, the IlsMvUserType instance is shared between the two IlsMvValues and its reference counter is increased.

◆ operator==()

IlsBoolean IlsMvValue::operator== ( const IlsMvValue ) const

Compares whether the value contained in the current object is equal to the value contained in the object passed as its parameter once this value has been converted to the current type.

If both values are of type IlsMvUserType*, the test returns IlsTrue if both pointers are null or IlsFalse if one of the two pointers is null. Otherwise, it returns the result of the operator IlsMvUserType::operator==() that is applied to the pointed objects.

◆ operator>()

IlsBoolean IlsMvValue::operator> ( const IlsMvValue ) const

Compares whether the value contained in the current object is greater than the value contained in the object passed as its parameter once that value has been converted to the current type.

Character strings are compared according to the alphabetical order.

If both values are of type IlsMvUserType*, the test returns IlsTrue if both pointers are null or IlsFalse if one of the two pointers is null. Otherwise, it returns the result of the operator IlsMvUserType::operator>() that is applied to the pointed objects.

◆ operator>=()

IlsBoolean IlsMvValue::operator>= ( const IlsMvValue ) const

Compares whether the value contained in the current object is greater than or equal to the value contained in the object passed as its parameter once converted to the current type.

Character strings are compared according to the alphabetical order.

If both values are of type IlsMvUserType*, the test returns IlsTrue if both pointers are null or IlsFalse if one of the two pointers is null. Otherwise, it returns the result of the operator IlsMvUserType::operator> =() that is applied to the pointed objects.

Friends And Related Function Documentation

◆ operator<<

ILSIMPORT_MVSVR IlsMvMessage& operator<< ( IlsMvMessage ,
const IlsMvValue  
)
friend

Inserts an IlsMvValue into an IlsMvMessage used to exchange information between the server and the application components.

If the value contained in an IlsMvValue is an instance of a subclass of IlsMvUserType, the virtual member function IlsMvUserType::ilsEncode() is executed to encode this instance.

◆ operator>>

ILSIMPORT_MVSVR IlsMvMessage& operator>> ( IlsMvMessage ,
IlsMvValue  
)
friend

Extracts an IlsMvValue from an IlsMvMessage.

If the value contained in an IlsMvValue is an instance of a subclass of IlsMvUserType, the static member function IlsMvUserType::ilsDecode() is executed to encode this instance.