ECS_AttrValueList

- Attribute value list class

SYNOPSIS

#include <ECS/AttrValueList.hh>
class ECS_AttrValueList
{
  public:
	_ECSAIO_PRIVAPI ECS_AttrValueList();
	_ECSAIO_PRIVAPI ECS_AttrValueList(int32 length);
	_ECSAIO_PRIVAPI ECS_AttrValueList(ECS_AttrValueList const& other);
	ECS_AttrValueList const& operator=(ECS_AttrValueList const& other);
	_ECSAIO_PRIVAPI virtual ~ECS_AttrValueList();
	virtual ostream& print(ostream& os) const;
	_ECSAIO_PRIVAPI int32 size() const;
	_ECSAIO_PRIVAPI EV_AttrType typeOfNthItem(int32 index) const;
	_ECSAIO_PRIVAPI const int32* getInteger(int32 index) const;
	_ECSAIO_PRIVAPI const real64* getReal(int32 index) const;
	_ECSAIO_PRIVAPI const bool* getBool(int32 index) const;
	_ECSAIO_PRIVAPI const EV_Time* getTime(int32 index) const;
	_ECSAIO_PRIVAPI const EV_Duration* getDuration(int32 index) const;
	_ECSAIO_PRIVAPI const char* getString(int32 index) const;
	_ECSAIO_PRIVAPI const u_int32* getOid(int32 index) const;
	_ECSAIO_PRIVAPI int32 getOidLength(int32 index) const;
	_ECSAIO_PRIVAPI ECS_AttrValueList getList(int32 index) const;
	_ECSAIO_PRIVAPI ECS_AttrValueList getTuple(int32 index) const;
	_ECSAIO_PRIVAPI int32 setValue(int32 index, int32 value);
	_ECSAIO_PRIVAPI int32 setValue(int32 index, real64 value);
	_ECSAIO_PRIVAPI int32 setBooleanValue(int32 index, bool value);
	_ECSAIO_PRIVAPI int32 setValue(int32 index, const EV_Time& value);
	_ECSAIO_PRIVAPI int32 setValue
	  (
	    int32 index,
	    const EV_Duration& value
	  );
	_ECSAIO_PRIVAPI int32 setValue(int32 index, const char* value);
	_ECSAIO_PRIVAPI int32 setValue
	  (
	    int32 index,
	    const u_int32*& oid,
	    int32 oidLength
	  );
	_ECSAIO_PRIVAPI int32 setNullValue(int32 index);
	_ECSAIO_PRIVAPI int32 setListValue
	  (
	    int32 index,
	    ECS_AttrValueList& value
	  );
	_ECSAIO_PRIVAPI int32 setTupleValue
	  (
	    int32 index,
	    ECS_AttrValueList& value
	  );
  protected:
	ECS_AttrValueList(const EV_AttrValue& data);
	const EV_AttrValue* getData() const;
	void setData(EV_AttrValue* data);
};

CLASS TYPE

Concrete

AUDIENCE

ECS Application Developers

DESCRIPTION

This is an attribute value list class. Instances of this class can contain an ordered heterogeneous collection of data. This class provides type safe methods for access to that data.

The index of the first item in the list or tuple is 1.

The getValue methods require that the correct method for the type being accessed be called. This can be determined using the typeOfNthItem() method. All get methods return const pointers to internal storage. This storage must not be deleted. If the index is not valid or the item is not of the correct type 0 will be returned.

The setValue methods will determine the type of the item being set from the type of the value passed in. Where this is not possible (e.g. list or tuple), type-specific variants of the method must be used (e.g. setListvalue(), setTupleValue()).

If the index specified is beyond the end of the list, then items of type EV_NULL will be inserted in all the intermediate locations and the value will be inserted at the specified index.

Constructors and Destructors

_ECSAIO_PRIVAPI ECS_AttrValueList();
The default constructor

This constructs an empty list.

_ECSAIO_PRIVAPI ECS_AttrValueList(int32 length);
The tuple constructor

Note: Every element of the tuple must be initialized using setValue() calls. If this is not done, then attempts to copy or otherwise use the tuple will fail.

_ECSAIO_PRIVAPI ECS_AttrValueList(ECS_AttrValueList const& other);
The copy constructor
ECS_AttrValueList const& operator=(ECS_AttrValueList const& other);
The assignment operator
_ECSAIO_PRIVAPI virtual ~ECS_AttrValueList();
The destructor

