[PATCH] deployer: add getComponentTypes operation

---
deployment/DeploymentComponent.cpp | 11 +++++++++++
deployment/DeploymentComponent.hpp | 7 +++++++
2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/deployment/DeploymentComponent.cpp b/deployment/DeploymentComponent.cpp
index d525231..8fe87b0 100644
--- a/deployment/DeploymentComponent.cpp
+++ b/deployment/DeploymentComponent.cpp
@@ -100,6 +100,7 @@ namespace OCL
this->addOperation("loadService", &DeploymentComponent::loadService, this, ClientThread).doc("Load a discovered service or plugin in an existing component.").arg("Name", "The name of the component which will receive the service").arg("Service", "The name of the service or plugin.");
this->addOperation("unloadComponent", &DeploymentComponent::unloadComponent, this, ClientThread).doc("Unload a loaded component instance.").arg("Name", "The name of the to be created component");
this->addOperation("displayComponentTypes", &DeploymentComponent::displayComponentTypes, this, ClientThread).doc("Print out a list of all component types this component can create.");
+ this->addOperation("getComponentTypes", &DeploymentComponent::getComponentTypes, this, ClientThread).doc("return a vector of all component types this component can create.");

this->addOperation("loadConfiguration", &DeploymentComponent::loadConfiguration, this, ClientThread).doc("Load a new XML configuration from a file (identical to loadComponents).").arg("File", "The file which contains the new configuration.");
this->addOperation("loadConfigurationString", &DeploymentComponent::loadConfigurationString, this, ClientThread).doc("Load a new XML configuration from a string.").arg("Text", "The string which contains the new configuration.");
@@ -1334,6 +1335,16 @@ namespace OCL
cout << " (none)"<<endl;
}

+ std::string DeploymentComponent::getComponentTypes() const
+ {
+ std::string s;
+ OCL::FactoryMap::iterator it;
+ for(it = OCL::ComponentFactories::Instance().begin(); it != OCL::ComponentFactories::Instance().end(); ++it)
+ s+=it->first + ';';
+
+ return s;
+ }
+
bool DeploymentComponent::setActivity(const std::string& comp_name,
double period, int priority,
int scheduler)
diff --git a/deployment/DeploymentComponent.hpp b/deployment/DeploymentComponent.hpp
index e523791..04cd1d7 100644
--- a/deployment/DeploymentComponent.hpp
+++ b/deployment/DeploymentComponent.hpp
@@ -352,6 +352,13 @@ namespace OCL
void displayComponentTypes() const;

/**
+ * This function returns the component types this DeploymentComponent
+ * can create in a comma separated list.
+ * @see loadComponent()
+ */
+ std::string getComponentTypes() const;
+
+ /**
* (Re-)set the activity of a component with a periodic activity.
*
* @param comp_name The name of the component to change.

[PATCH] deployer: add getComponentTypes operation

On Monday 29 November 2010 18:32:05 Markus Klotzbuecher wrote:
> ---
> deployment/DeploymentComponent.cpp | 11 +++++++++++
> deployment/DeploymentComponent.hpp | 7 +++++++
> 2 files changed, 18 insertions(+), 0 deletions(-)

I had already applied your patch on the master branch. I overlooked the fact
that you're returning a string instead of a vector of strings. Why's that ?

Peter

[PATCH] deployer: add getComponentTypes operation

On Mon, Dec 06, 2010 at 02:34:23PM +0100, Peter Soetens wrote:
> On Monday 29 November 2010 18:32:05 Markus Klotzbuecher wrote:
> > ---
> > deployment/DeploymentComponent.cpp | 11 +++++++++++
> > deployment/DeploymentComponent.hpp | 7 +++++++
> > 2 files changed, 18 insertions(+), 0 deletions(-)
>
> I had already applied your patch on the master branch. I overlooked the fact
> that you're returning a string instead of a vector of strings. Why's that ?

It is slightly simpler for my usecase and doesn't depend on an
additional typekit.

Markus

[PATCH] deployer: add getComponentTypes operation

On Monday 06 December 2010 14:54:57 Markus Klotzbuecher wrote:
> On Mon, Dec 06, 2010 at 02:34:23PM +0100, Peter Soetens wrote:
> > On Monday 29 November 2010 18:32:05 Markus Klotzbuecher wrote:
> > > ---
> > >
> > > deployment/DeploymentComponent.cpp | 11 +++++++++++
> > > deployment/DeploymentComponent.hpp | 7 +++++++
> > > 2 files changed, 18 insertions(+), 0 deletions(-)
> >
> > I had already applied your patch on the master branch. I overlooked the
> > fact that you're returning a string instead of a vector of strings.
> > Why's that ?
>
> It is slightly simpler for my usecase and doesn't depend on an
> additional typekit.

The 'strings' type is included in OCL and should be readily available.

The ';' separator is arbitrary ?

This would be the first function in RTT/OCL that doesn't return an
std::vector<string> when returning a list of names.

Peter

[PATCH] deployer: add getComponentTypes operation

On Mon, Dec 06, 2010 at 03:43:08PM +0100, Peter Soetens wrote:
> On Monday 06 December 2010 14:54:57 Markus Klotzbuecher wrote:
> > On Mon, Dec 06, 2010 at 02:34:23PM +0100, Peter Soetens wrote:
> > > On Monday 29 November 2010 18:32:05 Markus Klotzbuecher wrote:
> > > > ---
> > > >
> > > > deployment/DeploymentComponent.cpp | 11 +++++++++++
> > > > deployment/DeploymentComponent.hpp | 7 +++++++
> > > > 2 files changed, 18 insertions(+), 0 deletions(-)
> > >
> > > I had already applied your patch on the master branch. I overlooked the
> > > fact that you're returning a string instead of a vector of strings.
> > > Why's that ?
> >
> > It is slightly simpler for my usecase and doesn't depend on an
> > additional typekit.
>
> The 'strings' type is included in OCL and should be readily available.
>
> The ';' separator is arbitrary ?
>
> This would be the first function in RTT/OCL that doesn't return an
> std::vector<string> when returning a list of names.

Hmm, I guess you have a point there. I'll send you an update...

Markus