Skip to content

Commit

Permalink
Fix comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
balazsracz committed Nov 14, 2020
1 parent 4170f43 commit de17825
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/openlcb/BulkAliasAllocator.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,13 @@
namespace openlcb
{

/// Implementation of the BulkAliasAllocatorInterface to allocate many aliases
/// at the same time.
class BulkAliasAllocator : public CallableFlow<BulkAliasRequest>
{
public:
/// Constructor
/// @param iface the openlcb CAN interface
BulkAliasAllocator(IfCan *iface)
: CallableFlow<BulkAliasRequest>(iface)
{
Expand Down Expand Up @@ -144,6 +148,7 @@ class BulkAliasAllocator : public CallableFlow<BulkAliasRequest>
}
}

/// Called when all RID frames are sent out.
Action complete()
{
if_can()->frame_dispatcher()->unregister_handler_all(&conflictHandler_);
Expand All @@ -153,6 +158,10 @@ class BulkAliasAllocator : public CallableFlow<BulkAliasRequest>
}

private:
/// Callback from the stack for all incoming frames while we are
/// operating. We sniff the alias uot of it and record any conflicts we
/// see.
/// @param message an incoming CAN frame.
void handle_conflict(Buffer<CanMessageData> *message)
{
auto rb = get_buffer_deleter(message);
Expand Down Expand Up @@ -187,6 +196,7 @@ class BulkAliasAllocator : public CallableFlow<BulkAliasRequest>
if_can()->frame_write_flow()->send(b, 0);
}

/// @return the openlcb CAN interface
IfCan *if_can()
{
return static_cast<IfCan *>(service());
Expand All @@ -198,6 +208,7 @@ class BulkAliasAllocator : public CallableFlow<BulkAliasRequest>
return (os_get_time_monotonic() - startTime_) / MSEC_TO_NSEC(10);
}

/// We store this type in the time-ordered aliases structure.
struct PendingAliasInfo
{
PendingAliasInfo(NodeAlias alias)
Expand All @@ -208,7 +219,7 @@ class BulkAliasAllocator : public CallableFlow<BulkAliasRequest>

/// The value of the alias
unsigned alias_ : 12;
/// The time when the CID requests were sent. Counterd in
/// The time when the CID requests were sent. Counter in
/// relative_time(), i.e. 10 msec per increment.
unsigned cidTime_ : 8;
};
Expand Down

0 comments on commit de17825

Please sign in to comment.