/// <summary> /// Create Domain Participant /// </summary> /// <param name="partitionName">Create the participant and assign the partition name.</param> public void createParticipant(String partitionName) { dpf = DomainParticipantFactory.Instance; dpQos = new DomainParticipantQos(); dpf.GetDefaultParticipantQos(ref dpQos); ErrorHandler.checkHandle(dpf, "DomainParticipantFactory.Instance"); participant = dpf.CreateParticipant(DDS.DomainId.Default,dpQos); ErrorHandler.checkHandle(participant, "DomainParticipantFactory.CreateParticipant"); this.partitionName = partitionName; }
/** * Attribute containing the delegates to the individual Listener functions. */ /** * This operation returns the reference to the singleton DomainParticipantFactory. */ private static DomainParticipantFactory GetInstance() { // GetInstance() is called very infrequntly so a simple locked singleton // approach is used. lock(singleton_lock) { if (singletonSelf == null) // If singleton doesn't exist, create it. { IntPtr gapiPtr = OpenSplice.Gapi.DomainParticipantFactory.get_instance(); if (!gapiPtr.Equals(null)) // Wrap Gapi entity in C# object. { singletonSelf = new DomainParticipantFactory(gapiPtr); } } return singletonSelf; } }
/** * Attribute containing the delegates to the individual Listener functions. */ /** * This operation returns the reference to the singleton DomainParticipantFactory. */ private static DomainParticipantFactory GetInstance() { // GetInstance() is called very infrequntly so a simple locked singleton // approach is used. lock (singleton_lock) { if (singletonSelf == null) // If singleton doesn't exist, create it. { IntPtr gapiPtr = OpenSplice.Gapi.DomainParticipantFactory.get_instance(); if (!gapiPtr.Equals(null)) // Wrap Gapi entity in C# object. { singletonSelf = new DomainParticipantFactory(gapiPtr); } } return(singletonSelf); } }
// Attribute containing the delegates to the individual Listener functions. /// <summary> /// This operation returns the reference to the singleton DomainParticipantFactory. /// </summary> /// <remarks> /// The operation is idempotent, that is, it can be called multiple times without /// side-effects and it returns the same DomainParticipantFactory instance. /// /// The operation is static and must be called upon its class. /// <code> /// DDS.DomainParticipantFactory factory = null; /// factory = DomainParticipantFactory.GetInstance(); /// </code> /// </remarks> /// @return DomainParticipantFactory singleton private static DomainParticipantFactory GetInstance() { // GetInstance() is called very infrequently so a simple locked singleton // approach is used. lock (singleton_lock) { if (singletonSelf == null) // If singleton doesn't exist, create it. { if (DDS.OpenSplice.User.u.userInitialise() == V_RESULT.OK) { ReportStack.Start(); singletonSelf = new DomainParticipantFactory(); ReportStack.Flush(null, singletonSelf == null); if (singletonSelf != null) { AppDomain.CurrentDomain.ProcessExit += new EventHandler(ProcessExit); } } } return(singletonSelf); } }
private void init() { MyTopicTypeSupport typeSupport; DataWriterQos wQos = null; string msg = "Unknown error"; /** * @addtogroup group_dds1290 * * \b Test \b ID: \b sacs_invalid_data_000 * * \b Test \b Objectives: * * Create and initialise all required DDS entities * * \b Test \b Procedure: * * \e Action * * The following entities are obtained/created * \arg \c DomainParticipantFactory * \arg \c DomainParticipant with default QoS settings * \arg \c Publisher with default QoS settings * \arg \c Subscriber with default QoS settings * \arg \c The MyTopicModule::MyTopic type is registered * \arg \c A topic T1 of type MyTopicModule::MyTopic is created with default QoS settings * \arg \c A DataWriter W1 for T1 with default QoS settings, writer_data_lifecycle.autodispose_unregistered_instances = FALSE * \arg \c A DataWriter W2 for T1 with default QoS settings, writer_data_lifecycle.autodispose_unregistered_instances = FALSE * \arg \c A DataReader for T1 with default QoS settings * * \e Result * It is expected that all entities are created/initialized correctly and without any failures. \n * If a failure occurs at any of the above stages, the test fails, this is reported and no further testing is performed */ /*- INITIALIZATION ---------------------------------------------------------*/ tfw.TestStart ("sacs_invalid_data_000","invalid_data","initialization"); tfw.TestTitle ("Test initialization."); tfw.TestPurpose ("Test initialization."); factory = DomainParticipantFactory.Instance; if(factory == null){ msg = "DomainParticipantFactory could NOT be resolved"; proceed = false; } else { participant = factory.CreateParticipant(DDS.DomainId.Default); if(participant == null){ msg = "DomainParticipant could NOT be created"; proceed = false; } else { typeSupport = new MyTopicTypeSupport(); result = typeSupport.RegisterType(participant, "MyTopic"); if(result == ReturnCode.Ok){ topic = participant.CreateTopic("my_topic", "MyTopic"); if(topic != null){ subscriber = participant.CreateSubscriber(); if(subscriber != null){ reader = subscriber.CreateDataReader(topic) as MyTopicDataReader; if(reader != null){ publisher = participant.CreatePublisher(); if(publisher != null){ result = publisher.GetDefaultDataWriterQos(ref wQos); if(wQos != null && result == ReturnCode.Ok){ wQos.WriterDataLifecycle.AutodisposeUnregisteredInstances = false; writer1 = publisher.CreateDataWriter(topic, wQos) as MyTopicDataWriter; if(writer1 != null){ writer2 = publisher.CreateDataWriter(topic, wQos) as MyTopicDataWriter; if(writer2 == null){ msg = "DataWriter could NOT be created"; proceed = false; } } else { msg = "DataWriter could NOT be created"; proceed = false; } } else { reportResultCode(result); msg = "Default DataWriterQos could NOT be retrieved"; proceed = false; } } else { msg = "Publisher could NOT be created"; proceed = false; } } else { msg = "DataReader could NOT be created"; proceed = false; } } else { msg = "Subscriber could NOT be created"; proceed = false; } } else { msg = "Topic could NOT be created"; proceed = false; } } else { msg = "Typesupport NOT loaded into DomainParticipant"; proceed = false; } } } if(proceed == true){ tfw.TestResult("Initialization OK", "Initialization OK", TestVerdict.Pass, TestVerdict.Pass); tfw.TestFinish(); } else { tfw.TestResult("Initialization OK", msg, TestVerdict.Pass, TestVerdict.Fail); tfw.TestFinish(); } /*- END OF INITIALIZATION --------------------------------------------------*/ }
private void init() { tstTypeSupport typeSupport; string errMsg = "Unknown error"; for ( int i = 0; i < MAX_INSTANCE; i++ ) { testData[i] = new tst(); testData[i].long_1 = i; testData[i].long_2 = 0; testData[i].long_3 = 0; } initialiseInstanceData(); /** * @addtogroup group_dds1290 * * \b Test \b ID: \b saj_invalid_data_000 * * \b Test \b Objectives: * * Create and initialise all required DDS entities * * \b Test \b Procedure: * * \e Action * * The following entities are obtained/created * \arg \c DomainParticipantFactory * \arg \c DomainParticipant with default QoS settings * \arg \c Publisher with default QoS settings * \arg \c Subscriber with default QoS settings * \arg \c The mod::tst type is registered * \arg \c A topic T1 of type tstModule::tst is created with default QoS settings * \arg \c A DataWriter W for T1 with default QoS settings, writer_data_lifecycle.autodispose_unregistered_instances = FALSE * \arg \c A DataReader for T1 with default QoS settings * * \e Result * It is expected that all entities are created/initialized correctly and without any failures. \n * If a failure occurs at any of the above stages, the test fails, this is reported and no further testing is performed */ /*- INITIALIZATION ---------------------------------------------------------*/ tfw.TestStart ("sacs_sampleInfo_000","SampleInfo","initialization"); tfw.TestTitle ("Test SampleInfo initialization."); tfw.TestPurpose ("Test SampleInfo initialization."); factory = DomainParticipantFactory.Instance; if(factory == null){ errMsg = "DomainParticipantFactory could NOT be resolved"; proceed = false; } else { participant = factory.CreateParticipant(domainId); if(participant == null){ errMsg = "DomainParticipant could NOT be created"; proceed = false; } else { typeSupport = new tstTypeSupport(); result = typeSupport.RegisterType(participant, "tst"); if(result == ReturnCode.Ok){ topic = participant.CreateTopic("my_topic", "tst"); if(topic != null){ subscriber = participant.CreateSubscriber(); if(subscriber != null){ subscriber.GetDefaultDataReaderQos(ref drQos); if(drQos != null){ drQos.History.Kind = HistoryQosPolicyKind.KeepLastHistoryQos; drQos.History.Depth = MAX_DEPTH; reader = subscriber.CreateDataReader(topic, drQos) as tstDataReader; if(reader != null){ publisher = participant.CreatePublisher(); if(publisher != null){ result = publisher.GetDefaultDataWriterQos(ref dwQos); if(dwQos != null && result == ReturnCode.Ok){ dwQos.WriterDataLifecycle.AutodisposeUnregisteredInstances = false; writer = publisher.CreateDataWriter(topic, dwQos) as tstDataWriter; if(writer == null){ errMsg = "DataWriter could NOT be created"; proceed = false; } } else { reportResultCode(result); errMsg = "Default DataWriterQos could NOT be retrieved"; proceed = false; } } else { errMsg = "Publisher could NOT be created"; proceed = false; } } else { errMsg = "DataReader could NOT be created"; proceed = false; } } else { errMsg = "Default DataReaderQos could not be resolved."; proceed = false; } } else { errMsg = "Subscriber could NOT be created"; proceed = false; } } else { errMsg = "Topic could NOT be created"; proceed = false; } } else { errMsg = "Typesupport NOT loaded into DomainParticipant"; proceed = false; } } } if(proceed == true){ tfw.TestResult("Initialization OK", "Initialization OK", TestVerdict.Pass, TestVerdict.Pass); tfw.TestFinish(); } else { tfw.TestResult("Initialization OK", errMsg, TestVerdict.Pass, TestVerdict.Fail); tfw.TestFinish(); } /*- END OF INITIALIZATION --------------------------------------------------*/ }