DefaultBuilderModel Class Reference

#include <DefaultBuilderModel.h>

Inheritance diagram for DefaultBuilderModel:

Inheritance graph
[legend]
Collaboration diagram for DefaultBuilderModel:

Collaboration graph
[legend]

List of all members.

Public Member Functions

ConnectionFrameworkgetFramework ()
 DefaultBuilderModel (int &classNotFoundException, StaticFactory *sf, int64_t fComm, bool useComm)
virtual void initScript ()
virtual void componentChanged (ComponentChangedEvent *evt)
virtual void addComponentChangedListener (ComponentChangedListener *l)
std::string pullDownFromPallet (const std::string &className, const std::string &instanceName)
std::string pullDownFromPallet (const ::std::string &className, const ::std::string &instanceName,::ccafeopq::TypeMap_shared cprops)
std::string pullDownFromPallet (const std::string &className)
int disconnect (const char *fromInstance, const char *providesInstance, const char *toInstance, const char *usesInstance)
int connect (const char *fromInstance, const char *providesInstance, const char *toInstance, const char *usesInstance)
::std::map< ::std::string,
ComponentInfo_shared > 
getArena ()
::std::vector< std::string > getPallet ()
::std::vector< std::string > getInstanceNames ()
int goOne (const char *instanceName, const char *portName)
void setDebug (bool tf)
void removeInstantiatedComponent (const std::string &iname)
void removeAllInstantiatedComponents ()
virtual char * getConfiguration (const char *instanceName, const char *portName, const char *fieldName)
virtual char * getConfiguration (const char *instanceName, const char *portName)
virtual char * setConfiguration (const char *instanceName, const char *portName, const char *fieldName, const char *data)
virtual std::vector< std::string > getComponentProperties (::std::string &instanceName)
virtual const std::string getComponentProperty (const char *instanceName, const char *key)
virtual std::vector< std::string > getComponentProperties (const std::string &instanceName)
virtual void setComponentProperty (const char *instanceName, const char *key, const char *value)
virtual ::ccafeopq::TypeMap_shared getPortProperties (const ::std::string &instanceName, const std::string &portName)
virtual int setPortProperty (const ::std::string &instanceName, const std::string &portName, const std::string &key, const std::string &valueType, const std::string &value)
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 int loadPorts (const std::string &libPathName)

Private Member Functions

std::string createInstanceName (const std::string &className)

Private Attributes

::std::vector
< ComponentChangedListener * > 
cmptChgLsnrs
ConnectionFrameworkfwk_data


Detailed Description

This is implements the Model part of a Model-View-Controller design pattern. This is the object that actually deals first hand with the connection framework itself. It understands a concept of a pallet - a set of instantiatable classes maintained by the connection framework; a concept of an arena - a space where instantiated components are hooked together to create a program by the framework, and a go() or method that fires the flow executive in the connection framework. It's mainly a legacy convenience for a lot of things that can be better done by cleaner methods now available.

Constructor & Destructor Documentation

DefaultBuilderModel::DefaultBuilderModel ( int &  classNotFoundException,
StaticFactory sf,
int64_t  fComm,
bool  useComm 
)

classNotFoundException 0 if ok, -1 if error in starting. sf will be used to initialize the factory if it is not null. fComm will be ignored unless useComm is true, in which case it is a fortran mpi comm representation (from comm_c2f())cast to an int64_t.


Member Function Documentation

std::string DefaultBuilderModel::createInstanceName ( const std::string &  className  )  [private]

Create a unique instance name. don't free it. returns null from bogus input.

ConnectionFramework* DefaultBuilderModel::getFramework (  ) 

get the pointer

virtual void DefaultBuilderModel::initScript (  )  [virtual]

run the default setup

Implements BuilderModel.

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

Signal a change in the Component's status.

Implements ComponentChangedListener.

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

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

Implements BuilderModel.

std::string DefaultBuilderModel::pullDownFromPallet ( const std::string &  className,
const std::string &  instanceName 
)

Instantiate a component that presently exists on the pallet and place it in the arena with the given instance name.

Returns:
A string that is the instantiated components unique instance name. returns null if an error occurs.

std::string DefaultBuilderModel::pullDownFromPallet ( const ::std::string &  className,
const ::std::string &  instanceName,
::ccafeopq::TypeMap_shared  cprops 
)

