Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
UpdateLoop.hxx File Reference
#include "dcc/TrackIf.hxx"
#include "utils/Singleton.hxx"

Go to the source code of this file.

Classes

class  dcc::UpdateLoopBase
 Base class for implementing update loops. More...
 

Functions

void dcc::packet_processor_notify_update (PacketSource *source, unsigned code)
 Notifies the update processor that a modification happened to one of the packet sources.
 
bool dcc::packet_processor_add_refresh_source (PacketSource *source, unsigned priority)
 Adds a new refresh source to the background refresh loop.
 
void dcc::packet_processor_remove_refresh_source (PacketSource *source)
 Removes a refresh source from the background refresh loop.
 

Detailed Description

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Proxy implementation to the global update loop.

Author
Balazs Racz
Date
10 May 2014

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Interface to the global update loop.

Author
Balazs Racz
Date
10 May 2014

Definition in file UpdateLoop.hxx.

Function Documentation

◆ packet_processor_add_refresh_source()

bool dcc::packet_processor_add_refresh_source ( PacketSource source,
unsigned  priority = 0 
)

Adds a new refresh source to the background refresh loop.

Parameters
sourceis the packet source to add
priorityrepresents the packet source priority. If at least EXCLUSIVE_MIN_PRIORITY, then all packet slots will be assigned to this packet source, effectively stopping all background refresh. Only the largest priority will receive slots, until it gets unregistered.
Returns
true if there was no higher priority exclusive source than the one added now. In case of false, the source was still added but will not receive polling until the higher priority source goes away.

Definition at line 45 of file UpdateLoop.cxx.

◆ packet_processor_notify_update()

void dcc::packet_processor_notify_update ( PacketSource source,
unsigned  code 
)

Notifies the update processor that a modification happened to one of the packet sources.

Update processors will typically prioritize this packet source in the packet generation loop.

Parameters
sourceis the packet source that experienced a change
codeis a source-specific value that will be sent to the source in the get_next_packet callback. It should not be zero.

Definition at line 40 of file UpdateLoop.cxx.

◆ packet_processor_remove_refresh_source()

void dcc::packet_processor_remove_refresh_source ( PacketSource source)

Removes a refresh source from the background refresh loop.

Definition at line 53 of file UpdateLoop.cxx.