diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2009-11-05 19:59:28 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2009-11-05 19:59:28 +0000 |
commit | cb1a8d4ee08782b2783e6f6d26450811bd219cc9 (patch) | |
tree | 9b92c5fa794035bd785103a1ce91629666f1964b /CIAO/connectors/dds4ccm/examples | |
parent | 8930c7829d044ff6684ae243d748c9182767ce1e (diff) | |
download | ATCD-cb1a8d4ee08782b2783e6f6d26450811bd219cc9.tar.gz |
Thu Nov 5 18:53:35 UTC 2009 Johnny Willemsen <jwillemsen@remedy.nl>
Integrated work of the dds4ccm_1 branch which extends the DDS4CCM
connector infrastructure, adds a shapes component and adds timestamp
to the hello world example for measuring latency
Thu Nov 5 17:04:35 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Shapes/Receiver/Receiver_exec.cpp:
Removed some printf statements.
Thu Nov 5 16:32:02 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector_exec.h:
* connectors/dds4ccm/examples/Shapes/Sender/Sender_exec.cpp:
Resolved compiler errors.
* connectors/dds4ccm/impl/ndds/Reader_T.cpp:
* connectors/dds4ccm/impl/ndds/Updater_T.cpp:
Removed some printf statements.
Thu Nov 5 16:09:43 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/impl/ndds/DataReaderListener_T.cpp:
Resolved compiler errors on linux.
Thu Nov 5 16:06:58 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Quoter/Distributor/Distributor_exec.cpp:
Removed some printf statements.
* connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector_exec.h:
Added ConnectionStatusListener
* connectors/dds4ccm/impl/ndds/DataReaderListener_T.h:
* connectors/dds4ccm/impl/ndds/DataReaderListener_T.cpp:
Removed some comments and printf statements.
* connectors/dds4ccm/impl/ndds/Getter_T.cpp:
* connectors/dds4ccm/impl/ndds/Reader.cpp:
* connectors/dds4ccm/impl/ndds/Reader_T.cpp:
Removed some printf statements.
Thu Nov 5 14:40:52 UTC 2009 Marijke Hengstmengel <mhengstmengel@remedy.nl>
* connectors/dds4ccm/impl/ndds/Connector_T.cpp
* connectors/dds4ccm/impl/ndds/DataReaderListener_T.cpp
* connectors/dds4ccm/impl/ndds/DataReaderListener_T.h
Change in DataRaederListener for ConnectionStatus
Thu Nov 5 12:39:52 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector_exec.h:
* connectors/dds4ccm/impl/ndds/Connector_T.cpp:
Resolved compiler errors on Linux.
Thu Nov 5 12:25:04 UTC 2009 Marijke Hengstmengel <mhengstmengel@remedy.nl>
* connectors/dds4ccm/impl/ndds/Connector_T.cpp
* connectors/dds4ccm/impl/ndds/Connector_T.h
* connectors/dds4ccm/impl/ndds/ConnectorStatusListener.cpp
* connectors/dds4ccm/impl/ndds/ConnectorStatusListener.h
* connectors/dds4ccm/impl/ndds/ndds_impl.mpc
Changes in implementation of ConnectorStatusControl
Thu Nov 5 12:09:57 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/impl/ndds/DataReaderListener_T.h:
* connectors/dds4ccm/impl/ndds/DataReaderListener_T.cpp:
Cleanup some printf and unused methods.
Thu Nov 5 11:22:29 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Shapes/descriptors/Plan.cdp:
Enabled resizing of shape.
* connectors/dds4ccm/impl/ndds/Connector_T.cpp:
* connectors/dds4ccm/impl/ndds/DataReaderListener_T.h:
* connectors/dds4ccm/impl/ndds/DataReaderListener_T.cpp:
Implemented context switch.
Thu Nov 5 10:37:04 UTC 2009 Marijke Hengstmengel <mhengstmengel@remedy.nl>
* connectors/dds4ccm/impl/ndds/ConnectorStatusListener.cpp:
* connectors/dds4ccm/impl/ndds/ConnectorStatusListener.h:
Add implementation of ConnectorStatusControl
Thu Nov 5 09:17:37 UTC 2009 Johnny Willemsen <jwillemsen@remedy.nl>
* connectors/dds4ccm/impl/ndds/PortStatusListener.cpp:
* connectors/dds4ccm/impl/ndds/PortStatusListener.h:
Removed, not needed at all
Thu Nov 5 10:04:04 UTC 2009 Marijke Hengstmengel <mhengstmengel@remedy.nl>
* connectors/dds4ccm/examples/Quoter/Broker/Broker.idl3:
* connectors/dds4ccm/examples/Quoter/Broker/Broker_exec.cpp:
* connectors/dds4ccm/examples/Quoter/Broker/Broker_exec.h:
* connectors/dds4ccm/examples/Quoter/Connector/Quoter_Connector.idl3:
* connectors/dds4ccm/examples/Quoter/Connector/Quoter_Connector_exec.h:
* connectors/dds4ccm/examples/Quoter/descriptors/Plan.cdp:
* connectors/dds4ccm/idl/dds4ccm_ConnectorStatusListener.idl3:
* connectors/dds4ccm/impl/ndds/Connector_T.cpp:
* connectors/dds4ccm/impl/ndds/Connector_T.h:
* connectors/dds4ccm/impl/ndds/ndds_impl.mpc:
Add implementation of ConnectorStatusControl
Thu Nov 5 07:34:04 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Shapes/Base/Shapes_Base.idl:
X, Y and shapesize should be long (in stead off short).
* connectors/dds4ccm/examples/Shapes/descriptors/Plan.cdp:
Default rawlistener on.
Wed Nov 4 16:56:37 UTC 2009 Johnny Willemsen <jwillemsen@remedy.nl>
* connectors/dds4ccm/examples/Hello/DDS_Sender/Hello_Sender.cpp:
Added missing include for msvc9
Wed Nov 4 12:57:37 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/impl/ndds/DataReaderListener_T.h:
* connectors/dds4ccm/impl/ndds/DataReaderListener_T.cpp:
Created context switch. The rawlistener informs port listener
in a seperate thread.
Tue Nov 3 15:42:33 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Hello/Sender/Hello_Sender_exec.h:
* connectors/dds4ccm/examples/Hello/Sender/Hello_Sender_exec.cpp:
Resolved compiler errors on Windows.
Tue Nov 3 15:02:49 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Shapes/Receiver/Receiver.idl3:
* connectors/dds4ccm/examples/Shapes/Receiver/Receiver_exec.h:
* connectors/dds4ccm/examples/Shapes/Receiver/Receiver_exec.cpp:
Enabled rawlistener. Also created a flag to turn this on/off using
the deployment plan.
* connectors/dds4ccm/examples/Shapes/descriptors/Plan.cdp:
Added ability to turn on/off raw listener. Also created connections
to enable raw listen.
Mon Nov 2 18:35:23 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Shapes/Receiver/Receiver.idl3:
* connectors/dds4ccm/examples/Shapes/Receiver/Receiver_exec.h:
* connectors/dds4ccm/examples/Shapes/Receiver/Receiver_exec.cpp:
Resolved typo. Also extended with connection to ListenControl.
* connectors/dds4ccm/examples/Shapes/descriptors/Plan.cdp:
Changed due to previous typos.
Mon Nov 2 12:37:27 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector_exec.cpp:
Realingment.
* connectors/dds4ccm/examples/Shapes/Receiver/Receiver.idl3:
* connectors/dds4ccm/examples/Shapes/Receiver/Receiver_exec.h:
* connectors/dds4ccm/examples/Shapes/Receiver/Receiver_exec.cpp:
Implemented framework PortStatusListener.
* connectors/dds4ccm/examples/Shapes/Sender/Sender.idl3:
* connectors/dds4ccm/examples/Shapes/Sender/Sender_exec.h:
* connectors/dds4ccm/examples/Shapes/Sender/Sender_exec.cpp:
Resize shape can be set in Deployment plan.
* connectors/dds4ccm/examples/Shapes/descriptors/Plan.cdp:
* connectors/dds4ccm/examples/Shapes/descriptors/USER_QOS_PROFILES.xml:
Resize shape made available. Also set Qos settings for DDS exactly these
same as in the DDS demo.
* connectors/dds4ccm/impl/ndds/Connector_T.cpp:
* connectors/dds4ccm/impl/ndds/Getter_T.h:
* connectors/dds4ccm/impl/ndds/Getter_T.cpp:
* connectors/dds4ccm/impl/ndds/SampleInfo.h:
Minor changes.
Thu Oct 29 14:42:29 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Shapes/Sender/Sender_exec.h:
* connectors/dds4ccm/examples/Shapes/Sender/Sender_exec.cpp:
Made shape resize configurable.
* connectors/dds4ccm/examples/Shapes/descriptors/Plan.cdp:
Made shape resize configurable.
Thu Oct 29 14:36:45 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/impl/ndds/Reader_T.cpp:
Resolved compiler errors on linux.
Thu Oct 29 13:41:45 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Shapes/Base/Shapes_Base.idl:
* connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector.idl3:
* connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector_exec.h:
* connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector_exec.cpp:
* connectors/dds4ccm/examples/Shapes/Receiver/Receiver.idl3:
* connectors/dds4ccm/examples/Shapes/Receiver/Receiver_exec.h:
* connectors/dds4ccm/examples/Shapes/Receiver/Receiver_exec.cpp:
* connectors/dds4ccm/examples/Shapes/Sender/Sender.idl3:
* connectors/dds4ccm/examples/Shapes/Sender/Sender_exec.h:
* connectors/dds4ccm/examples/Shapes/Sender/Sender_exec.cpp:
* connectors/dds4ccm/examples/Shapes/descriptors/Plan.cdp:
* connectors/dds4ccm/examples/Shapes/descriptors/run_test.pl:
Refactored so that it suits the RTI shapes demo.
* connectors/dds4ccm/impl/ndds/Getter_T.h:
* connectors/dds4ccm/impl/ndds/Getter_T.cpp:
Refactored the get_one method.
Fri Oct 23 12:20:08 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Shapes/Receiver/Receiver.idl3:
* connectors/dds4ccm/examples/Shapes/Receiver/Receiver_exec.h:
* connectors/dds4ccm/examples/Shapes/Receiver/Receiver_exec.cpp:
Started with the implementation of the getter in this example.
The user is able to configure (using the deployment plan) whether
to get the data, to read the data or to do both.
* connectors/dds4ccm/examples/Shapes/descriptors/Plan.cdp:
The user is able to configure whether to get the data,
to read the data or to do both.
Added configparameters 'get_data' and 'read_data' to establish
this.
* connectors/dds4ccm/impl/ndds/Connector_T.cpp:
Resolved bug.
Fri Oct 23 11:37:53 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Shapes/Sender/Sender_exec.cpp:
Resolved a typo which results in strange behaviour.
Fri Oct 23 11:32:32 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Shapes/Receiver/Receiver_exec.cpp:
More accurate date time logging.
Fri Oct 23 10:59:06 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Quoter/Broker/Broker_exec.cpp:
* connectors/dds4ccm/examples/Shapes/Receiver/Receiver_exec.cpp:
Resolved runtime crashes related to compiler warnings.
Specified which rate is set (sender or receiver).
* connectors/dds4ccm/examples/Shapes/Sender/Sender_exec.cpp:
Specified which rate is set (sender or receiver).
Fri Oct 23 10:46:12 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Shapes/Receiver/Receiver.idl3:
* connectors/dds4ccm/examples/Shapes/Receiver/Receiver_exec.h:
* connectors/dds4ccm/examples/Shapes/Receiver/Receiver_exec.cpp:
Implemented read_one and read_all
* connectors/dds4ccm/examples/Shapes/Sender/Sender_exec.cpp:
Resolved minor bug.
* connectors/dds4ccm/examples/Shapes/descriptors/Plan.cdp:
changed to meet the receivers IDL.
Fri Oct 23 09:03:57 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Shapes/Base/Shapes_Base.idl:
* connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector.idl3:
* connectors/dds4ccm/examples/Shapes/Sender/Sender.idl3:
* connectors/dds4ccm/examples/Shapes/Sender/Sender_exec.h:
* connectors/dds4ccm/examples/Shapes/Sender/Sender_exec.cpp:
* connectors/dds4ccm/examples/Shapes/descriptors/Plan.cdp:
Added functionality to the sender.
Fri Oct 23 06:45:22 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Quoter/Broker/Broker_exec.h:
* connectors/dds4ccm/examples/Quoter/Broker/Broker_exec.cpp:
* connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector.idl3:
* connectors/dds4ccm/impl/ndds/Connector_T.cpp:
* connectors/dds4ccm/impl/ndds/Reader.cpp:
* connectors/dds4ccm/impl/ndds/Reader_T.h:
* connectors/dds4ccm/impl/ndds/Reader_T.cpp:
Resolved some fuzz errors.
Thu Oct 22 15:19:53 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/impl/ndds/Getter_T.h:
* connectors/dds4ccm/impl/ndds/Getter_T.cpp:
Used the correct duration conversion.
* connectors/dds4ccm/impl/ndds/Duration_t.h:
* connectors/dds4ccm/impl/ndds/Time_t.h:
Rename variables to proper names.
* connectors/dds4ccm/impl/ndds/Reader_T.cpp:
Resolved compiler errors on Linux.
Thu Oct 22 14:14:08 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/impl/ndds/SampleInfo.h:
Used the conversion methods for AccessStatus
and InstanceStatus in seq conversion operators.
Thu Oct 22 13:50:23 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/impl/ndds/SampleInfo.h:
Added conversion methods for AccessStatus and InstanceStatus.
Thu Oct 22 13:13:13 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Hello/DDS_Receiver/Hello_Receiver.cpp:
* connectors/dds4ccm/examples/Hello/DDS_Sender/Hello_Sender.cpp:
* connectors/dds4ccm/examples/Hello/Receiver/Hello_Receiver_exec.cpp:
* connectors/dds4ccm/examples/Hello/Sender/Hello_Sender_exec.cpp:
Used ACE_Date_Time to log timing differences.
* connectors/dds4ccm/examples/Hello/descriptors/run_test.pl:
Extended sleep time.
* connectors/dds4ccm/examples/Hello/descriptors/run_test_dds.pl:
Added to run DDS only hello example.
* connectors/dds4ccm/impl/ndds/Reader_T.cpp:
* connectors/dds4ccm/impl/ndds/SampleInfo.h:
Added operators to convert SampleInfoSeq to ReadInfo
and to convert SampleInfoSeq to ReadInfoSeq.
Wed Oct 21 13:43:25 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Hello/DDS_Sender/Hello_Sender.cpp:
* connectors/dds4ccm/examples/Hello/Sender/Hello_Sender_exec.cpp:
Used an ACE_Time_Value in sleep methods.
* connectors/dds4ccm/examples/Quoter/Broker/Broker_exec.h:
* connectors/dds4ccm/examples/Quoter/Broker/Broker_exec.cpp:
Extended the Broker with get_one.
* connectors/dds4ccm/impl/ndds/Connector_T.h:
* connectors/dds4ccm/impl/ndds/Connector_T.cpp:
Giving the getter its own DataReader instance.
* connectors/dds4ccm/impl/ndds/Getter_T.cpp:
Implemented a draft version of get_one.
* connectors/dds4ccm/impl/ndds/Updater_T.cpp:
is_lifecycle_checked default set to false.
Wed Oct 21 08:44:22 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Hello/DDS_Sender/Hello_Sender.cpp:
* connectors/dds4ccm/examples/Hello/Sender/Hello_Sender_exec.cpp:
* connectors/dds4ccm/examples/Hello/descriptors/run_test.pl:
* examples/Hello/Receiver/Receiver_exec.cpp:
Changed sleeping times.
* connectors/dds4ccm/examples/Quoter/Connector/Quoter_Connector.idl3:
* connectors/dds4ccm/impl/ndds/Connector_T.h:
* connectors/dds4ccm/impl/ndds/Connector_T.cpp:
Made key_fields attribute readonly.
* connectors/dds4ccm/examples/Shapes/Receiver/Receiver_exec.h:
* connectors/dds4ccm/examples/Shapes/Receiver/Receiver_exec.cpp:
* connectors/dds4ccm/examples/Shapes/Sender/Sender_exec.h:
* connectors/dds4ccm/examples/Shapes/Sender/Sender_exec.cpp:
* connectors/dds4ccm/examples/Shapes/descriptors/Plan.cdp:
Changed in order to run run test script.
Tue Oct 20 13:41:12 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Hello/descriptors/DeploymentPlan.cdp:
Added number of iterations.
* examples/Hello/Receiver/Receiver_exec.cpp:
Times in micro seconds
* examples/Hello/Sender/Sender_exec.cpp:
Removed extra loggin.
Tue Oct 20 12:44:49 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Hello/DDS_Receiver/Hello_Receiver.cpp:
* connectors/dds4ccm/examples/Hello/Receiver/Hello_Receiver_exec.cpp:
* connectors/dds4ccm/examples/Hello/descriptors/DeploymentPlan.cdp:
* connectors/dds4ccm/examples/Shapes/Sender/Sender_exec.h:
* connectors/dds4ccm/examples/Shapes/Sender/Sender_exec.cpp:
Logging in micro seconds.
Tue Oct 20 09:24:28 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Hello/DDS_Receiver/Hello_Receiver.cpp:
* connectors/dds4ccm/examples/Hello/DDS_Sender/Hello_Sender.cpp:
Added timing.
Tue Oct 20 08:44:31 UTC 2009 Marcel Smit <msmit@remedy.nl>
* examples/Hello/Receiver/Receiver.idl:
* examples/Hello/Receiver/Receiver_exec.h:
* examples/Hello/Receiver/Receiver_exec.cpp:
* examples/Hello/descriptors/DeploymentPlan.cdp:
Added number of iterations.
Mon Oct 19 18:29:02 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Shapes/Base/Shapes_Base.idl:
Made is real IDL.
* connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector.idl3:
* connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector_exec.h:
* connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector_exec.cpp:
Resolved compiler errors
* connectors/dds4ccm/examples/Shapes/Receiver/Receiver.idl3:
* connectors/dds4ccm/examples/Shapes/Receiver/Receiver_exec.h:
* connectors/dds4ccm/examples/Shapes/Receiver/Receiver_exec.cpp:
* connectors/dds4ccm/examples/Shapes/Sender/Sender_exec.h:
* connectors/dds4ccm/examples/Shapes/Sender/Sender_exec.cpp:
Created a compileable version.
* connectors/dds4ccm/impl/ndds/Reader_T.cpp:
Resolved some compiler errors on Linux.
Mon Oct 19 17:20:34 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Quoter/Base/Quoter_Base.idl:
* connectors/dds4ccm/examples/Shapes/Base/Shapes_Base.idl:
Removed the space character from "// @key"
Mon Oct 19 17:08:41 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Shapes:
* connectors/dds4ccm/examples/Shapes/Base:
* connectors/dds4ccm/examples/Shapes/Base/Shapes_Base.idl:
* connectors/dds4ccm/examples/Shapes/Base/Shapes_Base.mpc:
* connectors/dds4ccm/examples/Shapes/Connector:
* connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector.idl3:
* connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector.idl3p:
* connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector.mpc:
* connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector_exec.h:
* connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector_exec.cpp:
* connectors/dds4ccm/examples/Shapes/Receiver:
* connectors/dds4ccm/examples/Shapes/Receiver/Receiver.idl3:
* connectors/dds4ccm/examples/Shapes/Receiver/Receiver.idl3p:
* connectors/dds4ccm/examples/Shapes/Receiver/Receiver.mpc:
* connectors/dds4ccm/examples/Shapes/Sender:
* connectors/dds4ccm/examples/Shapes/Sender/Sender.idl3:
* connectors/dds4ccm/examples/Shapes/Sender/Sender.idl3p:
* connectors/dds4ccm/examples/Shapes/Sender/Sender.mpc:
* connectors/dds4ccm/examples/Shapes/descriptors:
* connectors/dds4ccm/examples/Shapes/descriptors/Plan.cdp:
* connectors/dds4ccm/examples/Shapes/descriptors/USER_QOS_PROFILES.xml:
* connectors/dds4ccm/examples/Shapes/descriptors/run_test.pl:
Added framework for a shape example.
* connectors/dds4ccm/impl/ndds/DataReaderListener_T.cpp:
Removed logging regarding StockInfo.
Mon Oct 19 13:17:12 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Quoter/Connector/Quoter_Connector_exec.h:
* connectors/dds4ccm/examples/Quoter/Connector/Quoter_Connector_exec.cpp:
* connectors/dds4ccm/impl/ndds/Connector_T.h:
* connectors/dds4ccm/impl/ndds/Connector_T.cpp:
The connector template should be provided with a name.
Mon Oct 19 12:36:26 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Quoter/Connector/Quoter_Connector_exec.h:
Code outlining.
* connectors/dds4ccm/impl/ndds/Connector_T.cpp:
Enabled getter.
* connectors/dds4ccm/impl/ndds/Getter_T.cpp:
* connectors/dds4ccm/impl/ndds/Updater_T.cpp:
Resolved compiler warnings.
Mon Oct 19 11:14:34 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Hello/descriptors/DeploymentPlan.cdp:
Added log timing flag.
* examples/Hello/Receiver/Receiver_exec.cpp:
* examples/Hello/Sender/Sender.idl:
* examples/Hello/Sender/Sender_exec.h:
* examples/Hello/Sender/Sender_exec.cpp:
Implemented timing information.
* examples/Hello/descriptors/DeploymentPlan.cdp:
Added log timing flag.
Fri Oct 16 15:00:14 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Hello/Receiver/Hello_Receiver_exec.cpp:
* connectors/dds4ccm/examples/Hello/Sender/Hello_Sender_exec.cpp:
Using high res timers to determine time difference.
Fri Oct 16 14:23:05 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Hello/Receiver/Hello_Receiver_exec.cpp:
* connectors/dds4ccm/examples/Hello/Sender/Hello_Sender.idl:
* connectors/dds4ccm/examples/Hello/Sender/Hello_Sender_exec.h:
* connectors/dds4ccm/examples/Hello/Sender/Hello_Sender_exec.cpp:
Introduced an attribute which controls the timestamp logging.
Fri Oct 16 14:09:33 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Hello/Receiver/Hello_Receiver_exec.cpp:
Rewritten timers.
Fri Oct 16 13:46:48 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Hello/Receiver/Hello_Receiver_exec.cpp:
* connectors/dds4ccm/examples/Hello/Sender/Hello_Sender_exec.cpp:
Added send and receive timestamps.
Fri Oct 16 10:51:03 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Quoter/Broker/Broker_exec.cpp:
Left getter out for now.
* connectors/dds4ccm/examples/Quoter/Connector/Quoter_Connector_exec.h:
* connectors/dds4ccm/examples/Quoter/Connector/Quoter_Connector_exec.cpp:
Removed Connector_T template class and put it in it's own file.
* connectors/dds4ccm/impl/ndds/Connector_T.h:
* connectors/dds4ccm/impl/ndds/Connector_T.cpp:
* connectors/dds4ccm/impl/ndds/DataReaderListener_T.cpp:
Created a Connector_T template class.
* connectors/dds4ccm/impl/ndds/Updater_T.h:
Removed unnecessary include.
Thu Oct 15 17:25:03 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Quoter/Broker/Broker.idl3:
* connectors/dds4ccm/examples/Quoter/Broker/Broker_exec.cpp:
Removed some tabs. Expanded the getter framework.
* connectors/dds4ccm/examples/Quoter/Connector/Quoter_Connector.idl3:
* connectors/dds4ccm/examples/Quoter/Connector/Quoter_Connector_exec.cpp:
Expanded the getter framework.
* connectors/dds4ccm/examples/Quoter/Distributor/Distributor_exec.cpp:
Improved logging regarding updater.
* connectors/dds4ccm/examples/Quoter/descriptors/Plan.cdp:
Added connector for the getter.
* connectors/dds4ccm/examples/Quoter/descriptors/run_test.pl:
Sleep time changed.
* connectors/dds4ccm/impl/ndds/Getter_T.h:
* connectors/dds4ccm/impl/ndds/Getter_T.cpp:
Expanded the getter framework a bit more.
* connectors/dds4ccm/impl/ndds/NDDS_Traits.h:
Removed tabs.
* connectors/dds4ccm/impl/ndds/Reader_T.cpp:
* connectors/dds4ccm/impl/ndds/Updater_T.cpp:
Some more investigation on the updater framework.
Thu Oct 15 09:21:57 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Quoter/Connector/Quoter_Connector.idl3:
* connectors/dds4ccm/examples/Quoter/Connector/Quoter_Connector_exec.h:
* connectors/dds4ccm/examples/Quoter/Connector/Quoter_Connector_exec.cpp:
* connectors/dds4ccm/impl/ndds/Getter_T.h:
* connectors/dds4ccm/impl/ndds/Getter_T.cpp:
Added Getter framework.
Wed Oct 14 15:09:11 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Quoter/Distributor/Distributor_exec.cpp:
Changed logging. Catching proper exceptions.
* connectors/dds4ccm/impl/ndds/Updater_T.cpp:
Changed logging. Using this-> for class variables.
Wed Oct 14 13:48:51 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Quoter/Distributor/Distributor_exec.cpp:
* connectors/dds4ccm/impl/ndds/Updater_T.h:
* connectors/dds4ccm/impl/ndds/Updater_T.cpp:
Implemented DDS interface for updater.
Wed Oct 14 09:24:51 UTC 2009 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/examples/Quoter/Connector/Quoter_Connector.idl3:
* connectors/dds4ccm/examples/Quoter/Connector/Quoter_Connector_exec.h:
* connectors/dds4ccm/examples/Quoter/Connector/Quoter_Connector_exec.cpp:
* connectors/dds4ccm/examples/Quoter/Distributor/Distributor.idl3:
* connectors/dds4ccm/examples/Quoter/Distributor/Distributor_exec.h:
* connectors/dds4ccm/examples/Quoter/Distributor/Distributor_exec.cpp:
* connectors/dds4ccm/examples/Quoter/descriptors/Plan.cdp:
* connectors/dds4ccm/impl/ndds/Updater_T.h:
* connectors/dds4ccm/impl/ndds/Updater_T.cpp:
Added updater framework.
* connectors/dds4ccm/examples/Quoter/descriptors/run_test.pl:
Reduced sleeping time.
Diffstat (limited to 'CIAO/connectors/dds4ccm/examples')
41 files changed, 3700 insertions, 508 deletions
diff --git a/CIAO/connectors/dds4ccm/examples/Hello/DDS_Receiver/Hello_Receiver.cpp b/CIAO/connectors/dds4ccm/examples/Hello/DDS_Receiver/Hello_Receiver.cpp index 6228d9eec6f..e4b26b81f31 100644 --- a/CIAO/connectors/dds4ccm/examples/Hello/DDS_Receiver/Hello_Receiver.cpp +++ b/CIAO/connectors/dds4ccm/examples/Hello/DDS_Receiver/Hello_Receiver.cpp @@ -5,6 +5,8 @@ #include "ace/OS_NS_unistd.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_stdlib.h" +#include "ace/Date_Time.h" +#include "ace/SString.h" #include <ndds/ndds_namespace_cpp.h> @@ -32,14 +34,14 @@ int ACE_TMAIN(int argc, ACE_TCHAR** argv) { { char *end = 0; num_samples = ACE_OS::strtol (argv[1], &end, 10); - + if (end == argv[1] && num_samples < 0) { ACE_ERROR ((LM_ERROR, "Error: provided argument not a valid integer over zero\n")); return -1; } } - + /* Create the domain participant on domain ID 0 */ ::DDS::DomainParticipant *participant = ::DDS::DomainParticipantFactory::get_instance()-> create_participant( @@ -144,8 +146,20 @@ void HelloListener::on_data_available(::DDS::DataReader *reader) { if (info.valid_data) { // Valid (this isn't just a lifecycle sample): print it ++received_samples; - - ACE_DEBUG ((LM_DEBUG, ACE_TEXT("%C\n"), sample)); + ACE_CString rec (sample); + ACE_Date_Time now; + int sec_rec = ACE_OS::atoi (rec.substr (0, 2).c_str() ); + if (sec_rec > 0) + { + int usec_rec = ACE_OS::atoi (rec.substr (3, 6).c_str ()); + if (sec_rec != now.second ()) + usec_rec += 10000000; + ACE_DEBUG ((LM_DEBUG, ACE_TEXT("%C dur <%d>\n"), sample, now.microsec () - usec_rec)); + } + else + { + ACE_DEBUG ((LM_DEBUG, ACE_TEXT("%C\n"), sample)); + } if(received_samples == num_samples || ACE_OS::strlen(sample) == 0){ shutdown_flag = true; } diff --git a/CIAO/connectors/dds4ccm/examples/Hello/DDS_Sender/Hello_Sender.cpp b/CIAO/connectors/dds4ccm/examples/Hello/DDS_Sender/Hello_Sender.cpp index 67b654f23f6..c761e4e7b8f 100644 --- a/CIAO/connectors/dds4ccm/examples/Hello/DDS_Sender/Hello_Sender.cpp +++ b/CIAO/connectors/dds4ccm/examples/Hello/DDS_Sender/Hello_Sender.cpp @@ -3,15 +3,19 @@ #include "ace/OS_main.h" #include "ace/Get_Opt.h" #include "ace/OS_NS_unistd.h" +#include "ace/OS_NS_stdio.h" +#include "ace/Date_Time.h" +#include "ace/SString.h" #include <ndds/ndds_namespace_cpp.h> int number_of_iterations = 100; +bool log_time = false; const char* send_string = "This is a DDS sender"; int parse_args (int argc, ACE_TCHAR *argv[]) { - ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("i:s:")); + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("i:s:t")); int c; while ((c = get_opts ()) != -1) @@ -23,6 +27,9 @@ parse_args (int argc, ACE_TCHAR *argv[]) case 'i': number_of_iterations = ACE_OS::atoi (get_opts.opt_arg ()); break; + case 't': + log_time = true; + break; case '?': default: @@ -30,6 +37,7 @@ parse_args (int argc, ACE_TCHAR *argv[]) "usage: %s " "-s <send string>" "-i <number of iterations>" + "-t log timing" "\n", argv [0]), -1); @@ -48,6 +56,7 @@ int ACE_TMAIN(int argc, ACE_TCHAR* argv[]) { if (parse_args (argc, argv) != 0) return 1; + ACE_Time_Value tv (0, 1000); //1 msec /* Create the domain participant */ ::DDS::DomainParticipant *participant = ::DDS::DomainParticipantFactory::get_instance()-> create_participant( @@ -94,24 +103,29 @@ int ACE_TMAIN(int argc, ACE_TCHAR* argv[]) { } // Sleep a couple seconds to allow discovery to happen - ACE_OS::sleep (2); + ACE_OS::sleep (1); /* --- Write Data ----------------------------------------------------- */ for (int i = 0; i < number_of_iterations; i++) { + ACE_TCHAR timestamp[16]; + ACE_CString msg (send_string); + ACE_CString ret; + ACE_Date_Time now; + ACE_OS::sprintf (timestamp, + "%02d.%d", + now.second(), + now.microsec ()); + ret.set (timestamp); + ret = ret + " " + msg; retcode = string_writer->write( - send_string, + ret.c_str (), DDS_HANDLE_NIL); if (retcode != DDS_RETCODE_OK) - { - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Write failed: %d.\n"), retcode)); - } - else - { - ACE_DEBUG ((LM_DEBUG, ACE_TEXT("Sending: %C\n"), send_string)); - } - ACE_OS::sleep (1); + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Write failed: %d.\n"), retcode)); + //ACE_ERROR ((LM_ERROR, ACE_TEXT ("%C.\n"), ret.c_str())); + ACE_OS::sleep (tv); } /* --- Clean Up ------------------------------------------------------- */ diff --git a/CIAO/connectors/dds4ccm/examples/Hello/Receiver/Hello_Receiver_exec.cpp b/CIAO/connectors/dds4ccm/examples/Hello/Receiver/Hello_Receiver_exec.cpp index 35ae3e5b2b3..610cd0f030a 100644 --- a/CIAO/connectors/dds4ccm/examples/Hello/Receiver/Hello_Receiver_exec.cpp +++ b/CIAO/connectors/dds4ccm/examples/Hello/Receiver/Hello_Receiver_exec.cpp @@ -6,6 +6,8 @@ // be/be_codegen.cpp:1278 #include "Hello_Receiver_exec.h" +#include "ace/Date_Time.h" +#include "ace/High_Res_Timer.h" #include "ciao/Logger/Log_Macros.h" #include "ace/Atomic_Op.h" @@ -34,8 +36,27 @@ namespace CIAO_Hello_DDS_Receiver_Impl const char * an_instance, const ::CCM_DDS::ReadInfo & /* info */) { + ++received_; - printf ("<%s> string_RawListener::on_data received <%s>\n", this->name_.c_str (), an_instance); + ACE_CString rec (an_instance); + ACE_Date_Time now; + int sec_rec = ACE_OS::atoi (rec.substr (0, 2).c_str() ); + if (sec_rec > 0) + { + int usec_rec = ACE_OS::atoi (rec.substr (3, 6).c_str ()); + if (sec_rec != now.second ()) + usec_rec += 10000000; + printf ("<%s> received <%s>. difference <%d>\n", + this->name_.c_str (), + an_instance, + now.microsec () - usec_rec); + } + else + { + printf ("<%s> received <%s>.\n", + this->name_.c_str (), + an_instance); + } } //============================================================ // Facet Executor Implementation Class: PortStatusListener_exec_i diff --git a/CIAO/connectors/dds4ccm/examples/Hello/Sender/Hello_Sender.idl b/CIAO/connectors/dds4ccm/examples/Hello/Sender/Hello_Sender.idl index cd9e07930fb..fc8e2efa9af 100644 --- a/CIAO/connectors/dds4ccm/examples/Hello/Sender/Hello_Sender.idl +++ b/CIAO/connectors/dds4ccm/examples/Hello/Sender/Hello_Sender.idl @@ -12,6 +12,7 @@ module Hello_DDS attribute unsigned long iterations; attribute string message; + attribute boolean log_time; }; home SenderHome manages Sender diff --git a/CIAO/connectors/dds4ccm/examples/Hello/Sender/Hello_Sender_exec.cpp b/CIAO/connectors/dds4ccm/examples/Hello/Sender/Hello_Sender_exec.cpp index 6efa77285f5..1f19bd59280 100644 --- a/CIAO/connectors/dds4ccm/examples/Hello/Sender/Hello_Sender_exec.cpp +++ b/CIAO/connectors/dds4ccm/examples/Hello/Sender/Hello_Sender_exec.cpp @@ -31,6 +31,7 @@ #include "Hello_Sender_exec.h" #include "ace/OS_NS_unistd.h" #include "ace/Task.h" +#include "ace/Date_Time.h" namespace CIAO_Hello_DDS_Sender_Impl { @@ -39,32 +40,50 @@ namespace CIAO_Hello_DDS_Sender_Impl public: Sending_Task (const ACE_CString &msg, CORBA::ULong iters, - ::CCM_DDS::string_Writer_ptr writer) + ::CCM_DDS::string_Writer_ptr writer, + bool log_time) : msg_ (msg), iters_ (iters), - writer_ (::CCM_DDS::string_Writer::_duplicate (writer)) + writer_ (::CCM_DDS::string_Writer::_duplicate (writer)), + log_time_ (log_time) { } virtual int svc (void) { // Allowing some time for discovery to happen - ACE_OS::sleep (10); - + ACE_OS::sleep (5); + ACE_Time_Value tv (0, 1000); //1 msec for (size_t i = 0; i < this->iters_; ++i) { - ACE_OS::sleep (2); - this->writer_->write (this->msg_.c_str ()); + ACE_CString msg = create_message (this->msg_); + this->writer_->write (msg.c_str ()); ACE_DEBUG ((LM_DEBUG, "Sender has sent string\n")); + ACE_OS::sleep (tv); } return 0; } + ACE_CString create_message (const ACE_CString &msg) + { + if (!this->log_time_) + return msg; + ACE_TCHAR timestamp[16]; + ACE_Date_Time now; + ACE_OS::sprintf (timestamp, + "%02d.%d", + now.second(), + now.microsec ()); + ACE_CString ret (timestamp); + ret = ret + " " + msg; + return ret.c_str (); + } private: const ACE_CString &msg_; CORBA::ULong iters_; ::CCM_DDS::string_Writer_var writer_; + bool log_time_; }; @@ -75,7 +94,8 @@ namespace CIAO_Hello_DDS_Sender_Impl Sender_exec_i::Sender_exec_i (void) : iters_ (10), msg_ ("Hi Johnny, I'm a CCM component sending DDS messages!"), - task_ (0) + task_ (0), + log_time_ (true) { } @@ -92,7 +112,7 @@ namespace CIAO_Hello_DDS_Sender_Impl char * Sender_exec_i::message (void) { - return CORBA::string_dup (this->msg_.c_str ()); + return CORBA::string_dup (this->msg_.c_str()); } void @@ -101,6 +121,18 @@ namespace CIAO_Hello_DDS_Sender_Impl this->msg_ = msg; } + ::CORBA::Boolean + Sender_exec_i::log_time (void) + { + return this->log_time_; + } + + void + Sender_exec_i::log_time (::CORBA::Boolean log_time) + { + this->log_time_ = log_time; + } + ::CORBA::ULong Sender_exec_i::iterations (void) @@ -145,7 +177,8 @@ namespace CIAO_Hello_DDS_Sender_Impl this->task_ = new Sending_Task (this->msg_, this->iters_, - writer); + writer, + this->log_time_); this->task_->activate (THR_NEW_LWP | THR_JOINABLE, 1); diff --git a/CIAO/connectors/dds4ccm/examples/Hello/Sender/Hello_Sender_exec.h b/CIAO/connectors/dds4ccm/examples/Hello/Sender/Hello_Sender_exec.h index 58d9189e733..fc101ba9be5 100644 --- a/CIAO/connectors/dds4ccm/examples/Hello/Sender/Hello_Sender_exec.h +++ b/CIAO/connectors/dds4ccm/examples/Hello/Sender/Hello_Sender_exec.h @@ -66,6 +66,10 @@ namespace CIAO_Hello_DDS_Sender_Impl virtual void message (const char *message); + virtual ::CORBA::Boolean log_time (void); + + virtual void log_time (::CORBA::Boolean log_time); + // Port operations. // Operations from Components::SessionComponent. @@ -86,6 +90,7 @@ namespace CIAO_Hello_DDS_Sender_Impl CORBA::ULong iters_; ACE_CString msg_; Sending_Task *task_; + bool log_time_; }; extern "C" HELLO_SENDER_EXEC_Export ::Components::EnterpriseComponent_ptr diff --git a/CIAO/connectors/dds4ccm/examples/Hello/descriptors/DeploymentPlan.cdp b/CIAO/connectors/dds4ccm/examples/Hello/descriptors/DeploymentPlan.cdp index f607f89b611..b0250ede08e 100644 --- a/CIAO/connectors/dds4ccm/examples/Hello/descriptors/DeploymentPlan.cdp +++ b/CIAO/connectors/dds4ccm/examples/Hello/descriptors/DeploymentPlan.cdp @@ -471,6 +471,39 @@ </value> </configProperty> <configProperty> + <name>message</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Hello, World</string> + </value> + </value> + </configProperty> + <configProperty> + <name>log_time</name> + <value> + <type> + <kind>tk_boolean</kind> + </type> + <value> + <boolean>false</boolean> + </value> + </value> + </configProperty> + <configProperty> + <name>iterations</name> + <value> + <type> + <kind>tk_long</kind> + </type> + <value> + <long>10</long> + </value> + </value> + </configProperty> + <configProperty> <name>edu.vanderbilt.dre.DAnCE.InstanceIOR</name> <value> <type> diff --git a/CIAO/connectors/dds4ccm/examples/Hello/descriptors/run_test.pl b/CIAO/connectors/dds4ccm/examples/Hello/descriptors/run_test.pl index 88b6d47c6fa..4d78e56e30a 100755 --- a/CIAO/connectors/dds4ccm/examples/Hello/descriptors/run_test.pl +++ b/CIAO/connectors/dds4ccm/examples/Hello/descriptors/run_test.pl @@ -176,8 +176,8 @@ if (PerlACE::waitforfile_timed ("Sender.ior", exit 1; } -print "Sleeping 60 seconds to allow task to complete\n"; -sleep (60); +print "Sleeping 20 seconds to allow task to complete\n"; +sleep (20); # print "Invoking the controller ($controller_exec -k file://Sender.ior)\n"; # $controller = new PerlACE::Process ("$controller_exec", "-k file://Sender.ior"); diff --git a/CIAO/connectors/dds4ccm/examples/Hello/descriptors/run_test_dds.pl b/CIAO/connectors/dds4ccm/examples/Hello/descriptors/run_test_dds.pl new file mode 100755 index 00000000000..61a5f8967e5 --- /dev/null +++ b/CIAO/connectors/dds4ccm/examples/Hello/descriptors/run_test_dds.pl @@ -0,0 +1,24 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{'ACE_ROOT'}/bin"; +use PerlACE::Run_Test; + +$CIAO_ROOT = "$ENV{'CIAO_ROOT'}"; +$TAO_ROOT = "$ENV{'TAO_ROOT'}"; +$DAnCE = "$ENV{'DANCE_ROOT'}"; + +print "Start receiver\n"; +$R = new PerlACE::Process ("$CIAO_ROOT/connectors/dds4ccm/examples/Hello/DDS_Receiver/DDS_receiver", ""); +$R->Spawn(); +print "Start sender\n"; +$S = new PerlACE::Process ("$CIAO_ROOT/connectors/dds4ccm/examples/Hello/DDS_Sender/DDS_Sender", + "-i 10000 -t -s \"Hello, World\""); +$S->SpawnWaitKill (30); +$R->Kill (); + +exit 0; diff --git a/CIAO/connectors/dds4ccm/examples/Quoter/Base/Quoter_Base.idl b/CIAO/connectors/dds4ccm/examples/Quoter/Base/Quoter_Base.idl index 58375a54263..750908a015d 100644 --- a/CIAO/connectors/dds4ccm/examples/Quoter/Base/Quoter_Base.idl +++ b/CIAO/connectors/dds4ccm/examples/Quoter/Base/Quoter_Base.idl @@ -15,7 +15,7 @@ module Quoter unsigned long low; unsigned long high; unsigned long current; - string symbol; // @key + string symbol; //@key }; typedef sequence<Stock_Info> Stock_Info_Seq; }; diff --git a/CIAO/connectors/dds4ccm/examples/Quoter/Broker/Broker.idl3 b/CIAO/connectors/dds4ccm/examples/Quoter/Broker/Broker.idl3 index c69f88bafbf..aef78ddcd99 100644 --- a/CIAO/connectors/dds4ccm/examples/Quoter/Broker/Broker.idl3 +++ b/CIAO/connectors/dds4ccm/examples/Quoter/Broker/Broker.idl3 @@ -16,10 +16,12 @@ module Quoter component Broker { uses CCM_DDS::Stock_Info_Reader info_out_data; + uses CCM_DDS::Stock_Info_Getter info_get_out_data; uses CCM_DDS::ListenerControl info_out_control; provides CCM_DDS::Stock_Info_RawListener info_out_listener; uses DDS::DataReader info_out_dds_entity; provides CCM_DDS::PortStatusListener info_out_status; + provides CCM_DDS::ConnectorStatusListener info_out_connector_status; }; }; diff --git a/CIAO/connectors/dds4ccm/examples/Quoter/Broker/Broker_exec.cpp b/CIAO/connectors/dds4ccm/examples/Quoter/Broker/Broker_exec.cpp index 1e86bd8da02..7273ec5feb6 100644 --- a/CIAO/connectors/dds4ccm/examples/Quoter/Broker/Broker_exec.cpp +++ b/CIAO/connectors/dds4ccm/examples/Quoter/Broker/Broker_exec.cpp @@ -31,9 +31,268 @@ // be/be_codegen.cpp:1278 #include "Broker_exec.h" +#include "ace/Reactor.h" +#include "ace/OS_NS_time.h" + + namespace CIAO_Quoter_Broker_Impl { + + read_action_Generator::read_action_Generator (Broker_exec_i &callback) + : active_ (0), + pulse_callback_ (callback) + { + // initialize the reactor + this->reactor (ACE_Reactor::instance ()); + } + + read_action_Generator::~read_action_Generator () + { + } + + int + read_action_Generator::open_h () + { + // convert the task into a active object that runs in separate thread + return this->activate (); + } + + int + read_action_Generator::close_h () + { + this->reactor ()->end_reactor_event_loop (); + // wait for all threads in the task to exit before it returns + return this->wait (); + } + + int + read_action_Generator::start (CORBA::ULong hertz) + { + // return if not valid + if (hertz == 0 || this->active_ != 0) + { + return -1; + } + + // calculate the interval time + long usec = 1000 / hertz; + + std::cerr << "Starting read_action_generator with hertz of " << hertz << ", interval of " + << usec << std::endl; + + if (this->reactor ()->schedule_timer (this, + 0, + ACE_Time_Value(0), + ACE_Time_Value(3)) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Unable to setup Timer\n"), + -1); + + } + + this->active_ = 1; + return 0; + } + + int + read_action_Generator::stop (void) + { + // return if not valid. + if (this->active_ == 0) + { + return -1; + } + // cancle the timer + this->reactor ()->cancel_timer (this); + this->active_ = 0; + return 0; + } + + int + read_action_Generator::active (void) + { + return this->active_; + } + + int + read_action_Generator::handle_close (ACE_HANDLE handle, + ACE_Reactor_Mask close_mask) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("[%x] handle = %d, close_mask = %d\n"), + this, + handle, + close_mask)); + return 0; + } + + int + read_action_Generator::handle_timeout (const ACE_Time_Value &, + const void *) + { + // Notify the subscribers + // this->pulse_callback_.read_one(); + // this->pulse_callback_.read_one_history(); + // this->pulse_callback_.read_all(); + // this->pulse_callback_.read_all_history(); + return 0; + } + + int + read_action_Generator::svc (void) + { + // define the owner of the reactor thread + this->reactor ()->owner (ACE_OS::thr_self ()); + + // run event loop to wait for event, and then dispatch them to corresponding handlers + this->reactor ()->run_reactor_event_loop (); + + return 0; + } + void + Broker_exec_i::read_one (void) + { + std::cerr << "read_one" << std::endl; + ::Quoter::Stock_Info stock_info; + stock_info.symbol= "IBM"; + ::CCM_DDS::ReadInfo readinfo; + + try + { + this->reader_->read_one (stock_info, readinfo ); + time_t tim = readinfo.timestamp.sec; + printf("Read_Info. -> date = %s",ctime(&tim)); + printf ("Stock_Info_Read_One: received a stock_info for <%s> at %u:%u:%u\n", + stock_info.symbol.in (), + stock_info.low, + stock_info.current, + stock_info.high); + } + catch(CCM_DDS::NonExistent& ) + { + printf("Stock_Info_Read_One: no stock_info received\n"); + } + + + /* printf("GO TO get ONE\n"); + this->getter_->get_one (stock_info, readinfo ); + + printf ("Stock_Info_GET_One: received a stock_info for <%s> at %u:%u:%u\n", + stock_info.symbol.in (), + stock_info.low, + stock_info.current, + stock_info.high); + printf("END OF GET_ONE\n"); + */ + } + +void + Broker_exec_i::read_all (void) + { + std::cerr << "read_all" << std::endl; + + ::Quoter::Stock_Info_Seq_var stock_infos; + ::CCM_DDS::ReadInfoSeq_var readinfoseq; + this->reader_->read_all(stock_infos.out(), readinfoseq.out()); + if(0 != &readinfoseq && readinfoseq->length()!= 0) + { + int nr_of_infos = readinfoseq->length(); + for(int i = 0; i < nr_of_infos; i ++) + { + time_t tim = readinfoseq[i].timestamp.sec; + printf("Read_Info.timestamp -> date = %s",ctime(&tim)); + } + } + if( 0!= &stock_infos && stock_infos->length()!= 0) + { + int nr_of_stock_infos = stock_infos->length(); + for(CORBA::ULong i = 0; i < (CORBA::ULong)nr_of_stock_infos; i ++) + { + printf ("Stock_Info_Read_All: Number %d : received a stock_info for <%s> at %u:%u:%u\n", + i, + stock_infos[i].symbol.in (), + stock_infos[i].low, + stock_infos[i].current, + stock_infos[i].high); + } + } + } +void + Broker_exec_i::read_all_history (void) + { + std::cerr << "read_all_history" << std::endl; + + ::Quoter::Stock_Info_Seq_var stock_infos; + ::CCM_DDS::ReadInfoSeq_var readinfoseq; + this->reader_->read_all_history(stock_infos.out(), readinfoseq.out()); + if(0 != &readinfoseq && readinfoseq->length()!= 0) + { + int nr_of_infos = readinfoseq->length(); + for(int i = 0; i < nr_of_infos; i ++) + { + time_t tim = readinfoseq[i].timestamp.sec; + printf("Read_Info.timestamp -> date = %s",ctime(&tim)); + } + } + if( 0!= &stock_infos && stock_infos->length()!= 0) + { + int nr_of_stock_infos = stock_infos->length(); + for(CORBA::ULong i = 0; i < (CORBA::ULong)nr_of_stock_infos; i ++) + { + printf ("Stock_Info_Read_All_History: Number %d : received a stock_info for <%s> at %u:%u:%u\n", + i, + stock_infos[i].symbol, + stock_infos[i].low, + stock_infos[i].current, + stock_infos[i].high); + + } + } + } + // read all samples of an given instance + void + Broker_exec_i::read_one_history (void) + { + std::cerr << "read_one_history" << std::endl; + ::Quoter::Stock_Info stock_info; + stock_info.symbol= "IBM"; //key of instance to read + + ::Quoter::Stock_Info_Seq_var stock_infos; + ::CCM_DDS::ReadInfoSeq_var readinfoseq; + try + { + this->reader_->read_one_history(stock_info,stock_infos.out(), readinfoseq.out()); + if(0 != &readinfoseq && readinfoseq->length()!= 0) + { + int nr_of_infos = readinfoseq->length(); + for(int i = 0; i < nr_of_infos; i ++) + { + time_t tim = readinfoseq[i].timestamp.sec; + printf("Read_Info.timestamp -> date = %s",ctime(&tim)); + } + } + if( 0!= &stock_infos && stock_infos->length()!= 0) + { + int nr_of_stock_infos = stock_infos->length(); + for(CORBA::ULong i = 0; i < (CORBA::ULong)nr_of_stock_infos; i ++) + { + printf ("Stock_Info_Read_One_History: Number %d : received a stock_info for <%s> at %u:%u:%u\n", + i, + stock_infos[i].symbol, + stock_infos[i].low, + stock_infos[i].current, + stock_infos[i].high); + + } + } + } + catch(CCM_DDS::NonExistent& ) + { + printf("Stock_Info_Read_One_History: no stock_info's received\n"); + } + } //============================================================ // Facet Executor Implementation Class: Stock_Info_RawListener_exec_i //============================================================ @@ -53,18 +312,68 @@ namespace CIAO_Quoter_Broker_Impl const ::Quoter::Stock_Info & an_instance, const ::CCM_DDS::ReadInfo & /* info */) { + printf ("Stock_Info_RawListener: received a stock_info for <%s> at %u:%u:%u\n", an_instance.symbol.in (), an_instance.low, an_instance.current, an_instance.high); + } //============================================================ + // Facet Executor Implementation Class: ConnectorStatusListener_exec_i + //============================================================ + + ConnectorStatusListener_exec_i::ConnectorStatusListener_exec_i (void) + { + } + + ConnectorStatusListener_exec_i::~ConnectorStatusListener_exec_i (void) + { + + } + + // Operations from ::CCM_DDS::ConnectorStatusListener + void ConnectorStatusListener_exec_i::on_inconsistent_topic( + ::DDS::Topic_ptr the_topic, + const DDS::InconsistentTopicStatus & status) + { + printf("ConnectorStatusListener_exec_i::on_inconsistent_topic\n"); + } + void ConnectorStatusListener_exec_i::on_requested_incompatible_qos( + ::DDS::DataReader_ptr the_reader, + const DDS::RequestedIncompatibleQosStatus & status) { + printf("ConnectorStatusListener_exec_i::on_requested_incompatible_qos\n"); + } + void ConnectorStatusListener_exec_i::on_sample_rejected( + ::DDS::DataReader_ptr the_reader, + const DDS::SampleRejectedStatus & status) { + printf("ConnectorStatusListener_exec_i::on_sample_rejected\n"); + } + void ConnectorStatusListener_exec_i::on_offered_deadline_missed( + ::DDS::DataWriter_ptr the_writer, + const DDS::OfferedDeadlineMissedStatus & status) { + printf("ConnectorStatusListener_exec_i::on_offered_deadline_missed\n"); + } + void ConnectorStatusListener_exec_i::on_offered_incompatible_qos( + ::DDS::DataWriter_ptr the_writer, + const DDS::OfferedIncompatibleQosStatus & status) { + printf("ConnectorStatusListener_exec_i::on_offered_incompatible_qos\n"); + } + void ConnectorStatusListener_exec_i::on_unexpected_status( + ::DDS::Entity_ptr the_entity, + ::DDS::StatusKind status_kind) { + printf("ConnectorStatusListener_exec_i::on_unexpected_status\n"); + } + + +//============================================================ // Facet Executor Implementation Class: PortStatusListener_exec_i //============================================================ PortStatusListener_exec_i::PortStatusListener_exec_i (void) { + printf("####### construct PortStatusListener ######");/* Your code here. */ } PortStatusListener_exec_i::~PortStatusListener_exec_i (void) @@ -78,15 +387,18 @@ namespace CIAO_Quoter_Broker_Impl ::DDS::DataReader_ptr /* the_reader */, const ::DDS::RequestedDeadlineMissedStatus & /* status */) { - /* Your code here. */ + printf("####### deadline missed ######");/* Your code here. */ } void PortStatusListener_exec_i::on_sample_lost ( - ::DDS::DataReader_ptr /* the_reader */, - const ::DDS::SampleLostStatus & /* status */) + ::DDS::DataReader_ptr the_reader , + const ::DDS::SampleLostStatus & status ) { - /* Your code here. */ + printf("####### sample lost ######"); + printf(" status.total_count = %d\n", status.total_count); + printf(" status.total_count_change = %d\n", status.total_count_change); + } //============================================================ @@ -94,11 +406,14 @@ namespace CIAO_Quoter_Broker_Impl //============================================================ Broker_exec_i::Broker_exec_i (void) - { + { + ACE_OS::srand (static_cast <u_int> (ACE_OS::time ())); + this->ticker_ = new read_action_Generator (*this); } Broker_exec_i::~Broker_exec_i (void) { + printf ("Broker_exec_i::~Broker_exec_i\n"); } // Supported operations and attributes. @@ -110,16 +425,24 @@ namespace CIAO_Quoter_Broker_Impl ::CCM_DDS::CCM_Stock_Info_RawListener_ptr Broker_exec_i::get_info_out_listener (void) { - /* Your code here. */ printf ("*************** out listener\n"); return new Stock_Info_RawListener_exec_i (); + } ::CCM_DDS::CCM_PortStatusListener_ptr Broker_exec_i::get_info_out_status (void) { - /* Your code here. */ - return ::CCM_DDS::CCM_PortStatusListener::_nil (); + printf ("*************** out status************************\n"); + //return ::CCM_DDS::CCM_PortStatusListener::_nil (); + return new PortStatusListener_exec_i (); + } + + ::CCM_DDS::CCM_ConnectorStatusListener_ptr + Broker_exec_i::get_info_out_connector_status (void) + { + printf ("*************** out connector status************************\n"); + return new ConnectorStatusListener_exec_i (); } // Operations from Components::SessionComponent. @@ -143,33 +466,61 @@ namespace CIAO_Quoter_Broker_Impl Broker_exec_i::configuration_complete (void) { /* Your code here. */ + std::cerr << ">>> Broker_exec_i::configuration_complete" << endl; + this->reader_ = this->context_->get_connection_info_out_data(); +// this->getter_ = this->context_->get_connection_info_get_out_data (); +// this->ticker_->open_h (); + ::CCM_DDS::CCM_ConnectorStatusListener_var pl = this->get_info_out_connector_status(); + + } + + void + Broker_exec_i::start (void) + { + std::cerr << ">>> Broker_exec_i::start" << endl; + this->ticker_->start (500); + } + + void + Broker_exec_i::stop (void) + { + std::cerr << ">>> Broker_exec_i::stop" << endl; + this->ticker_->stop (); } void Broker_exec_i::ccm_activate (void) { + std::cerr << ">>> Broker_exec_i::ccm_activate" << endl; ::CCM_DDS::ListenerControl_var lc = - this->context_->get_connection_info_out_control (); + this->context_->get_connection_info_out_control (); - if (CORBA::is_nil (lc.in ())) - { - printf ("Error: Listener control receptacle is null!\n"); - throw CORBA::INTERNAL (); - } + + if (CORBA::is_nil (lc.in ())) + { + printf ("Error: Listener control receptacle is null!\n"); + throw CORBA::INTERNAL (); + } + //in case of testing RawListener set lc-> enabled true lc->enabled (true); + //in case of testing Reader set lc-> enabled false, so the RawListener doesn't consume all the messages + //lc->enabled (false); + this->start(); } void Broker_exec_i::ccm_passivate (void) { - /* Your code here. */ + std::cerr << ">>> Broker_exec_i::ccm_passivate" << endl; + this->stop (); } void Broker_exec_i::ccm_remove (void) { - /* Your code here. */ + std::cerr << ">>> Broker_exec_i::ccm_remove" << endl; + this->ticker_->close_h (); } extern "C" BROKER_EXEC_Export ::Components::EnterpriseComponent_ptr @@ -177,7 +528,7 @@ namespace CIAO_Quoter_Broker_Impl { ::Components::EnterpriseComponent_ptr retval = ::Components::EnterpriseComponent::_nil (); - + printf("in create Broker\n"); ACE_NEW_NORETURN ( retval, Broker_exec_i); diff --git a/CIAO/connectors/dds4ccm/examples/Quoter/Broker/Broker_exec.h b/CIAO/connectors/dds4ccm/examples/Quoter/Broker/Broker_exec.h index 5318cd91e5e..13e8a900043 100644 --- a/CIAO/connectors/dds4ccm/examples/Quoter/Broker/Broker_exec.h +++ b/CIAO/connectors/dds4ccm/examples/Quoter/Broker/Broker_exec.h @@ -43,9 +43,64 @@ #include /**/ "Broker_exec_export.h" #include "tao/LocalObject.h" +#include "ace/Task.h" +#include "ace/Reactor.h" namespace CIAO_Quoter_Broker_Impl { + + class Broker_exec_i; + /** + * @class reader activity generator + * + * @brief an active object used by StockBroker to perform a periodical read action + * + */ + class read_action_Generator : public ACE_Task_Base + { + public: + read_action_Generator (Broker_exec_i &callback); + + ~read_action_Generator (); + + /// Hook method that performs application-defined initialization activities + int open_h (void); + + /// Hook method that performs application-defined destruction activites + int close_h (void); + + /// appliation-defined method for starting the pulse-generation service + int start (CORBA::ULong hertz); + + /// application-defined method for stopping the pulse-generation service + int stop (void); + + /// Indicate whether the current object is active + int active (void); + + /// Handle the timeout. + virtual int handle_timeout (const ACE_Time_Value &tv, + const void *arg); + + /// Called when timer handler is removed. + virtual int handle_close (ACE_HANDLE handle, + ACE_Reactor_Mask close_mask); + + /// Hook methods implemnting the task's service processing, + /// invoked by all threads activated by activate () method + virtual int svc (void); + + private: + /// Tracking whether we are actively generating pulse or not. + int active_; + + /// Maintains a handle that actually process the event + Broker_exec_i &pulse_callback_; + + }; + + + class BROKER_EXEC_Export Stock_Info_RawListener_exec_i : public virtual ::CCM_DDS::CCM_Stock_Info_RawListener, public virtual ::CORBA::LocalObject @@ -64,7 +119,6 @@ namespace CIAO_Quoter_Broker_Impl const ::Quoter::Stock_Info & an_instance, const ::CCM_DDS::ReadInfo & info); }; - class BROKER_EXEC_Export PortStatusListener_exec_i : public virtual ::CCM_DDS::CCM_PortStatusListener, public virtual ::CORBA::LocalObject @@ -91,12 +145,47 @@ namespace CIAO_Quoter_Broker_Impl ::DDS::DataReader_ptr the_reader, const ::DDS::SampleLostStatus & status); }; + + +class BROKER_EXEC_Export ConnectorStatusListener_exec_i + : public virtual ::CCM_DDS::CCM_ConnectorStatusListener, + public virtual ::CORBA::LocalObject + { + public: + ConnectorStatusListener_exec_i (void); + virtual ~ConnectorStatusListener_exec_i (void); + + virtual + void on_inconsistent_topic( ::DDS::Topic_ptr the_topic, + const DDS::InconsistentTopicStatus & status); + virtual + void on_requested_incompatible_qos( ::DDS::DataReader_ptr the_reader, + const DDS::RequestedIncompatibleQosStatus & status); + virtual + void on_sample_rejected( ::DDS::DataReader_ptr the_reader, + const DDS::SampleRejectedStatus & status); + virtual + void on_offered_deadline_missed( ::DDS::DataWriter_ptr the_writer, + const DDS::OfferedDeadlineMissedStatus & status); + virtual + void on_offered_incompatible_qos( ::DDS::DataWriter_ptr the_writer, + const DDS::OfferedIncompatibleQosStatus & status); + virtual + void on_unexpected_status( ::DDS::Entity_ptr the_entity, + ::DDS::StatusKind status_kind); + + }; + class BROKER_EXEC_Export Broker_exec_i : public virtual Broker_Exec, public virtual ::CORBA::LocalObject { public: + + + + Broker_exec_i (void); virtual ~Broker_exec_i (void); @@ -105,15 +194,23 @@ namespace CIAO_Quoter_Broker_Impl // Component attributes. // Port operations. + virtual ::CCM_DDS::CCM_ConnectorStatusListener_ptr + get_info_out_connector_status (void); + + virtual ::CCM_DDS::CCM_Stock_Info_RawListener_ptr get_info_out_listener (void); virtual ::CCM_DDS::CCM_PortStatusListener_ptr get_info_out_status (void); - + void read_one (void); + void read_one_history (void); + void read_all(void); + void read_all_history(void); // Operations from Components::SessionComponent. - + + virtual void set_session_context ( ::Components::SessionContext_ptr ctx); @@ -123,9 +220,16 @@ namespace CIAO_Quoter_Broker_Impl virtual void ccm_activate (void); virtual void ccm_passivate (void); virtual void ccm_remove (void); + virtual void start (void); + virtual void stop (void); + + private: ::Quoter::CCM_Broker_Context_var context_; + read_action_Generator * ticker_; + ::CCM_DDS::Stock_Info_Reader_var reader_; + ::CCM_DDS::Stock_Info_Getter_var getter_; }; extern "C" BROKER_EXEC_Export ::Components::EnterpriseComponent_ptr diff --git a/CIAO/connectors/dds4ccm/examples/Quoter/Connector/Quoter_Connector.idl3 b/CIAO/connectors/dds4ccm/examples/Quoter/Connector/Quoter_Connector.idl3 index 33a63f2a711..53ea3b9affa 100644 --- a/CIAO/connectors/dds4ccm/examples/Quoter/Connector/Quoter_Connector.idl3 +++ b/CIAO/connectors/dds4ccm/examples/Quoter/Connector/Quoter_Connector.idl3 @@ -16,6 +16,7 @@ #include "dds4ccm/idl/dds4ccm_PortStatusListener.idl3" #include "dds4ccm/idl/dds4ccm_PortStatusListenerE.idl" #include "dds4ccm/idl/dds4ccm_ConnectorStatusListener.idl3" +#include "dds4ccm/idl/dds4ccm_ConnectorStatusListenerE.idl" #include "dds4ccm/idl/dds4ccm_ListenerControl.idl3" #include "dds4ccm/idl/dds_rtf2_dcpsE.idl" #include "Base/Quoter_Base.idl" @@ -29,6 +30,41 @@ module CCM_DDS raises (InternalError); }; + // @from DDS_Update for Quoter::Stock_Info + interface Stock_Info_Updater + { + void create (in Quoter::Stock_Info an_instance) + raises (AlreadyCreated, + InternalError); + void update(in Quoter::Stock_Info an_instance) + raises (NonExistent, + InternalError); + void delete (in Quoter::Stock_Info an_instance) + raises (NonExistent, + InternalError); + readonly attribute boolean is_lifecycle_checked; + }; + + interface Stock_Info_Getter + { + boolean get_all (out Quoter::Stock_Info_Seq instances, out ReadInfoSeq infos) + raises (InternalError); + boolean get_all_history (out Quoter::Stock_Info_Seq instances, out ReadInfoSeq infos) + raises (InternalError); + boolean get_one (inout Quoter::Stock_Info an_instance, out ReadInfo info) + raises (NonExistent, + InternalError); + boolean get_one_history (in Quoter::Stock_Info an_instance, + out Quoter::Stock_Info_Seq instances, out ReadInfoSeq infos) + raises (NonExistent, + InternalError); + boolean get_next (out Quoter::Stock_Info an_instance, out ReadInfo info) + raises (InternalError); + attribute QueryFilter filter + setraises (BadParameter); + attribute DDS::Duration_t time_out; + }; + // @from Reader<T> from DDS_RawListen for Quoter::Stock_Info interface Stock_Info_Reader { @@ -56,6 +92,8 @@ module CCM_DDS { void on_data (in Quoter::Stock_Info an_instance, in ReadInfo info); }; + + }; module Quoter @@ -64,7 +102,7 @@ module Quoter { // @from DDS_TopicBase attribute string topic_name; - attribute DDS::StringSeq key_fields; + readonly attribute DDS::StringSeq key_fields; // @from DDS_TopicBase : DDS_Base uses CCM_DDS::ConnectorStatusListener error_listener; @@ -75,12 +113,17 @@ module Quoter provides CCM_DDS::Stock_Info_Writer info_in_data; provides DDS::DataWriter info_in_dds_entity; + // @from DDS_Update for Stock_Info + provides CCM_DDS::Stock_Info_Updater info_update_data; + // @from DDS_RawListen for Stock_Info provides CCM_DDS::Stock_Info_Reader info_out_data; + provides CCM_DDS::Stock_Info_Getter info_get_out_data; provides CCM_DDS::ListenerControl info_out_control; uses CCM_DDS::Stock_Info_RawListener info_out_listener; provides DDS::DataReader info_out_dds_entity; uses CCM_DDS::PortStatusListener info_out_status; + uses CCM_DDS::ConnectorStatusListener info_out_connector_status; }; }; diff --git a/CIAO/connectors/dds4ccm/examples/Quoter/Connector/Quoter_Connector_exec.cpp b/CIAO/connectors/dds4ccm/examples/Quoter/Connector/Quoter_Connector_exec.cpp index f0cb7762d4c..b5013ed743f 100644 --- a/CIAO/connectors/dds4ccm/examples/Quoter/Connector/Quoter_Connector_exec.cpp +++ b/CIAO/connectors/dds4ccm/examples/Quoter/Connector/Quoter_Connector_exec.cpp @@ -3,356 +3,10 @@ #include "Quoter_Connector_exec.h" -#include "dds4ccm/impl/ndds/NDDS_Traits.h" -#include "dds4ccm/impl/ndds/DomainParticipantFactory.h" -#include "dds4ccm/impl/ndds/DomainParticipant.h" -#include "dds4ccm/impl/ndds/DataReaderListener_T.h" - -// Should be removed after we refactor stuff back into ndds impl. -#include "dds4ccm/impl/ndds/DataReader.h" -#include "dds4ccm/impl/ndds/ListenerControl.h" - namespace CIAO_Quoter_Quoter_Connector_Impl { - template <typename NDDS_TYPE, typename CONNECTOR_TYPE> - Connector_T<NDDS_TYPE, CONNECTOR_TYPE>::Connector_T (void) - : default_domain_configured_ (false), - domain_id_ (0), - default_topic_configured_ (false), - topic_name_ ("Quoter_Topic"), - __info_in_configured_ (false), - __info_out_configured_ (false), - __info_out_rawlistener_enabled_ (false) - { - } - - template <typename NDDS_TYPE, typename CONNECTOR_TYPE> - Connector_T<NDDS_TYPE, CONNECTOR_TYPE>::~Connector_T (void) - { - } - - template <typename NDDS_TYPE, typename CONNECTOR_TYPE> - char * - Connector_T<NDDS_TYPE, CONNECTOR_TYPE>::topic_name (void) - { - // @from DDS_TopicBase - return CORBA::string_dup (this->topic_name_.in ()); - } - - template <typename NDDS_TYPE, typename CONNECTOR_TYPE> - void - Connector_T<NDDS_TYPE, CONNECTOR_TYPE>::topic_name ( - const char * topic_name) - { - // @from DDS_TopicBase - this->topic_name_ = topic_name; - } - - template <typename NDDS_TYPE, typename CONNECTOR_TYPE> - ::DDS::StringSeq * - Connector_T<NDDS_TYPE, CONNECTOR_TYPE>::key_fields (void) - { - // @from DDS_TopicBase - ::DDS::StringSeq *retval = - new ::DDS::StringSeq (this->key_fields_.length ()); - - for (CORBA::ULong i = 0; i < this->key_fields_.length (); ++i) - (*retval)[i] = CORBA::string_dup (this->key_fields_[i]); - - return retval; - } - - template <typename NDDS_TYPE, typename CONNECTOR_TYPE> - void - Connector_T<NDDS_TYPE, CONNECTOR_TYPE>::key_fields ( - const ::DDS::StringSeq & key_fields) - { - // @from DDS_TopicBase - this->key_fields_.length (key_fields.length ()); - - for (CORBA::ULong i = 0; i < this->key_fields_.length (); ++i) - this->key_fields_[i] = CORBA::string_dup (key_fields[i]); - } - - template <typename NDDS_TYPE, typename CONNECTOR_TYPE> - ::DDS::DomainId_t - Connector_T<NDDS_TYPE, CONNECTOR_TYPE>::domain_id (void) - { - // @from DDS_Base - return this->domain_id_; - } - - template <typename NDDS_TYPE, typename CONNECTOR_TYPE> - void - Connector_T<NDDS_TYPE, CONNECTOR_TYPE>::domain_id ( - ::DDS::DomainId_t domain_id) - { - // @from DDS_Base - this->domain_id_ = domain_id; - } - - template <typename NDDS_TYPE, typename CONNECTOR_TYPE> - char * - Connector_T<NDDS_TYPE, CONNECTOR_TYPE>::qos_profile (void) - { - // @from DDS_Base - return CORBA::string_dup (this->qos_profile_.in ()); - } - - template <typename NDDS_TYPE, typename CONNECTOR_TYPE> - void - Connector_T<NDDS_TYPE, CONNECTOR_TYPE>::qos_profile ( - const char * qos_profile) - { - // @from DDS_Base - this->qos_profile_ = qos_profile; - } - - // Port operations. - - template <typename NDDS_TYPE, typename CONNECTOR_TYPE> - void - Connector_T<NDDS_TYPE, CONNECTOR_TYPE>::configure_default_domain_ (void) - { - CIAO_DEBUG ((LM_TRACE, CLINFO "Quoter_Connector_exec_i::configure_default_domain_ - " - "Configuring default domain\n")); - - if (this->default_domain_configured_) return; - - try - { - NDDSConfigLogger::get_instance()->set_verbosity_by_category(NDDS_CONFIG_LOG_CATEGORY_API, - NDDS_CONFIG_LOG_VERBOSITY_STATUS_ALL ); - - // Generic code - this->domain_factory_ = new ::CIAO::DDS4CCM::RTI::RTI_DomainParticipantFactory_i (); - - ::DDS::DomainParticipantQos qos; - this->domain_ = - this->domain_factory_->create_participant (this->domain_id_, - qos, - 0, - 0); - } - catch (...) - { - CIAO_ERROR ((LM_ERROR, "Caught unknown C++ exception whilst configuring default domain\n")); - throw CORBA::INTERNAL (); - } - } - - template <typename NDDS_TYPE, typename CONNECTOR_TYPE> - void - Connector_T<NDDS_TYPE, CONNECTOR_TYPE>::configure_default_topic_ (void) - { - CIAO_DEBUG ((LM_TRACE, CLINFO "Quoter_Connector_exec_i::configure_default_topic_ - " - "Configuring default topic\n")); - if (this->default_topic_configured_) return; - - this->configure_default_domain_ (); - - try - { - if (CORBA::is_nil (this->topic_)) - { - CIAO::DDS4CCM::RTI::RTI_DomainParticipant_i *part = dynamic_cast< CIAO::DDS4CCM::RTI::RTI_DomainParticipant_i * > (this->domain_.in ()); - DDS_ReturnCode_t retcode = NDDS_TYPE::type_support::register_type( - part->get_participant (), NDDS_TYPE::type_support::get_type_name ()); - if (retcode == DDS_RETCODE_OK) - { - ::DDS::TopicQos tqos; - this->topic_ = - this->domain_->create_topic (this->topic_name_.in (), - NDDS_TYPE::type_support::get_type_name (), - tqos, - 0, - 0); - } - else - { - throw CORBA::INTERNAL (); - } - } - } - catch (...) - { - CIAO_ERROR ((LM_ERROR, "Caught unknown error while configuring default topic\n")); - throw CORBA::INTERNAL (); - } - } - - template <typename NDDS_TYPE, typename CONNECTOR_TYPE> - void - Connector_T<NDDS_TYPE, CONNECTOR_TYPE>::configure_port_info_in_ (void) - { - if (this->__info_in_configured_) - return; - - this->configure_default_topic_ (); - - try - { - if (CORBA::is_nil (this->__info_in_publisher_.in ())) - { - ::DDS::PublisherQos pqos; - this->__info_in_publisher_ = this->domain_->create_publisher (pqos, - 0, - 0); - } - - if (CORBA::is_nil (this->__info_in_datawriter_.in ())) - { - ::DDS::DataWriterQos dwqos; - ::DDS::DataWriter_var dwv_tmp = this->__info_in_publisher_->create_datawriter (this->topic_.in (), - dwqos, - 0, - 0); - this->__info_in_datawriter_ = ::DDS::CCM_DataWriter::_narrow (dwv_tmp); - } - } - catch (...) - { - CIAO_ERROR ((LM_ERROR, "Caught unknown C++ exception while configuring port info_in_\n")); - throw CORBA::INTERNAL (); - } - } - - template <typename NDDS_TYPE, typename CONNECTOR_TYPE> - void - Connector_T<NDDS_TYPE, CONNECTOR_TYPE>::configure_port_info_out_ (void) - { - if (this->__info_out_configured_) - return; - - this->configure_default_topic_ (); - - try - { - if (CORBA::is_nil (this->__info_out_subscriber_.in ())) - { - ::DDS::SubscriberQos sqos; - this->__info_out_subscriber_ = this->domain_->create_subscriber (sqos, - 0, - 0); - } - - if (CORBA::is_nil (this->__info_out_datareader_.in ())) - { - this->__info_out_portstatus_ = this->context_->get_connection_info_out_status (); - - this->__info_out_datareaderlistener = new ::CIAO::DDS4CCM::RTI::DataReaderListener_T<NDDS_TYPE, typename CONNECTOR_TYPE::rawlistener_type, ::CCM_DDS::PortStatusListener> ( - this->context_->get_connection_info_out_listener (), - this->context_->get_connection_info_out_status (), - this->__info_out_rawlistener_enabled_); - ::DDS::DataReaderQos drqos; - this->__info_out_datareader_ = - this->__info_out_subscriber_->create_datareader (this->topic_.in (), - drqos, - this->__info_out_datareaderlistener.in (), - DDS_DATA_AVAILABLE_STATUS); - } - - } - catch (...) - { - CIAO_ERROR ((LM_EMERGENCY, "Caught unknown c++ exception while creating subscriber entities\n")); - throw CORBA::INTERNAL (); - } - } - - template <typename NDDS_TYPE, typename CONNECTOR_TYPE> - typename CONNECTOR_TYPE::writer_type::_ptr_type - Connector_T<NDDS_TYPE, CONNECTOR_TYPE>::get_info_in_data (void) - { - std::cerr << "get_info_in_data" << std::endl; - - this->configure_port_info_in_ (); - - return new CIAO::DDS4CCM::RTI::Writer_T<NDDS_TYPE, - typename CONNECTOR_TYPE::writer_type> (this->__info_in_datawriter_.in ()); - } - - template <typename NDDS_TYPE, typename CONNECTOR_TYPE> - ::DDS::CCM_DataWriter_ptr - Connector_T<NDDS_TYPE, CONNECTOR_TYPE>::get_info_in_dds_entity (void) - { - this->configure_port_info_in_ (); - - return this->__info_in_datawriter_.in (); - } - - template <typename NDDS_TYPE, typename CONNECTOR_TYPE> - typename CONNECTOR_TYPE::reader_type::_ptr_type - Connector_T<NDDS_TYPE, CONNECTOR_TYPE>::get_info_out_data (void) - { - std::cerr << "get_info_out_data" << std::endl; - - //this->configure_port_info_in_ (); - - return new CIAO::DDS4CCM::RTI::Reader_T<NDDS_TYPE, - typename CONNECTOR_TYPE::reader_type> (this->__info_out_datareader_.in ()); - } - - template <typename NDDS_TYPE, typename CONNECTOR_TYPE> - ::CCM_DDS::CCM_ListenerControl_ptr - Connector_T<NDDS_TYPE, CONNECTOR_TYPE>::get_info_out_control (void) - { - return new CCM_DDS_ListenerControl_i (this->__info_out_rawlistener_enabled_); - } - - template <typename NDDS_TYPE, typename CONNECTOR_TYPE> - ::DDS::CCM_DataReader_ptr - Connector_T<NDDS_TYPE, CONNECTOR_TYPE>::get_info_out_dds_entity (void) - { - return ::DDS::CCM_DataReader::_nil (); - } - - template <typename NDDS_TYPE, typename CONNECTOR_TYPE> - void - Connector_T<NDDS_TYPE, CONNECTOR_TYPE>::set_session_context ( - ::Components::SessionContext_ptr ctx) - { - typename CONNECTOR_TYPE::context_type::_var_type lctx = - CONNECTOR_TYPE::context_type::_narrow (ctx); - - if ( ::CORBA::is_nil (lctx.in ())) - { - throw ::CORBA::INTERNAL (); - } - - this->context_ = lctx; - } - - template <typename NDDS_TYPE, typename CONNECTOR_TYPE> - void - Connector_T<NDDS_TYPE, CONNECTOR_TYPE>::configuration_complete (void) - { - } - - template <typename NDDS_TYPE, typename CONNECTOR_TYPE> - void - Connector_T<NDDS_TYPE, CONNECTOR_TYPE>::ccm_activate (void) - { - if (!CORBA::is_nil (this->context_->get_connection_info_out_listener ()) || - !CORBA::is_nil (this->context_->get_connection_info_out_status ())) - { - this->configure_port_info_out_ (); - } - } - - template <typename NDDS_TYPE, typename CONNECTOR_TYPE> - void - Connector_T<NDDS_TYPE, CONNECTOR_TYPE>::ccm_passivate (void) - { - } - - template <typename NDDS_TYPE, typename CONNECTOR_TYPE> - void - Connector_T<NDDS_TYPE, CONNECTOR_TYPE>::ccm_remove (void) - { - } - - Quoter_Connector_exec_i::Quoter_Connector_exec_i (void) + Quoter_Connector_exec_i::Quoter_Connector_exec_i (const char * topic_name) + : Connector_T<Stock_Info_DDS_Traits, Stock_Info_Connector_Traits> (topic_name) { } @@ -368,7 +22,7 @@ namespace CIAO_Quoter_Quoter_Connector_Impl ACE_NEW_NORETURN ( retval, - Quoter_Connector_exec_i); + Quoter_Connector_exec_i ("Quoter_Topic")); return retval; } diff --git a/CIAO/connectors/dds4ccm/examples/Quoter/Connector/Quoter_Connector_exec.h b/CIAO/connectors/dds4ccm/examples/Quoter/Connector/Quoter_Connector_exec.h index 49d2981adc1..db88acc001d 100644 --- a/CIAO/connectors/dds4ccm/examples/Quoter/Connector/Quoter_Connector_exec.h +++ b/CIAO/connectors/dds4ccm/examples/Quoter/Connector/Quoter_Connector_exec.h @@ -16,113 +16,18 @@ #include "tao/LocalObject.h" #include "dds4ccm/impl/ndds/NDDS_Traits.h" -#include "dds4ccm/impl/ndds/DataWriter.h" -#include "dds4ccm/impl/ndds/Writer.h" -#include "dds4ccm/impl/ndds/Reader_T.h" +#include "dds4ccm/impl/ndds/Connector_T.h" + #include "Base/Quoter_BaseSupport.h" namespace CIAO_Quoter_Quoter_Connector_Impl { - template <typename NDDS_TYPE, typename CONNECTOR_TYPE> - class Connector_T - : public virtual CONNECTOR_TYPE::base_type, - public virtual ::CORBA::LocalObject - { - public: - Connector_T (void); - virtual ~Connector_T (void); - - virtual char *topic_name (void); - - virtual void topic_name (const char * topic_name); - - virtual ::DDS::StringSeq *key_fields (void); - - virtual void key_fields (const ::DDS::StringSeq & key_fields); - - virtual ::DDS::DomainId_t domain_id (void); - - virtual void domain_id (::DDS::DomainId_t domain_id); - - virtual char *qos_profile (void); - - virtual void qos_profile (const char * qos_profile); - - virtual typename CONNECTOR_TYPE::writer_type::_ptr_type get_info_in_data (void); - - virtual ::DDS::CCM_DataWriter_ptr get_info_in_dds_entity (void); - - virtual typename CONNECTOR_TYPE::reader_type::_ptr_type get_info_out_data (void); - - virtual ::CCM_DDS::CCM_ListenerControl_ptr get_info_out_control (void); - - virtual ::DDS::CCM_DataReader_ptr get_info_out_dds_entity (void); - - virtual void set_session_context (::Components::SessionContext_ptr ctx); - - virtual void configuration_complete (void); - - virtual void ccm_activate (void); - virtual void ccm_passivate (void); - virtual void ccm_remove (void); - - private: - typename CONNECTOR_TYPE::context_type::_var_type context_; - - // Default stuff - void configure_default_domain_ (void); - bool default_domain_configured_; - ::DDS::DomainParticipantFactory_var domain_factory_; - ::DDS::DomainParticipant_var domain_; - - // @from DDS_Base - CCM_DDS::ConnectorStatusListener_var error_listener_; - DDS::DomainId_t domain_id_; - CORBA::String_var qos_profile_; - - // @from DDS_TopicBase - void configure_default_topic_ (void); - bool default_topic_configured_; - ::DDS::Topic_var topic_; - CORBA::String_var topic_name_; - DDS::StringSeq key_fields_; - - // @from DDS_Write for Stock_Info - void configure_port_info_in_ (void); - bool __info_in_configured_; - ::DDS::Publisher_var __info_in_publisher_; - ::DDS::CCM_DataWriter_var __info_in_datawriter_; - typename CONNECTOR_TYPE::writer_type::_var_type __info_in_writer_; - - // @from DDS_RawListen - void configure_port_info_out_ (void); - bool __info_out_configured_; - typename CONNECTOR_TYPE::rawlistener_type::_var_type __info_out_rawlistener_; - ACE_Atomic_Op <TAO_SYNCH_MUTEX, bool> __info_out_rawlistener_enabled_; - CCM_DDS::PortStatusListener_var __info_out_portstatus_; - ::DDS::Subscriber_var __info_out_subscriber_; - ::DDS::DataReaderListener_var __info_out_listener_; - ::DDS::DataReader_var __info_out_datareader_; - ::DDS::DataReaderListener_var __info_out_datareaderlistener; - }; - - template <typename BASE_TYPE, - typename WRITER_TYPE, - typename READER_TYPE, - typename CONTEXT_TYPE, - typename RAWLISTENER_TYPE> - struct Connector_Traits - { - typedef BASE_TYPE base_type; - typedef WRITER_TYPE writer_type; - typedef READER_TYPE reader_type; - typedef CONTEXT_TYPE context_type; - typedef RAWLISTENER_TYPE rawlistener_type; - }; // @from use of Stock_Info as a parameter - typedef CIAO::DDS4CCM::RTI::Type_Traits < ::Quoter::Stock_Info, + typedef CIAO::DDS4CCM::RTI::Type_Traits < + ::Quoter::Stock_Info, ::Quoter::Stock_Info_Seq, + ::Quoter::Stock_InfoSeq, ::Quoter::Stock_InfoTypeSupport, ::Quoter::Stock_InfoDataWriter, ::Quoter::Stock_InfoDataReader > Stock_Info_DDS_Traits; @@ -130,15 +35,19 @@ namespace CIAO_Quoter_Quoter_Connector_Impl typedef Connector_Traits < ::CIAO_Quoter_Quoter_Connector_Impl::Quoter_Connector_Exec, ::CCM_DDS::CCM_Stock_Info_Writer, + ::CCM_DDS::CCM_Stock_Info_Updater, + ::CCM_DDS::CCM_Stock_Info_Getter, ::CCM_DDS::CCM_Stock_Info_Reader, ::Quoter::CCM_Quoter_Connector_Context, - ::CCM_DDS::Stock_Info_RawListener> Stock_Info_Connector_Traits; + ::CCM_DDS::Stock_Info_RawListener, + ::CCM_DDS::ConnectorStatusListener> Stock_Info_Connector_Traits; + class QUOTER_CONNECTOR_EXEC_Export Quoter_Connector_exec_i : public Connector_T <Stock_Info_DDS_Traits, Stock_Info_Connector_Traits> { public: - Quoter_Connector_exec_i (void); + Quoter_Connector_exec_i (const char * topic_name); virtual ~Quoter_Connector_exec_i (void); }; diff --git a/CIAO/connectors/dds4ccm/examples/Quoter/Distributor/Distributor.idl3 b/CIAO/connectors/dds4ccm/examples/Quoter/Distributor/Distributor.idl3 index 54de36fe62f..f00474ffc12 100644 --- a/CIAO/connectors/dds4ccm/examples/Quoter/Distributor/Distributor.idl3 +++ b/CIAO/connectors/dds4ccm/examples/Quoter/Distributor/Distributor.idl3 @@ -26,6 +26,7 @@ module Quoter component Distributor supports Trigger { uses CCM_DDS::Stock_Info_Writer info_in_data; + uses CCM_DDS::Stock_Info_Updater info_update_data; uses ::DDS::DataWriter info_in_dds_entity; attribute unsigned long rate; }; diff --git a/CIAO/connectors/dds4ccm/examples/Quoter/Distributor/Distributor_exec.cpp b/CIAO/connectors/dds4ccm/examples/Quoter/Distributor/Distributor_exec.cpp index 98d0241e2f6..8c4f2a78496 100644 --- a/CIAO/connectors/dds4ccm/examples/Quoter/Distributor/Distributor_exec.cpp +++ b/CIAO/connectors/dds4ccm/examples/Quoter/Distributor/Distributor_exec.cpp @@ -155,7 +155,7 @@ namespace CIAO_Quoter_Distributor_Impl } Distributor_exec_i::Distributor_exec_i (void) - : rate_ (5) + : rate_ (1) { ACE_OS::srand (static_cast <u_int> (ACE_OS::time ())); this->ticker_ = new pulse_Generator (*this); @@ -190,11 +190,60 @@ namespace CIAO_Quoter_Distributor_Impl if (i->second->current < i->second->low) i->second->low = i->second->current; - if (!CORBA::is_nil (this->writer_)) + if (!CORBA::is_nil (this->writer_)) { + printf ("WRITE AND CREATE stock_info for <%s> %u:%u:%u\n", + i->first.c_str(), + i->second->low, + i->second->current, + i->second->high); this->writer_->write (i->second); + try + { + this->updater_->create (i->second); + } + catch (CCM_DDS::AlreadyCreated& ) + { + printf ("Stock_info for <%s> already created.\n", + i->first.c_str ()); + } + catch (CCM_DDS::InternalError& ) + { + printf ("Internal Error while creating Stock_info for <%s>.\n", + i->first.c_str ()); + } + } else std::cerr << "Writer reference is nil!" << std::endl; - + } + else + { + if (!CORBA::is_nil (this->updater_)) + { + i->second->current = ACE_OS::rand () % 50; + i->second->high = i->second->current + ACE_OS::rand () % 50; + i->second->low = ACE_OS::rand () % 50; + try + { + this->updater_->update (i->second); + printf ("Updated stock_info for <%s> %u:%u:%u\n", + i->first.c_str(), + i->second->low, + i->second->current, + i->second->high); + } + catch (CCM_DDS::NonExistent& ) + { + printf ("Stock_info for <%s> not updated: <%s> didn't exist.\n", + i->first.c_str (), i->first.c_str ()); + } + catch (CCM_DDS::InternalError& ) + { + printf ("Internal Error while updating Stock_info for <%s>.\n", + i->first.c_str ()); + } + } + else + std::cerr << "Updater reference is nil!" << std::endl; } } } @@ -245,6 +294,13 @@ namespace CIAO_Quoter_Distributor_Impl void Distributor_exec_i::stop (void) { + for (Stock_Table::iterator i = this->stocks_.begin (); + i != this->stocks_.end (); + ++i) + { + printf ("Unregister <%s>\n", i->first.c_str ()); + this->updater_->_cxx_delete (i->second); + } this->ticker_->stop (); } @@ -285,9 +341,8 @@ namespace CIAO_Quoter_Distributor_Impl void Distributor_exec_i::configuration_complete (void) { - /* Your code here. */ - this->writer_ = this->context_->get_connection_info_in_data (); - + this->writer_ = this->context_->get_connection_info_in_data (); + this->updater_ = this->context_->get_connection_info_update_data (); this->ticker_->activate (); } @@ -296,6 +351,11 @@ namespace CIAO_Quoter_Distributor_Impl { this->start (); this->add_stock ("MSFT"); + this->add_stock ("IBM"); + this->add_stock ("HP"); + this->add_stock ("DELL"); + this->add_stock ("ACER"); + this->add_stock ("ASUS"); } void @@ -308,6 +368,7 @@ namespace CIAO_Quoter_Distributor_Impl Distributor_exec_i::ccm_remove (void) { /* Your code here. */ + //this->stop (); } extern "C" DISTRIBUTOR_EXEC_Export ::Components::EnterpriseComponent_ptr diff --git a/CIAO/connectors/dds4ccm/examples/Quoter/Distributor/Distributor_exec.h b/CIAO/connectors/dds4ccm/examples/Quoter/Distributor/Distributor_exec.h index 5f9e14bcfc0..62f8e1ab24f 100644 --- a/CIAO/connectors/dds4ccm/examples/Quoter/Distributor/Distributor_exec.h +++ b/CIAO/connectors/dds4ccm/examples/Quoter/Distributor/Distributor_exec.h @@ -177,6 +177,7 @@ namespace CIAO_Quoter_Distributor_Impl Stock_Table stocks_; CORBA::ULong rate_; CCM_DDS::Stock_Info_Writer_var writer_; + CCM_DDS::Stock_Info_Updater_var updater_; }; extern "C" DISTRIBUTOR_EXEC_Export ::Components::EnterpriseComponent_ptr diff --git a/CIAO/connectors/dds4ccm/examples/Quoter/descriptors/Plan.cdp b/CIAO/connectors/dds4ccm/examples/Quoter/descriptors/Plan.cdp index 17d283b5b68..8fb87d3b2d1 100644 --- a/CIAO/connectors/dds4ccm/examples/Quoter/descriptors/Plan.cdp +++ b/CIAO/connectors/dds4ccm/examples/Quoter/descriptors/Plan.cdp @@ -207,6 +207,22 @@ </connection> <connection> + <name>info_get_out_data</name> + <internalEndpoint> + <portName>info_get_out_data</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="BrokerComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>info_get_out_data</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="Quoter_ConnectorComponentInstance2" /> + </internalEndpoint> + </connection> + + <connection> <name>_listenercontrol</name> <internalEndpoint> <portName>info_out_control</portName> @@ -271,6 +287,22 @@ </connection> <connection> + <name>_connectorstatuslistener</name> + <internalEndpoint> + <portName>info_out_connector_status</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="BrokerComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>info_out_connector_status</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="Quoter_ConnectorComponentInstance2" /> + </internalEndpoint> + </connection> + + <connection> <name>writer_connection</name> <internalEndpoint> <portName>info_in_data</portName> @@ -286,6 +318,21 @@ </internalEndpoint> </connection> + <connection> + <name>updater_connection</name> + <internalEndpoint> + <portName>info_update_data</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="DistributorComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>info_update_data</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="Quoter_ConnectorComponentInstance" /> + </internalEndpoint> + </connection> <artifact xmi:id="Distributor_ExecArtifact"> <name>Distributor_exec</name> diff --git a/CIAO/connectors/dds4ccm/examples/Quoter/descriptors/run_test.pl b/CIAO/connectors/dds4ccm/examples/Quoter/descriptors/run_test.pl index 728c251c06c..aafbb22d119 100755 --- a/CIAO/connectors/dds4ccm/examples/Quoter/descriptors/run_test.pl +++ b/CIAO/connectors/dds4ccm/examples/Quoter/descriptors/run_test.pl @@ -159,8 +159,8 @@ $E = $E->SpawnWaitKill (50); -print "Sleeping 60 seconds to allow task to complete\n"; -sleep (60); +print "Sleeping 12 seconds to allow task to complete\n"; +sleep (12); # print "Invoking the controller ($controller_exec -k file://Sender.ior)\n"; # $controller = new PerlACE::Process ("$controller_exec", "-k file://Sender.ior"); diff --git a/CIAO/connectors/dds4ccm/examples/Shapes/Base/Shapes_Base.idl b/CIAO/connectors/dds4ccm/examples/Shapes/Base/Shapes_Base.idl new file mode 100644 index 00000000000..750a8e327e5 --- /dev/null +++ b/CIAO/connectors/dds4ccm/examples/Shapes/Base/Shapes_Base.idl @@ -0,0 +1,26 @@ +// $Id$ + +/** + * @file Shapes_Base.idl + * @author Marcel Smit <msmit@remedy.nl> + */ + +#ifndef SHAPES_BASE_IDL +#define SHAPES_BASE_IDL + +struct ShapeType { + string color; //@key + long x; + long y; + long shapesize; +}; + +struct Attributes { + string shape; //@key + string color; //@key + float speed; +}; + +typedef sequence<ShapeType> ShapeType_Seq; + +#endif diff --git a/CIAO/connectors/dds4ccm/examples/Shapes/Base/Shapes_Base.mpc b/CIAO/connectors/dds4ccm/examples/Shapes/Base/Shapes_Base.mpc new file mode 100644 index 00000000000..019aa2925e6 --- /dev/null +++ b/CIAO/connectors/dds4ccm/examples/Shapes/Base/Shapes_Base.mpc @@ -0,0 +1,72 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -o ../lib -u DDS -n Shapes_Base" + +project(DDS_Shapes_Base_idl_gen) : taoidldefaults, anytypecode { + custom_only = 1 + idlflags -= -St -Sa + idlflags += -SS -Gxhst \ + -Wb,stub_export_macro=SHAPES_BASE_STUB_Export \ + -Wb,stub_export_include=Shapes_Base_stub_export.h -GT + + IDL_Files { + Shapes_Base.idl + } +} + +project(DDS_Shapes_Base_ndds_ts_gen) : ndds_ts_defaults { + custom_only = 1 + after += DDS_Shapes_Base_idl_gen + ndds_ts_flags += -corba Shapes_BaseC.h -orb ACE_TAO1.7 + + NDDSTypeSupport_Files { + Shapes_Base.idl + } +} + +project(DDS_Shapes_Base_NDDS_TS) : nddslib, taolib { + after += DDS_Shapes_Base_ndds_ts_gen DDS_Shapes_Base_stub + libs += DDS_Shapes_Base_stub + libout = ../lib + libpaths += ../lib + sharedname = DDS_Shapes_Base_NDDS_TS + + Source_Files { + Shapes_Base.cxx + Shapes_BasePlugin.cxx + Shapes_BaseSupport.cxx + } + + Header_Files { + Shapes_Base.h + Shapes_BasePlugin.h + Shapes_BaseSupport.h + } + + Inline_Files { + } +} + +project(DDS_Shapes_Base_stub) : ccm_stub { + after += DDS_Shapes_Base_idl_gen + libs += + libout = ../lib + sharedname = DDS_Shapes_Base_stub + dynamicflags = SHAPES_BASE_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Shapes_BaseC.cpp + } + + Header_Files { + Shapes_BaseC.h + Shapes_Base_stub_export.h + } + + Inline_Files { + Shapes_BaseC.inl + } +} + diff --git a/CIAO/connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector.idl3 b/CIAO/connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector.idl3 new file mode 100644 index 00000000000..2c1a64f0f68 --- /dev/null +++ b/CIAO/connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector.idl3 @@ -0,0 +1,126 @@ +// $Id$ + +/** + * @file Shapes_Connector.idl3 + * @author Marcel Smit <msmit@remedy.nl> + * + * by-hand translation of the idl3p. + */ + +#ifndef SHAPES_CONNECTOR_IDL3_ +#define SHAPES_CONNECTOR_IDL3_ + +#include <Components.idl> +#include "dds4ccm/idl/dds4ccm_ListenerControl.idl3" +#include "dds4ccm/idl/dds4ccm_ListenerControlE.idl" +#include "dds4ccm/idl/dds4ccm_PortStatusListener.idl3" +#include "dds4ccm/idl/dds4ccm_PortStatusListenerE.idl" +#include "dds4ccm/idl/dds4ccm_ConnectorStatusListener.idl3" +#include "dds4ccm/idl/dds4ccm_ListenerControl.idl3" +#include "dds4ccm/idl/dds_rtf2_dcpsE.idl" +#include "Base/Shapes_Base.idl" + +module CCM_DDS +{ + // @from DDS_Write for Shapes::ShapeType + interface ShapeType_Writer + { + void write (in ShapeType an_instance) + raises (InternalError); + }; + + // @from DDS_Update for Shapes::ShapeType + interface ShapeType_Updater + { + void create (in ShapeType an_instance) + raises (AlreadyCreated, + InternalError); + void update(in ShapeType an_instance) + raises (NonExistent, + InternalError); + void delete (in ShapeType an_instance) + raises (NonExistent, + InternalError); + readonly attribute boolean is_lifecycle_checked; + }; + + interface ShapeType_Getter + { + boolean get_all (out ShapeType_Seq instances, out ReadInfoSeq infos) + raises (InternalError); + boolean get_all_history (out ShapeType_Seq instances, out ReadInfoSeq infos) + raises (InternalError); + boolean get_one (inout ShapeType an_instance, out ReadInfo info) + raises (NonExistent, + InternalError); + boolean get_one_history (in ShapeType an_instance, + out ShapeType_Seq instances, out ReadInfoSeq infos) + raises (NonExistent, + InternalError); + boolean get_next (out ShapeType an_instance, out ReadInfo info) + raises (InternalError); + attribute QueryFilter filter + setraises (BadParameter); + attribute DDS::Duration_t time_out; + }; + + // @from Reader<T> from DDS_RawListen for Shapes::ShapeType + interface ShapeType_Reader + { + void read_all (out ShapeType_Seq instances, out ReadInfoSeq infos) + raises (InternalError); + + void read_all_history (out ShapeType_Seq instances, out ReadInfoSeq infos) + raises (InternalError); + + void read_one (inout ShapeType an_instance, out ReadInfo info) + raises (NonExistent, + InternalError); + + void read_one_history (in ShapeType an_instance, + out ShapeType_Seq instances, out ReadInfoSeq infos) + raises (NonExistent, + InternalError); + + attribute QueryFilter filter + setraises (BadParameter); + }; + + // @from RawListener for Shapes::ShapeType + interface ShapeType_RawListener + { + void on_data (in ShapeType an_instance, in ReadInfo info); + }; +}; + +module Shapes +{ + component Shapes_Connector + { + // @from DDS_TopicBase + attribute string topic_name; + readonly attribute DDS::StringSeq key_fields; + + // @from DDS_TopicBase : DDS_Base + uses CCM_DDS::ConnectorStatusListener error_listener; + attribute DDS::DomainId_t domain_id; + attribute string qos_profile; + + // @from DDS_Write for ShapeType + provides CCM_DDS::ShapeType_Writer info_in_data; + provides DDS::DataWriter info_in_dds_entity; + + // @from DDS_Update for ShapeType + provides CCM_DDS::ShapeType_Updater info_update_data; + + // @from DDS_RawListen for ShapeType + provides CCM_DDS::ShapeType_Reader info_out_data; + provides CCM_DDS::ShapeType_Getter info_get_out_data; + provides CCM_DDS::ListenerControl info_out_control; + uses CCM_DDS::ShapeType_RawListener info_out_listener; + provides DDS::DataReader info_out_dds_entity; + uses CCM_DDS::PortStatusListener info_out_status; + }; +}; + +#endif /* SHAPES_CONNECTOR_IDL3_ */ diff --git a/CIAO/connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector.idl3p b/CIAO/connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector.idl3p new file mode 100644 index 00000000000..38049f250bd --- /dev/null +++ b/CIAO/connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector.idl3p @@ -0,0 +1,25 @@ +// $Id$ + +/** + * @file + * @author Marcel Smit <msmit@remedy.nl> + * + * IDL3P description of the shapes connector. + */ +#ifndef SHAPES_CONNECTOR_IDL3P +#define SHAPES_CONNECTOR_IDL3P + +#include <dds4ccm/idl/dds4ccm_Connector_Base.idl3p> +#include <dds4ccm/idl/dds4ccm_Port_RawListen.idl3p> +#include <dds4ccm/idl/dds4ccm_Port_Write.idl3p> + +module Shapes +{ + connector Shapes_Connector : CCM_DDS::DDS_TopicBase + { + mirrorport CCM_DDS::DDS_Write <Shape_Info> info_in; + mirrorport CCM_DDS::DDS_RawListen <Shape_Info> info_out; + }; +}; + +#endif /* SHAPES_CONNECTOR_IDL3P */ diff --git a/CIAO/connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector.mpc b/CIAO/connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector.mpc new file mode 100644 index 00000000000..46f227ac5a1 --- /dev/null +++ b/CIAO/connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector.mpc @@ -0,0 +1,147 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p DDS_Shapes_Base -l .. -o ../lib -u DDS Shapes_Connector" + +project(DDS_Shapes_Connector_idl_gen) : connectoridldefaults, componentidldefaults { + after += DDS4CCM_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=SHAPES_CONNECTOR_STUB_Export \ + -Wb,stub_export_include=Shapes_Connector_stub_export.h \ + -Wb,skel_export_macro=SHAPES_CONNECTOR_SVNT_Export \ + -Wb,skel_export_include=Shapes_Connector_svnt_export.h \ + -Wb,exec_export_macro=SHAPES_CONNECTOR_EXEC_Export \ + -Wb,exec_export_include=Shapes_Connector_exec_export.h \ + -I .. + + IDL_Files { + Shapes_Connector.idl3 + } +} + +project(DDS_Shapes_Connector_lem_gen) : ciaoidldefaults { + custom_only = 1 + after += DDS_Shapes_Connector_idl_gen + idlflags += -Wb,stub_export_macro=SHAPES_CONNECTOR_LEM_STUB_Export \ + -Wb,stub_export_include=Shapes_Connector_lem_stub_export.h \ + -SS -Gxhst \ + -I .. -I $(CIAO_ROOT)/connectors -I$(CIAO_ROOT)/connectors/dds4ccm/idl + + IDL_Files { + Shapes_ConnectorE.idl + } +} + +project(DDS_Shapes_Connector_lem_stub) : ccm_svnt, dds4ccm_base { + after += DDS_Shapes_Connector_lem_gen DDS_Shapes_Connector_stub DDS_Shapes_Base_stub + libs += DDS_Shapes_Base_stub DDS_Shapes_Connector_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = DDS_Shapes_Connector_lem_stub + dynamicflags = SHAPES_CONNECTOR_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Shapes_ConnectorEC.cpp + } + + Header_Files { + Shapes_ConnectorEC.h + Shapes_Connector_lem_stub_export.h + } + + Inline_Files { + Shapes_ConnectorEC.inl + } +} + +project(DDS_Shapes_Connector_stub) : ccm_stub, dds4ccm_base { + after += DDS_Shapes_Connector_idl_gen DDS_Shapes_Base_stub + libs += DDS_Shapes_Base_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = DDS_Shapes_Connector_stub + dynamicflags = SHAPES_CONNECTOR_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Shapes_ConnectorC.cpp + } + + Header_Files { + Shapes_ConnectorC.h + Shapes_Connector_stub_export.h + } + + Inline_Files { + Shapes_ConnectorC.inl + } +} + +project(DDS_Shapes_Connector_exec) : ciao_executor, dds4ccm_skel, nddslib { + after += DDS_Shapes_Connector_lem_stub DDS_Shapes_Connector_stub DDS4CCM_lem_stub CIAO_DDS4CCM_NDDS_Impl DDS_Shapes_Base_ndds_ts_gen + sharedname = DDS_Shapes_Connector_exec + libs += DDS_Shapes_Connector_stub DDS_Shapes_Connector_lem_stub DDS_Shapes_Base_stub CIAO_DDS4CCM_NDDS_Impl DDS4CCM_lem_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags = SHAPES_CONNECTOR_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Shapes_Connector_exec.cpp + ../Base/Shapes_Base.cxx + ../Base/Shapes_BasePlugin.cxx + ../Base/Shapes_BaseSupport.cxx + + } + + Header_Files { + Shapes_Connector_exec.h + Shapes_Connector_exec_export.h + } + + Inline_Files { + } +} + + +project(DDS_Shapes_Connector_svnt) : ciao_servant, dds4ccm_skel, nddslib { + after += DDS_Shapes_Connector_lem_stub DDS_Shapes_Connector_exec DDS_Shapes_Connector_stub DDS4CCM_lem_stub + sharedname = DDS_Shapes_Connector_svnt + libs += DDS_Shapes_Connector_stub \ + DDS_Shapes_Connector_lem_stub \ + DDS_Shapes_Base_stub \ + DDS_Shapes_Connector_exec \ + DDS4CCM_lem_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags = SHAPES_CONNECTOR_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Shapes_ConnectorS.cpp + Shapes_Connector_svnt.cpp + } + + Header_Files { + Shapes_ConnectorS.h + Shapes_Connector_svnt.h + Shapes_Connector_svnt_export.h + } + + Inline_Files { + Shapes_ConnectorS.inl + } +} + + diff --git a/CIAO/connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector_exec.cpp b/CIAO/connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector_exec.cpp new file mode 100644 index 00000000000..fa17a3cdde4 --- /dev/null +++ b/CIAO/connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector_exec.cpp @@ -0,0 +1,30 @@ +// -*- C++ -*- +// $Id$ + +#include "Shapes_Connector_exec.h" + +namespace CIAO_Shapes_Shapes_Connector_Impl +{ + Shapes_Connector_exec_i::Shapes_Connector_exec_i (const char * topic_name) + : Connector_T<ShapeType_DDS_Traits, ShapeType_Connector_Traits> (topic_name) + { + } + + Shapes_Connector_exec_i::~Shapes_Connector_exec_i (void) + { + } + + extern "C" SHAPES_CONNECTOR_EXEC_Export ::Components::EnterpriseComponent_ptr + create_Shapes_Shapes_Connector_Impl (void) + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_NORETURN ( + retval, + Shapes_Connector_exec_i ("Default_Topic_Name")); //should be set by dep. plan. + + return retval; + } +} + diff --git a/CIAO/connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector_exec.h b/CIAO/connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector_exec.h new file mode 100644 index 00000000000..9af586b71a2 --- /dev/null +++ b/CIAO/connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector_exec.h @@ -0,0 +1,60 @@ +// -*- C++ -*- +// $Id$ + +#ifndef SHAPES_CONNECTOR_EXEC_H_ +#define SHAPES_CONNECTOR_EXEC_H_ + +#include /**/ "ace/pre.h" + +#include "Shapes_ConnectorEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include /**/ "Shapes_Connector_exec_export.h" +#include "tao/LocalObject.h" + +#include "dds4ccm/impl/ndds/NDDS_Traits.h" +#include "dds4ccm/impl/ndds/Connector_T.h" + +#include "Base/Shapes_BaseSupport.h" + +namespace CIAO_Shapes_Shapes_Connector_Impl +{ + + // @from use of ShapeType as a parameter + typedef CIAO::DDS4CCM::RTI::Type_Traits < + ShapeType, + ShapeType_Seq, + ShapeTypeSeq, + ShapeTypeTypeSupport, + ShapeTypeDataWriter, + ShapeTypeDataReader > ShapeType_DDS_Traits; + + typedef Connector_Traits < + ::CIAO_Shapes_Shapes_Connector_Impl::Shapes_Connector_Exec, + ::CCM_DDS::CCM_ShapeType_Writer, + ::CCM_DDS::CCM_ShapeType_Updater, + ::CCM_DDS::CCM_ShapeType_Getter, + ::CCM_DDS::CCM_ShapeType_Reader, + ::Shapes::CCM_Shapes_Connector_Context, + ::CCM_DDS::ShapeType_RawListener, + ::CCM_DDS::ConnectorStatusListener> ShapeType_Connector_Traits; + + class SHAPES_CONNECTOR_EXEC_Export Shapes_Connector_exec_i : + public Connector_T <ShapeType_DDS_Traits, ShapeType_Connector_Traits> + { + public: + Shapes_Connector_exec_i (const char * topic_name); + virtual ~Shapes_Connector_exec_i (void); + }; + + extern "C" SHAPES_CONNECTOR_EXEC_Export ::Components::EnterpriseComponent_ptr + create_Shapes_Shapes_Connector_Impl (void); +} + +#include /**/ "ace/post.h" + +#endif /* ifndef */ + diff --git a/CIAO/connectors/dds4ccm/examples/Shapes/Receiver/Receiver.idl3 b/CIAO/connectors/dds4ccm/examples/Shapes/Receiver/Receiver.idl3 new file mode 100644 index 00000000000..36f0adfda52 --- /dev/null +++ b/CIAO/connectors/dds4ccm/examples/Shapes/Receiver/Receiver.idl3 @@ -0,0 +1,30 @@ +// $Id$ + +/** + * @file + * @author Marcel Smit <msmit@remedy.nl> + */ + +#ifndef RECEIVER_IDL3 +#define RECEIVER_IDL3 + +#include "Connector/Shapes_Connector.idl3" +#include "Connector/Shapes_ConnectorE.idl" + +module Shapes +{ + component Receiver + { + uses CCM_DDS::ShapeType_Reader info_out_data; + uses CCM_DDS::ShapeType_Getter info_get_out_data; + uses CCM_DDS::ListenerControl info_out_control; + provides CCM_DDS::ShapeType_RawListener info_out_listener; + provides CCM_DDS::PortStatusListener info_out_status; + attribute unsigned long rate; + attribute boolean get_data; //if true, get_one and get_all are invoked + attribute boolean read_data;//if true, read_one and read_all are invoked. + attribute boolean raw_listen; //if true, raw listen port is enabled. + }; +}; + +#endif diff --git a/CIAO/connectors/dds4ccm/examples/Shapes/Receiver/Receiver.idl3p b/CIAO/connectors/dds4ccm/examples/Shapes/Receiver/Receiver.idl3p new file mode 100644 index 00000000000..3ed223133fa --- /dev/null +++ b/CIAO/connectors/dds4ccm/examples/Shapes/Receiver/Receiver.idl3p @@ -0,0 +1,23 @@ +// $Id$ + +/** + * @file + * @author Marcel Smit <msmit@remedy.nl> + * + */ + +#ifndef RECEIVER_IDL3P +#define RECEIVER_IDL3P + +#include <dds4ccm/idl/dds4ccm_Connector_Base.idl3p> +#include <dds4ccm/idl/dds4ccm_Port_RawListen.idl3p> + +module Shapes +{ + component Receiver + { + port CCM_DDS::DDS_RawListen <Shape_Info> info; + }; +}; + +#endif /* RECEIVER_IDL3P */ diff --git a/CIAO/connectors/dds4ccm/examples/Shapes/Receiver/Receiver.mpc b/CIAO/connectors/dds4ccm/examples/Shapes/Receiver/Receiver.mpc new file mode 100644 index 00000000000..bd1a08850c1 --- /dev/null +++ b/CIAO/connectors/dds4ccm/examples/Shapes/Receiver/Receiver.mpc @@ -0,0 +1,137 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -l ../lib -o ../lib -u DDS -b dds4ccm_base Receiver" + +project(DDS_Receiver_idl_gen) : componentidldefaults , connectoridldefaults { + custom_only = 1 + after += DDS_Shapes_Connector_idl_gen + idlflags += -Wb,stub_export_macro=RECEIVER_STUB_Export \ + -Wb,stub_export_include=Receiver_stub_export.h \ + -Wb,skel_export_macro=RECEIVER_SVNT_Export \ + -Wb,skel_export_include=Receiver_svnt_export.h \ + -Wb,exec_export_macro=RECEIVER_EXEC_Export \ + -Wb,exec_export_include=Receiver_exec_export.h -I.. + + IDL_Files { + Receiver.idl3 + } +} + +project(DDS_Receiver_lem_gen) : connectoridldefaults, { + after += DDS_Receiver_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=RECEIVER_LEM_STUB_Export \ + -Wb,stub_export_include=Receiver_lem_stub_export.h \ + -SS -Gxhst -I.. + + IDL_Files { + ReceiverE.idl + } +} + +project(DDS_Receiver_lem_stub) : ccm_svnt , dds4ccm_base { + after += DDS_Receiver_lem_gen DDS_Receiver_stub DDS_Shapes_Connector_stub DDS_Shapes_Base_stub + libs += Receiver_stub DDS_Shapes_Connector_stub DDS_Shapes_Base_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = Receiver_lem_stub + dynamicflags = RECEIVER_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + ReceiverEC.cpp + } + + Header_Files { + ReceiverEC.h + Receiver_lem_stub_export.h + } + + Inline_Files { + ReceiverEC.inl + } +} + +project(DDS_Receiver_stub) : ccm_stub , dds4ccm_base { + after += DDS_Receiver_idl_gen DDS_Shapes_Connector_stub DDS_Shapes_Base_stub DDS_Shapes_Connector_lem_gen + libs += DDS_Shapes_Connector_stub DDS_Shapes_Base_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = Receiver_stub + dynamicflags = RECEIVER_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + ReceiverC.cpp + } + + Header_Files { + ReceiverC.h + Receiver_stub_export.h + } + + Inline_Files { + ReceiverC.inl + } +} + +project(DDS_Receiver_exec) : ciao_executor , dds4ccm_base { + after += DDS_Receiver_lem_stub DDS_Receiver_stub DDS_Shapes_Base_stub DDS_Shapes_Connector_stub DDS_Shapes_Connector_lem_stub DDS4CCM_lem_stub + sharedname = Receiver_exec + libs += Receiver_stub Receiver_lem_stub DDS_Shapes_Base_stub DDS_Shapes_Connector_stub DDS_Shapes_Connector_lem_stub DDS4CCM_lem_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags = RECEIVER_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Receiver_exec.cpp + } + + Header_Files { + Receiver_exec.h + Receiver_exec_export.h + } + + Inline_Files { + } +} + + +project(DDS_Receiver_svnt) : ciao_servant , dds4ccm_base, nddslib { + after += DDS_Receiver_lem_stub DDS_Shapes_Base_stub DDS_Shapes_Connector_stub DDS_Shapes_Connector_svnt DDS_Receiver_exec DDS_Shapes_Connector_lem_stub DDS4CCM_lem_stub DDS4CCM_skel + sharedname = Receiver_svnt + libs += Receiver_stub Receiver_lem_stub DDS_Shapes_Base_stub DDS_Shapes_Connector_stub DDS_Shapes_Connector_svnt Receiver_exec DDS_Shapes_Connector_lem_stub DDS4CCM_lem_stub DDS4CCM_skel + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags = RECEIVER_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + ReceiverS.cpp + Receiver_svnt.cpp + } + + Header_Files { + ReceiverS.h + Receiver_svnt.h + Receiver_svnt_export.h + } + + Inline_Files { + ReceiverS.inl + } +} + + diff --git a/CIAO/connectors/dds4ccm/examples/Shapes/Receiver/Receiver_exec.cpp b/CIAO/connectors/dds4ccm/examples/Shapes/Receiver/Receiver_exec.cpp new file mode 100644 index 00000000000..0679e166158 --- /dev/null +++ b/CIAO/connectors/dds4ccm/examples/Shapes/Receiver/Receiver_exec.cpp @@ -0,0 +1,471 @@ +// -*- C++ -*- +// +// $Id$ + +/** + * Code generated by the The ACE ORB (TAO) IDL Compiler v1.7.3 + * TAO and the TAO IDL Compiler have been developed by: + * Center for Distributed Object Computing + * Washington University + * St. Louis, MO + * USA + * http://www.cs.wustl.edu/~schmidt/doc-center.html + * and + * Distributed Object Computing Laboratory + * University of California at Irvine + * Irvine, CA + * USA + * http://doc.ece.uci.edu/ + * and + * Institute for Software Integrated Systems + * Vanderbilt University + * Nashville, TN + * USA + * http://www.isis.vanderbilt.edu/ + * + * Information about TAO is available at: + * http://www.cs.wustl.edu/~schmidt/TAO.html + **/ + +// TAO_IDL - Generated from +// be/be_codegen.cpp:1278 + +#include "Receiver_exec.h" +#include "ciao/CIAO_common.h" + +namespace CIAO_Shapes_Receiver_Impl +{ + read_action_Generator::read_action_Generator (Receiver_exec_i &callback) + : active_ (0), + pulse_callback_ (callback) + { + // initialize the reactor + this->reactor (ACE_Reactor::instance ()); + } + + read_action_Generator::~read_action_Generator () + { + } + + int + read_action_Generator::open_h () + { + // convert the task into a active object that runs in separate thread + return this->activate (); + } + + int + read_action_Generator::close_h () + { + this->reactor ()->end_reactor_event_loop (); + // wait for all threads in the task to exit before it returns + return this->wait (); + } + + int + read_action_Generator::start (CORBA::ULong hertz) + { + // return if not valid + if (hertz == 0 || this->active_ != 0) + { + return -1; + } + + // calculate the interval time + long usec = 1000000 / hertz; + + std::cerr << "Starting read_action_generator with hertz of " << hertz << ", interval of " + << usec << std::endl; + + if (this->reactor ()->schedule_timer (this, + 0, + ACE_Time_Value(0), + ACE_Time_Value(3)) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Unable to setup Timer\n"), + -1); + + } + + this->active_ = 1; + return 0; + } + + int + read_action_Generator::stop (void) + { + // return if not valid. + if (this->active_ == 0) + { + return -1; + } + // cancle the timer + this->reactor ()->cancel_timer (this); + this->active_ = 0; + return 0; + } + + int + read_action_Generator::active (void) + { + return this->active_; + } + + int + read_action_Generator::handle_close (ACE_HANDLE handle, + ACE_Reactor_Mask close_mask) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("[%x] handle = %d, close_mask = %d\n"), + this, + handle, + close_mask)); + return 0; + } + + int + read_action_Generator::handle_timeout (const ACE_Time_Value &, + const void *) + { + if (pulse_callback_.read_data ()) + { + this->pulse_callback_.read_one(); + this->pulse_callback_.read_all(); + } + if (pulse_callback_.get_data ()) + { + this->pulse_callback_.get_one (); + this->pulse_callback_.get_all (); + } + return 0; + } + + int + read_action_Generator::svc (void) + { + // define the owner of the reactor thread + this->reactor ()->owner (ACE_OS::thr_self ()); + + // run event loop to wait for event, and then dispatch them to corresponding handlers + this->reactor ()->run_reactor_event_loop (); + + return 0; + } + + //============================================================ + // Facet Executor Implementation Class: ShapeType_RawListener_exec_i + //============================================================ + + ShapeType_RawListener_exec_i::ShapeType_RawListener_exec_i (void) + { + } + + ShapeType_RawListener_exec_i::~ShapeType_RawListener_exec_i (void) + { + } + + // Operations from ::CCM_DDS::ShapeType_RawListener + + void + ShapeType_RawListener_exec_i::on_data ( + const ShapeType & an_instance , + const ::CCM_DDS::ReadInfo & /* info */) + { + CIAO_DEBUG ((LM_DEBUG, ACE_TEXT ("ShapeType_RawListener: ") + ACE_TEXT ("received shape_info for <%s> at %u:%u:%u\n"), + an_instance.color.in (), + an_instance.x, + an_instance.y, + an_instance.shapesize)); + } + //============================================================ + // Facet Executor Implementation Class: PortStatusListener_exec_i + //============================================================ + + PortStatusListener_exec_i::PortStatusListener_exec_i (void) + { + } + + PortStatusListener_exec_i::~PortStatusListener_exec_i (void) + { + } + + // Operations from ::CCM_DDS::PortStatusListener + + void + PortStatusListener_exec_i::on_requested_deadline_missed ( + ::DDS::DataReader_ptr /* the_reader */, + const ::DDS::RequestedDeadlineMissedStatus & /* status */) + { + /* Your code here. */ + } + + void + PortStatusListener_exec_i::on_sample_lost ( + ::DDS::DataReader_ptr /* the_reader */, + const ::DDS::SampleLostStatus & /* status */) + { + + } + + //============================================================ + // Component Executor Implementation Class: Receiver_exec_iShapeType_RawListener_exec_i (); + //============================================================ + + Receiver_exec_i::Receiver_exec_i (void) + : rate_ (0), + get_data_ (true), + read_data_ (true), + raw_listen_ (false) + + { + this->ticker_ = new read_action_Generator (*this); + } + + Receiver_exec_i::~Receiver_exec_i (void) + { + } + + // Supported operations and attributes. + void + Receiver_exec_i::read_one (void) + { + ShapeType shape_info; + shape_info.color = "GREEN"; + ::CCM_DDS::ReadInfo readinfo; + + try + { + this->reader_->read_one (shape_info, readinfo ); + time_t tim = readinfo.timestamp.sec; + tm* time = localtime(&tim); + CIAO_DEBUG ((LM_DEBUG, ACE_TEXT ("READ_ONE Read_Info ") + ACE_TEXT (" -> date = %02d:%02d:%02d.%d\n"), + time->tm_hour, + time->tm_min, + time->tm_sec, + readinfo.timestamp.nanosec)); + CIAO_DEBUG ((LM_DEBUG, ACE_TEXT ("READ ON shape info : ") + ACE_TEXT ("received shape_info for <%s> at %u:%u:%u\n"), + shape_info.color.in (), + shape_info.x, + shape_info.y, + shape_info.shapesize)); + } + catch(CCM_DDS::NonExistent& ) + { + CIAO_ERROR ((LM_ERROR, ACE_TEXT ("ShapeType_Read_One: ") + ACE_TEXT ("no shape_info receieved\n"))); + } + } + + void + Receiver_exec_i::read_all (void) + { + ShapeType_Seq_var shape_infos; + ::CCM_DDS::ReadInfoSeq_var readinfoseq; + this->reader_->read_all(shape_infos.out(), readinfoseq.out()); + for(unsigned int i = 0; i < readinfoseq->length(); ++i) + { + time_t tim = readinfoseq[i].timestamp.sec; + tm* time = localtime(&tim); + CIAO_DEBUG ((LM_DEBUG, ACE_TEXT ("READ_ALL ReadInfo ") + ACE_TEXT ("-> UTC date = %02d:%02d:%02d.%d\n"), + time->tm_hour, + time->tm_min, + time->tm_sec, + readinfoseq[i].timestamp.nanosec)); + } + for(CORBA::ULong i = 0; i < (CORBA::ULong)shape_infos->length(); ++i) + { + CIAO_DEBUG ((LM_DEBUG, ACE_TEXT ("READ_ALL Shape Info : ") + ACE_TEXT ("Number <%d> : received shape_info for <%s> at %u:%u:%u\n"), + i, + shape_infos[i].color.in (), + shape_infos[i].x, + shape_infos[i].y, + shape_infos[i].shapesize)); + } + } + + void + Receiver_exec_i::get_one (void) + { + ShapeType shape_info; + shape_info.color = "yellow"; + ::CCM_DDS::ReadInfo readinfo; + + try + { + if (this->getter_->get_one (shape_info, readinfo )) + { + time_t tim = readinfo.timestamp.sec; + tm* time = localtime(&tim); + CIAO_DEBUG ((LM_DEBUG, ACE_TEXT ("GET_ONE ReadInfo -> ") + ACE_TEXT ("date = %02d:%02d:%02d.%d\n"), + time->tm_hour, + time->tm_min, + time->tm_sec, + readinfo.timestamp.nanosec)); + CIAO_DEBUG ((LM_DEBUG, ACE_TEXT ("GET_ONE ShapeType : ") + ACE_TEXT ("received shape_info for <%s> at %u:%u:%u\n"), + shape_info.color.in (), + shape_info.x, + shape_info.y, + shape_info.shapesize)); + } + else + { + CIAO_DEBUG ((LM_DEBUG, ACE_TEXT ("GET_ONE No data available for <%C>\n"), + shape_info.color.in ())); + } + } + catch(CCM_DDS::NonExistent& ) + { + CIAO_ERROR ((LM_ERROR, ACE_TEXT ("ShapeType_Read_One: no shape_info receieved\n"))); + } + } + + void + Receiver_exec_i::get_all (void) + { + } + // Component attributes. + ::CORBA::ULong + Receiver_exec_i::rate (void) + { + return this->rate_; + } + + void + Receiver_exec_i::rate ( + ::CORBA::ULong rate) + { + this->rate_ = rate; + } + ::CORBA::Boolean + Receiver_exec_i::get_data (void) + { + return this->get_data_; + } + + void + Receiver_exec_i::get_data ( + ::CORBA::Boolean get_data) + { + this->get_data_ = get_data; + } + + ::CORBA::Boolean + Receiver_exec_i::read_data (void) + { + return this->read_data_; + } + + void + Receiver_exec_i::read_data ( + ::CORBA::Boolean read_data) + { + this->read_data_ = read_data; + } + + + ::CORBA::Boolean + Receiver_exec_i::raw_listen (void) + { + return this->raw_listen_; + } + + void + Receiver_exec_i::raw_listen ( + ::CORBA::Boolean raw_listen) + { + this->raw_listen_ = raw_listen; + } + + // Port operations. + + ::CCM_DDS::CCM_ShapeType_RawListener_ptr + Receiver_exec_i::get_info_out_listener (void) + { + CIAO_DEBUG ((LM_DEBUG, ACE_TEXT ("new ShapeType RAW listener\n"))); + return new ShapeType_RawListener_exec_i (); + } + + ::CCM_DDS::CCM_PortStatusListener_ptr + Receiver_exec_i::get_info_out_status (void) + { + CIAO_DEBUG ((LM_DEBUG, ACE_TEXT ("new PortStatuslistener\n"))); + return new PortStatusListener_exec_i (); + } + + // Operations from Components::SessionComponent. + + void + Receiver_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + this->context_ = + ::Shapes::CCM_Receiver_Context::_narrow (ctx); + if ( ::CORBA::is_nil (this->context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + Receiver_exec_i::configuration_complete (void) + { + if (this->read_data ()) + { + this->reader_ = this->context_->get_connection_info_out_data(); + } + if (this->get_data ()) + { + this->getter_ = this->context_->get_connection_info_get_out_data(); + } + } + + void + Receiver_exec_i::ccm_activate (void) + { + ::CCM_DDS::ListenerControl_var lc = + this->context_->get_connection_info_out_control (); + + if (CORBA::is_nil (lc.in ())) + { + CIAO_ERROR ((LM_INFO, ACE_TEXT ("Error: Listener control receptacle is null!\n"))); + throw CORBA::INTERNAL (); + } + lc->enabled (this->raw_listen_); + + this->ticker_->start (this->rate_); + } + + void + Receiver_exec_i::ccm_passivate (void) + { + this->ticker_->stop (); + } + + void + Receiver_exec_i::ccm_remove (void) + { + this->ticker_->close_h (); + } + + extern "C" RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_Shapes_Receiver_Impl (void) + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_NORETURN ( + retval, + Receiver_exec_i); + + return retval; + } +} + diff --git a/CIAO/connectors/dds4ccm/examples/Shapes/Receiver/Receiver_exec.h b/CIAO/connectors/dds4ccm/examples/Shapes/Receiver/Receiver_exec.h new file mode 100644 index 00000000000..59717a85b06 --- /dev/null +++ b/CIAO/connectors/dds4ccm/examples/Shapes/Receiver/Receiver_exec.h @@ -0,0 +1,226 @@ +// -*- C++ -*- +// +// $Id$ + +/** + * Code generated by the The ACE ORB (TAO) IDL Compiler v1.7.3 + * TAO and the TAO IDL Compiler have been developed by: + * Center for Distributed Object Computing + * Washington University + * St. Louis, MO + * USA + * http://www.cs.wustl.edu/~schmidt/doc-center.html + * and + * Distributed Object Computing Laboratory + * University of California at Irvine + * Irvine, CA + * USA + * http://doc.ece.uci.edu/ + * and + * Institute for Software Integrated Systems + * Vanderbilt University + * Nashville, TN + * USA + * http://www.isis.vanderbilt.edu/ + * + * Information about TAO is available at: + * http://www.cs.wustl.edu/~schmidt/TAO.html + **/ + +// TAO_IDL - Generated from +// be/be_codegen.cpp:1217 + +#ifndef CIAO_RECEIVER_EXEC_H_ +#define CIAO_RECEIVER_EXEC_H_ + + +#include "ReceiverEC.h" + +#include /**/ "Receiver_exec_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/LocalObject.h" +#include "ace/Task.h" +#include "ace/Reactor.h" + +namespace CIAO_Shapes_Receiver_Impl +{ + class Receiver_exec_i; + /** + * @class reader activity generator + * + * @brief an active object used by Receiver to perform a periodical read action + * + */ + class read_action_Generator : public ACE_Task_Base + { + public: + read_action_Generator (Receiver_exec_i &callback); + + ~read_action_Generator (); + + /// Hook method that performs application-defined initialization activities + int open_h (void); + + /// Hook method that performs application-defined destruction activites + int close_h (void); + + /// appliation-defined method for starting the pulse-generation service + int start (CORBA::ULong hertz); + + /// application-defined method for stopping the pulse-generation service + int stop (void); + + /// Indicate whether the current object is active + int active (void); + + /// Handle the timeout. + virtual int handle_timeout (const ACE_Time_Value &tv, + const void *arg); + + /// Called when timer handler is removed. + virtual int handle_close (ACE_HANDLE handle, + ACE_Reactor_Mask close_mask); + + /// Hook methods implemnting the task's service processing, + /// invoked by all threads activated by activate () method + virtual int svc (void); + + private: + /// Tracking whether we are actively generating pulse or not. + int active_; + + /// Maintains a handle that actually process the event + Receiver_exec_i &pulse_callback_; + + }; + + class RECEIVER_EXEC_Export ShapeType_RawListener_exec_i + : public virtual ::CCM_DDS::CCM_ShapeType_RawListener, + public virtual ::CORBA::LocalObject + { + public: + ShapeType_RawListener_exec_i (void); + virtual ~ShapeType_RawListener_exec_i (void); + + // Operations and attributes from ::CCM_DDS::ShapeType_RawListener + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual void + on_data ( + const ShapeType & an_instance, + const ::CCM_DDS::ReadInfo & info); + }; + + class RECEIVER_EXEC_Export PortStatusListener_exec_i + : public virtual ::CCM_DDS::CCM_PortStatusListener, + public virtual ::CORBA::LocalObject + { + public: + PortStatusListener_exec_i (void); + virtual ~PortStatusListener_exec_i (void); + + // Operations and attributes from ::CCM_DDS::PortStatusListener + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual void + on_requested_deadline_missed ( + ::DDS::DataReader_ptr the_reader, + const ::DDS::RequestedDeadlineMissedStatus & status); + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual void + on_sample_lost ( + ::DDS::DataReader_ptr the_reader, + const ::DDS::SampleLostStatus & status); + }; + + class RECEIVER_EXEC_Export Receiver_exec_i + : public virtual Receiver_Exec, + public virtual ::CORBA::LocalObject + { + public: + Receiver_exec_i (void); + virtual ~Receiver_exec_i (void); + + // Supported operations and attributes. + void read_one (void); + void read_all (void); + void get_one (void); + void get_all (void); + + // Component attributes. + virtual ::CORBA::ULong + rate (void); + + virtual void + rate ( + ::CORBA::ULong rate); + + virtual ::CORBA::Boolean + get_data (void); + + virtual void + get_data ( + ::CORBA::Boolean get_data); + + virtual ::CORBA::Boolean + read_data (void); + + virtual void + read_data ( + ::CORBA::Boolean read_data); + + virtual ::CORBA::Boolean + raw_listen (void); + + virtual void + raw_listen ( + ::CORBA::Boolean raw_listen); + // Port operations. + + + + virtual ::CCM_DDS::CCM_ShapeType_RawListener_ptr + get_info_out_listener (void); + + virtual ::CCM_DDS::CCM_PortStatusListener_ptr + get_info_out_status (void); + + // Operations from Components::SessionComponent. + + virtual void + set_session_context ( + ::Components::SessionContext_ptr ctx); + + virtual void configuration_complete (void); + + virtual void ccm_activate (void); + virtual void ccm_passivate (void); + virtual void ccm_remove (void); + + private: + ::Shapes::CCM_Receiver_Context_var context_; + ::CCM_DDS::ShapeType_Reader_var reader_; + ::CCM_DDS::ShapeType_Getter_var getter_; + + read_action_Generator * ticker_; + CORBA::ULong rate_; + CORBA::Boolean get_data_, read_data_, raw_listen_; + }; + + extern "C" RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_Shape_Receiver_Impl (void); +} + +#endif /* ifndef */ + diff --git a/CIAO/connectors/dds4ccm/examples/Shapes/Sender/Sender.idl3 b/CIAO/connectors/dds4ccm/examples/Shapes/Sender/Sender.idl3 new file mode 100644 index 00000000000..a3400769f9a --- /dev/null +++ b/CIAO/connectors/dds4ccm/examples/Shapes/Sender/Sender.idl3 @@ -0,0 +1,35 @@ +// $Id$ + +/** + * @file + * @author Marcel Smit <msmit@remedy.nl> + * + * by-hand idl3 translation of sender components. + */ + +#ifndef DDS_SENDER_IDL3 +#define DDS_SENDER_IDL3 + +#include "Connector/Shapes_Connector.idl3" +#include "Connector/Shapes_ConnectorE.idl" + +module Shapes +{ + interface Trigger + { + void start (); + void stop (); + }; + + component Sender supports Trigger + { + uses CCM_DDS::ShapeType_Updater info_update_data; + attribute unsigned long rate; + attribute unsigned short max_x; + attribute unsigned short max_y; + attribute unsigned short max_size; + attribute boolean resize_shape; + }; +}; + +#endif diff --git a/CIAO/connectors/dds4ccm/examples/Shapes/Sender/Sender.idl3p b/CIAO/connectors/dds4ccm/examples/Shapes/Sender/Sender.idl3p new file mode 100644 index 00000000000..07a9bf5c184 --- /dev/null +++ b/CIAO/connectors/dds4ccm/examples/Shapes/Sender/Sender.idl3p @@ -0,0 +1,19 @@ +// $Id$ + +/** + * @file + * @author Marcel Smit <msmit@remedy.nl> + */ + +#ifndef DDS_SENDER_IDL3P +#define DDS_SENDER_IDL3P + +module Shapes +{ + component Sender + { + port CCM_DDS::DDS_Write <Shape_Info> info; + }; +}; + +#endif /* DDS_SENDER_IDL3P */ diff --git a/CIAO/connectors/dds4ccm/examples/Shapes/Sender/Sender.mpc b/CIAO/connectors/dds4ccm/examples/Shapes/Sender/Sender.mpc new file mode 100644 index 00000000000..2bcf005711c --- /dev/null +++ b/CIAO/connectors/dds4ccm/examples/Shapes/Sender/Sender.mpc @@ -0,0 +1,138 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p DDS_Shapes_Base -l ../lib -o ../lib -c controller -u DDS Sender" + +project(DDS_Sender_idl_gen) : connectoridldefaults, componentidldefaults { + after += DDS_Shapes_Connector_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=SENDER_STUB_Export \ + -Wb,stub_export_include=Sender_stub_export.h \ + -Wb,skel_export_macro=SENDER_SVNT_Export \ + -Wb,skel_export_include=Sender_svnt_export.h \ + -Wb,exec_export_macro=SENDER_EXEC_Export \ + -Wb,exec_export_include=Sender_exec_export.h \ + -I .. + + IDL_Files { + Sender.idl3 + } +} + +project(DDS_Sender_lem_gen) : connectoridldefaults { + after += DDS_Sender_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=SENDER_LEM_STUB_Export \ + -Wb,stub_export_include=Sender_lem_stub_export.h \ + -SS -Gxhst -I $CIAO_ROOT/connectors -I .. + + IDL_Files { + SenderE.idl + } +} + +project(DDS_Sender_lem_stub) : ccm_svnt, dds4ccm_base { + after += DDS_Sender_lem_gen DDS_Sender_stub DDS_Shapes_Base_stub + libs += DDS_Shapes_Base_stub Sender_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = Sender_lem_stub + dynamicflags = SENDER_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SenderEC.cpp + } + + Header_Files { + SenderEC.h + Sender_lem_stub_export.h + } + + Inline_Files { + SenderEC.inl + } +} + +project(DDS_Sender_stub) : ccm_stub, dds4ccm_base { + after += DDS_Sender_idl_gen DDS_Shapes_Base_stub DDS_Shapes_Connector_stub + libs += DDS_Shapes_Base_stub DDS_Shapes_Connector_stub + includes += .. + libpaths += ../lib + libout = ../lib + sharedname = Sender_stub + dynamicflags = SENDER_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SenderC.cpp + } + + Header_Files { + SenderC.h + Sender_stub_export.h + } + + Inline_Files { + SenderC.inl + } +} + +project(DDS_Sender_exec) : ciao_executor, dds4ccm_base { + after += DDS_Sender_lem_stub DDS_Sender_stub DDS_Shapes_Connector_lem_stub DDS_Shapes_Connector_stub + sharedname = Sender_exec + libs += Sender_stub Sender_lem_stub DDS_Shapes_Base_stub DDS_Shapes_Connector_lem_stub DDS_Shapes_Connector_stub + libpaths += ../lib + includes += .. + libout = ../lib + dynamicflags = SENDER_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Sender_exec.cpp + } + + Header_Files { + Sender_exec.h + Sender_exec_export.h + } + + Inline_Files { + } +} + + +project(DDS_Sender_svnt) : ciao_servant, dds4ccm_base, nddslib { + after += DDS_Shapes_Base_stub DDS_Sender_lem_stub DDS4CCM_lem_stub DDS4CCM_skel DDS_Shapes_Connector_stub DDS_Shapes_Connector_svnt DDS_Shapes_Connector_lem_stub + sharedname = Sender_svnt + libs += Sender_stub Sender_lem_stub \ + DDS_Shapes_Base_stub DDS4CCM_lem_stub DDS4CCM_skel DDS_Shapes_Connector_stub DDS_Shapes_Connector_svnt DDS_Shapes_Connector_lem_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags = SENDER_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SenderS.cpp + Sender_svnt.cpp + } + + Header_Files { + SenderS.h + Sender_svnt.h + Sender_svnt_export.h + } + + Inline_Files { + SenderS.inl + } +} + diff --git a/CIAO/connectors/dds4ccm/examples/Shapes/Sender/Sender_exec.cpp b/CIAO/connectors/dds4ccm/examples/Shapes/Sender/Sender_exec.cpp new file mode 100644 index 00000000000..37ba67648a8 --- /dev/null +++ b/CIAO/connectors/dds4ccm/examples/Shapes/Sender/Sender_exec.cpp @@ -0,0 +1,396 @@ +// -*- C++ -*- +// +// $Id$ + +/** + * Code generated by the The ACE ORB (TAO) IDL Compiler v1.7.3 + * TAO and the TAO IDL Compiler have been developed by: + * Center for Distributed Object Computing + * Washington University + * St. Louis, MO + * USA + * http://www.cs.wustl.edu/~schmidt/doc-center.html + * and + * Distributed Object Computing Laboratory + * University of California at Irvine + * Irvine, CA + * USA + * http://doc.ece.uci.edu/ + * and + * Institute for Software Integrated Systems + * Vanderbilt University + * Nashville, TN + * USA + * http://www.isis.vanderbilt.edu/ + * + * Information about TAO is available at: + * http://www.cs.wustl.edu/~schmidt/TAO.html + **/ + +// TAO_IDL - Generated from +// be/be_codegen.cpp:1278 + +#include "Sender_exec.h" +#include "ciao/CIAO_common.h" +#include "ace/Guard_T.h" + +namespace CIAO_Shapes_Sender_Impl +{ + //============================================================ + // Pulse generator + //============================================================ + + pulse_Generator::pulse_Generator (Sender_exec_i &callback) + : active_ (0), + pulse_callback_ (callback) + { + // initialize the reactor + this->reactor (ACE_Reactor::instance ()); + } + + pulse_Generator::~pulse_Generator () + { + } + + int + pulse_Generator::open_h () + { + // convert the task into a active object that runs in separate thread + return this->activate (); + } + + int + pulse_Generator::close_h () + { + this->reactor ()->end_reactor_event_loop (); + + // wait for all threads in the task to exit before it returns + return this->wait (); + } + + int + pulse_Generator::start (CORBA::ULong hertz) + { + // return if not valid + if (hertz == 0 || this->active_ != 0) + { + return -1; + } + + // calculate the interval time + long usec = 1000000 / hertz; + + std::cerr << "Starting pulse_generator with hertz of " << hertz << ", interval of " + << usec << std::endl; + + if (this->reactor ()->schedule_timer (this, + 0, + ACE_Time_Value (0, usec), + ACE_Time_Value (0, usec)) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Unable to setup Timer\n"), + -1); + + } + + this->active_ = 1; + return 0; + } + + int + pulse_Generator::stop (void) + { + // return if not valid. + if (this->active_ == 0) + { + return -1; + } + // cancle the timer + this->reactor ()->cancel_timer (this); + this->active_ = 0; + return 0; + } + + int + pulse_Generator::active (void) + { + return this->active_; + } + + int + pulse_Generator::handle_close (ACE_HANDLE handle, + ACE_Reactor_Mask close_mask) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("[%x] handle = %d, close_mask = %d\n"), + this, + handle, + close_mask)); + return 0; + } + + int + pulse_Generator::handle_timeout (const ACE_Time_Value &, + const void *) + { + // Notify the subscribers + this->pulse_callback_.tick (); + return 0; + } + + int + pulse_Generator::svc (void) + { + // define the owner of the reactor thread + this->reactor ()->owner (ACE_OS::thr_self ()); + + // run event loop to wait for event, and then dispatch them to corresponding handlers + this->reactor ()->run_reactor_event_loop (); + + return 0; + } + + //============================================================ + // Component Executor Implementation Class: Sender_exec_i + //============================================================ + + Sender_exec_i::Sender_exec_i (void) + : rate_ (1), + max_x_ (100), + max_y_ (100), + max_size_ (25), + resize_ (false), + x_increasing_ (false), + y_increasing_ (false), + size_increasing_ (false) + { + square_ = new ShapeType; + this->ticker_ = new pulse_Generator (*this); + } + + Sender_exec_i::~Sender_exec_i (void) + { + } + + // Supported operations and attributes. + + void + Sender_exec_i::tick () + { + if (this->x_increasing_) + { + ++square_->x; + this->x_increasing_ = square_->x + 1 <= this->max_x_; + } + else + { + --square_->x; + this->x_increasing_ = square_->x - 1 < 0; + } + if (this->y_increasing_) + { + ++square_->y; + this->y_increasing_ = square_->y + 1 <= this->max_y_; + } + else + { + --square_->y; + this->y_increasing_ = square_->y - 1 < 0; + } + if (resize_shape ()) + { + if (this->size_increasing_) + { + ++square_->shapesize; + this->size_increasing_ = square_->shapesize + 1 <= this->max_size_; + } + else + { + --square_->shapesize; + this->size_increasing_ = square_->shapesize - 1 < 0; + } + } + try + { + this->updater_->update (*square_); + CIAO_DEBUG ((LM_DEBUG, ACE_TEXT ("UPDATED Shape_info for <%s> %u:%u:%u\n"), + square_->color.in (), + square_->x, + square_->y, + square_->shapesize)); + } + catch (CCM_DDS::NonExistent& ) + { + CIAO_ERROR ((LM_ERROR, ACE_TEXT ("Shape_info for <%s> not updated: <%s> didn't exist.\n"), + square_->color.in (), square_->color.in ())); + } + catch (CCM_DDS::InternalError& ) + { + CIAO_ERROR ((LM_ERROR, ACE_TEXT ("Internal Error while updating Shape_info for <%s>.\n"), + square_->color.in ())); + } + } + + void + Sender_exec_i::start (void) + { + this->ticker_->start (this->rate_); + } + + void + Sender_exec_i::stop (void) + { + this->ticker_->stop (); + } + + // Component attributes. + + ::CORBA::ULong + Sender_exec_i::rate (void) + { + return this->rate_; + } + + void + Sender_exec_i::rate ( + ::CORBA::ULong rate) + { + this->rate_ = rate; + } + + + ::CORBA::UShort + Sender_exec_i::max_x (void) + { + return this->max_x_; + } + + void + Sender_exec_i::max_x ( + ::CORBA::UShort max_x) + { + this->max_x_ = max_x; + } + + ::CORBA::UShort + Sender_exec_i::max_y (void) + { + return this->max_y_; + } + + void + Sender_exec_i::max_y ( + ::CORBA::UShort max_y) + { + this->max_y_ = max_y; + } + + ::CORBA::UShort + Sender_exec_i::max_size (void) + { + return this->max_size_; + } + + void + Sender_exec_i::max_size ( + ::CORBA::UShort max_size) + { + this->max_size_ = max_size; + } + + void + Sender_exec_i::resize_shape ( + ::CORBA::Boolean resize) + { + this->resize_ = resize; + } + + ::CORBA::Boolean + Sender_exec_i::resize_shape () + { + return this->resize_; + } + + // Port operations. + + // Operations from Components::SessionComponent. + + void + Sender_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + this->context_ = + ::Shapes::CCM_Sender_Context::_narrow (ctx); + + if ( ::CORBA::is_nil (this->context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + Sender_exec_i::configuration_complete (void) + { + /* Your code here. */ + this->updater_ = this->context_->get_connection_info_update_data (); + this->ticker_->activate (); + } + + void + Sender_exec_i::ccm_activate (void) + { + this->start (); + square_->x = ACE_OS::rand () % this->max_x_; + square_->y = ACE_OS::rand () % this->max_y_; + square_->shapesize = max_size_; + square_->color = CORBA::string_dup("GREEN"); + + //Register shape with dds. + CIAO_DEBUG ((LM_DEBUG, ACE_TEXT ("REGISTER Shape_info for <%s> %u:%u:%u\n"), + square_->color.in (), + square_->x, + square_->y, + square_->shapesize)); + try + { + this->updater_->create (*square_); + } + catch (CCM_DDS::AlreadyCreated& ) + { + CIAO_ERROR ((LM_ERROR, ACE_TEXT ("Shape_info for <%s> already created.\n"), + square_->color.in ())); + } + catch (CCM_DDS::InternalError& ) + { + CIAO_ERROR ((LM_ERROR, ACE_TEXT ("Internal Error while creating Shape_info for <%s>.\n"), + square_->color.in ())); + } + } + + void + Sender_exec_i::ccm_passivate (void) + { + /* Your code here. */ + } + + void + Sender_exec_i::ccm_remove (void) + { + /* Your code here. */ + } + + extern "C" SENDER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_Shape_Sender_Impl (void) + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_NORETURN ( + retval, + Sender_exec_i); + + return retval; + } +} + diff --git a/CIAO/connectors/dds4ccm/examples/Shapes/Sender/Sender_exec.h b/CIAO/connectors/dds4ccm/examples/Shapes/Sender/Sender_exec.h new file mode 100644 index 00000000000..b8096ebb4ac --- /dev/null +++ b/CIAO/connectors/dds4ccm/examples/Shapes/Sender/Sender_exec.h @@ -0,0 +1,199 @@ +// -*- C++ -*- +// +// $Id$ + +/** + * Code generated by the The ACE ORB (TAO) IDL Compiler v1.7.3 + * TAO and the TAO IDL Compiler have been developed by: + * Center for Distributed Object Computing + * Washington University + * St. Louis, MO + * USA + * http://www.cs.wustl.edu/~schmidt/doc-center.html + * and + * Distributed Object Computing Laboratory + * University of California at Irvine + * Irvine, CA + * USA + * http://doc.ece.uci.edu/ + * and + * Institute for Software Integrated Systems + * Vanderbilt University + * Nashville, TN + * USA + * http://www.isis.vanderbilt.edu/ + * + * Information about TAO is available at: + * http://www.cs.wustl.edu/~schmidt/TAO.html + **/ + +// TAO_IDL - Generated from +// be/be_codegen.cpp:1217 + +#ifndef CIAO_SENDER_EXEC_H_ +#define CIAO_SENDER_EXEC_H_ + + +#include "SenderEC.h" + +#include /**/ "Sender_exec_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/LocalObject.h" +#include "ace/Task.h" +#include "ace/Reactor.h" + +#include <map> + +namespace CIAO_Shapes_Sender_Impl +{ + class Sender_exec_i; + + class pulse_Generator : public ACE_Task_Base + { + public: + pulse_Generator (Sender_exec_i &callback); + + ~pulse_Generator (); + + /// Hook method that performs application-defined initialization activities + int open_h (void); + + /// Hook method that performs application-defined destruction activites + int close_h (void); + + /// appliation-defined method for starting the pulse-generation service + int start (CORBA::ULong hertz); + + /// application-defined method for stopping the pulse-generation service + int stop (void); + + /// Indicate whether the current object is active + int active (void); + + /// Handle the timeout. + virtual int handle_timeout (const ACE_Time_Value &tv, + const void *arg); + + /// Called when timer handler is removed. + virtual int handle_close (ACE_HANDLE handle, + ACE_Reactor_Mask close_mask); + + /// Hook methods implemnting the task's service processing, + /// invoked by all threads activated by activate () method + virtual int svc (void); + + private: + /// Tracking whether we are actively generating pulse or not. + int active_; + + /// Maintains a handle that actually process the event + Sender_exec_i &pulse_callback_; + + }; + + class Sender_exec_i + : public virtual Sender_Exec, + public virtual ::CORBA::LocalObject + { + public: + Sender_exec_i (void); + virtual ~Sender_exec_i (void); + + // Supported operations and attributes. + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual void + start (void); + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual void + stop (void); + + void tick (); + + // Component attributes. + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual ::CORBA::ULong + rate (void); + + virtual void + rate ( + ::CORBA::ULong rate); + + virtual ::CORBA::UShort + max_x (void); + + virtual void + max_x ( + ::CORBA::UShort max_x); + + virtual ::CORBA::UShort + max_y (void); + + virtual void + max_y ( + ::CORBA::UShort max_y); + + virtual ::CORBA::UShort + max_size (void); + + virtual void + max_size ( + ::CORBA::UShort max_size); + + virtual void + resize_shape ( + ::CORBA::Boolean resize); + + virtual ::CORBA::Boolean + resize_shape (void); + + // Port operations. + + // Operations from Components::SessionComponent. + + virtual void + set_session_context ( + ::Components::SessionContext_ptr ctx); + + virtual void configuration_complete (void); + + virtual void ccm_activate (void); + virtual void ccm_passivate (void); + virtual void ccm_remove (void); + + private: + CCM_DDS::ShapeType_Updater_var updater_; + + pulse_Generator * ticker_; + ::Shapes::CCM_Sender_Context_var context_; + CORBA::ULong rate_; + CORBA::UShort max_x_; + CORBA::UShort max_y_; + CORBA::UShort max_size_; + CORBA::Boolean resize_; + + bool x_increasing_; + bool y_increasing_; + bool size_increasing_; + + ShapeType* square_; + }; + + extern "C" SENDER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_Shape_Sender_Impl (void); +} + +#endif /* ifndef */ + diff --git a/CIAO/connectors/dds4ccm/examples/Shapes/descriptors/Plan.cdp b/CIAO/connectors/dds4ccm/examples/Shapes/descriptors/Plan.cdp new file mode 100644 index 00000000000..f6ea5c1b67e --- /dev/null +++ b/CIAO/connectors/dds4ccm/examples/Shapes/descriptors/Plan.cdp @@ -0,0 +1,459 @@ +<Deployment:DeploymentPlan + xmlns:Deployment="http://www.omg.org/Deployment" + xmlns:xmi="http://www.omg.org/XMI" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.omg.org/Deployment Deployment.xsd"> + <label>Shapes_Depl_1</label> + <UUID>Shapes_Depl_1</UUID> + + <implementation xmi:id="ReceiverComponentImplementation"> + <name>ReceiverComponentImplementation</name> + <source/> + <artifact xmi:idref="Receiver_ExecArtifact" /> + <artifact xmi:idref="Receiver_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see 10.6.1) --> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Shapes_Receiver_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Shapes_Receiver_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Receiver_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Receiver_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="Shapes_ConnectorComponentImplementation"> + <name>Shapes_ConnectorComponentImplementation</name> + <source/> + <artifact xmi:idref="Shapes_Connector_ExecArtifact" /> + <artifact xmi:idref="Shapes_Connector_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see 10.6.1) --> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Shapes_Shapes_Connector_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Shapes_Shapes_Connector_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Shapes_Connector_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Shapes_Connector_exec</string> + </value> + </value> + </execParameter> + </implementation> + <implementation xmi:id="SenderComponentImplementation"> + <name>SenderComponentImplementation</name> + <source/> + <artifact xmi:idref="Sender_ExecArtifact" /> + <artifact xmi:idref="Sender_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see 10.6.1) --> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Shape_Sender_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Shapes_Sender_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Sender_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Sender_exec</string> + </value> + </value> + </execParameter> + </implementation> + <instance xmi:id="ReceiverComponentInstance"> + <name>ReceiverComponent</name> + <node>ReceiverNode</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="ReceiverComponentImplementation" /> + <configProperty> + <name>rate</name> + <value> + <type> + <kind>tk_long</kind> + </type> + <value> + <long>1</long> + </value> + </value> + </configProperty> + <configProperty> + <name>get_data</name> + <value> + <type> + <kind>tk_boolean</kind> + </type> + <value> + <boolean>false</boolean> + </value> + </value> + </configProperty> + <configProperty> + <name>read_data</name> + <value> + <type> + <kind>tk_boolean</kind> + </type> + <value> + <boolean>false</boolean> + </value> + </value> + </configProperty> + <configProperty> + <name>raw_listen</name> + <value> + <type> + <kind>tk_boolean</kind> + </type> + <value> + <boolean>true</boolean> + </value> + </value> + </configProperty> + </instance> + <instance xmi:id="Shapes_ConnectorComponentInstance"> + <name>Shapes_ConnectorComponent</name> + <node>SenderNode</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="Shapes_ConnectorComponentImplementation" /> + <configProperty> + <name>topic_name</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Square</string> + </value> + </value> + </configProperty> + </instance> + <instance xmi:id="Shapes_ConnectorComponentInstance2"> + <name>Shapes_ConnectorComponent2</name> + <node>ReceiverNode</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="Shapes_ConnectorComponentImplementation" /> + <configProperty> + <name>topic_name</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Square</string> + </value> + </value> + </configProperty> + </instance> + <instance xmi:id="SenderComponentInstance"> + <name>SenderComponent</name> + <node>SenderNode</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SenderComponentImplementation" /> + <configProperty> + <name>rate</name> + <value> + <type> + <kind>tk_long</kind> + </type> + <value> + <long>10</long> + </value> + </value> + </configProperty> + <configProperty> + <name>max_x</name> + <value> + <type> + <kind>tk_short</kind> + </type> + <value> + <short>225</short> + </value> + </value> + </configProperty> + <configProperty> + <name>max_y</name> + <value> + <type> + <kind>tk_short</kind> + </type> + <value> + <short>250</short> + </value> + </value> + </configProperty> + <configProperty> + <name>max_size</name> + <value> + <type> + <kind>tk_short</kind> + </type> + <value> + <short>25</short> + </value> + </value> + </configProperty> + <configProperty> + <name>resize_shape</name> + <value> + <type> + <kind>tk_boolean</kind> + </type> + <value> + <boolean>true</boolean> + </value> + </value> + </configProperty> + </instance> + + <connection> + <name>info_out_data</name> + <internalEndpoint> + <portName>info_out_data</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="ReceiverComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>info_out_data</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="Shapes_ConnectorComponentInstance2" /> + </internalEndpoint> + </connection> + <connection> + <name>_listenercontrol</name> + <internalEndpoint> + <portName>info_out_control</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="ReceiverComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>info_out_control</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="Shapes_ConnectorComponentInstance2" /> + </internalEndpoint> + </connection> + <connection> + <name>_portstatuslistener</name> + <internalEndpoint> + <portName>info_out_status</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="ReceiverComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>info_out_status</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="Shapes_ConnectorComponentInstance2" /> + </internalEndpoint> + </connection> + <connection> + <name>_rawlistner</name> + <internalEndpoint> + <portName>info_out_listener</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="ReceiverComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>info_out_listener</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="Shapes_ConnectorComponentInstance2" /> + </internalEndpoint> + </connection> + <connection> + <name>info_get_out_data</name> + <internalEndpoint> + <portName>info_get_out_data</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="ReceiverComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>info_get_out_data</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="Shapes_ConnectorComponentInstance2" /> + </internalEndpoint> + </connection> + + <connection> + <name>updater_connection</name> + <internalEndpoint> + <portName>info_update_data</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="SenderComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>info_update_data</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="Shapes_ConnectorComponentInstance" /> + </internalEndpoint> + </connection> + + <artifact xmi:id="Sender_ExecArtifact"> + <name>Sender_exec</name> + <source/> + <node/> + <location>Sender_exec</location> + </artifact> + <artifact xmi:id="Sender_SvntArtifact"> + <name>Sender_svnt</name> + <source/> + <node/> + <location>Sender_svnt</location> + </artifact> + <artifact xmi:id="Sender_StubArtifact"> + <name>Sender_stub</name> + <source/> + <node/> + <location>Sender_stub</location> + </artifact> + <artifact xmi:id="Shapes_Connector_ExecArtifact"> + <name>Shapes_Connector_exec</name> + <source/> + <node/> + <location>DDS_Shapes_Connector_exec</location> + </artifact> + <artifact xmi:id="Shapes_Connector_SvntArtifact"> + <name>Shapes_Connector_svnt</name> + <source/> + <node/> + <location>DDS_Shapes_Connector_svnt</location> + </artifact> + <artifact xmi:id="Shapes_Connector_StubArtifact"> + <name>Shapes_Connector_stub</name> + <source/> + <node/> + <location>DDS_Shapes_Connector_stub</location> + </artifact> + <artifact xmi:id="Receiver_ExecArtifact"> + <name>Receiver_exec</name> + <source/> + <node/> + <location>Receiver_exec</location> + </artifact> + <artifact xmi:id="Receiver_SvntArtifact"> + <name>Receiver_svnt</name> + <source/> + <node/> + <location>Receiver_svnt</location> + </artifact> + <artifact xmi:id="Receiver_StubArtifact"> + <name>Receiver_stub</name> + <source/> + <node/> + <location>Receiver_stub</location> + </artifact> +</Deployment:DeploymentPlan> diff --git a/CIAO/connectors/dds4ccm/examples/Shapes/descriptors/USER_QOS_PROFILES.xml b/CIAO/connectors/dds4ccm/examples/Shapes/descriptors/USER_QOS_PROFILES.xml new file mode 100644 index 00000000000..05eac617c37 --- /dev/null +++ b/CIAO/connectors/dds4ccm/examples/Shapes/descriptors/USER_QOS_PROFILES.xml @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + +Description +XML QoS Profile + +The QoS configuration of the DDS entities in the generated example is +loaded from this file. + +This file is used only when it is in the current working directory +or when the enviroment variable +NDDS_QOS_PROFILES is defined and points to this file. + +For more information about XML QoS Profiles see Chapter 15 in the +RTI Data Distribution Service user manual. +--> +<dds xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="c:/ndds/ndds.4.4d/scripts/../resource/rtiddsgen/../qos_profiles_4.4d/schema/rti_dds_qos_profiles.xsd" version="4.4d"> + <!-- QoS Library containing the QoS profile used in the generated example. + + A QoS library is a named set of QoS profiles. + --> + <qos_library name="HelloMsg_Library"> + <!-- QoS profile used to configure reliable communication between the DataWriter + and DataReader created in the example code. + + A QoS profile groups a set of related QoS. + --> + <qos_profile name="HelloMsg_Profile" is_default_qos="true"> + <!-- QoS used to configure the data writer created in the example code --> + <datawriter_qos> + <reliability> + <kind>RELIABLE_RELIABILITY_QOS</kind> + <max_blocking_time> + <sec>10</sec> + <nanosec>0</nanosec> + </max_blocking_time> + </reliability> + <durability> + <kind>TRANSIENT_DURABILITY_QOS</kind> + </durability> + <history> + <kind>KEEP_LAST_HISTORY_QOS</kind> + <depth>20</depth> + </history> + <protocol> + <rtps_reliable_writer> + <max_heartbeat_retries>10</max_heartbeat_retries> + </rtps_reliable_writer> + </protocol> + </datawriter_qos> + <!-- QoS used to configure the data reader created in the example code --> + <datareader_qos> + <reliability> + <kind>RELIABLE_RELIABILITY_QOS</kind> + </reliability> + <history> + <kind>KEEP_LAST_HISTORY_QOS</kind> + <depth>20</depth> + </history> + <durability> + <kind>TRANSIENT_LOCAL_DURABILITY_QOS</kind> + </durability> + </datareader_qos> + </qos_profile> + </qos_library> +</dds>
\ No newline at end of file diff --git a/CIAO/connectors/dds4ccm/examples/Shapes/descriptors/run_test.pl b/CIAO/connectors/dds4ccm/examples/Shapes/descriptors/run_test.pl new file mode 100755 index 00000000000..5a45cf23637 --- /dev/null +++ b/CIAO/connectors/dds4ccm/examples/Shapes/descriptors/run_test.pl @@ -0,0 +1,189 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{'ACE_ROOT'}/bin"; +use PerlACE::Run_Test; + +$CIAO_ROOT = "$ENV{'CIAO_ROOT'}"; +$TAO_ROOT = "$ENV{'TAO_ROOT'}"; +$DAnCE = "$ENV{'DANCE_ROOT'}"; + +$daemons_running = 0; +$em_running = 0; +$ns_running = 0; + +$daemons = 2; +@ports = ( 60001, 60002 ); +@iorfiles = ( "NodeApp1.ior", "NodeApp2.ior" ); +@nodenames = ( "SenderNode", "ReceiverNode" ); + +$status = 0; +$cdp_file = "Plan.cdp"; + +$nsior = PerlACE::LocalFile ("ns.ior"); + +PerlACE::add_lib_path ('../lib'); + +unlink $nsior; + +$E = 0; +$EM = 0; + +# Delete if there are any .ior files. +sub delete_ior_files { + for ($i = 0; $i < $daemons; ++$i) { + unlink $iorfiles[$i]; + } + unlink PerlACE::LocalFile ("EM.ior"); + unlink PerlACE::LocalFile ("DAM.ior"); + unlink PerlACE::LocalFile ("ns.ior"); +} + +sub kill_node_daemons { + for ($i = 0; $i < $daemons; ++$i) { + $Daemons[$i]->Kill (); $Daemons[$i]->TimedWait (1); + } +} + +sub kill_open_processes { + if ($daemons_running == 1) { + kill_node_daemons (); + } + + if ($em_running == 1) { + $EM->Kill (); + $EM->TimedWait (1); + } + + if ($ns_running == 1) { + $NS->Kill (); + $NS->TimedWait (1); + } + +} + +sub run_node_daemons { + for ($i = 0; $i < $daemons; ++$i) + { + $iorfile = $iorfiles[$i]; + $port = $ports[$i]; + $nodename = $nodenames[$i]; + $iiop = "iiop://localhost:$port"; + $node_app = "$CIAO_ROOT/bin/ciao_componentserver"; + + $d_cmd = "$DAnCE/bin/dance_node_manager"; + $d_param = "-ORBEndpoint $iiop -s $node_app -n $nodename=$iorfile -t 30 --domain-nc corbaloc:rir:/NameService"; + + print "Run dance_node_manager with $d_param\n"; + + $Daemons[$i] = new PerlACE::Process ($d_cmd, $d_param); + $result = $Daemons[$i]->Spawn (); + push(@processes, $Daemons[$i]); + + if (PerlACE::waitforfile_timed ($iorfile, + 30) == -1) { + print STDERR + "ERROR: The ior $iorfile file of node daemon $i could not be found\n"; + for (; $i >= 0; --$i) { + $Daemons[$i]->Kill (); $Daemons[$i]->TimedWait (1); + } + return -1; + } + } + return 0; +} + +delete_ior_files (); + +# Invoke naming service + +$NS = new PerlACE::Process ("$TAO_ROOT/orbsvcs/Naming_Service/Naming_Service", "-m 0 -ORBEndpoint iiop://localhost:60003 -o ns.ior"); + +$NS->Spawn (); + +print STDERR "Starting Naming Service with -m 0 -ORBEndpoint iiop://localhost:60003 -o ns.ior\n"; + +if (PerlACE::waitforfile_timed ($nsior, $PerlACE::wait_interval_for_process_creation) == -1) +{ + print STDERR "ERROR: cannot find naming service IOR file\n"; + $NS->Kill (); + exit 1; +} + +$ns_running = 1; + +# Set up NamingService environment +$ENV{"NameServiceIOR"} = "corbaloc:iiop:localhost:60003/NameService"; + + +# Invoke node daemons. +print "Invoking node daemons\n"; +$status = run_node_daemons (); + +if ($status != 0) { + print STDERR "ERROR: Unable to execute the node daemons\n"; + kill_open_processes (); + exit 1; +} + +$daemons_running = 1; + +# Invoke execution manager. +print "Invoking execution manager (dance_execution_manager.exe) with -eEM.ior \n"; +$EM = new PerlACE::Process ("$DAnCE/bin/dance_execution_manager", + "-eEM.ior --domain-nc corbaloc:rir:/NameService"); +$EM->Spawn (); + +if (PerlACE::waitforfile_timed ("EM.ior", + $PerlACE::wait_interval_for_process_creation) == -1) { + print STDERR + "ERROR: The ior file of execution manager could not be found\n"; + kill_open_processes (); + exit 1; +} + +$em_running = 1; + +# Invoke executor - start the application -. +print "Invoking executor - start the application -\n"; + +print "Start dance_plan_launcher.exe with -x $cdp_file -k file://EM.ior\n"; +$E = + new PerlACE::Process ("$DAnCE/bin/dance_plan_launcher", + "-x $cdp_file -k file://EM.ior"); + +$E->SpawnWaitKill (50); + + +print "Sleeping 60 seconds to allow task to complete\n"; +sleep (60); + +# print "Invoking the controller ($controller_exec -k file://Sender.ior)\n"; +# $controller = new PerlACE::Process ("$controller_exec", "-k file://Sender.ior"); +# $result = $controller->SpawnWaitKill (30); + +# if ($result != 0) { +# print STDERR "ERROR: The controller returned $result\n"; +# $status = 1; +# } + +# Invoke executor - stop the application -. +print "Invoking executor - stop the application -\n"; +print "by running dance_plan_launcher.exe with -k file://EM.ior -x $cdp_file -q\n"; + +$E = + new PerlACE::Process ("$DAnCE/bin/dance_plan_launcher", + "-k file://EM.ior -x $cdp_file -q"); +$E->SpawnWaitKill (30); + +print "Executor returned.\n"; +print "Shutting down rest of the processes.\n"; + +delete_ior_files (); +kill_open_processes (); + +exit $status; |