Skip to content

Commit 1c24f98

Browse files
committed
[occ] Improve documentation
1 parent 79eb0bf commit 1c24f98

2 files changed

Lines changed: 20 additions & 2 deletions

File tree

occ/occlib/OccInstance.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,13 @@ class OCC_EXPORT OccInstance
5757
*
5858
* @see OccGlobals.h
5959
*
60-
* @note This constructor spawns a server thread for gRPC. Incoming message handlers are triggered
61-
* from there and eventually result in calls to the transition functions in RuntimeControlledObject.
60+
* @note This constructor spawns two additional threads: a server thread for gRPC, and an event loop
61+
* thread for managing the states of the RuntimeControlledObject (indirectly, via the OccServer
62+
* constructor).
63+
* Incoming message handlers are triggered from the server thread and eventually result in
64+
* calls to the transition functions in RuntimeControlledObject.
65+
* Additionally, the event loop thread runs in every state to allow the implementer to report
66+
* an error or finished condition.
6267
* The OccInstance destructor takes care of safely tearing down this server.
6368
*/
6469
explicit OccInstance(RuntimeControlledObject *rco, int controlPort = 0);

occ/occlib/OccServer.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,21 @@ const std::unordered_map<std::string, std::string> EXPECTED_FINAL_STATE = {
5353
class OccServer final : public pb::Occ::Service
5454
{
5555
public:
56+
/**
57+
* Instantiate the gRPC-based control message server.
58+
*
59+
* @param rco a pointer to the RuntimeControlledObject-derived state machine.
60+
*
61+
* @note This constructor spawns an additional thread which acts as event loop to check the
62+
* state of the RuntimeControlledObject.
63+
*
64+
* @see OccInstance
65+
*/
5666
explicit OccServer(RuntimeControlledObject* rco);
5767

68+
/**
69+
* Tears down the OccServer.
70+
*/
5871
virtual ~OccServer();
5972

6073
grpc::Status StateStream(grpc::ServerContext* context,

0 commit comments

Comments
 (0)