ConnectionFramework Class Reference

#include <ConnectionFramework.h>

Inheritance diagram for ConnectionFramework:

Inheritance graph
[legend]
Collaboration diagram for ConnectionFramework:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 ConnectionFramework (int64_t fComm, bool useComm)
 ConnectionFramework (int64_t fComm, bool useComm, int &status)
int setDebug (bool tf)
void initStaticFactory (StaticFactory *sf)
ComponentFactory_shared getBaseComponentFactory ()
std::vector
< ::ccafeopq::ComponentID_shared > 
getComponentsThatUse (const std::string &portType)
std::vector
< ::ccafeopq::ComponentID_shared > 
getComponentsThatProvide (const std::string &portType)
void putFrameItem (std::string s, void *item)
void * getFrameItem (std::string s)
std::vector< std::string > getComponentClasses ()
ComponentInfo_shared instantiate (char *className, char *instanceName)
ComponentInfo_shared instantiate (const ::std::string &className, const ::std::string &instanceName,::ccafeopq::TypeMap_shared tm)
ComponentInfo_shared addExternalComponent (const ::std::string &className, const ::std::string &instanceName,::ccafeopq::TypeMap_shared tm)
void removeExternalComponent (const ::std::string &instanceName)
void removeInstantiatedComponent (const std::string &instanceName)
int connect (const char *fromName, const char *fromPortName, const char *toName, const char *toPortName)
int directConnect (const char *fromName, const char *fromPortName, const char *toName, const char *toPortName)
int disconnect (const char *fromName, const char *fromPortName, const char *toName, const char *toPortName)
int disconnect (const ::std::string &fromName, const ::std::string &fromPortName, const ::std::string &toName, const ::std::string &toPortName)
int disconnect (const ::ccafeopq::ComponentID_shared fromC, const ::std::string &fromPortName, const ::ccafeopq::ComponentID_shared toC, const ::std::string &toPortName)
int disconnectAll (const char *componentInstanceName)
int directDisconnect (const char *fromName, const char *fromPortName, const char *toName, const char *toPortName)
std::vector< std::string > getComponentProperties (const std::string &instanceName)
const std::string getComponentProperty (const std::string &instanceName, const std::string &key)
void setComponentProperty (const std::string &instanceName, const std::string &key, const std::string &value)
int goOne (const char *instanceName, const char *portInstanceName)
char * getConfiguration (const char *instanceName, const char *portInstanceName)
char * getConfiguration (const char *instanceName, const char *portInstanceName, const char *fieldName)
char * setConfiguration (const char *instanceName, const char *portInstanceName, const char *fieldName, const char *configuration)
virtual void componentChanged (ComponentChangedEvent *evt)
void addXCmptFactory (XCmptFactory_shared xs)
virtual void addComponentChangedListener (ComponentChangedListener *l)
::std::vector< ::std::string > instanceNames ()
::std::map< ::std::string,::ccafe::CmpBox_shared > getInstances ()
::ccafeopq::ConnectionID_shared getConnectionID (const char *uc, const char *up, const char *pc, const char *pp)
::ccafeopq::TypeMap_shared getConnectionProperties (::ccafeopq::ConnectionID_shared &conn)
void setConnectionProperties (::ccafeopq::ConnectionID_shared &connID,::ccafeopq::TypeMap_shared &map) throw ( ::ccafeopq::Exception )
::std::vector
< ::ccafeopq::ConnectionID_shared > 
getConnectionIDs (::std::vector< ::ccafeopq::ComponentID_shared > &clist)
::std::vector
< ::ccafeopq::ConnectionID_shared > 
getConnectionIDs (const ::std::string &userName, const ::std::string &usingPortName, const ::std::string &providerName, const ::std::string &providingPortName) throw (::ccafeopq::Exception )
void setPortProperties (::ccafeopq::ComponentID_shared &cid, const ::std::string &portname,::ccafeopq::TypeMap_shared &map) throw (::ccafeopq::Exception )
int setPortProperty (const ::std::string &instanceName, const std::string &portName, const std::string &key, const std::string &valueType, const std::string &value)
::ccafeopq::TypeMap_shared getPortProperties (::ccafeopq::ComponentID_shared &cid, const ::std::string &portname) throw ( ::ccafeopq::Exception )
::ccafeopq::TypeMap_shared getPortProperties (const ::std::string &cName, const ::std::string &portname) throw ()
::ccafeopq::TypeMap_shared getComponentPropertyTypeMap (const ::std::string &instanceName)
bool setComponentPropertyTypeMap (const ::std::string &instanceName,::ccafeopq::TypeMap_shared &tm)
virtual int setRepositoryPath (char **argv, int argc)
virtual int setRepositoryPath (const std::vector< std::string > &p)
virtual std::vector< std::string > getRepositoryPath ()
virtual std::vector< std::string > getRepositoryClasses ()
virtual int loadRepositoryClass (const char *className, bool global, bool lazy)
virtual void refreshPallet ()
virtual int loadPorts (const std::string &libPathName)

