Skip to content

CPS application templates

Amy Buck edited this page Nov 29, 2018 · 7 revisions

This information includes templates for developing applications in C/C++ and Python. Client applications subscribe to events — server applications publish events. Applications can act as both clients and servers, and can publish and subscribe to events.

Interactions between publisher and subscriber applications

Python templates

Template Description
Server application Template for the structure of a server (object owner), including the transaction callback handler for set, create, delete, action operations, and a separate handler for get operations (see python_server_template.py).
Client application Template for the structure of a client application, including the execution of a get request (see python_client_application_template.py).
Event publisher application Template for the structure of an event publisher (see python_event_publisher_application.py).
Event subscriber application Template for the structure of an event subscriber. The application registers for events, and then waits for events in a loop (see python_event_subscriber_application.py.

C/C++ templates

Template Description
Server application Templates for the structure of a CPS server (object owner), including read and write functions for get operations (read function, xyz_read); set, create, delete, action operations (xyz_write); and rollback of failed transactions (xyz_rollback) (see c_template_server_application.c).
Client application Templates for the structure of a client application, including read and write functions for get requests (building keys and object lists), and set requests (using a transaction) (see c_client_template.c).
Event publisher application Template for the structure of a CPS event publisher, including the initialization of the event service, connection to the CPS object library service, and the event publish operation. You must de-allocate or delete the object after it is published (see c_template_event_publisher_application.c).
Event subscriber application Template for the structure of an event subscriber, including initialization of the event service and event processing thread, and registration of the event handler function and event processing callback. The key list specified in the registration is used to determine the events delivered to the application — list contains a single element (see c_template_event_subscriber_application.c).
Clone this wiki locally