Utility

virtual ostream& print(ostream& os) const;
Prints a textual representation of the class to the output stream specified viaos.

Access

These methods provide access to the contents of the list or tuple.

_ECSAIO_PRIVAPI int32 size() const;
Returns the number of elements in the list.
_ECSAIO_PRIVAPI EV_AttrType typeOfNthItem(int32 index) const;
Returns the type of the value at index. If the value of index does not indicate a valid element then a type of EV_NONE is returned.
_ECSAIO_PRIVAPI const int32* getInteger(int32 index) const;
Returns a pointer to the integer value at the specified index.

If the index is not valid or the value at the specified index is not an integer then 0 is returned.

_ECSAIO_PRIVAPI const real64* getReal(int32 index) const;
Returns the a pointer to the real value at the specified index.

If the index is not valid or the value at the specified index is not a real number then 0 is returned.

_ECSAIO_PRIVAPI const bool* getBool(int32 index) const;
Returns the a pointer to the Boolean value at the specified index.

If the index is not valid or the value at the specified index is not a Boolean then 0 is returned.

_ECSAIO_PRIVAPI const EV_Time* getTime(int32 index) const;
Returns the a pointer to the time value at the specified index.

If the index is not valid or the value at the specified index is not a time then 0 is returned.

_ECSAIO_PRIVAPI const EV_Duration* getDuration(int32 index) const;
Returns the a pointer to the duration value at the specified index.

If the index is not valid or the value at the specified index is not a duration then 0 is returned.

_ECSAIO_PRIVAPI const char* getString(int32 index) const;
Returns the a pointer to the string value at the specified index.

If the index is not valid or the value at the specified index is not a string then 0 is returned.

_ECSAIO_PRIVAPI const u_int32* getOid(int32 index) const;
Returns the a pointer to the object identifier at the specified index.

If the index is not valid or the value at the specified index is not an object identifier then 0 is returned.

The method getOidLength must be used to determine the number of elements in the oid.

_ECSAIO_PRIVAPI int32 getOidLength(int32 index) const;
Returns the length of the object identifier at the specified index.

If the index is not valid or the value at the specified index is not an object identifier then -1 is returned.

_ECSAIO_PRIVAPI ECS_AttrValueList getList(int32 index) const;
Returns the a pointer to the attribute value list at the specified index.

If the index is not valid or the value at the specified index is not a list then the list returned will have a size of 0.

_ECSAIO_PRIVAPI ECS_AttrValueList getTuple(int32 index) const;
Returns a pointer to the attribute value list at the specified index.

If the index is not valid or the value at the specified index is not a tuple then the list returned will have a size of 0.

_ECSAIO_PRIVAPI int32 setValue(int32 index, int32 value);
Sets the value at the specified index to the integer specified in value.
_ECSAIO_PRIVAPI int32 setValue(int32 index, real64 value);
Sets the value at the specified index to the real number specified in value.
_ECSAIO_PRIVAPI int32 setBooleanValue(int32 index, bool value);
Sets the value at the specified index to the Boolean value specified in value.
_ECSAIO_PRIVAPI int32 setValue(int32 index, const EV_Time& value);
Sets the value at the specified index to the time specified in value.
_ECSAIO_PRIVAPI int32 setValue(int32 index, const EV_Duration& value);
Sets the value at the specified index to the duration specified in value.
_ECSAIO_PRIVAPI int32 setValue(int32 index, const char* value);
Sets the value at the specified index to the character string specified in value.
_ECSAIO_PRIVAPI int32 setValue
(
int32 index,
const u_int32*& oid,
int32 oidLength
);
Sets the value at the specified index to the oid specified in value.
_ECSAIO_PRIVAPI int32 setNullValue(int32 index);
Sets the value at the specified index to a null value
_ECSAIO_PRIVAPI int32 setListValue
(
int32 index,
ECS_AttrValueList& value
);
Sets the value at the specified index to a copy of the list specified in value.
_ECSAIO_PRIVAPI int32 setTupleValue
(
int32 index,
ECS_AttrValueList& value
);
Sets the value at the specified index to a copy of the tuple specified in value.

NOTES

None

SEE ALSO

None

LIBRARY

ECS

VERSION

1.5

DATE RELEASED

1998/04/03

AUTHOR(S)

Hewlett-Packard Company

COPYRIGHT

Copyright (c) 1997 Hewlett-Packard Company. All Rights Reserved.