/* * (c) Copyright, Real-Time Innovations, 2021. * All rights reserved. * * No duplications, whole or partial, manual or electronic, may be made * without express written permission. Any such copies, or * revisions thereof, must display this notice unaltered. * This code contains trade secrets of Real-Time Innovations, Inc. */ #ifndef WEBINTEGRATIONSERVICE_H #define WEBINTEGRATIONSERVICE_H #include #include #include #include #include namespace rti { namespace webdds { /*e \defgroup RTI_WebIntegrationServiceLibModule RTI Web Integration Library API * * @brief @product can be deployed as a native library linked into your * application in select architectures. * * This API allows you to create, configure and start @product instances from * your application. * * The following code shows the typical use of the API: * * \code * * int main () * { * rti::webdds::Service service( * rti::webdds::ServiceProperty() * .cfg_file("MyWebint.xml") * .cfg_name("MyWebint")); * ... * * service.start(); * * while(keep_running) { * sleep(); * ... * } * * return 0; * } * * \endcode * * Instead of a file, you can use XML strings to configure @product. * See ServiceProperty for more information. *

* To build your application you need to link with the @product native library * in <@ndds home>/bin/<architecture>/ . * * ### Development Requirements * * | | Unix-based Systems | Windows Systems | * | --------------: | :----------------: | :-------------: | * | Shared Libraries| librtiwebintegrationservice.so | rtiwebintegrationservice.dll| * | ^ | libnddscpp.so | nddscpp.dll | * | ^ | libnddsc.so | nddsc.dll | * | ^ | libnddscore.so | nddscore.dll | * | ^ | librtiapputilsc.so | rtiapputilsc.dll | * | ^ | librtisqlite.so | rtisqlite.dll | * | ^ | libcivetweb-cpp.so.1.15.0 | civetweb-cpp.dll | * | ^ | libcivetweb.so.1.15.0 | civetweb.dll | * | Headers | rti/webdds/Service.hpp | rti/webdds/Service.hpp | * */ /** \ingroup RTI_WebIntegrationServiceLibModule * * @brief The @product. * */ class Service : public dds::core::Reference { public: typedef dds::core::Reference Base; OMG_DDS_REF_TYPE_NOTYPENAME( Service, dds::core::Reference, WebIntegrationServiceImpl); /** * @brief Creates a @product instance * * @param[in] property * The property to configure @product instance. * */ Service(ServiceProperty&& property) : Base(new WebIntegrationServiceImpl(std::move(property))) { this->delegate()->remember_reference(this->delegate()); } explicit Service(Base::DELEGATE_REF_T reference) : Base(reference) { if (this->delegate()) { this->delegate()->remember_reference(this->delegate()); } } /** * @brief Starts @product. * * This is a non-blocking operation. @product will create its own set of * threads to perform its tasks. */ void start() { this->delegate()->start(); } /** * @brief Stops @product. * * This operation will bloc the instance is fully stopped. */ void stop() { this->delegate()->stop(); } }; }} #endif // WEBINTEGRATIONSERVICE_H