Instantiate a component that presently exists on the pallet and place it in the arena with the given instance name. The given properties (cprops) will be available during setServices if the component queries for them.

Returns:
A string that is the instantiated components unique instance name. returns null if an error occurs.

std::string DefaultBuilderModel::pullDownFromPallet ( const std::string &  className  ) 

Instantiate a component that presently exists on the pallet and place it in the arena.

Returns:
A string that is the instantiated components unique instance name. returns null if an error occurs.

int DefaultBuilderModel::disconnect ( const char *  fromInstance,
const char *  providesInstance,
const char *  toInstance,
const char *  usesInstance 
) [virtual]

diconnect two components. same return as connect.

Implements BuilderModel.

int DefaultBuilderModel::connect ( const char *  fromInstance,
const char *  providesInstance,
const char *  toInstance,
const char *  usesInstance 
) [virtual]

Connect the instance of an already "pulled down" (instantiated) component, already residing in the arena, to another component in the arena. Note that the order here honors the port flow. Port's flow from "fromInstance" to toInstance in the argument list. Data flow moves in the opposite direction of port flow. returns 0 if ok, -1 if vetoed, -2 if bogus input.

Implements BuilderModel.

::std::map< ::std::string, ComponentInfo_shared > DefaultBuilderModel::getArena (  )  [virtual]

The arena is where instantiated components live and can be subsequently connected together. The component information is stored in a ComponentInfo_shared map. The key to each is the String-valued instance name of the instantiated component.

Implements BuilderModel.

::std::vector< std::string > DefaultBuilderModel::getPallet (  )  [virtual]

The pallet is an array of String's that are the class names (types) of components that can be instantiated by the connection framework. Do not delete (or cache) the pointer returned.

Implements BuilderModel.

::std::vector< std::string > DefaultBuilderModel::getInstanceNames (  )  [virtual]

return list of all names for instances.

Implements BuilderModel.

int DefaultBuilderModel::goOne ( const char *  instanceName,
const char *  portName 
)

use this one instead.

void DefaultBuilderModel::removeInstantiatedComponent ( const std::string &  iname  ) 

Remove an already instantiated component from the Arena.

void DefaultBuilderModel::removeAllInstantiatedComponents (  ) 

Remove an all instantiated components from the Arena.

virtual char* DefaultBuilderModel::getConfiguration ( const char *  instanceName,
const char *  portName,
const char *  fieldName 
) [virtual]

get configuration string for single field from parameter port on instance

virtual char* DefaultBuilderModel::getConfiguration ( const char *  instanceName,
const char *  portName 
) [virtual]

get configuration string for all fields from parameter port on instance

virtual char* DefaultBuilderModel::setConfiguration ( const char *  instanceName,
const char *  portName,
const char *  fieldName,
const char *  data 
) [virtual]

set configuration field to parameter port on instance

virtual std::vector< std::string > DefaultBuilderModel::getComponentProperties ( ::std::string &  instanceName  )  [virtual]

Get a string list of all property keys and value (an even length list). Destroy the list when done with it, but leave the strings alone. This is for the old KeyValuePort stuff

Implements BuilderModel.

virtual const std::string DefaultBuilderModel::getComponentProperty ( const char *  instanceName,
const char *  key 
) [virtual]

Get the value of a property, or 0 if no such property exists. This is for the old KeyValuePort stuff

Implements BuilderModel.

virtual void DefaultBuilderModel::setComponentProperty ( const char *  instanceName,
const char *  key,
const char *  value 
) [virtual]

Copy the value into the properties of instance with the given key. Will replace previously defined values. This is for the old KeyValuePort stuff.

Implements BuilderModel.

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

============= repository activities ============= 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 > DefaultBuilderModel::getRepositoryPath (  )  [virtual]

Get current componenent path as an argv. Path returned is null-terminated and has argc elements. Not yours to mess with the content.

virtual std::vector< std::string > DefaultBuilderModel::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 DefaultBuilderModel::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 int DefaultBuilderModel::loadPorts ( const std::string &  libPathName  )  [virtual]

just load a library globally and forget about it.

Implements BuilderModel.


Member Data Documentation

Holds ComponentChangedListener's.


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

Generated on Tue Apr 28 03:12:54 2009 for CCAFFEINE by  doxygen 1.5.5