Private Member Functions

void nullPortMessage (std::string name, ccafeopq::ExceptionType et)
::ccafe::CmpBox_shared getInstance (const ::std::string &name)
GizzardgetGizzard (const char *instanceName)
GizzardgetGizzard (const ::std::string &instanceName)
void initInternals (int64_t fComm, bool useComm)
std::string deriveConfigurationString (const ::std::string &prefix,::ccafeopq::TypeMap_shared tm)
std::string deriveConfigurationString (const ::std::string &prefix,::ccafeopq::TypeMap_shared tm, const ::std::string &key)
int insertConfigurationString (::ccafeopq::TypeMap_shared pptm, const std::string &fieldName, const std::string &configuration)

Private Attributes

Gizzardwall
ComponentFactory_shared ocf
std::vector< std::string > pallet
::std::map< ::std::string,::ccafe::CmpBox_shared > instances
std::vector
< ComponentChangedListener * > 
cmptChgLsnrs
OpqServiceRegistry * osr
OpqBuilderServiceobs
OpqGUIService * ogs
DefaultJPrintfPortjpfp
ccafeopq::event::ContextEventManager * cem
std::vector< XCmptFactory_shared > xCmptFactories
bool debug
bool instantiatingComponent
std::map< std::string, void * > frameItems
int64_t fortranMPIComm
bool hasComm

Friends

class OpqBuilderService
class ccafe::Frame


Detailed Description

Our simple-minded implementation of a container for components that lets one make and manage connections. Memory model rules:

ConnectionFramework owns all the cmpboxes.

CmpBox owns the gizzard in it until the framework wants it back, and also the Component pointer.

The gizzard owns the Port-related data containers.

The gizzard is the source for all shared componentID and TypeMap.

The userportdata connection list owns the connectionids, and the connectionframework/builderservice list is full of elements originated in the gizzard and stored in the connection list. Userportdata creates all connectionid.

Port pointers are kept in ProviderPortData as the ports are originated by a component addProvidesPort. Port pointers are kept only in ConnectionID data when they are from the framework instead of another component, and they are cached in the ConnectionID when connection is made from a ProviderPortData. This is exactly equivalent to the old gizzard::pPort/uPort vector usage.

PortInfo is no longer used in the kernel for anything -- it's just a wrapper we have some legacy support for.


Constructor & Destructor Documentation

ConnectionFramework::ConnectionFramework ( int64_t  fComm,
bool  useComm 
)

create a framework

ConnectionFramework::ConnectionFramework ( int64_t  fComm,
bool  useComm,
int &  status 
)

create a framework and tell nicely if it fails.


Member Function Documentation

void ConnectionFramework::nullPortMessage ( std::string  name,
ccafeopq::ExceptionType  et 
) [private]

write something about et for failed getport named.

::ccafe::CmpBox_shared ConnectionFramework::getInstance ( const ::std::string &  name  )  [private]

fetch the named cmpbox, if it exists. _shared item returned may be the null item. This function avoids the map side-effect of creating null _shared items which direct [] lookup has.

Gizzard* ConnectionFramework::getGizzard ( const char *  instanceName  )  [private]

Lookup the gizzard of the named component instance.

void ConnectionFramework::initStaticFactory ( StaticFactory sf  ) 

finds the hidden ComponentFactory instance within the frame and exposes its ComponentRegistrar interface to the sf given. sf will never be cached by the frame.

