classic_gov_cca_KeyValuePort(3)

classic::gov::cca::KeyValuePort(3) 'Classic' CCA c++ binding (ccaffeine-only) classic::gov::cca::KeyValuePort(3)

NAME

classic::gov::cca::KeyValuePort -

UNADOPTED Standard: KeyValuePort for use decorating components with strings external to the implementation of the component.

SYNOPSIS

#include <KeyValuePort.h>

Inherits classic::gov::cca::Port.

Public Member Functions


virtual ~KeyValuePort ()
obligatory vdtor virtual const ::std::string getValue (const ::std::string &key) CLASSIC_CCA_PURE
Return the value of the requested key. virtual void setValue (const ::std::string &key, const ::std::string &value) CLASSIC_CCA_PURE
Store the value for the given key, possibly replacing previous. virtual const ::std::string remove (const ::std::string &key) CLASSIC_CCA_PURE
Delete a key and associated value. virtual ::std::vector
< ::std::string > getKeys () CLASSIC_CCA_PURE"
Return NULL-terminated list of all known keys.

Detailed Description

UNADOPTED Standard: KeyValuePort for use decorating components with strings external to the implementation of the component.

DEPRECATED: do not use. See ComponentPropertiesService in newer cca spec. Alternative, misleading names for this would be


EnvironmentPort (which has too many global connotations)
RegistryPort (which has way too many global connotations)
PropertiesPort (which will be confused with port properties and java Propertie s...).
ParameterPort (which is already taken in the CCAFFEINE framework.).

This class is deliberately simpler than java Properties, for compatibility with basic c++ implementations.

In a reasonable framework, each component will just be automatically decorated with one of these if that framework exposes the component to external agents.

The following code fragment illustrates the use of the KeyValuePort by a framework Services implementation to decorate every component with a properties for the frameworks use.


int err;
err = addProvidesPort(kvp,createPortInfo('cProps','gov.cca.ComponentProperties',0));
assert(!err); // cannot fail, due to other framework design features

The following code fragment illustrates the use of the port as a service by a component that wants to know/modify what the framework says about it.


setServices(Services *s) {
int err;
err= s->registerUsesPort(kvp,createPortInfo('sProps','gov.cca.ComponentPropertiesService',0));
assert(!err); // cannot fail, if we adopt it as a well known service.
Port *p = getPort('sProps');
KeyValuePort *kvp = dynamic_cast<KeyValuePort *>(p);
kvp->setValue('gov.babel.guiApplet.URL',
'http://z.ca.sandia.gov/cgi-bin/babel.asp?component=gov.sandia.viz');
s->releasePort('sProps');
s->unregisterUsesPort('sProps');
}

Author:

Ben Allan, 8/5/2000, Sandia National Laboratories.

Version:

Id:

KeyValuePort.h,v 1.5 2004/02/19 01:22:00 renata Exp

Constructor & Destructor Documentation

virtual classic::gov::cca::KeyValuePort::~KeyValuePort () [inline, virtual]

obligatory vdtor

{}

Member Function Documentation

virtual const ::std::string classic::gov::cca::KeyValuePort::getValue (const ::std::string &key) [virtual]

Return the value of the requested key. If key unknown, returns null. The value returned is owned by the port and should not be destroyed.

virtual void classic::gov::cca::KeyValuePort::setValue (const ::std::string &key, const ::std::string &value) [virtual]

Store the value for the given key, possibly replacing previous. The pointers to key, value are not kept -- just copied. Keys cannot contain the whitespace or '='. Returns nonzero on bogus input or other error.

virtual const ::std::string classic::gov::cca::KeyValuePort::remove (const ::std::string &key) [virtual]

Delete a key and associated value. The deleted value is returned.

virtual ::std::vector< ::std::string > classic::gov::cca::KeyValuePort::getKeys ()

Return NULL-terminated list of all known keys. May be the empty vector.

Author

Generated automatically by Doxygen for 'Classic' CCA c++ binding (ccaffeine-only) from the source code.

Tue Nov 12 2013 Version 0.5.7