summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthrall <thrall@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2004-08-09 01:39:06 +0000
committerthrall <thrall@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2004-08-09 01:39:06 +0000
commit73f1510a69cb83fd5cb7eaf60a9df4b2d767fd47 (patch)
tree2659a8a7d510650b834586ca2bdcc4d8e3c0f293
parent6cc57489186fddc6da167c1f9ca0763d2b8d0172 (diff)
downloadATCD-73f1510a69cb83fd5cb7eaf60a9df4b2d767fd47.tar.gz
Most functionality implemented but not debugged.
TODO: Allow RemoteEC consumers and suppliers, Negotiate event type and supplier IDs instead of specifying in XML, Implement ECTestDriver, Integrate with EC_DT tests
-rw-r--r--TAO/orbsvcs/examples/RtEC/ECConfigurator/ConfigurableEC.cpp8
-rw-r--r--TAO/orbsvcs/examples/RtEC/ECConfigurator/Configurator_ParseHandler.cpp39
-rw-r--r--TAO/orbsvcs/examples/RtEC/ECConfigurator/Configurator_SyntaxHandler.cpp261
-rw-r--r--TAO/orbsvcs/examples/RtEC/ECConfigurator/Configurator_SyntaxHandler.h33
-rw-r--r--TAO/orbsvcs/examples/RtEC/ECConfigurator/ECConsumer.cpp22
-rw-r--r--TAO/orbsvcs/examples/RtEC/ECConfigurator/ECConsumer.h12
-rw-r--r--TAO/orbsvcs/examples/RtEC/ECConfigurator/ECDriver.cpp31
-rw-r--r--TAO/orbsvcs/examples/RtEC/ECConfigurator/ECDriver.h42
-rw-r--r--TAO/orbsvcs/examples/RtEC/ECConfigurator/ECSupplier.cpp10
-rw-r--r--TAO/orbsvcs/examples/RtEC/ECConfigurator/ECSupplier.h6
-rw-r--r--TAO/orbsvcs/examples/RtEC/ECConfigurator/RtSchedEventChannel.idl29
-rw-r--r--TAO/orbsvcs/examples/RtEC/ECConfigurator/SyntaxTree.h4
-rw-r--r--TAO/orbsvcs/examples/RtEC/ECConfigurator/ecconfig.dtd4
-rw-r--r--TAO/orbsvcs/examples/RtEC/ECConfigurator/ecconfigurator.mpc2
14 files changed, 362 insertions, 141 deletions
diff --git a/TAO/orbsvcs/examples/RtEC/ECConfigurator/ConfigurableEC.cpp b/TAO/orbsvcs/examples/RtEC/ECConfigurator/ConfigurableEC.cpp
index 07611a250dc..900ab4ee88a 100644
--- a/TAO/orbsvcs/examples/RtEC/ECConfigurator/ConfigurableEC.cpp
+++ b/TAO/orbsvcs/examples/RtEC/ECConfigurator/ConfigurableEC.cpp
@@ -6,6 +6,8 @@
#include "ACEXML/common/FileCharStream.h"
#include "ACEXML/common/DefaultHandler.h"
+#include "tao/ORB.h"
+
#include "Configurator_ParseHandler.h"
#include "Configurator_SyntaxHandler.h"
@@ -32,7 +34,7 @@ main (int argc, char *argv[])
{
return 1;
}
- /*
+
// ORB initialization boiler plate...
CORBA::ORB_var orb =
CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER);
@@ -49,7 +51,7 @@ main (int argc, char *argv[])
ACE_TRY_CHECK;
poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
- */
+
ACEXML_FileCharStream *fcs = new ACEXML_FileCharStream();
if ((retval = fcs->open(args.filename_.c_str())) != 0) {
//ACE_DEBUG ((LM_DEBUG, "Could not open file %s\n",args.filename_.c_str()));
@@ -77,7 +79,7 @@ main (int argc, char *argv[])
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Finished parsing\n")));
Configurator_SyntaxHandler cfgtor;
- //cfgtor.init(orb,poa);
+ cfgtor.init(orb.in(),poa.in());
cfgtor.setRootNode(xmlhandler.getRootNode());
cfgtor.setNameTable(xmlhandler.getNameTable());
cfgtor.parse();
diff --git a/TAO/orbsvcs/examples/RtEC/ECConfigurator/Configurator_ParseHandler.cpp b/TAO/orbsvcs/examples/RtEC/ECConfigurator/Configurator_ParseHandler.cpp
index 623c81b2bca..897d45606c7 100644
--- a/TAO/orbsvcs/examples/RtEC/ECConfigurator/Configurator_ParseHandler.cpp
+++ b/TAO/orbsvcs/examples/RtEC/ECConfigurator/Configurator_ParseHandler.cpp
@@ -410,7 +410,20 @@ Configurator_ParseHandler::parseEvent (Event* vs, void* arg)
}
else
{
- ACEXML_THROW (ACEXML_SAXException (ACE_TEXT("Invalid attributes for Event")));
+ ACEXML_THROW (ACEXML_SAXException (ACE_TEXT("Invalid name attribute for Event")));
+ }
+ val = alist->getValue(ACE_TEXT("type"));
+ if (val != 0)
+ {
+ std::istringstream iss(val);
+ if ((iss >> vs->type) == 0)
+ {
+ ACEXML_THROW(ACEXML_SAXException(ACE_TEXT ("Invalid number format in Event type attribute")));
+ }
+ }
+ else
+ {
+ ACEXML_THROW (ACEXML_SAXException (ACE_TEXT("Invalid type attribute for Event")));
}
ECConfiguration *parent = dynamic_cast<ECConfiguration*> (this->scope_.top());
@@ -797,6 +810,19 @@ Configurator_ParseHandler::parseSupplier (Supplier* vs, void* arg)
{
ACEXML_THROW (ACEXML_SAXException (ACE_TEXT("Invalid attributes for Supplier")));
}
+ val = alist->getValue(ACE_TEXT("id"));
+ if (val != 0)
+ {
+ std::istringstream iss(val);
+ if ((iss >> vs->id) == 0)
+ {
+ ACEXML_THROW(ACEXML_SAXException(ACE_TEXT ("Invalid number format in Supplier id attribute")));
+ }
+ }
+ else
+ {
+ ACEXML_THROW (ACEXML_SAXException (ACE_TEXT("Invalid id attribute for Supplier")));
+ }
if (this->scope_.top()->getSyntaxType() == VisitableSyntax::LOCALEVENTCHANNEL)
{
@@ -960,9 +986,8 @@ Configurator_ParseHandler::parseEventName (EventName* vs, void* arg)
ACE_UNUSED_ARG(arg);
if (this->scope_.top()->getSyntaxType() != VisitableSyntax::SUBSCRIPTIONS
- && this->scope_.top()->getSyntaxType() != VisitableSyntax::PUBLICATIONS
- && this->scope_.top()->getSyntaxType() != VisitableSyntax::TRIGGERS)
- ACEXML_THROW (ACEXML_SAXException (ACE_TEXT("EventName not child of Subscriptions, Publications, or Triggers")));
+ && this->scope_.top()->getSyntaxType() != VisitableSyntax::PUBLICATIONS)
+ ACEXML_THROW (ACEXML_SAXException (ACE_TEXT("EventName not child of Subscriptions or Publications")));
if (this->scope_.top()->getSyntaxType() == VisitableSyntax::SUBSCRIPTIONS)
{
@@ -976,12 +1001,6 @@ Configurator_ParseHandler::parseEventName (EventName* vs, void* arg)
ACE_ASSERT(parent);
parent->eventnames.push_back(vs);
}
- else if (this->scope_.top()->getSyntaxType() == VisitableSyntax::TRIGGERS)
- {
- Triggers *parent = dynamic_cast<Triggers*> (this->scope_.top());
- ACE_ASSERT(parent);
- parent->eventnames.push_back(vs);
- }
this->scope_.push(vs);
return 0;
diff --git a/TAO/orbsvcs/examples/RtEC/ECConfigurator/Configurator_SyntaxHandler.cpp b/TAO/orbsvcs/examples/RtEC/ECConfigurator/Configurator_SyntaxHandler.cpp
index 27147906a71..26f46560512 100644
--- a/TAO/orbsvcs/examples/RtEC/ECConfigurator/Configurator_SyntaxHandler.cpp
+++ b/TAO/orbsvcs/examples/RtEC/ECConfigurator/Configurator_SyntaxHandler.cpp
@@ -4,12 +4,16 @@
#include "SyntaxTree.h"
#include "RtSchedEventChannelC.h"
#include "Kokyu_EC.h"
+#include "ECDriver.h"
+#include "ECSupplier.h"
#include "ace/ACE.h"
#include "ace/Log_Msg.h"
#include "ace/OS_String.h"
#include "ace/Hash_Map_Manager.h"
+#include "tao/ORB_Core.h"
+
#include "RtecSchedulerC.h"
#include <stdlib.h> //for atol
@@ -21,25 +25,24 @@ Configurator_SyntaxHandler::Configurator_SyntaxHandler (void)
this->nametable.open();
this->eventqostable.open();
this->timeoutqostable.open();
+ this->suppliermap.open();
}
-/*
+
int
-init (CORBA::ORB_var orb, PortableServer::POA_var poa)
+Configurator_SyntaxHandler::init (CORBA::ORB_var orb, PortableServer::POA_var poa)
{
this->orb = orb;
this->poa = poa;
- ACE_NEW_RETURN(ginit,
- Gateway_Initializer(),-1);
-
return 0;
}
-*/
+
Configurator_SyntaxHandler::~Configurator_SyntaxHandler (void)
{
this->nametable.close();
this->eventqostable.close();
this->timeoutqostable.close();
+ this->suppliermap.close();
}
// SyntaxVisitor FUNCTIONS //
@@ -93,10 +96,33 @@ Configurator_SyntaxHandler::parseECConfiguration (ECConfiguration* vs, void* arg
}
//remoteecs
+ Gateway_Initializer::FileNameVector remote_ior_files;
RemoteECVector::iterator reciter = vs->remoteECs.begin();
for (; reciter != vs->remoteECs.end(); reciter++)
{
- (*reciter)->visit(this,NULL);
+ (*reciter)->visit(this,&remote_ior_files);
+ }
+
+ // Initialize gateways from local ECs to remote ECs
+ KokyuECVector::iterator keciter = this->kokyuECs.begin();
+ for(; keciter != this->kokyuECs.end(); ++keciter)
+ {
+ KokyuECVector::value_type kokyuEC = *keciter;
+
+ Gateway_Initializer *ginit;
+ ACE_NEW_RETURN(ginit,
+ Gateway_Initializer(),-1);
+ ginit->init(this->orb,this->poa,kokyuEC,
+ kokyuEC->get_name(),remote_ior_files);
+ ACE_Time_Value gateway_delay(5,000000);
+ long timer_id = this->orb->orb_core()->reactor()->schedule_timer(this->ginitv[0],0,gateway_delay);
+ if (timer_id < 0)
+ {
+ ACE_CString error("Could not schedule Gateway_Initializer timer for Local EC ");
+ error += kokyuEC->get_name();
+ ACEXML_THROW (ACEXML_SAXException (error.c_str()));
+ }
+ this->ginitv.push_back(ginit);
}
// DEBUG -- print name table
@@ -144,6 +170,9 @@ Configurator_SyntaxHandler::parseEvent (Event* vs, void* arg)
vs->worstexecution->visit(this,&schedinfo);
vs->typicalexecution->visit(this,&schedinfo);
+ // Set EventType
+ schedinfo.type = vs->type;
+
// Since nametable was OK, eventqostable should be too
this->eventqostable.bind(vs->name,schedinfo);
@@ -220,35 +249,39 @@ Configurator_SyntaxHandler::parseLocalEventChannel (LocalEventChannel* vs, void*
ACE_CString sched_type;
switch (vs->schedulingstrategy->type) {
case SchedulingStrategy::EDF:
- sched_type += "edf";
+ sched_type = "edf";
break;
case SchedulingStrategy::MUF:
- sched_type += "muf";
+ sched_type = "muf";
break;
case SchedulingStrategy::RMS:
- sched_type += "rms";
+ sched_type = "rms";
break;
}
- // TODO: set up local EC
+ // Set up local EC
RtEventChannelAdmin::RtSchedEventChannel_var localEC;
- /*
- Kokyu_EC local_ec;
- if (local_ec.init(this->driver->time_master(),
- sched_type.c_str(), this->poa.in(),
- this->orb->orb_core()->reactor()) == -1)
+
+ Kokyu_EC *local_ec;
+ ACE_NEW_RETURN(local_ec,
+ Kokyu_EC(),-1);
+
+ if (local_ec->init(this->driver->get_time_master(),
+ sched_type.c_str(), this->poa.in(),
+ this->orb->orb_core()->reactor()) == -1)
{
ACE_CString error("Unable to initialize EC: ");
error += vs->name;
ACEXML_THROW (ACEXML_SAXException (error.c_str()));
}
- localEC = local_ec._this(ACE_ENV_SINGLE_ARG_PARAMETER);
+ localEC = local_ec->_this(ACE_ENV_SINGLE_ARG_PARAMETER);
- CORBA::String_var ior = orb->object_to_string(local_ec.in()
+ CORBA::String_var ior = orb->object_to_string(localEC.in()
ACE_ENV_ARG_PARAMETER);
- ACE_CString ior_output_filename;
+ ACE_CString ior_output_filename(vs->name);
+ ior_output_filename += ".ior";
FILE *ior_output_file = ACE_OS::fopen (ior_output_filename.c_str(), "w");
if (ior_output_file == 0)
{
@@ -261,21 +294,25 @@ Configurator_SyntaxHandler::parseLocalEventChannel (LocalEventChannel* vs, void*
ACE_OS::fprintf(ior_output_file, ior.in());
ACE_OS::fclose(ior_output_file);
+ this->kokyuECs.push_back(local_ec);
this->localECs.push_back(localEC);
- */
- // visit localEC children
- //consumers
- ConsumerVector::iterator citer = vs->consumers.begin();
- for (; citer != vs->consumers.end(); citer++)
- {
- (*citer)->visit(this,localEC.in());
- }
+ // visit localEC children
+ // suppliers go first because consumers might need them as dependants
//suppliers
SupplierVector::iterator siter = vs->suppliers.begin();
for (; siter != vs->suppliers.end(); siter++)
{
- (*siter)->visit(this,localEC.in());
+ //(*siter)->visit(this,localEC.in());
+ (*siter)->visit(this,local_ec);
+ }
+
+ //consumers
+ ConsumerVector::iterator citer = vs->consumers.begin();
+ for (; citer != vs->consumers.end(); citer++)
+ {
+ //(*citer)->visit(this,localEC.in());
+ (*citer)->visit(this,local_ec);
}
return 0;
@@ -291,29 +328,19 @@ Configurator_SyntaxHandler::parseRemoteEventChannel (RemoteEventChannel* vs, voi
// get IOR filename
ACE_CString iorfilename(vs->iorfile->str);
-
- // TODO: set up remote EC
+ Gateway_Initializer::FileNameVector *remote_ior_filenames =
+ static_cast<Gateway_Initializer::FileNameVector*> (arg);
+ ACE_ASSERT(remote_ior_filenames);
+ remote_ior_filenames->push_back(iorfilename.c_str());
+ /* TODO: for now, don't allow consumers and suppliers on remote EC
+ // Set up remote EC
RtEventChannelAdmin::RtSchedEventChannel_var remoteEC;
- /*
- // TODO: for now, just do one gateway init
- this->ginitv[0]->init(this->orb,this->poa,localECs[0].in(),ior_output_filename,ior_input_files);
- ACE_Time_Value gateway_delay(5,000000);
- long timer_id = this->orb->orb_core()->reactor()->schedule_timer(this->ginitv[0],0,gateway_delay);
- if (timer_id < 0)
- {
- ACE_CString error("Could not schedule Gateway_Initializer timer for RemoteEC ");
- error += vs->name;
- ACEXML_THROW (ACEXML_SAXException (error.c_str()));
- }
- */
- // visit remoteEC consumers and suppliers
- //consumers
- ConsumerVector::iterator citer = vs->consumers.begin();
- for (; citer != vs->consumers.end(); citer++)
- {
- (*citer)->visit(this,remoteEC.in());
- }
+ Kokyu_EC::init_remote_ec(iorfilename.c_str(),this->orb.in(),
+ remoteEC.out());
+
+ // Visit remoteEC Children
+ // suppliers go first because consumers might need them as dependants
//suppliers
SupplierVector::iterator siter = vs->suppliers.begin();
for (; siter != vs->suppliers.end(); siter++)
@@ -321,6 +348,13 @@ Configurator_SyntaxHandler::parseRemoteEventChannel (RemoteEventChannel* vs, voi
(*siter)->visit(this,remoteEC.in());
}
+ //consumers
+ ConsumerVector::iterator citer = vs->consumers.begin();
+ for (; citer != vs->consumers.end(); citer++)
+ {
+ (*citer)->visit(this,remoteEC.in());
+ }
+ */
return 0;
}
@@ -355,11 +389,55 @@ Configurator_SyntaxHandler::parseConsumer (Consumer* vs, void* arg)
SupplierVector dependants; //dependants push_back
vs->dependants->visit(this,&dependants);
- // TODO: register Consumer
+ // Register Consumer
+ /*
RtEventChannelAdmin::RtSchedEventChannel *ec =
static_cast<RtEventChannelAdmin::RtSchedEventChannel*> (arg);
+ */
+ Kokyu_EC *ec = static_cast<Kokyu_EC*> (arg);
- // TODO: map syntax dependants to actual suppliers somehow
+ // TODO: negotiate event types
+ ECSupplier::EventTypeVector subtypes;
+ QoSVector::iterator subiter = subs.begin();
+ for (; subiter != subs.end(); ++subiter)
+ {
+ QoSVector::value_type qos = *subiter;
+ subtypes.push_back(qos.type);
+ }
+
+ ECConsumer *consumer;
+ ACE_NEW_RETURN(consumer,
+ ECConsumer(subtypes),-1);
+
+ // for each dependant, set up the dependency
+ SupplierVector::iterator siter = dependants.begin();
+ for (; siter != dependants.end(); ++siter)
+ {
+ SupplierVector::value_type supplier = *siter;
+ SupplierMap::VALUE ecsupplier;
+ this->suppliermap.find(supplier->name,ecsupplier);
+ ACE_ASSERT(ecsupplier); // shouldn't have got here with no Supplier
+
+ //TODO: multi-type consumer subs
+ QoSVector::value_type qos = subs[0]; //for now just use this
+ // if multiple timeouts, this won't reg supplier multiple times
+ consumer->pushDependant(ecsupplier);
+ ec->add_consumer_with_supplier(consumer,
+ vs->name.c_str(),
+ subs,
+ /*
+ qos.period,
+ subs,
+ qos.criticality,
+ qos.importance,
+ */
+ ecsupplier,
+ supplier->name.c_str(),
+ ecsupplier->getPublishedTypes()
+ ACE_ENV_ARG_PARAMETER
+ );
+ }
+ this->consumermap.bind(vs->name,consumer);
return 0;
}
@@ -424,7 +502,7 @@ Configurator_SyntaxHandler::parseSupplier (Supplier* vs, void* arg)
&& vs->triggers))
{
ACE_CString error("Supplier has missing child: ");
- error += vs->name;
+ error += vs->publications ? "Triggers" : "Publications";
ACEXML_THROW (ACEXML_SAXException (error.c_str()));
}
@@ -435,9 +513,50 @@ Configurator_SyntaxHandler::parseSupplier (Supplier* vs, void* arg)
QoSVector trigs;
vs->triggers->visit(this,&trigs);
- // TODO: register Supplier
+ // Register Supplier
+ /*
RtEventChannelAdmin::RtSchedEventChannel *ec =
static_cast<RtEventChannelAdmin::RtSchedEventChannel*> (arg);
+ */
+ Kokyu_EC *ec = static_cast<Kokyu_EC*> (arg);
+
+ // TODO: negotiate event types
+ ECSupplier::EventType type = 100 * vs->id;
+
+ ECSupplier::EventTypeVector pubtypes;
+ QoSVector::iterator pubiter = pubs.begin();
+ for (; pubiter != pubs.end(); ++pubiter,++type)
+ {
+ pubtypes.push_back(type);
+ }
+
+ ECSupplier *supplier;
+ ACE_NEW_RETURN(supplier,
+ ECSupplier(vs->id,pubtypes),-1);
+
+ //for each trigger timeout, set up a timer
+ QoSVector::iterator qositer = trigs.begin();
+ for (; qositer != trigs.end(); ++qositer)
+ {
+ QoSVector::value_type qos = *qositer;
+ // Timeout QoS only has period and phase
+ ECSupplier_Timeout_Handler *timeout;
+ ACE_NEW_RETURN(timeout,
+ ECSupplier_Timeout_Handler(supplier),-1);
+
+ // if multiple timeouts, this won't reg supplier multiple times
+ ec->add_supplier_with_timeout(supplier,
+ vs->name.c_str(),
+ pubtypes,
+ timeout,
+ qos.phase,
+ qos.period,
+ RtecScheduler::LOW_CRITICALITY,
+ RtecScheduler::LOW_IMPORTANCE
+ ACE_ENV_ARG_PARAMETER
+ );
+ }
+ this->suppliermap.bind(vs->name,supplier);
return 0;
}
@@ -475,28 +594,15 @@ Configurator_SyntaxHandler::parseTriggers (Triggers* vs, void* arg)
ACE_ASSERT(trigs);
// parse Triggers
- EventNameVector::iterator eniter = vs->eventnames.begin();
- for (; eniter != vs->eventnames.end(); eniter++)
- {
- QoSVector::value_type trigqos;
- ACE_DEBUG ((LM_DEBUG,ACE_TEXT("Trigger Event %s\n"),(*eniter)->str.c_str()));
- if (this->eventqostable.find((*eniter)->str,trigqos))
- {
- ACE_CString error("Unknown trigger event: ");
- error += (*eniter)->str;
- ACEXML_THROW (ACEXML_SAXException (error.c_str()));
- }
- trigs->push_back(trigqos);
- }
TimeoutNameVector::iterator tniter = vs->timeoutnames.begin();
for (; tniter != vs->timeoutnames.end(); tniter++)
{
QoSVector::value_type trigqos;
- ACE_DEBUG ((LM_DEBUG,ACE_TEXT("Trigger Timeout %s\n"),(*eniter)->str.c_str()));
- if (this->timeoutqostable.find((*eniter)->str,trigqos))
+ ACE_DEBUG ((LM_DEBUG,ACE_TEXT("Trigger Timeout %s\n"),(*tniter)->str.c_str()));
+ if (this->timeoutqostable.find((*tniter)->str,trigqos))
{
ACE_CString error("Unknown trigger timeout: ");
- error += (*eniter)->str;
+ error += (*tniter)->str;
ACEXML_THROW (ACEXML_SAXException (error.c_str()));
}
trigs->push_back(trigqos);
@@ -526,8 +632,15 @@ Configurator_SyntaxHandler::parseTestDriver (TestDriver* vs, void* arg)
long limit;
vs->stopcondition->visit(this,&limit);
- // TODO: Create TestDriver
- this->testdriver = NULL;
+ // Create TestDriver
+ if (this->driver)
+ {
+ ACE_CString error("More than one TestDriver");
+ ACEXML_THROW (ACEXML_SAXException (error.c_str()));
+ }
+ ACE_NEW_RETURN (this->driver,
+ ECTestDriver(),-1);
+ this->driver->set_time_master(vs->startcondition->master);
return 0;
}
@@ -710,10 +823,10 @@ Configurator_SyntaxHandler::parse (void)
this->root->visit(this,NULL);
}
-ECTestDriver *
-Configurator_SyntaxHandler::getTestDriver (void)
+ECDriver *
+Configurator_SyntaxHandler::getDriver (void)
{
- return this->testdriver;
+ return this->driver;
}
void
diff --git a/TAO/orbsvcs/examples/RtEC/ECConfigurator/Configurator_SyntaxHandler.h b/TAO/orbsvcs/examples/RtEC/ECConfigurator/Configurator_SyntaxHandler.h
index feccadd88fb..4eafef71200 100644
--- a/TAO/orbsvcs/examples/RtEC/ECConfigurator/Configurator_SyntaxHandler.h
+++ b/TAO/orbsvcs/examples/RtEC/ECConfigurator/Configurator_SyntaxHandler.h
@@ -20,10 +20,17 @@
#include "ACEXML/common/SAXExceptions.h"
+#include "tao/ORB.h"
+#include "tao/PortableServer/PortableServer.h"
+
#include <vector>
// Forward decls
-class ECTestDriver;
+class ECDriver;
+class Kokyu_EC;
+class Gateway_Initializer;
+class ECSupplier;
+class ECConsumer;
/**
* @class Configurator_SyntaxHandler
@@ -41,7 +48,7 @@ public:
*/
Configurator_SyntaxHandler (void);
- //int init(CORBA::ORB_var orb, PortableServer::POA_var poa);
+ int init(CORBA::ORB_var orb, PortableServer::POA_var poa);
/*
* Default destructor.
@@ -114,7 +121,7 @@ public:
virtual void parse (void)
ACE_THROW_SPEC ((ACEXML_SAXException));
- ECTestDriver *getTestDriver (void);
+ ECDriver *getDriver (void);
void setNameTable(NameTable &nt);
@@ -122,7 +129,11 @@ public:
typedef std::vector<RtEventChannelAdmin::SchedInfo> QoSVector;
typedef std::vector<RtEventChannelAdmin::RtSchedEventChannel_var> ECVector;
- //typedef std::vector<GatewayInitializer> GatewayInitVector;
+ typedef std::vector<Kokyu_EC*> KokyuECVector;
+ typedef std::vector<Gateway_Initializer*> GatewayInitVector;
+
+ typedef ACE_Hash_Map_Manager<ACE_CString,ECSupplier*,ACE_Null_Mutex> SupplierMap;
+ typedef ACE_Hash_Map_Manager<ACE_CString,ECConsumer*,ACE_Null_Mutex> ConsumerMap;
private:
NameTable nametable;
@@ -131,15 +142,21 @@ private:
VisitableSyntax *root;
- ECTestDriver *testdriver;
+ ECDriver *driver;
// ORB stuff
- //CORBA::ORB_var orb;
- //PortableServer::POA_var poa;
+ CORBA::ORB_var orb;
+ PortableServer::POA_var poa;
+
+ // EC stuff
+ KokyuECVector kokyuECs; // for convenience
ECVector localECs;
ECVector remoteECs;
- //GatewayInitVector ginitv;
+ GatewayInitVector ginitv;
+ // Consumer/Supplier stuff
+ SupplierMap suppliermap;
+ ConsumerMap consumermap;
};
#endif /* CONFIGURATOR_SYNTAXHANDLER_H */
diff --git a/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECConsumer.cpp b/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECConsumer.cpp
index 3953b47d6e6..e36418e9e36 100644
--- a/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECConsumer.cpp
+++ b/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECConsumer.cpp
@@ -16,10 +16,8 @@
ACE_RCSID(EC_Examples, ECConsumer, "$Id$")
-ECConsumer::ECConsumer (EventTypeVector &sub_types,
- ECSupplier *fwddest, Service_Handler * handler)
+ECConsumer::ECConsumer (EventTypeVector &sub_types, Service_Handler * handler)
: worktime_(0,0)
- , fwddest_(fwddest)
, handler_(handler)
, sub_types_(sub_types)
{
@@ -27,9 +25,8 @@ ECConsumer::ECConsumer (EventTypeVector &sub_types,
ECConsumer::ECConsumer (EventTypeVector &sub_types,
ACE_Time_Value& worktime,
- ECSupplier *fwddest, Service_Handler *handler)
+ Service_Handler *handler)
: worktime_(worktime)
- , fwddest_(fwddest)
, handler_(handler)
, sub_types_(sub_types)
{
@@ -108,11 +105,12 @@ ECConsumer::push (const RtecEventComm::EventSet& events
// prio, exec_duration, elapsed_time.msec ()));
//now, trigger the next subtask if any
- if (this->fwddest_ != 0)
+ ACE_DEBUG((LM_DEBUG,"ECConsumer (%P|%t) triggering next subtasks\n"));
+ SupplierVector::iterator siter = this->dependants_.begin();
+ for(; siter != this->dependants_.end(); ++siter)
{
- //trigger next subtask; we assume we are the only ones who set the ECSupplier's mode!
- ACE_DEBUG((LM_DEBUG,"ECConsumer (%P|%t) triggering next subtask\n"));
- this->fwddest_->timeout_occured(ACE_ENV_SINGLE_ARG_PARAMETER);
+ SupplierVector::value_type supplier = *siter;
+ supplier->timeout_occured(ACE_ENV_SINGLE_ARG_PARAMETER);
}
if (this->handler_ != 0)
@@ -159,6 +157,12 @@ ECConsumer::handler(void) const
return this->handler_;
}
+void
+ECConsumer::pushDependant(ECSupplier *dep)
+{
+ this->dependants_.push_back(dep);
+}
+
// ****************************************************************
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
diff --git a/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECConsumer.h b/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECConsumer.h
index 80996cccb88..612a0d379ca 100644
--- a/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECConsumer.h
+++ b/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECConsumer.h
@@ -38,7 +38,6 @@ class ECConsumer : public POA_RtecEventComm::PushConsumer
//
// = DESCRIPTION
// This class is a consumer of events.
- // It simply register for two event typesone event type
// The class is just a helper to simplify common tasks in EC
// tests, such as subscribing for a range of events, disconnecting
// from the EC, informing the driver of shutdown messages, etc.
@@ -51,14 +50,13 @@ public:
typedef RtecEventComm::EventType EventType;
typedef std::vector<EventType> EventTypeVector;
typedef RtecScheduler::handle_t InfoHandle;
+ typedef std::vector<ECSupplier*> SupplierVector;
ECConsumer (EventTypeVector &sub_types,
- ACE_Time_Value& worktime,
- ECSupplier *fwddest = 0, Service_Handler *handler = 0);
+ ACE_Time_Value& worktime, Service_Handler *handler = 0);
// Constructor
- ECConsumer (EventTypeVector &sub_types,
- ECSupplier *fwddest = 0, Service_Handler *handler = 0);
+ ECConsumer (EventTypeVector &sub_types, Service_Handler *handler = 0);
// Constructor
virtual ~ECConsumer(void);
@@ -81,10 +79,12 @@ public:
Service_Handler * handler(void) const;
+ void pushDependant (ECSupplier *dep);
+
protected:
ACE_Time_Value worktime_;
- ECSupplier *fwddest_;
+ SupplierVector dependants_;
InfoHandle rt_info_;
Service_Handler * handler_;
diff --git a/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECDriver.cpp b/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECDriver.cpp
new file mode 100644
index 00000000000..d3a60da1b23
--- /dev/null
+++ b/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECDriver.cpp
@@ -0,0 +1,31 @@
+// $Id$
+
+#include "ECDriver.h"
+
+ECDriver::ECDriver (void)
+{
+}
+
+ECDriver::~ECDriver (void)
+{
+}
+
+ECTestDriver::ECTestDriver (void)
+{
+}
+
+ECTestDriver::~ECTestDriver (void)
+{
+}
+
+bool
+ECTestDriver::get_time_master (void) const
+{
+ return this->time_master;
+}
+
+void
+ECTestDriver::set_time_master (bool tm)
+{
+ this->time_master = tm;
+}
diff --git a/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECDriver.h b/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECDriver.h
new file mode 100644
index 00000000000..18b0cb3818a
--- /dev/null
+++ b/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECDriver.h
@@ -0,0 +1,42 @@
+// $Id$
+
+//=============================================================================
+/**
+ * @file ECDriver.h
+ *
+ * $Id$
+ *
+ * @author Bryan Thrall <thrall@cse.wustl.edu>
+ */
+//=============================================================================
+
+
+#ifndef ECDRIVER_H
+#define ECDRIVER_H
+
+class ECDriver
+{
+public:
+ ECDriver (void);
+
+ virtual ~ECDriver (void);
+
+ virtual bool get_time_master (void) const = 0;
+ virtual void set_time_master (bool tm) = 0;
+};
+
+class ECTestDriver : public ECDriver
+{
+public:
+ ECTestDriver (void);
+
+ virtual ~ECTestDriver (void);
+
+ virtual bool get_time_master (void) const;
+ virtual void set_time_master (bool tm);
+
+protected:
+ bool time_master;
+};
+
+#endif // ECDRIVER_H
diff --git a/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECSupplier.cpp b/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECSupplier.cpp
index f6fce838bea..18bf6be81d9 100644
--- a/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECSupplier.cpp
+++ b/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECSupplier.cpp
@@ -89,8 +89,14 @@ ECSupplier::handler(void) const
return this->handler_;
}
-// ****************************************************************
+const ECSupplier::EventTypeVector &
+ECSupplier::getPublishedTypes (void) const
+{
+ return this->pub_types_;
+}
+// ****************************************************************
+/*
ECTimeout_Consumer::ECTimeout_Consumer (ECSupplier* supplier)
:supplier_impl_ (supplier)
{
@@ -118,7 +124,7 @@ ECTimeout_Consumer::disconnect_push_consumer (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
ACE_THROW_SPEC ((CORBA::SystemException))
{
}
-
+*/
// ****************************************************************
/// Constructor
diff --git a/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECSupplier.h b/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECSupplier.h
index 2a75c586fb7..c38fb647fc7 100644
--- a/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECSupplier.h
+++ b/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECSupplier.h
@@ -76,6 +76,8 @@ public:
Service_Handler * handler(void) const;
+ const EventTypeVector &getPublishedTypes (void) const;
+
protected:
SourceID id_;
EventTypeVector pub_types_;
@@ -86,7 +88,7 @@ protected:
Service_Handler *handler_;
}; //class ECSupplier
-
+/*
class ECTimeout_Consumer : public POA_RtecEventComm::PushConsumer
{
// = TITLE
@@ -113,7 +115,7 @@ public:
private:
ECSupplier *supplier_impl_;
}; //class ECTimeout_Consumer
-
+*/
class ECSupplier_Timeout_Handler : public ACE_Event_Handler
{
// = TITLE
diff --git a/TAO/orbsvcs/examples/RtEC/ECConfigurator/RtSchedEventChannel.idl b/TAO/orbsvcs/examples/RtEC/ECConfigurator/RtSchedEventChannel.idl
index 84720d12920..158e1772aec 100644
--- a/TAO/orbsvcs/examples/RtEC/ECConfigurator/RtSchedEventChannel.idl
+++ b/TAO/orbsvcs/examples/RtEC/ECConfigurator/RtSchedEventChannel.idl
@@ -21,6 +21,8 @@ module RtEventChannelAdmin
typedef RtecScheduler::Threads_t Threads_t;
typedef RtecScheduler::Info_Type_t Info_Type_t;
typedef long Phase_t; // 100 of nanoseconds
+ typedef RtecEventComm::_EventType Event_Type;
+ typedef RtecEventComm::EventSourceID EventSourceID;
struct SchedInfo {
Criticality_t criticality;
@@ -33,35 +35,12 @@ module RtEventChannelAdmin
Quantum_t quantum;
Threads_t threads;
Info_Type_t info_type;
+
+ Event_Type type;
};
interface RtSchedEventChannel
{
- handle_t register_consumer(in string entry_point,
- in SchedInfo info,
- in RtecEventComm::_EventType type,
- in RtecEventComm::PushConsumer consumer,
- out RtecEventChannelAdmin::ProxyPushSupplier proxy_supplier)
- raises (RtecScheduler::UNKNOWN_TASK,
- RtecScheduler::INTERNAL,
- RtecScheduler::SYNCHRONIZATION_FAILURE);
-
- handle_t register_supplier(in string entry_point,
- in RtecEventComm::EventSourceID source,
- in RtecEventComm::_EventType type,
- in RtecEventComm::PushSupplier supplier,
- out RtecEventChannelAdmin::ProxyPushConsumer proxy_consumer)
- raises (RtecScheduler::UNKNOWN_TASK,
- RtecScheduler::INTERNAL,
- RtecScheduler::SYNCHRONIZATION_FAILURE);
-
- void add_dependency(in handle_t handle,
- in handle_t dependency,
- in long number_of_calls,
- in RtecScheduler::Dependency_Type_t dependency_type)
- raises (RtecScheduler::SYNCHRONIZATION_FAILURE,
- RtecScheduler::UNKNOWN_TASK);
-
void start()
raises (RtecScheduler::UNKNOWN_TASK,
RtecScheduler::INTERNAL,
diff --git a/TAO/orbsvcs/examples/RtEC/ECConfigurator/SyntaxTree.h b/TAO/orbsvcs/examples/RtEC/ECConfigurator/SyntaxTree.h
index 619a45562e7..0322ddf9908 100644
--- a/TAO/orbsvcs/examples/RtEC/ECConfigurator/SyntaxTree.h
+++ b/TAO/orbsvcs/examples/RtEC/ECConfigurator/SyntaxTree.h
@@ -15,6 +15,7 @@
#define SYNTAXTREE_H
#include "SyntaxVisitor.h"
+#include "RtSchedEventChannelC.h" // Event_Type,SourceId
#include "RtecSchedulerC.h"
#include "ace/OS_String.h"
@@ -203,6 +204,7 @@ public:
// Attributes
ACE_CString name;
+ RtEventChannelAdmin::Event_Type type; // TODO: handle Event::type
};
class Criticality : public VisitableSyntax
@@ -438,6 +440,7 @@ public:
// Attributes
ACE_CString name;
+ RtEventChannelAdmin::EventSourceID id; // TODO: handle Supplier::id
};
class Publications : public VisitableSyntax
@@ -479,7 +482,6 @@ public:
}
// Children
- EventNameVector eventnames;
TimeoutNameVector timeoutnames;
};
diff --git a/TAO/orbsvcs/examples/RtEC/ECConfigurator/ecconfig.dtd b/TAO/orbsvcs/examples/RtEC/ECConfigurator/ecconfig.dtd
index 807b6718ab1..172b9187419 100644
--- a/TAO/orbsvcs/examples/RtEC/ECConfigurator/ecconfig.dtd
+++ b/TAO/orbsvcs/examples/RtEC/ECConfigurator/ecconfig.dtd
@@ -6,6 +6,7 @@
<!-- EVENT -->
<!ELEMENT Event (Period,Phase,Criticality,Importance,WorstExecution,TypicalExecution) >
<!ATTLIST Event name CDATA #REQUIRED >
+ <!ATTLIST Event type CDATA #REQUIRED >
<!ELEMENT Criticality (EMPTY) >
<!ATTLIST Criticality value (VERY_LOW|LOW|MEDIUM|HIGH|VERY_HIGH) #REQUIRED >
@@ -47,10 +48,11 @@
<!-- If no Triggers is supplied (or it is empty), the Supplier is assumed to be self-triggered -->
<!ELEMENT Supplier (Publications,Triggers?) >
<!ATTLIST Supplier name CDATA #REQUIRED >
+ <!ATTLIST Supplier id CDATA #REQUIRED >
<!ELEMENT Publications (EventName*) >
- <!ELEMENT Triggers ((EventName|TimeoutName)*) >
+ <!ELEMENT Triggers (TimeoutName*) >
<!ELEMENT TimeoutName (#PCDATA) >
diff --git a/TAO/orbsvcs/examples/RtEC/ECConfigurator/ecconfigurator.mpc b/TAO/orbsvcs/examples/RtEC/ECConfigurator/ecconfigurator.mpc
index 3e7b82f9ca3..c08fc2e1023 100644
--- a/TAO/orbsvcs/examples/RtEC/ECConfigurator/ecconfigurator.mpc
+++ b/TAO/orbsvcs/examples/RtEC/ECConfigurator/ecconfigurator.mpc
@@ -12,6 +12,7 @@ project(configurable_ec): orbsvcsexe, rtevent, rtsched, rtschedevent, rtkokyueve
Kokyu_EC.cpp
ECConsumer.cpp
ECSupplier.cpp
+ ECDriver.cpp
}
Header_Files {
@@ -23,6 +24,7 @@ project(configurable_ec): orbsvcsexe, rtevent, rtsched, rtschedevent, rtkokyueve
ECConsumer.h
ECSupplier.h
Service_Handler.h
+ ECDriver.h
}
IDL_Files {