ComponentFactory_shared ConnectionFramework::getBaseComponentFactory (  ) 

return the ur-factory that comes with the framework.

void ConnectionFramework::putFrameItem ( std::string  s,
void *  item 
)

add an arbitrary piece of state scoped with the frame.

std::vector< std::string > ConnectionFramework::getComponentClasses (  ) 

Lists the pallet of components that are available to be instantiated.

ComponentInfo_shared ConnectionFramework::instantiate ( char *  className,
char *  instanceName 
)

Takes a component from the pallet (i.e. list of available components) and instantiates it, placing it in the Arena, and making it available for connections to other components.

ComponentInfo_shared ConnectionFramework::addExternalComponent ( const ::std::string &  className,
const ::std::string &  instanceName,
::ccafeopq::TypeMap_shared  tm 
)

create a component with no Component interface to keep track of.

void ConnectionFramework::removeExternalComponent ( const ::std::string &  instanceName  ) 

remove a component added with addExternalComponent.

void ConnectionFramework::removeInstantiatedComponent ( const std::string &  instanceName  ) 

Remove an already instantiated component from the Arena.

int ConnectionFramework::connect ( const char *  fromName,
const char *  fromPortName,
const char *  toName,
const char *  toPortName 
)

============== component wiring ========= Make a connection from the providing component <fromName> with the provides port <fromPortName> to the using component <toName> with the uses port <toPortName>.

int ConnectionFramework::directConnect ( const char *  fromName,
const char *  fromPortName,
const char *  toName,
const char *  toPortName 
)

Make a connection from the providing component <fromName> with the provides port <fromPortName> to the using component <toName> with the uses port <toPortName>.

int ConnectionFramework::disconnect ( const char *  fromName,
const char *  fromPortName,
const char *  toName,
const char *  toPortName 
)

Break a connection from the providing component <fromName> with the provides port <fromPortName> to the using component <toName> with the uses port <toPortName>. Return 0 if ok, -1 if there's a problem, -2 if there's just bogus input.

int ConnectionFramework::disconnectAll ( const char *  componentInstanceName  ) 

Eliminate all connections to and from this component.

int ConnectionFramework::directDisconnect ( const char *  fromName,
const char *  fromPortName,
const char *  toName,
const char *  toPortName 
)

Break a connection from the providing component <fromName> with the provides port <fromPortName> to the using component <toName> with the uses port <toPortName>.

std::vector< std::string> ConnectionFramework::getComponentProperties ( const std::string &  instanceName  ) 

Return the list of key/value pairs. DEPRECATED. see getComponentPropertyTypeMap.

const std::string ConnectionFramework::getComponentProperty ( const std::string &  instanceName,
const std::string &  key 
)

Return the value corresponding to key, or NULL if key unknown. DEPRECATED. see getComponentPropertyTypeMap.

void ConnectionFramework::setComponentProperty ( const std::string &  instanceName,
const std::string &  key,
const std::string &  value 
)

Set the value corresponding to key. Returns nonzero if an error occurs. key/value given are copied not kept. DEPRECATED. see setComponentPropertyTypeMap.

int ConnectionFramework::goOne ( const char *  instanceName,
const char *  portInstanceName 
)

tries to go a specific instance and portname. returns 0- ok, -1 whine but component can continue, -2 component/code should quit.

char* ConnectionFramework::getConfiguration ( const char *  instanceName,
const char *  portInstanceName 
)

=================== component configuration ========= Get the parameter data from a component, if it has any, or the empty string if it doesn't or an error occurs.

char* ConnectionFramework::getConfiguration ( const char *  instanceName,
const char *  portInstanceName,
const char *  fieldName 
)

Get the parameter data from a component, if it has any, or the empty string if it doesn't or an error occurs.

char* ConnectionFramework::setConfiguration ( const char *  instanceName,
const char *  portInstanceName,
const char *  fieldName,
const char *  configuration 
)

Set the parameter data from a component, if it has any. Return the parameters if it takes any, or the empty string if it doesn't or an error occurs.

virtual void ConnectionFramework::componentChanged ( ComponentChangedEvent evt  )  [virtual]

