diff options
author | sjiang <sjiang@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2006-09-23 04:27:31 +0000 |
---|---|---|
committer | sjiang <sjiang@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2006-09-23 04:27:31 +0000 |
commit | abef30fd40087bd91db948baeef62ac52d435981 (patch) | |
tree | 2dd6cf6a5eda379fe8288fb77a6c319fd4377af0 | |
parent | f069fdbe018e9aaabecd369c8eaea40b6cd50338 (diff) | |
download | ATCD-abef30fd40087bd91db948baeef62ac52d435981.tar.gz |
ChangeLog Tag: Sat Sep 23 04:07:59 UTC 2006 Shanshan Jiang <shanshan.jiang@vanderbilt.edu>
-rw-r--r-- | CIAO/DAnCE/Planner/Node_T.cpp | 18 | ||||
-rw-r--r-- | CIAO/DAnCE/Planner/Node_T.h | 46 | ||||
-rw-r--r-- | CIAO/DAnCE/Planner/Node_T.inl | 11 | ||||
-rw-r--r-- | CIAO/DAnCE/Planner/PCVisitor.cpp | 452 | ||||
-rw-r--r-- | CIAO/DAnCE/Planner/PCVisitor.h | 168 | ||||
-rw-r--r-- | CIAO/DAnCE/Planner/PCVisitorBase.cpp | 24 | ||||
-rw-r--r-- | CIAO/DAnCE/Planner/PCVisitorBase.h | 214 | ||||
-rw-r--r-- | CIAO/DAnCE/Planner/PCVisitorBase.inl | 162 | ||||
-rw-r--r-- | CIAO/DAnCE/Planner/Planner.cpp | 138 | ||||
-rw-r--r-- | CIAO/DAnCE/Planner/Planner.mpc | 25 |
10 files changed, 0 insertions, 1258 deletions
diff --git a/CIAO/DAnCE/Planner/Node_T.cpp b/CIAO/DAnCE/Planner/Node_T.cpp deleted file mode 100644 index 412060d4c5b..00000000000 --- a/CIAO/DAnCE/Planner/Node_T.cpp +++ /dev/null @@ -1,18 +0,0 @@ - -//Author: Stoyan Paunov -//$Id$ - -#include "Node_T.h" - -template <class T> -Node<T>::Node (T* t) -: t_ (t), - next_ (0), - prev_ (0) -{ -} - -#if !defined (__ACE_INLINE__) -#include "Node_T.inl" -#endif /* __ACE_INLINE__ */ - diff --git a/CIAO/DAnCE/Planner/Node_T.h b/CIAO/DAnCE/Planner/Node_T.h deleted file mode 100644 index 11cd6573368..00000000000 --- a/CIAO/DAnCE/Planner/Node_T.h +++ /dev/null @@ -1,46 +0,0 @@ - -//Author: Stoyan Paunov -//$Id$ - -//Node class which is used in Double_Linked_Lists - - -#ifndef NODE_H -#define NODE_H - -#include /**/ "ace/pre.h" -#include /**/ "ace/config.h" - -template <class T> -class Node { - public: - Node (T* t = 0); - T* get (void); - Node* next_; - Node* prev_; - private: - T* t_; - }; - -template <typename E> -class Node_Factory { - public: - Node_Factory () : list_ (0) {}; - ~Node_Factory () {}; - Node<E>& Create (E* element) {return new Node<E> (element);} - private: - Node<E>* list_; -}; - - -#if defined (__ACE_INLINE__) -#include "Node_T.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "Node_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#include /**/ "ace/post.h" - -#endif /* NODE_H */ diff --git a/CIAO/DAnCE/Planner/Node_T.inl b/CIAO/DAnCE/Planner/Node_T.inl deleted file mode 100644 index fd47ccd9719..00000000000 --- a/CIAO/DAnCE/Planner/Node_T.inl +++ /dev/null @@ -1,11 +0,0 @@ - -//Author: Stoyan Paunov -//$Id$ - -template <class T> -ACE_INLINE T* -Node<T>::get (void) -{ - return this->t_; -} - diff --git a/CIAO/DAnCE/Planner/PCVisitor.cpp b/CIAO/DAnCE/Planner/PCVisitor.cpp deleted file mode 100644 index c041e444a90..00000000000 --- a/CIAO/DAnCE/Planner/PCVisitor.cpp +++ /dev/null @@ -1,452 +0,0 @@ -/* -*- C++ -*- */ - -//======================================================================== -/* - * file PCVisitor.cpp - * - * $Id$ - * - * This file contains the implementation of the PackageConfiguration - * Visitor class PCVisitor which derives from PCVisitorBase. Each - * Visit function focuses on the functionality necessary to process - * the PackageConfiguration element which is passed to it as an argument - * and on dispatching the next sequence of calls in the correct order! - * - * This implementation takes a PackageConfiguration and tries to grow - * a DeploymentPlan out of it by expanding the latter in width and depth - * simultaneously. At each level of the PackageConfiguration the - * PCVisitor first expands the DeploymentPlan vertically at the - * corrsponding level and then dispatches the children of the current - * PackageConfiguration element. This in turn might and most probably - * will cause another vertical expansion of the DeploymentPlan, however - * for a different element. This effect is produced due to the flattened - * structure of the DeploymentPlan. - * - * author Stoyan Paunov <spaunov@isis.vanderbilt.edu - */ -//======================================================================== - -#include "PCVisitorBase.h" -#include "PCVisitor.h" - -#include "ace/OS_Memory.h" //for ACE_NEW* macros -#include "ace/SString.h" //for ACE_CString - -#include "ciao/DeploymentC.h" -#include "ciao/Deployment_DataC.h" -#include "ciao/Packaging_DataC.h" - -#include "Config_Handlers/DnC_Dump.h" - -#include <iostream> -using namespace std; - - //Constructor - PCVisitor::PCVisitor (Deployment::DeploymentPlan &plan, - Deployment::PackageConfiguration &pc) - : PCVisitorBase (), - plan_ (plan), - pc_ (pc), - last_cad_ (0) - { - } - - //entry point for the protected visitor to get it do start - //the visitation process - void PCVisitor::Visit () - { - Accept (*this, this->pc_); - } - - // A whole slew of overloaded routines for different IDL - // data types part of the PackageConfiguration. - - - void PCVisitor::Visit (Deployment::PackageConfiguration &pc) - { - cout << "Flattening: " << pc.label << endl; - - //visit the ComponentPackageDescription - if (pc.basePackage.length ()) - { - //currently no support for that anywhere - //for (size_t r = 0; r = pc.selectRequirement.length (); ++r); - - Accept (*this, pc.basePackage); - } - else - ACE_DEBUG ((LM_WARNING, - "[PCVisitor - PackageConfiguration] We currently " - "do NOT support package references, specializedConfigs", - "or imports!\n")); - } - - //!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-! - - //ComponentPackageDescription descendents - - void PCVisitor::Visit (Deployment::ComponentPackageDescription &cpd) - { - Accept (*this, cpd.realizes); - //for (size_t impl = 0; impl < cpd.implementation.length (); ++impl) - Accept (*this, cpd.implementation[0]); - } - - - void PCVisitor::Visit (Deployment::ComponentInterfaceDescription &) - { - //Might want to populate this too once PICML starts supporting it - } - - - void PCVisitor::Visit (Deployment::PackagedComponentImplementation &pci) - { - Accept (*this, pci.referencedImplementation); - - size_t plan_impl_len = plan_.implementation.length (); - size_t plan_inst_len = plan_.instance.length (); - - //NOTE: order here matters. Need to populate the - //MonolithicDeploymentDescription and the - //InstanceDeploymentDescription first, - //then call the update_configProperty - if (plan_impl_len > 0 && plan_inst_len > 0) - update_configProperty (pci, - plan_.implementation[plan_impl_len - 1], - plan_.instance[plan_inst_len - 1]); - } - - - void PCVisitor::Visit (Deployment::ComponentImplementationDescription &cid) - { - if (cid.assemblyImpl.length ()) - Accept (*this, cid.assemblyImpl); - else - //;//Do nothing - monolithic component deployment not supported - Accept (*this, cid.monolithicImpl); - } - - - void PCVisitor::Visit (Deployment::ComponentAssemblyDescription &cad) - { - //NOTE: order matters for these calls. We need to populate - //the instances before we try to polulate the connections - - //set the last ComponentAssemblyDescription - this->last_cad_ = &cad; - - //visit the SubcomponentInstantiationDescription - Accept (*this, cad.instance); - //visit the connections - Accept (*this, cad.connection); - - //reset the last ComponentAssemblyDescription - this->last_cad_ = NULL; - } - - - void PCVisitor::Visit (Deployment::SubcomponentInstantiationDescription &sid) - { - //visit the ComponentPackageDescription (again) - if (sid.basePackage.length ()) - { - size_t inst_len = plan_.instance.length (); - plan_.instance.length (inst_len + 1); - - update_configProperty (sid, plan_.instance[inst_len]); - - plan_.instance[inst_len].name = sid.name; - size_t impl_len = plan_.implementation.length (); - plan_.implementation.length (impl_len + 1); - - ACE_CString mdname (plan_.instance[inst_len].name); - mdname += "-mdd"; - plan_.implementation[impl_len].name = mdname.c_str (); - - plan_.instance[inst_len].implementationRef = impl_len; - - Accept (*this, sid.basePackage); - } - else - ACE_DEBUG ((LM_WARNING, - "[PCVisitor - SubcomponentInstantiationDescription] ", - "We currently do NOT support package references, ", - "specializedConfigs or imports!\n")); - } - - - void PCVisitor::Visit (Deployment::MonolithicImplementationDescription &mid) - { - //NOTE: There are usually 3 NamedImplementationArtifacts per - //MonolithicImplementationDescription *_stub, *_svnt & *_exec - - //visit the NamedImplementationArtifacts - Accept (*this, mid.primaryArtifact); - } - - - void PCVisitor::Visit (Deployment::NamedImplementationArtifact &nia) - { - //increase the artifact length by one - size_t arti_len = plan_.artifact.length (); - plan_.artifact.length (arti_len + 1); - plan_.artifact[arti_len].name = nia.name; - - //increase the artifactRef length by one and - //update the reference - - //get the index of the last MonolithicDeploymentDescription - size_t last_mdd = plan_.implementation.length () - 1; - Deployment::MonolithicDeploymentDescription& mdd = plan_.implementation[last_mdd]; - size_t ref_len = mdd.artifactRef.length (); - mdd.artifactRef.length (ref_len + 1); - mdd.artifactRef[ref_len] = arti_len; - - //visit the actual ImplementationArtifactDescriptor - Accept (*this, nia.referencedArtifact); - } - - - void PCVisitor::Visit (Deployment::ImplementationArtifactDescription &iad) - { - - size_t last_arti = plan_.artifact.length (); - size_t plan_loc_len = plan_.artifact[last_arti - 1].location.length (); - size_t num_loc = iad.location.length (); - for (size_t i = 0; i < num_loc; ++i) - { - Deployment::ArtifactDeploymentDescription& add = plan_.artifact[last_arti - 1]; - add.location.length (plan_loc_len + 1); - add.location[plan_loc_len] = iad.location[i]; - ++plan_loc_len; - - //update execParameter - update_execParameter (iad, add); - } - } - - //!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-! - - //ComponentPackageReference descendents - - void PCVisitor::Visit (Deployment::ComponentPackageReference &) - { - //not implemented - } - - //!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-! - - //properties - - void PCVisitor::Visit (Deployment::AssemblyPropertyMapping &) - { - - } - - - void PCVisitor::Visit (Deployment::Property &) - { - - } - - - //requirements & capabilities - - void PCVisitor::Visit (Deployment::Requirement &) - { - - } - - - void PCVisitor::Visit (Deployment::Capability &) - { - - } - - - void PCVisitor::Visit (Deployment::ImplementationRequirement &) - { - - } - - - void PCVisitor::Visit (Deployment::ImplementationDependency &) - { - - } - - //ports and connections - - void PCVisitor::Visit (Deployment::AssemblyConnectionDescription &acd) - { - if (!this->last_cad_) - return; - - Deployment::ComponentAssemblyDescription& cad = *(this->last_cad_); - - size_t plan_conn_len = plan_.connection.length (); - plan_.connection.length (plan_conn_len + 1); - plan_.connection[plan_conn_len].name = acd.name; - - size_t iep_len = acd.internalEndpoint.length (); - size_t plan_iep_len = - plan_.connection[plan_conn_len].internalEndpoint.length (); - - //cout << "==> " << acd.name << " has " << iep_len << " and " - // << acd.externalEndpoint.length () << endl << endl ; - - plan_.connection[plan_conn_len].internalEndpoint.length (plan_iep_len + iep_len); - - for (size_t i = 0; i < iep_len; ++i) - { - plan_.connection[plan_conn_len] - .internalEndpoint[plan_iep_len + i].portName = - acd.internalEndpoint[i].portName; - - size_t inst_ref = acd.internalEndpoint[i].instanceRef; - const char* inst_name = cad.instance[inst_ref].name; - size_t plan_inst_len = plan_.instance.length (); - - for (size_t j = 0; j < plan_inst_len; ++j) - { - const char* plan_inst_name = plan_.instance[j].name; - if (ACE_OS::strcmp (plan_inst_name, inst_name) == 0) - { - plan_.connection[plan_conn_len] - .internalEndpoint[plan_iep_len + i].instanceRef = j; - break; - } - } - - //Now traverse the interface - - //NOTE: move these up and refactor! - Deployment::SubcomponentInstantiationDescription& scid = - cad.instance[inst_ref]; - Deployment::PlanSubcomponentPortEndpoint& pspe = - plan_.connection[plan_conn_len] - .internalEndpoint[plan_iep_len + i]; - - size_t pkg_len = scid.basePackage.length (); - for (size_t k = 0; k < pkg_len; ++k) - { - Deployment::ComponentPackageDescription& package = scid.basePackage[k]; - - //empty unfortunately - Deployment::ComponentInterfaceDescription cid = package.realizes; - //cid = package.implementation[0].referencedImplementation.implements; - - size_t port_len = cid.port.length (); - for (size_t p = 0; p < port_len; ++p) - { - const char* cid_pname = cid.port[p].name; - const char* pspe_pname = pspe.portName; - //cout << "CMP: " << pspe_pname << " <=> " << cid_pname << endl; - if (ACE_OS::strcmp (cid_pname, pspe_pname) == 0) - { - pspe.kind = cid.port[p].kind; - - //cout << "-->" << pspe_pname << " Port kind is " - // << pspe.kind << endl; - - goto interface_end; - break; // ??? - } - } - } - -interface_end: - //cout << endl; - ; - - } - - } - - - void PCVisitor::Visit (Deployment::SubcomponentPortEndpoint &) - { - - } - - - void PCVisitor::Visit (Deployment::ComponentExternalPortEndpoint &) - { - - } - -//several helper functions - - void PCVisitor:: - update_execParameter (Deployment::ImplementationArtifactDescription& iad, - Deployment::ArtifactDeploymentDescription& add) - { - //update execParameters - size_t num_execP = iad.execParameter.length (); - for (size_t j = 0; j < num_execP; ++j) - { - size_t execP_len = add.execParameter.length (); - add.execParameter.length (execP_len + 1); - add.execParameter[execP_len] = iad.execParameter[j]; - ++execP_len; - } - } - - void PCVisitor:: - update_configProperty (Deployment::SubcomponentInstantiationDescription &scid, - Deployment::InstanceDeploymentDescription &idd) - { - size_t scid_plen = - scid.configProperty.length (); - - size_t idd_plen = idd.configProperty.length (); - idd.configProperty.length (idd_plen + scid_plen); - - for (size_t i = 0; i < scid_plen; ++i) - idd.configProperty[idd_plen + i] = - scid.configProperty[i]; - - } - - void PCVisitor:: - update_configProperty (Deployment::PackagedComponentImplementation& pcid, - Deployment::MonolithicDeploymentDescription& mid, - Deployment::InstanceDeploymentDescription& idd) - { - bool update; - size_t pcid_plen = pcid.referencedImplementation - .configProperty.length (); - - size_t mid_eplen = mid.execParameter.length (); - mid.execParameter.length (mid_eplen + pcid_plen); - - for (size_t i = 0; i < pcid_plen; ++i) - { - update = true; - mid.execParameter[mid_eplen + i] = pcid.referencedImplementation - .configProperty[i]; - - const char* pname = pcid.referencedImplementation - .configProperty[i].name; - - size_t idd_plen = idd.configProperty.length (); - - for (size_t j = 0; j < idd_plen; ++j) - { - const char* idd_pname = idd.configProperty[j].name; - if (ACE_OS::strcmp (idd_pname, pname) == 0) - { - update = false; - break; - } - } - - if (update) - { - idd.configProperty.length (idd_plen + 1); - idd.configProperty[idd_plen] = - pcid.referencedImplementation.configProperty[i]; - } - } - } - diff --git a/CIAO/DAnCE/Planner/PCVisitor.h b/CIAO/DAnCE/Planner/PCVisitor.h deleted file mode 100644 index 9f355c5afa8..00000000000 --- a/CIAO/DAnCE/Planner/PCVisitor.h +++ /dev/null @@ -1,168 +0,0 @@ -/* -*- C++ -*- */ - -//======================================================================== -/** - * file PCVisitor.h - * - * $Id$ - * - * This file contains a number of Visitor classes which are used to - * traverse the PackageConfiguration element defined in the - * PackagingData.idl - * - * author Stoyan Paunov <spaunov@isis.vanderbilt.edu> - */ -//======================================================================== - -#ifndef PC_VISITOR_H -#define PC_VISITOR_H - -#include /**/ "ace/pre.h" -#include "ace/SString.h" //for the ACE_CString - -#include "PCVisitorBase.h" //for the base visitor -#include "Node_T.h" //Node -#include "ace/Containers_T.h" //for ACE_Double_Linked_List - - - -#include "ciao/DeploymentC.h" -#include "ciao/Deployment_BaseC.h" -#include "ciao/Deployment_DataC.h" -#include "ciao/Packaging_DataC.h" - -namespace { -//Definition of various Node elements parametrized by -//Deployment specific types - typedef Node<Deployment::Node> NNode; - typedef Node<Deployment::MonolithicImplementationDescription> MNode; - -//Definition of various stacks used to store information -//about the elements being parsed at various levels - typedef ACE_Bounded_Stack<int> INDEX_STACK; - -//definition of a Node which takes an ACE_CString - typedef Node<ACE_CString> SNode; -} - -//=========================================================================== -/** - * class PCVisitor - * - * This class is is the actual implementation for the PackageConfiguration - * Visitor. It derives from PCVisitorBase and overloads the functions which - * deal with single elements. Sequences are handled in the base class. - */ -//=========================================================================== - - -class PCVisitor : public PCVisitorBase -{ -public: - - //constructor - PCVisitor (Deployment::DeploymentPlan &plan, - Deployment::PackageConfiguration &pc); - - ///Entry point to protected Visitor functions - void Visit (); - -protected: - /// A whole slew of overloaded routines for different IDL - /// data types part of the PackageConfiguration. - - virtual - void Visit (Deployment::PackageConfiguration &pc); - - //!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-! - - //ComponentPackageDescription descendents - virtual - void Visit (Deployment::ComponentPackageDescription &cpd); - - virtual - void Visit (Deployment::ComponentInterfaceDescription &cid); - - virtual - void Visit (Deployment::PackagedComponentImplementation &pci); - - virtual - void Visit (Deployment::ComponentImplementationDescription &cid); - - virtual - void Visit (Deployment::ComponentAssemblyDescription &cad); - - virtual - void Visit (Deployment::SubcomponentInstantiationDescription &sid); - - virtual - void Visit (Deployment::MonolithicImplementationDescription &mid); - - virtual - void Visit (Deployment::NamedImplementationArtifact &nia); - - virtual - void Visit (Deployment::ImplementationArtifactDescription &iad); - - //!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-! - - //ComponentPackageReference descendents - virtual - void Visit (Deployment::ComponentPackageReference &cpr); - - //!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-! - - //properties - virtual - void Visit (Deployment::AssemblyPropertyMapping &apm); - - virtual - void Visit (Deployment::Property &property); - - - //requirements & capabilities - virtual - void Visit (Deployment::Requirement &requirement); - - virtual - void Visit (Deployment::Capability &capability); - - virtual - void Visit (Deployment::ImplementationRequirement &ir); - - virtual - void Visit (Deployment::ImplementationDependency &id); - - //ports and connections - virtual - void Visit (Deployment::AssemblyConnectionDescription &acd); - - virtual - void Visit (Deployment::SubcomponentPortEndpoint &spe); - - virtual - void Visit (Deployment::ComponentExternalPortEndpoint &cepe); - -protected: - ///several helper functions - void update_execParameter (Deployment::ImplementationArtifactDescription& iad, - Deployment::ArtifactDeploymentDescription& add); - - void update_configProperty (Deployment::SubcomponentInstantiationDescription &scid, - Deployment::InstanceDeploymentDescription &idd); - - void update_configProperty (Deployment::PackagedComponentImplementation& pcid, - Deployment::MonolithicDeploymentDescription& mid, - Deployment::InstanceDeploymentDescription& idd); - -private: - - Deployment::DeploymentPlan& plan_; - Deployment::PackageConfiguration& pc_; - Deployment::ComponentAssemblyDescription* last_cad_; - -}; - -#include /**/ "ace/post.h" - -#endif /* PC_VISITOR_H */ diff --git a/CIAO/DAnCE/Planner/PCVisitorBase.cpp b/CIAO/DAnCE/Planner/PCVisitorBase.cpp deleted file mode 100644 index 040ecb9eb45..00000000000 --- a/CIAO/DAnCE/Planner/PCVisitorBase.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/* -*- C++ -*- */ - -//======================================================================== -/* - * file PCVisitorBase.cpp - * - * $Id$ - * - * This file is a dummy which either includes the PCVisitorBase.inl or - * is ignored. - * - * author Stoyan Paunov <spaunov@isis.vanderbilt.edu> - */ -//======================================================================== - -#include "PCVisitorBase.h" - - PCVisitorBase::PCVisitorBase (void) - { - } - -#if !defined (__ACE_INLINE__) -#include "PCVisitorBase.inl" -#endif /* __ACE_INLINE__ */ diff --git a/CIAO/DAnCE/Planner/PCVisitorBase.h b/CIAO/DAnCE/Planner/PCVisitorBase.h deleted file mode 100644 index cd3cb2b8752..00000000000 --- a/CIAO/DAnCE/Planner/PCVisitorBase.h +++ /dev/null @@ -1,214 +0,0 @@ -/* -*- C++ -*- */ - -//======================================================================== -/** - * file PCVisitorBase.h - * - * $Id$ - * - * This file contains the virtual base class for the PackageConfiguration - * Visitor which is used to traverse the PackageConfiguration element - * defined in the PackagingData.idl. The PackageConfiguration has a - * number of sequence elements. This class actually implements the - * operations which involve sequences and delegates the calls to - * the operations which handle single elements from the sequence type. - * - * author Stoyan Paunov <spaunov@isis.vanderbilt.edu> - */ -//======================================================================== - -#ifndef PC_VISITOR_BASE_H -#define PC_VISITOR_BASE_H - -#include /**/ "ace/pre.h" -#include "ciao/DeploymentC.h" -#include "ciao/Deployment_DataC.h" -#include "ciao/Packaging_DataC.h" -#include "ace/SString.h" //for the ACE_CString -#include "ace/Containers_T.h" //for ACE_Unbounded_Stack - - -//forward declaration -class PCVisitorBase; - -//======================================================================== -/** - * class PCAdapter - * - * This class is used as an Adapter around the CIAO::Depolyment elements - * which are part of the PackageConfiguration traversal hierarchy in - * order to adapt each element to exhibit 'Visitor Node'-like structure. - * This allows us to use the Visitor double-dispatch traversal paradigm. - */ -//======================================================================== - -template <typename E> -class PCAdapter -{ -public: - PCAdapter (E& element) : element_ (element) {} - void Accept (PCVisitorBase &v) {v.Visit (*this);} - E& get () {return this-element_;} - -private: - E &element_; -}; - - -template <typename T> -void Accept (PCVisitorBase &v, T& element_to_visit) -{ - v.Visit (element_to_visit); -} - -//======================================================================== -/** - * function - visit_sequence - * - * This function is used to handle sequences of elements where each - * element takes the form of a Visitor Node. - */ -//======================================================================== - - -/// I am using this to dispatch sequences -template <typename SEQ> -void visit_sequence (SEQ &seq, PCVisitorBase& v) -{ - const CORBA::ULong size = seq.length (); - - for (CORBA::ULong i = 0; i < size; ++i) - { - Accept(v, seq[i]); - } -} - -//======================================================================== -/** - * class PCVisitorBase - * - * This class is a virtual base class for the PackageConfiguration Visitor - * The operation which deal with sequences are implemented here by means - * of the visit_sequence function above, in order to make the logic of - * derived classes easier to write. Writers of derived classes need only - * overload the functions which deal with single elements. Sequences are - * always handled here. - */ -//======================================================================== - - -class PCVisitorBase -{ -public: - - //constructor - PCVisitorBase (void); - - ///function what dispatches sequences - template <typename SEQ> - friend void visit_sequence (SEQ &seq, PCVisitorBase& v); - - /// A whole slew of overloaded routines for different IDL - /// data types part of the PackageConfiguration. - - virtual - void Visit (Deployment::PackageConfiguration &pc) = 0; - void Visit (Deployment::PackageConfigurations &pcs); - - //!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-! - - //ComponentPackageDescription descendents - virtual - void Visit (Deployment::ComponentPackageDescription &cpd) = 0; - void Visit (Deployment::ComponentPackageDescriptions &cpds); - - virtual - void Visit (Deployment::ComponentInterfaceDescription &cid) = 0; - //void Visit (Deployment::ComponentInterfaceDescriptions &cids); - - virtual - void Visit (Deployment::PackagedComponentImplementation &pci) = 0; - void Visit (Deployment::PackagedComponentImplementations &pcis); - - virtual - void Visit (Deployment::ComponentImplementationDescription &cid) = 0; - //void Visit (Deployment::ComponentImplementationDescriptions &cids); - - virtual - void Visit (Deployment::ComponentAssemblyDescription &cad) = 0; - void Visit (Deployment::ComponentAssemblyDescriptions &cads); - - virtual - void Visit (Deployment::SubcomponentInstantiationDescription &sid) = 0; - void Visit (Deployment::SubcomponentInstantiationDescriptions &sids); - - virtual - void Visit (Deployment::MonolithicImplementationDescription &mid) = 0; - void Visit (Deployment::MonolithicImplementationDescriptions &mids); - - virtual - void Visit (Deployment::NamedImplementationArtifact &nia) = 0; - void Visit (Deployment::NamedImplementationArtifacts &nias); - - virtual - void Visit (Deployment::ImplementationArtifactDescription &iad) = 0; - //void Visit (Deployment::ImplementationArtifactDescriptions &iads); - - //!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-! - - //ComponentPackageReference descendents - virtual - void Visit (Deployment::ComponentPackageReference &cpr) = 0; - void Visit (Deployment::ComponentPackageReferences &cprs); - - //!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-! - - //properties - virtual - void Visit (Deployment::AssemblyPropertyMapping &apm) = 0; - void Visit (Deployment::AssemblyPropertyMappings &apms); - - virtual - void Visit (Deployment::Property &property) = 0; - void Visit (Deployment::Properties &properties); - - - //requirements & capabilities - virtual - void Visit (Deployment::Requirement &requirement) = 0; - void Visit (Deployment::Requirements &requirements); - - virtual - void Visit (Deployment::Capability &capability) = 0; - void Visit (Deployment::Capabilities &capabilities); - - virtual - void Visit (Deployment::ImplementationRequirement &ir) = 0; - void Visit (Deployment::ImplementationRequirements &irs); - - virtual - void Visit (Deployment::ImplementationDependency &id) = 0; - void Visit (Deployment::ImplementationDependencies &ids); - - //ports and connections - virtual - void Visit (Deployment::AssemblyConnectionDescription &acd) = 0; - void Visit (Deployment::AssemblyConnectionDescriptions &acds); - - virtual - void Visit (Deployment::SubcomponentPortEndpoint &spe) = 0; - void Visit (Deployment::SubcomponentPortEndpoints &spes); - - virtual - void Visit (Deployment::ComponentExternalPortEndpoint &cepe) = 0; - void Visit (Deployment::ComponentExternalPortEndpoints &cepes); - -}; - -#if defined (__ACE_INLINE__) -#include "PCVisitorBase.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* PC_VISITOR_BASE_H */ diff --git a/CIAO/DAnCE/Planner/PCVisitorBase.inl b/CIAO/DAnCE/Planner/PCVisitorBase.inl deleted file mode 100644 index f6787601353..00000000000 --- a/CIAO/DAnCE/Planner/PCVisitorBase.inl +++ /dev/null @@ -1,162 +0,0 @@ -/* -*- C++ -*- */ - -//======================================================================== -/* - * file PCVisitorBase.inl - * - * $Id$ - * - * This file contains the implementation of the sequence-based - * PackageConfiguration Visitor functions. By implementing these - * we relieve developers of derived classes of the burden of handling - * the correct traversal of sequence-based elements. This implementation - * used the visit_sequence templatized function to do the heavy lifting. - * - * author Stoyan Paunov <spaunov@isis.vanderbilt.edu - */ -//======================================================================== - - - /// A whole slew of overloaded routines for different IDL - /// data types part of the PackageConfiguration. - - ACE_INLINE void PCVisitorBase::Visit - (Deployment::PackageConfigurations &pcs) - { - visit_sequence (pcs, *this); - } - - //!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-! - - //ComponentPackageDescription descendents - - ACE_INLINE void PCVisitorBase::Visit - (Deployment::ComponentPackageDescriptions &cpds) - { - visit_sequence (cpds, *this); - } - - //NOT a member of Deployment - - //ACE_INLINE void PCVisitorBase::Visit - // (Deployment::ComponentInterfaceDescriptions &cids) - //{ - // visit_sequence (cids, *this); - //} - - ACE_INLINE void PCVisitorBase::Visit - (Deployment::PackagedComponentImplementations &pcis) - { - visit_sequence (pcis, *this); - } - - //NOT a member of Deployment - - //ACE_INLINE void PCVisitorBase::Visit - // (Deployment::ComponentImplementationDescriptions &cids) - //{ - // visit_sequence (cids, *this); - //} - - ACE_INLINE void PCVisitorBase::Visit - (Deployment::ComponentAssemblyDescriptions &cads) - { - visit_sequence (cads, *this); - } - - ACE_INLINE void PCVisitorBase::Visit - (Deployment::SubcomponentInstantiationDescriptions &sids) - { - visit_sequence (sids, *this); - } - - ACE_INLINE void PCVisitorBase::Visit - (Deployment::MonolithicImplementationDescriptions &mids) - { - visit_sequence (mids, *this); - } - - ACE_INLINE void PCVisitorBase::Visit - (Deployment::NamedImplementationArtifacts &nias) - { - visit_sequence (nias, *this); - } - - //ACE_INLINE void PCVisitorBase::Visit - // (Deployment::ImplementationArtifactDescriptions &iads) - //{ - // visit_sequence (iads, *this); - //} - - //!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-! - - //ComponentPackageReference descendents - - ACE_INLINE void PCVisitorBase::Visit - (Deployment::ComponentPackageReferences &cprs) - { - visit_sequence (cprs, *this); - } - - //!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-! - - //properties - - ACE_INLINE void PCVisitorBase::Visit - (Deployment::AssemblyPropertyMappings &apms) - { - visit_sequence (apms, *this); - } - - ACE_INLINE void PCVisitorBase::Visit - (Deployment::Properties &properties) - { - visit_sequence (properties, *this); - } - - //requirements & capabilities - - ACE_INLINE void PCVisitorBase::Visit - (Deployment::Requirements &requirements) - { - visit_sequence (requirements, *this); - } - - ACE_INLINE void PCVisitorBase::Visit - (Deployment::Capabilities &capabilities) - { - visit_sequence (capabilities, *this); - } - - ACE_INLINE void PCVisitorBase::Visit - (Deployment::ImplementationRequirements &irs) - { - visit_sequence (irs, *this); - } - - ACE_INLINE void PCVisitorBase::Visit - (Deployment::ImplementationDependencies &ids) - { - visit_sequence (ids, *this); - } - - //ports and connections - - ACE_INLINE void PCVisitorBase::Visit - (Deployment::AssemblyConnectionDescriptions &acds) - { - visit_sequence (acds, *this); - } - - ACE_INLINE void PCVisitorBase::Visit - (Deployment::SubcomponentPortEndpoints &spes) - { - visit_sequence (spes, *this); - } - - ACE_INLINE void PCVisitorBase::Visit - (Deployment::ComponentExternalPortEndpoints &cepes) - { - visit_sequence (cepes, *this); - } - diff --git a/CIAO/DAnCE/Planner/Planner.cpp b/CIAO/DAnCE/Planner/Planner.cpp deleted file mode 100644 index 03f613538c5..00000000000 --- a/CIAO/DAnCE/Planner/Planner.cpp +++ /dev/null @@ -1,138 +0,0 @@ - -//Author: Stoyan Paunov -//$Id$ - - -#include "ace/OS_main.h" - -#include "ciao/RepositoryManagerC.h" -#include "PCVisitor.h" -#include "PCVisitorBase.h" -#include "Config_Handlers/DnC_Dump.h" - -#include "ciao/DeploymentC.h" -#include "ciao/Deployment_BaseC.h" -#include "ciao/Deployment_DataC.h" -#include "ciao/Packaging_DataC.h" - -#include "Node_T.h" //Node -#include "ace/OS_Memory.h" //for ACE_NEW* macros -#include "ace/Containers_T.h" //for ACE_Double_Linked_List - - -#include "Config_Handlers/DP_Handler.h" -#include "Config_Handlers/Utils/XML_Helper.h" -#include "Config_Handlers/Deployment.hpp" -//using namespace CIAO::Config_Handlers; - -#include <iostream> -using namespace std; - - -//Definition of a Node parametrized by -//Deployment::Node -namespace { - typedef ::Node<Deployment::Node> NNode; -} - -int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - - char* name = 0; - - if (argc < 2) - { - cout << "Please provide name of package you want to deploy!\n"; - } - else - name = argv[1]; - - - ACE_TRY_NEW_ENV - { - // Initialize orb - CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, - ""ACE_ENV_ARG_PARAMETER); - - ACE_TRY_CHECK; - - //form the path to the RepoMan IOR file - ACE_CString RepoMan_ior = ("file://"); - RepoMan_ior += ACE_OS::getenv ("CIAO_ROOT"); - RepoMan_ior += "/DAnCE/RepositoryManager/RepositoryManagerDeamon.ior"; - - //get an object reference to the RepositoryManager - CORBA::Object_var obj = - orb->string_to_object (RepoMan_ior.c_str () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - Deployment::RepositoryManager_var rm = - Deployment::RepositoryManager::_narrow (obj.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (CORBA::is_nil (rm.in ())) - { - ACE_ERROR_RETURN ((LM_ERROR, - "Unable to acquire RepositoryManagerDaemon's objref\n"), - -1); - } - - Deployment::PackageConfiguration_var pc; - try - { - pc = rm->findPackageByName (name); - cout << "The package was found!" << endl; - } - catch (CORBA::Exception &) - { - cout << "Unable to retrieve package!\n" << endl; - return -1; - } - ACE_TRY_CHECK; - - Deployment::DeploymentPlan plan; - - PCVisitor pcv (plan, *pc); - pcv.Visit (); - ACE_TRY_CHECK; - - cout << "--> Printing populated DeploymentPlan\n"; - ::Deployment::DnC_Dump::dump (plan); - cout << "End of populated DeploymentPlan dump\n---------------------------------------\n"; - ACE_TRY_CHECK; - -/*-- NOTE: Currently reverse handler segfaults - - //Create an XML_Helper for all the file work - XML_Helper the_helper; - - //Convert it back to an XSC structure with a new DP_Handler - DP_Handler reverse_handler(plan); - - //Create a new DOMDocument for writing the XSC into XML - xercesc::DOMDocument* the_xsc (the_helper.create_dom(0)); - - //Serialize the XSC into a DOMDocument - deploymentPlan(*reverse_handler.xsc(), the_xsc); - - - //Write it to test.xml - the_helper.write_DOM(the_xsc, "generatedDP.xml"); -*/ - - // Finally destroy the ORB - orb->destroy (); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "Unknown exception \n"); - return -1; - } - ACE_ENDTRY; - - return 0; -} diff --git a/CIAO/DAnCE/Planner/Planner.mpc b/CIAO/DAnCE/Planner/Planner.mpc deleted file mode 100644 index f8845433494..00000000000 --- a/CIAO/DAnCE/Planner/Planner.mpc +++ /dev/null @@ -1,25 +0,0 @@ -// -*- MPC -*- -//Author: Stoyan Paunov -//$Id$ - -//Planner project which aims to automate the planning stage in DAnCE - -project (Planner) : taoexe, ciao_component_dnc, ciao_client_dnc, ciao_deployment_stub, ciao_config_handlers { - - exename = Planner - requires += RepositoryManager - after += RepositoryManager - includes += ../RepositoryManager - includes += $(CIAO_ROOT)/tools/Config_Handlers - - Source_Files { - Planner.cpp - PCVisitorBase.cpp - PCVisitor.cpp - } - - Template_Files { - Node_T.cpp - } -} - |