=================== events ======================= Implements ComponentChangedListener. Signal a change in the Component's status.

Implements ComponentChangedListener.

void ConnectionFramework::addXCmptFactory ( XCmptFactory_shared  xs  ) 

Add a factory for creating components.

virtual void ConnectionFramework::addComponentChangedListener ( ComponentChangedListener l  )  [virtual]

Add a listener for a change in the status of a component.

::std::vector< ::std::string > ConnectionFramework::instanceNames (  ) 

fetch the names of current component instances.

::ccafeopq::ConnectionID_shared ConnectionFramework::getConnectionID ( const char *  uc,
const char *  up,
const char *  pc,
const char *  pp 
)

dig up a connid based on strings.

Parameters:
uc - using component name
up - uses port name
pc - providing component name
pp - provides port name

::ccafeopq::TypeMap_shared ConnectionFramework::getConnectionProperties ( ::ccafeopq::ConnectionID_shared &  conn  ) 

see cca.sidl

::std::vector< ::ccafeopq::ConnectionID_shared > ConnectionFramework::getConnectionIDs ( ::std::vector< ::ccafeopq::ComponentID_shared > &  clist  ) 

see cca.sidl

void ConnectionFramework::setPortProperties ( ::ccafeopq::ComponentID_shared &  cid,
const ::std::string &  portname,
::ccafeopq::TypeMap_shared &  map 
) throw (::ccafeopq::Exception )

copy data from the map, or throw if illformed input.

int ConnectionFramework::setPortProperty ( const ::std::string &  instanceName,
const std::string &  portName,
const std::string &  key,
const std::string &  valueType,
const std::string &  value 
)

copy data in for a specific key, type, value. if this requires redefining the key type, returns a nonzero result and does not do the modification.

::ccafeopq::TypeMap_shared ConnectionFramework::getPortProperties ( ::ccafeopq::ComponentID_shared &  cid,
const ::std::string &  portname 
) throw ( ::ccafeopq::Exception )

fetch up the typemap, or throw if ill formed input.

::ccafeopq::TypeMap_shared ConnectionFramework::getPortProperties ( const ::std::string &  cName,
const ::std::string &  portname 
) throw ()

converts all exceptions to an int, and does the lookup-from-name.

virtual int ConnectionFramework::setRepositoryPath ( char **  argv,
int  argc 
) [virtual]

=================== repository use ================== Set current module path from an argv. Input will only be read until argc or a null element is reached. Normal return is 0.

virtual std::vector< std::string > ConnectionFramework::getRepositoryPath (  )  [virtual]

Get current componenent path as a vector.

virtual std::vector< std::string > ConnectionFramework::getRepositoryClasses (  )  [virtual]

Return the list of unloaded classes and where they come from. argc is an even number, as you get the library location following each class entry. Class names will be unique, whether or not component writers worried about that.

virtual int ConnectionFramework::loadRepositoryClass ( const char *  className,
bool  global,
bool  lazy 
) [virtual]

Move a class from the repository to the pallet. Probably involves a dynamic load. returns 0 if transferred successfully.

virtual void ConnectionFramework::refreshPallet (  )  [virtual]

recompute the pallet of instantiable components

virtual int ConnectionFramework::loadPorts ( const std::string &  libPathName  )  [virtual]

dlopen a port library globally and forget it.


Member Data Documentation

This gizzard is the container the framework uses as a home so that the normal connections processes apply to services the frame provides. It doesn't go with a single component, though it appears to. Think of it as the thick wall of the framework in the component diagrams.

ComponentFactory_shared ConnectionFramework::ocf [private]

the base component factory with components ccaffeine happens to supply, which may be none, and support for dynamic loading (if built that way).

::std::map< ::std::string, ::ccafe::CmpBox_shared > ConnectionFramework::instances [private]

string lookup of components. across all bindings, the keys in this table must be unique (component names).

Contains ComponentChangedListener's.

std::vector< XCmptFactory_shared > ConnectionFramework::xCmptFactories [private]

A list of external component factories.


The documentation for this class was generated from the following file:

Generated on Thu Mar 17 13:10:39 2011 for CCAFFEINE by  doxygen 1.5.9